forked from clarkx/Lumiere-V0.4
-
Notifications
You must be signed in to change notification settings - Fork 1
/
lumiere_preferences.py
162 lines (139 loc) · 4.62 KB
/
lumiere_preferences.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
import bpy
from bpy.props import (
IntProperty,
FloatProperty,
EnumProperty,
PointerProperty,
FloatVectorProperty,
StringProperty,
BoolProperty,
)
# -------------------------------------------------------------------- #
## Preferences
class LumiereAddonPreferences(bpy.types.AddonPreferences):
"""Preferences for Lumiere"""
bl_idname = __package__
type_preferences : EnumProperty(
items=(('lights', "Lights", "", 0),
('platform', "Platform", "", 1),
# ('cameras', "Cameras", "", 2),
# ('world', "World", "", 3),
('render', "Render", "", 2),
('collections', "Collections", "", 3),
))
#---Use keys during raycast
modal_keys : BoolProperty(
name="Modal keys",
description="Activate the keys during modal operation",
default=True)
#---Lights 3d gizmos
lights_3dgizmos : BoolProperty(
name="Gizmos lights",
description="Activate the gizmos for the lights",
default=True)
#---Lights size
lights_size : FloatProperty(
name="Lights size",
description="Default light size",
default=1)
#---Lights rounding
lights_rounding : FloatProperty(
name="Lights rounding",
description="Default light rounding",
default=0.25)
#---Lights 2d buttons
lights_2dgizmos : BoolProperty(
name="Buttons lights",
description="Activate the 2d buttons in the 3d view",
default=True)
#---Platform 3d gizmos
platform_3dgizmos : BoolProperty(
name="Gizmos platform",
description="Activate the gizmos for the Platform",
default=True)
#---Platform 2d buttons
platform_2dgizmos : BoolProperty(
name="Buttons platform",
description="Activate the 2d buttons in the 3d view",
default=True)
#---Camera 3d gizmos
camera_3dgizmos : BoolProperty(
name="Gizmos camera",
description="Activate the gizmos for the camera",
default=True)
#---Camera 2d buttons
camera_2dgizmos : BoolProperty(
name="Buttons camera",
description="Activate the 2d buttons in the 3d view",
default=True)
#---Activate render pause
render_pause : BoolProperty(
name="Render Pause",
description="Pause the render during interactive to save time",
default=False)
#---Primary collection name
primary_collection : StringProperty(
name="Primary Collection",
description="Default name of the primary collection",
default="Lumiere")
#---Lights collection name
lights_collection : StringProperty(
name="Lights Collection",
description="Default name of the lights collection",
default="Lights")
#---Camera collection name
camera_collection : StringProperty(
name="Camera Collection",
description="Default name of the camera collection",
default="Camera")
#---Platform collection name
platform_collection : StringProperty(
name="Platform Collection",
description="Default name of the platform collection",
default="Platform")
#---Camera location
camera_location : FloatVectorProperty(
name="Camera location",
description="Default location of the camera",
default=(2,0,0.5))
#---Camera Rotation
camera_rotation : FloatVectorProperty(
name="Camera rotation",
description="Default rotation of the camera",
default=(90,0,90))
def draw(self, context):
layout = self.layout
row= layout.row(align=True)
row.prop(self, "type_preferences", expand=True)
row.scale_y = 1.5
if self.type_preferences == 'lights':
layout.prop(self, "lights_3dgizmos")
layout.prop(self, "lights_2dgizmos")
layout.prop(self, "modal_keys")
layout.prop(self, "lights_size")
elif self.type_preferences == 'platform':
layout.prop(self, "platform_3dgizmos")
layout.prop(self, "platform_2dgizmos")
elif self.type_preferences == 'collections':
layout.prop(self, "primary_collection")
layout.prop(self, "lights_collection")
layout.prop(self, "camera_collection")
layout.prop(self, "platform_collection")
# elif self.type_preferences == 'camera':
# layout.prop(self, "camera_location")
# layout.prop(self, "camera_rotation")
elif self.type_preferences == 'render':
layout.prop(self, "render_pause")
# -------------------------------------------------------------------- #
## Register
classes = [
LumiereAddonPreferences,
]
def register():
from bpy.utils import register_class
for cls in classes:
register_class(cls)
def unregister():
from bpy.utils import unregister_class
for cls in reversed(classes):
unregister_class(cls)