-
Notifications
You must be signed in to change notification settings - Fork 0
/
properties.py
140 lines (107 loc) · 2.93 KB
/
properties.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
import bpy
import bpy.types as T
from bpy import props as P
import logging
logger = logging.getLogger(__name__)
#
#
class CharacterProps(T.PropertyGroup):
character_color_1: P.FloatVectorProperty(
name='Primary',
description='Primary player color',
subtype='COLOR',
default=(0.631, 0.515, 0.002),
min=0.0,
max=1.0,
)
character_color_2: P.FloatVectorProperty(
name='Secondary',
description='Secondary player color',
subtype='COLOR',
default=(0.042, 0.004, 0.610),
min=0.0,
max=1.0,
)
eye_pupil_size: P.FloatProperty(
name='Eye pupil size',
description='Eye pupil size',
min=-1.0,
max=1.0,
)
eye_pupil_depth: P.FloatProperty(
name='Eye pupil depth',
description='Eye pupil depth',
min=-1.0,
max=1.0,
)
skin_tone_1: P.FloatVectorProperty(
name='Skin Tone 1',
description='Top skin layer color',
subtype='COLOR',
default=(0.971, 0.862, 0.604),
min=0.0,
max=1.0,
)
skin_tone_2: P.FloatVectorProperty(
name='Skin Tone 2',
description='Mid skin layer color',
subtype='COLOR',
default=(0.386, 0.109, 0.047),
min=0.0,
max=1.0,
)
skin_tone_3: P.FloatVectorProperty(
name='Skin Tone 3',
description='Shine-through (scatter) skin color',
subtype='COLOR',
default=(0.451, 0.019, 0.005),
min=0.0,
max=1.0,
)
#
class MatImporterProps(T.PropertyGroup):
search_path: P.StringProperty(
name='Search path',
default='W:\\Blender\\work\\__RESOURCES'
)
recursive: P.BoolProperty(
name='Recursive',
default=True,
)
use_material_name: P.BoolProperty(
name='Use material name for prefix',
default=True,
)
#
class SurimiRootCollectionProperties(T.PropertyGroup):
asd: T.EnumProperty
#
CLASSES = [
CharacterProps,
MatImporterProps,
SurimiRootCollectionProperties,
]
PROPS = [
# ('surimi_props', T.Object, P.PointerProperty(type=CharacterProps)),
# ('surimi_mat_importer', T.Material, P.PointerProperty(type=MatImporterProps)),
# ('surimi_root_props', T.Collection, P.PointerProperty(
# type=SurimiRootCollectionProperties)),
]
def register():
logger.info('register custom properties')
for name, obj, prop in PROPS:
logger.info(' - properties:')
logger.info(' - props: %s', name)
logger.info(' - on: %s', obj.__name__)
logger.info(' - prop: %s', prop)
for cls in CLASSES:
bpy.utils.register_class(cls)
for k, Type, prop in PROPS:
setattr(Type, k, prop)
def unregister():
for cls in reversed(CLASSES):
bpy.utils.unregister_class(cls)
for k, Type, prop in reversed(PROPS):
delattr(Type, k)
if __name__ == '__main__':
register()