-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathmvr_objects.py
64 lines (50 loc) · 2.32 KB
/
mvr_objects.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Copyright vanous
#
# This file is part of BlenderDMX.
#
# BlenderDMX is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
# any later version.
#
# BlenderDMX is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <https://www.gnu.org/licenses/>.
import uuid
import bpy
from bpy.props import BoolProperty, PointerProperty, StringProperty
from bpy.types import Collection, PropertyGroup
class DMX_MVR_Object(PropertyGroup):
"""Universal MVR object... in the future, make this specific
SceneObject, Truss, Layer..."""
name: StringProperty(name="Name", description="Name", default="")
collection: PointerProperty(name="Collection of objects", type=Collection)
uuid: StringProperty(name="UUID", description="UUID", default=str(uuid.uuid4()))
object_type: StringProperty(
name="Object type",
description="Simple object classification",
default="SceneObject", # Layer, Truss,
)
classing: StringProperty(
name="Classing", description="Grouping/Layering", default=""
)
class DMX_MVR_Class(PropertyGroup):
name: StringProperty(name="Name", description="Name", default="")
uuid: StringProperty(name="UUID", description="Unique ID, used for MVR", default="")
def onEnable(self, context):
enabled = self.enabled
for obj in bpy.context.scene.objects:
if obj.get("classing", None) == self.uuid:
obj.hide_set(not enabled)
obj.hide_viewport = not enabled
obj.hide_render = not enabled
for fixture in bpy.context.scene.dmx.fixtures:
if fixture.classing == self.uuid:
# fixture.collection.hide_set(not enabled)
fixture.collection.hide_viewport = not enabled
fixture.collection.hide_render = not enabled
enabled: BoolProperty(name="Enabled", default=True, update=onEnable)