Compare commits
349 Commits
temp-geome
...
modifier-p
Author | SHA1 | Date | |
---|---|---|---|
13de8b171e | |||
fcbd53c3b0 | |||
9e76a641af | |||
5ecc239c0a | |||
b6764b9a31 | |||
76e9cdc90a | |||
8a971c9d91 | |||
09feff781c | |||
fb7cc1d275 | |||
0e18ea5b9c | |||
e7076c6d95 | |||
7961d27fdf | |||
bda924385f | |||
8eca2b4a1b | |||
686eaad84c | |||
5094397dab | |||
e57458470d | |||
dde592e622 | |||
1d8b4e4023 | |||
8b9ae6bc91 | |||
56e40dd168 | |||
e0efec00db | |||
d91adcf8b7 | |||
60a14bd8ef | |||
eefbd92981 | |||
6e577f8236 | |||
d86e97c757 | |||
49a5422500 | |||
deef89c17c | |||
1359bd34ce | |||
9063269462 | |||
1784982498 | |||
c14878923b | |||
cbc380d252 | |||
caae7fe9ef | |||
cf261540e6 | |||
7969a3384e | |||
bedf3550b1 | |||
a9e822484c | |||
d1b2dd6492 | |||
e8d028c0af | |||
6d3af8e647 | |||
37b3f18fec | |||
6a32b744b4 | |||
c7bc1e7778 | |||
9867d84628 | |||
6222f6a22c | |||
2e4d8aea50 | |||
75d676a089 | |||
d8f9baa063 | |||
342ef4e678 | |||
81b7dbc0a7 | |||
deed16e4b6 | |||
ab6afef863 | |||
17f03611ac | |||
91877e71df | |||
917d7a6cea | |||
29d40872c3 | |||
2beed7cbf7 | |||
ecb4861a78 | |||
b13e9f8147 | |||
7a2cd6f14b | |||
42cbeca9ec | |||
f33ed9b0b4 | |||
481315be8b | |||
b7cd5ffe84 | |||
71962eb62e | |||
2c88153ba6 | |||
d4de4ae278 | |||
a41c86bdce | |||
1de1dc4fe4 | |||
07237c9b7f | |||
1429fc674d | |||
c62aa8c0e7 | |||
4469d44ea2 | |||
02036767f2 | |||
d30f334e9b | |||
405180192a | |||
098b43769e | |||
faed15c2be | |||
2ba8002b36 | |||
57e8e174ff | |||
c5aa7f2c6e | |||
cf87438414 | |||
ec07b2f496 | |||
da0f59f55a | |||
6d49335137 | |||
391b4dfd37 | |||
33edd753dc | |||
57fc9ef717 | |||
8ef0a9fdea | |||
4464b99465 | |||
854461002c | |||
eac08d6562 | |||
c055fbf557 | |||
24da365d1c | |||
4f1aa83683 | |||
65ab18bc59 | |||
2972b185a5 | |||
45e46267a8 | |||
2000c3ed7a | |||
f9744e1153 | |||
f45d7e3fee | |||
e55a870430 | |||
25898b9799 | |||
4571ea1bdd | |||
5c19f23635 | |||
1fb95a08f9 | |||
07c55e2543 | |||
2c34d44d28 | |||
e9d8259d13 | |||
c4cbb499d5 | |||
a7e3bbabd2 | |||
726585cb37 | |||
6c05aa60c4 | |||
4c7c8efd0b | |||
909d497107 | |||
39555526ae | |||
d882ec322a | |||
7229f9a99e | |||
20da3ae1c5 | |||
a81b558d48 | |||
18cc24ded7 | |||
b3f7eb4a07 | |||
80446f237b | |||
b5a46211f4 | |||
f12a66817d | |||
f787b7f1ca | |||
aa369d9e4f | |||
f4636b0965 | |||
c45e1ef21b | |||
d9f542bbb0 | |||
94fb309372 | |||
dec9349a75 | |||
110c148773 | |||
3aef74bc1f | |||
6fa3e4151e | |||
e8a6759c1d | |||
1a2bca63ef | |||
54ac90625f | |||
460318257c | |||
330300659c | |||
bd5f7f7429 | |||
84eb739a0e | |||
55a385620e | |||
e46f4a7e45 | |||
ac943796d4 | |||
87ef42419d | |||
66eee8ca6e | |||
187c65becb | |||
bc252b3b1a | |||
bdeb0c310b | |||
6b44e0e71a | |||
86309bd7f8 | |||
04111faf67 | |||
38031a4a24 | |||
d83b93c1e1 | |||
df7407e451 | |||
![]() |
1d4411d1fd | ||
16a350cd49 | |||
a22a7f78a4 | |||
47b85fb664 | |||
e7fcfe7d64 | |||
6fe7bb5754 | |||
5ede1bea5e | |||
cc24695be7 | |||
ce8808ec07 | |||
b36e8b0d55 | |||
352b72791a | |||
c9feac0afb | |||
77a8f89a50 | |||
![]() |
2909c0e56f | ||
![]() |
02caa87e52 | ||
4bbfa924ad | |||
7f9131bcc5 | |||
4566f08679 | |||
25f854552e | |||
c392903942 | |||
01ef0eba9a | |||
3679a1f601 | |||
f8b6a2faad | |||
062d7c8e96 | |||
b05dadea6b | |||
b39e9bfca0 | |||
7a9aa8ad27 | |||
b2a4eb75ab | |||
202bdf1e99 | |||
57cbedf602 | |||
759da271df | |||
1e7e94588d | |||
00b45c3dce | |||
0af8fcee76 | |||
0dc1873477 | |||
17db2e69e9 | |||
93f8363516 | |||
9ced07fa76 | |||
c3475ebe61 | |||
e654a7d67f | |||
d191723756 | |||
c9fd25b070 | |||
1ac55cad30 | |||
966431c2dc | |||
5588497639 | |||
fbe9ee62cd | |||
3e43c5f2cc | |||
5b14027f54 | |||
8383fc55d5 | |||
482334aa98 | |||
7447c2ecaf | |||
d91078bb6e | |||
915fd3d088 | |||
338232c294 | |||
5eac872627 | |||
adad62e8d6 | |||
1035184c15 | |||
f3a2f735a2 | |||
a284ac3213 | |||
c128c65345 | |||
cdb0449e91 | |||
7fb4010137 | |||
513de8eaf6 | |||
db06fd9a01 | |||
2c19926cc2 | |||
01900f5e6c | |||
7714746e5c | |||
ce54157417 | |||
d20886e98d | |||
dfc62af147 | |||
a8036cc2a1 | |||
ac01b80221 | |||
191a565600 | |||
1651a5e52c | |||
24dfb057bd | |||
2fecab55f9 | |||
50154a52cb | |||
e60ad2867a | |||
4f5c607622 | |||
31690ad463 | |||
0f95127d1a | |||
5bf61c9d74 | |||
26b9436975 | |||
61dafc1afb | |||
6fb4816956 | |||
0c927243d0 | |||
5e0b359ac5 | |||
3b0f241e72 | |||
5a33f291f4 | |||
9d1c9e86c4 | |||
fc4d2d1e16 | |||
f8347075d0 | |||
184dbb396d | |||
fb58cc8dc9 | |||
824f80a5d7 | |||
e4043bb908 | |||
40dbb7fc31 | |||
1974b5b903 | |||
c5500b6af8 | |||
27717c5d0a | |||
bbeb31f4ce | |||
820350ac80 | |||
18f1d80a6c | |||
4884d9cd52 | |||
beeb650940 | |||
0dcc4fd780 | |||
6c655d6a50 | |||
014a575129 | |||
7cca282052 | |||
1e889f2705 | |||
45b6f746a3 | |||
dd723f5f89 | |||
8d2128009d | |||
bcf9daf155 | |||
cdfd743c93 | |||
2692ec06d1 | |||
105b0b7f6a | |||
babb028b84 | |||
1f669db7ae | |||
5071288adb | |||
53a3e88175 | |||
f2792cff11 | |||
63db01cd58 | |||
2bae660703 | |||
88ff68f011 | |||
5fc13d1112 | |||
274481620b | |||
98c289f5d8 | |||
a5184a82cb | |||
e21fc05b35 | |||
21a313eec2 | |||
50c747d234 | |||
4e8532c145 | |||
27a40b880e | |||
191ddaf577 | |||
92541ba2ad | |||
240fb4d8d1 | |||
e7458db4b4 | |||
172ac7896b | |||
aed38c2207 | |||
d9787141da | |||
3bd124d78e | |||
b47e8c1b94 | |||
e19f83294a | |||
29344fca44 | |||
fb22ae2387 | |||
23199693f9 | |||
2dc5d82ba8 | |||
d37df1a39d | |||
adb989768d | |||
fa9e1a5873 | |||
f60d614c5f | |||
42a030ccac | |||
c0f481c7f2 | |||
2814a1316f | |||
25f72d1d17 | |||
c4672ff3a8 | |||
fce2c12ca6 | |||
b5233a4f74 | |||
4d5a9b7755 | |||
cd9a64b9c0 | |||
3d9af1de8d | |||
c0d187d434 | |||
d0ba75544a | |||
94f986edd4 | |||
ecfae8a55b | |||
4ac54cf6b0 | |||
3221187dd5 | |||
f4d70b686d | |||
2c5795618b | |||
0b75c41afe | |||
5699058e54 | |||
8b073594d9 | |||
932f974532 | |||
8709a46e96 | |||
270b3d1a04 | |||
6e7873e54a | |||
042fab271f | |||
2d20d11b01 | |||
249c5663d8 | |||
bdabb02ee6 | |||
520b7b2887 | |||
bd307afbbe | |||
2374237762 | |||
b5ec14af68 | |||
f0e7dba4ff | |||
802be17ce7 | |||
4f4f08cee4 | |||
51ea1eea48 | |||
68c96b8bb2 | |||
a8bb0af673 |
File diff suppressed because it is too large
Load Diff
@@ -46,13 +46,6 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
|
||||
class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, Panel):
|
||||
bl_label = "Modifiers"
|
||||
|
||||
def check_conflicts(self, layout, ob):
|
||||
for md in ob.grease_pencil_modifiers:
|
||||
if md.type == 'GP_TIME':
|
||||
row = layout.row()
|
||||
row.label(text="Build and Time Offset modifier not compatible", icon='ERROR')
|
||||
break
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
ob = context.object
|
||||
@@ -60,483 +53,8 @@ class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, Panel):
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
ob = context.object
|
||||
|
||||
layout.operator_menu_enum("object.gpencil_modifier_add", "type")
|
||||
|
||||
for md in ob.grease_pencil_modifiers:
|
||||
box = layout.template_greasepencil_modifier(md)
|
||||
if box:
|
||||
# match enum type to our functions, avoids a lookup table.
|
||||
getattr(self, md.type)(box, ob, md)
|
||||
|
||||
# the mt.type enum is (ab)used for a lookup on function names
|
||||
# ...to avoid lengthy if statements
|
||||
# so each type must have a function here.
|
||||
|
||||
def gpencil_masking(self, layout, ob, md, use_vertex, use_curve=False):
|
||||
gpd = ob.data
|
||||
layout.separator()
|
||||
layout.label(text="Influence Filters:")
|
||||
|
||||
split = layout.split(factor=0.25)
|
||||
|
||||
col1 = split.column()
|
||||
|
||||
col1.label(text="Layer:")
|
||||
col1.label(text="Material:")
|
||||
if use_vertex:
|
||||
col1.label(text="Vertex Group:")
|
||||
|
||||
col2 = split.column()
|
||||
|
||||
split = col2.split(factor=0.6)
|
||||
row = split.row(align=True)
|
||||
row.prop_search(md, "layer", gpd, "layers", text="", icon='GREASEPENCIL')
|
||||
row.prop(md, "invert_layers", text="", icon='ARROW_LEFTRIGHT')
|
||||
|
||||
row = split.row(align=True)
|
||||
row.prop(md, "layer_pass", text="Pass")
|
||||
row.prop(md, "invert_layer_pass", text="", icon='ARROW_LEFTRIGHT')
|
||||
|
||||
split = col2.split(factor=0.6)
|
||||
|
||||
row = split.row(align=True)
|
||||
|
||||
valid = md.material in (slot.material for slot in ob.material_slots) or md.material is None
|
||||
if valid:
|
||||
icon = 'SHADING_TEXTURE'
|
||||
else:
|
||||
icon = 'ERROR'
|
||||
|
||||
row.alert = not valid
|
||||
row.prop_search(md, "material", gpd, "materials", text="", icon=icon)
|
||||
row.prop(md, "invert_materials", text="", icon='ARROW_LEFTRIGHT')
|
||||
|
||||
row = split.row(align=True)
|
||||
row.prop(md, "pass_index", text="Pass")
|
||||
row.prop(md, "invert_material_pass", text="", icon='ARROW_LEFTRIGHT')
|
||||
|
||||
if use_vertex:
|
||||
row = col2.row(align=True)
|
||||
row.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
|
||||
row.prop(md, "invert_vertex", text="", icon='ARROW_LEFTRIGHT')
|
||||
|
||||
if use_curve:
|
||||
col = layout.column()
|
||||
col.separator()
|
||||
col.prop(md, "use_custom_curve")
|
||||
if md.use_custom_curve:
|
||||
col.template_curve_mapping(md, "curve")
|
||||
|
||||
def GP_NOISE(self, layout, ob, md):
|
||||
split = layout.split()
|
||||
|
||||
col = split.column()
|
||||
row = col.row(align=True)
|
||||
row.prop(md, "factor", text="Position")
|
||||
row = col.row(align=True)
|
||||
row.prop(md, "factor_strength", text="Strength")
|
||||
row = col.row(align=True)
|
||||
row.prop(md, "factor_thickness", text="Thickness")
|
||||
row = col.row(align=True)
|
||||
row.prop(md, "factor_uvs", text="UV")
|
||||
|
||||
col.separator()
|
||||
row = col.row(align=True)
|
||||
row.prop(md, "random", text="", icon='TIME', toggle=True)
|
||||
|
||||
subrow = row.row(align=True)
|
||||
subrow.enabled = md.random
|
||||
subrow.prop(md, "step")
|
||||
subrow.prop(md, "seed")
|
||||
|
||||
col.separator()
|
||||
col.prop(md, "noise_scale")
|
||||
|
||||
self.gpencil_masking(layout, ob, md, True, True)
|
||||
|
||||
def GP_SMOOTH(self, layout, ob, md):
|
||||
col = layout.column()
|
||||
col.prop(md, "factor")
|
||||
col.prop(md, "step", text="Repeat")
|
||||
|
||||
col.label(text="Affect:")
|
||||
row = col.row(align=True)
|
||||
row.prop(md, "use_edit_position", text="Position", toggle=True)
|
||||
row.prop(md, "use_edit_strength", text="Strength", toggle=True)
|
||||
row.prop(md, "use_edit_thickness", text="Thickness", toggle=True)
|
||||
row.prop(md, "use_edit_uv", text="UV", toggle=True)
|
||||
|
||||
self.gpencil_masking(layout, ob, md, True, True)
|
||||
|
||||
def GP_SUBDIV(self, layout, ob, md):
|
||||
layout.row().prop(md, "subdivision_type", expand=True)
|
||||
split = layout.split()
|
||||
col = split.column()
|
||||
row = col.row(align=True)
|
||||
row.prop(md, "level", text="Subdivisions")
|
||||
|
||||
self.gpencil_masking(layout, ob, md, False)
|
||||
|
||||
def GP_SIMPLIFY(self, layout, ob, md):
|
||||
gpd = ob.data
|
||||
|
||||
row = layout.row()
|
||||
row.prop(md, "mode")
|
||||
|
||||
split = layout.split()
|
||||
|
||||
col = split.column()
|
||||
col.label(text="Settings:")
|
||||
|
||||
if md.mode == 'FIXED':
|
||||
col.prop(md, "step")
|
||||
elif md.mode == 'ADAPTIVE':
|
||||
col.prop(md, "factor")
|
||||
elif md.mode == 'SAMPLE':
|
||||
col.prop(md, "length")
|
||||
elif md.mode == 'MERGE':
|
||||
col.prop(md, "distance")
|
||||
|
||||
self.gpencil_masking(layout, ob, md, False)
|
||||
|
||||
def GP_THICK(self, layout, ob, md):
|
||||
col = layout.column()
|
||||
|
||||
col.prop(md, "normalize_thickness")
|
||||
|
||||
if md.normalize_thickness:
|
||||
col.prop(md, "thickness")
|
||||
else:
|
||||
col.prop(md, "thickness_factor")
|
||||
|
||||
self.gpencil_masking(layout, ob, md, True, True)
|
||||
|
||||
def GP_TEXTURE(self, layout, ob, md):
|
||||
col = layout.column()
|
||||
|
||||
col.prop(md, "mode")
|
||||
if md.mode in {'STROKE', 'STROKE_AND_FILL'}:
|
||||
col.label(text="Stroke Texture:")
|
||||
col.prop(md, "fit_method")
|
||||
col.prop(md, "uv_offset")
|
||||
col.prop(md, "uv_scale")
|
||||
|
||||
if md.mode == 'STROKE_AND_FILL':
|
||||
col.separator()
|
||||
|
||||
if md.mode in {'FILL', 'STROKE_AND_FILL'}:
|
||||
col.label(text="Fill Texture:")
|
||||
col.prop(md, "fill_rotation", text="Rotation")
|
||||
col.prop(md, "fill_offset", text="Location")
|
||||
col.prop(md, "fill_scale", text="Scale")
|
||||
|
||||
self.gpencil_masking(layout, ob, md, True)
|
||||
|
||||
def GP_TINT(self, layout, ob, md):
|
||||
layout.row().prop(md, "tint_type", expand=True)
|
||||
|
||||
if md.tint_type == 'UNIFORM':
|
||||
col = layout.column()
|
||||
col.prop(md, "color")
|
||||
|
||||
col.separator()
|
||||
col.prop(md, "factor")
|
||||
|
||||
if md.tint_type == 'GRADIENT':
|
||||
col = layout.column()
|
||||
col.label(text="Colors:")
|
||||
col.template_color_ramp(md, "colors")
|
||||
|
||||
col.separator()
|
||||
|
||||
col.label(text="Object:")
|
||||
col.prop(md, "object", text="")
|
||||
|
||||
col.separator()
|
||||
row = col.row(align=True)
|
||||
row.prop(md, "radius")
|
||||
row.prop(md, "factor")
|
||||
|
||||
col.separator()
|
||||
col.prop(md, "vertex_mode")
|
||||
|
||||
self.gpencil_masking(layout, ob, md, True, True)
|
||||
|
||||
def GP_TIME(self, layout, ob, md):
|
||||
gpd = ob.data
|
||||
|
||||
row = layout.row()
|
||||
row.prop(md, "mode", text="Mode")
|
||||
|
||||
row = layout.row()
|
||||
if md.mode == 'FIX':
|
||||
txt = "Frame"
|
||||
else:
|
||||
txt = "Frame Offset"
|
||||
row.prop(md, "offset", text=txt)
|
||||
|
||||
row = layout.row()
|
||||
row.enabled = md.mode != 'FIX'
|
||||
row.prop(md, "frame_scale")
|
||||
|
||||
row = layout.row()
|
||||
row.separator()
|
||||
|
||||
row = layout.row()
|
||||
row.enabled = md.mode != 'FIX'
|
||||
row.prop(md, "use_custom_frame_range")
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.enabled = md.mode != 'FIX' and md.use_custom_frame_range is True
|
||||
row.prop(md, "frame_start")
|
||||
row.prop(md, "frame_end")
|
||||
|
||||
row = layout.row()
|
||||
row.enabled = md.mode != 'FIX'
|
||||
row.prop(md, "use_keep_loop")
|
||||
|
||||
row = layout.row()
|
||||
row.label(text="Layer:")
|
||||
row = layout.row(align=True)
|
||||
row.prop_search(md, "layer", gpd, "layers", text="", icon='GREASEPENCIL')
|
||||
row.prop(md, "invert_layers", text="", icon='ARROW_LEFTRIGHT')
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.prop(md, "layer_pass", text="Pass")
|
||||
row.prop(md, "invert_layer_pass", text="", icon='ARROW_LEFTRIGHT')
|
||||
|
||||
def GP_COLOR(self, layout, ob, md):
|
||||
split = layout.split()
|
||||
|
||||
col = split.column()
|
||||
col.label(text="Color:")
|
||||
col.prop(md, "hue", text="H", slider=True)
|
||||
col.prop(md, "saturation", text="S", slider=True)
|
||||
col.prop(md, "value", text="V", slider=True)
|
||||
|
||||
row = layout.row()
|
||||
row.prop(md, "modify_color")
|
||||
|
||||
self.gpencil_masking(layout, ob, md, False, True)
|
||||
|
||||
def GP_OPACITY(self, layout, ob, md):
|
||||
split = layout.split()
|
||||
|
||||
col = split.column()
|
||||
col.prop(md, "modify_color")
|
||||
|
||||
if md.modify_color == 'HARDNESS':
|
||||
col.prop(md, "hardness")
|
||||
show = False
|
||||
else:
|
||||
col.prop(md, "normalize_opacity")
|
||||
if md.normalize_opacity is True:
|
||||
text="Strength"
|
||||
else:
|
||||
text="Opacity Factor"
|
||||
|
||||
col.prop(md, "factor", text=text)
|
||||
show = True
|
||||
self.gpencil_masking(layout, ob, md, show, show)
|
||||
|
||||
def GP_ARRAY(self, layout, ob, md):
|
||||
col = layout.column()
|
||||
col.prop(md, "count")
|
||||
|
||||
split = layout.split()
|
||||
col = split.column()
|
||||
col.prop(md, "use_constant_offset", text="Constant Offset")
|
||||
subcol = col.column()
|
||||
subcol.enabled = md.use_constant_offset
|
||||
subcol.prop(md, "constant_offset", text="")
|
||||
|
||||
col.prop(md, "use_object_offset")
|
||||
subcol = col.column()
|
||||
subcol.enabled = md.use_object_offset
|
||||
subcol.prop(md, "offset_object", text="")
|
||||
|
||||
col = split.column()
|
||||
col.prop(md, "use_relative_offset", text="Relative Offset")
|
||||
subcol = col.column()
|
||||
subcol.enabled = md.use_relative_offset
|
||||
subcol.prop(md, "relative_offset", text="")
|
||||
|
||||
split = layout.split()
|
||||
col = split.column()
|
||||
col.label(text="Random Offset:")
|
||||
col.prop(md, "random_offset", text="")
|
||||
|
||||
col = split.column()
|
||||
col.label(text="Random Rotation:")
|
||||
col.prop(md, "random_rotation", text="")
|
||||
|
||||
col = split.column()
|
||||
col.label(text="Random Scale:")
|
||||
col.prop(md, "random_scale", text="")
|
||||
|
||||
col = layout.column()
|
||||
col.prop(md, "seed")
|
||||
col.separator()
|
||||
col.prop(md, "replace_material", text="Material Override")
|
||||
|
||||
self.gpencil_masking(layout, ob, md, False)
|
||||
|
||||
def GP_BUILD(self, layout, ob, md):
|
||||
gpd = ob.data
|
||||
|
||||
split = layout.split()
|
||||
|
||||
col = split.column()
|
||||
self.check_conflicts(col, ob)
|
||||
|
||||
col.prop(md, "mode")
|
||||
if md.mode == 'CONCURRENT':
|
||||
col.prop(md, "concurrent_time_alignment")
|
||||
|
||||
col.separator()
|
||||
col.prop(md, "transition")
|
||||
sub = col.column(align=True)
|
||||
sub.prop(md, "start_delay")
|
||||
sub.prop(md, "length")
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.prop(md, "use_restrict_frame_range")
|
||||
sub = col.column(align=True)
|
||||
sub.active = md.use_restrict_frame_range
|
||||
sub.prop(md, "frame_start", text="Start")
|
||||
sub.prop(md, "frame_end", text="End")
|
||||
|
||||
col.prop(md, "use_percentage")
|
||||
sub = col.column(align=True)
|
||||
sub.active = md.use_percentage
|
||||
sub.prop(md, "percentage_factor")
|
||||
|
||||
layout.label(text="Influence Filters:")
|
||||
|
||||
split = layout.split(factor=0.25)
|
||||
|
||||
col1 = split.column()
|
||||
|
||||
col1.label(text="Layer:")
|
||||
|
||||
col2 = split.column()
|
||||
|
||||
split = col2.split(factor=0.6)
|
||||
row = split.row(align=True)
|
||||
row.prop_search(md, "layer", gpd, "layers", text="", icon='GREASEPENCIL')
|
||||
row.prop(md, "invert_layers", text="", icon='ARROW_LEFTRIGHT')
|
||||
|
||||
row = split.row(align=True)
|
||||
row.prop(md, "layer_pass", text="Pass")
|
||||
row.prop(md, "invert_layer_pass", text="", icon='ARROW_LEFTRIGHT')
|
||||
|
||||
def GP_LATTICE(self, layout, ob, md):
|
||||
split = layout.split()
|
||||
|
||||
col = split.column()
|
||||
col.label(text="Object:")
|
||||
col.prop(md, "object", text="")
|
||||
|
||||
layout.prop(md, "strength", slider=True)
|
||||
|
||||
self.gpencil_masking(layout, ob, md, True)
|
||||
|
||||
def GP_MIRROR(self, layout, ob, md):
|
||||
row = layout.row(align=True)
|
||||
row.prop(md, "x_axis")
|
||||
row.prop(md, "y_axis")
|
||||
row.prop(md, "z_axis")
|
||||
|
||||
layout.label(text="Mirror Object:")
|
||||
layout.prop(md, "object", text="")
|
||||
|
||||
self.gpencil_masking(layout, ob, md, False)
|
||||
|
||||
def GP_HOOK(self, layout, ob, md):
|
||||
split = layout.split()
|
||||
|
||||
col = split.column()
|
||||
col.label(text="Object:")
|
||||
col.prop(md, "object", text="")
|
||||
if md.object and md.object.type == 'ARMATURE':
|
||||
col.label(text="Bone:")
|
||||
col.prop_search(md, "subtarget", md.object.data, "bones", text="")
|
||||
|
||||
use_falloff = (md.falloff_type != 'NONE')
|
||||
|
||||
layout.separator()
|
||||
|
||||
row = layout.row(align=True)
|
||||
if use_falloff:
|
||||
row.prop(md, "falloff_radius")
|
||||
row.prop(md, "strength", slider=True)
|
||||
layout.prop(md, "falloff_type")
|
||||
|
||||
col = layout.column()
|
||||
if use_falloff:
|
||||
if md.falloff_type == 'CURVE':
|
||||
col.template_curve_mapping(md, "falloff_curve")
|
||||
|
||||
split = layout.split()
|
||||
|
||||
col = split.column()
|
||||
col.prop(md, "use_falloff_uniform")
|
||||
|
||||
self.gpencil_masking(layout, ob, md, True)
|
||||
|
||||
def GP_OFFSET(self, layout, ob, md):
|
||||
split = layout.split()
|
||||
|
||||
split.column().prop(md, "location")
|
||||
split.column().prop(md, "rotation")
|
||||
split.column().prop(md, "scale")
|
||||
|
||||
self.gpencil_masking(layout, ob, md, True)
|
||||
|
||||
def GP_ARMATURE(self, layout, ob, md):
|
||||
split = layout.split()
|
||||
|
||||
col = split.column()
|
||||
col.label(text="Object:")
|
||||
col.prop(md, "object", text="")
|
||||
# col.prop(md, "use_deform_preserve_volume")
|
||||
|
||||
col = split.column()
|
||||
col.label(text="Bind To:")
|
||||
col.prop(md, "use_vertex_groups", text="Vertex Groups")
|
||||
col.prop(md, "use_bone_envelopes", text="Bone Envelopes")
|
||||
|
||||
layout.separator()
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.label(text="Vertex Group:")
|
||||
row = layout.row(align=True)
|
||||
row.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
|
||||
sub = row.row(align=True)
|
||||
sub.active = bool(md.vertex_group)
|
||||
sub.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT')
|
||||
|
||||
def GP_MULTIPLY(self, layout, ob, md):
|
||||
col = layout.column()
|
||||
|
||||
col.prop(md, "duplicates")
|
||||
subcol = col.column()
|
||||
subcol.enabled = md.duplicates > 0
|
||||
subcol.prop(md, "distance")
|
||||
subcol.prop(md, "offset", slider=True)
|
||||
|
||||
subcol.separator()
|
||||
|
||||
subcol.prop(md, "use_fade")
|
||||
if md.use_fade:
|
||||
subcol.prop(md, "fading_center")
|
||||
subcol.prop(md, "fading_thickness", slider=True)
|
||||
subcol.prop(md, "fading_opacity", slider=True)
|
||||
|
||||
self.gpencil_masking(layout, ob, md, False)
|
||||
layout.template_grease_pencil_modifiers()
|
||||
|
||||
|
||||
classes = (
|
||||
|
@@ -24,11 +24,11 @@ class ShaderFxButtonsPanel:
|
||||
bl_space_type = 'PROPERTIES'
|
||||
bl_region_type = 'WINDOW'
|
||||
bl_context = "shaderfx"
|
||||
bl_options = {'HIDE_HEADER'}
|
||||
|
||||
|
||||
class DATA_PT_shader_fx(ShaderFxButtonsPanel, Panel):
|
||||
bl_label = "Effects"
|
||||
bl_options = {'HIDE_HEADER'}
|
||||
|
||||
# Unused: always show for now.
|
||||
|
||||
@@ -39,122 +39,8 @@ class DATA_PT_shader_fx(ShaderFxButtonsPanel, Panel):
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
ob = context.object
|
||||
|
||||
layout.operator_menu_enum("object.shaderfx_add", "type")
|
||||
|
||||
for fx in ob.shader_effects:
|
||||
box = layout.template_shaderfx(fx)
|
||||
if box:
|
||||
# match enum type to our functions, avoids a lookup table.
|
||||
getattr(self, fx.type)(box, fx)
|
||||
|
||||
# the mt.type enum is (ab)used for a lookup on function names
|
||||
# ...to avoid lengthy if statements
|
||||
# so each type must have a function here.
|
||||
|
||||
def FX_BLUR(self, layout, fx):
|
||||
|
||||
layout.prop(fx, "use_dof_mode", text="Use Depth of Field")
|
||||
layout.separator()
|
||||
|
||||
col = layout.column()
|
||||
col.enabled = not fx.use_dof_mode
|
||||
col.prop(fx, "size", text="Size")
|
||||
col.separator()
|
||||
col.prop(fx, "rotation")
|
||||
|
||||
layout.prop(fx, "samples", text="Samples")
|
||||
|
||||
|
||||
def FX_COLORIZE(self, layout, fx):
|
||||
layout.prop(fx, "mode", text="Mode")
|
||||
|
||||
if fx.mode == 'DUOTONE':
|
||||
layout.prop(fx, "low_color", text="Low Color")
|
||||
if fx.mode == 'CUSTOM':
|
||||
layout.prop(fx, "low_color", text="Color")
|
||||
|
||||
if fx.mode == 'DUOTONE':
|
||||
layout.prop(fx, "high_color", text="High Color")
|
||||
|
||||
layout.prop(fx, "factor")
|
||||
|
||||
def FX_WAVE(self, layout, fx):
|
||||
row = layout.row(align=True)
|
||||
row.prop(fx, "orientation", expand=True)
|
||||
|
||||
layout.separator()
|
||||
layout.prop(fx, "amplitude")
|
||||
layout.prop(fx, "period")
|
||||
layout.prop(fx, "phase")
|
||||
|
||||
def FX_PIXEL(self, layout, fx):
|
||||
layout.prop(fx, "size", text="Size")
|
||||
|
||||
def FX_RIM(self, layout, fx):
|
||||
layout.prop(fx, "offset", text="Offset")
|
||||
|
||||
layout.prop(fx, "rim_color")
|
||||
layout.prop(fx, "mask_color")
|
||||
layout.prop(fx, "mode", text="Blend")
|
||||
layout.prop(fx, "blur")
|
||||
layout.prop(fx, "samples")
|
||||
|
||||
def FX_SHADOW(self, layout, fx):
|
||||
layout.prop(fx, "offset", text="Offset")
|
||||
|
||||
layout.prop(fx, "shadow_color")
|
||||
layout.prop(fx, "scale")
|
||||
layout.prop(fx, "rotation")
|
||||
|
||||
layout.separator()
|
||||
layout.prop(fx, "blur")
|
||||
layout.prop(fx, "samples")
|
||||
|
||||
layout.separator()
|
||||
layout.prop(fx, "use_object", text="Use Object as Pivot")
|
||||
if fx.use_object:
|
||||
row = layout.row()
|
||||
row.prop(fx, "object", text="Object")
|
||||
|
||||
layout.separator()
|
||||
layout.prop(fx, "use_wave", text="Use Wave Effect")
|
||||
if fx.use_wave is True:
|
||||
row = layout.row(align=True)
|
||||
row.prop(fx, "orientation", expand=True)
|
||||
layout.prop(fx, "amplitude")
|
||||
layout.prop(fx, "period")
|
||||
layout.prop(fx, "phase")
|
||||
|
||||
def FX_GLOW(self, layout, fx):
|
||||
layout.prop(fx, "mode")
|
||||
if fx.mode == 'LUMINANCE':
|
||||
layout.prop(fx, "threshold")
|
||||
else:
|
||||
layout.prop(fx, "select_color")
|
||||
|
||||
layout.prop(fx, "glow_color")
|
||||
layout.separator()
|
||||
layout.prop(fx, "blend_mode", text="Blend")
|
||||
layout.prop(fx, "opacity")
|
||||
|
||||
layout.prop(fx, "size")
|
||||
layout.prop(fx, "rotation")
|
||||
layout.prop(fx, "samples")
|
||||
|
||||
layout.prop(fx, "use_glow_under", text="Glow Under")
|
||||
|
||||
def FX_SWIRL(self, layout, fx):
|
||||
layout.prop(fx, "object", text="Object")
|
||||
|
||||
layout.prop(fx, "radius")
|
||||
layout.prop(fx, "angle")
|
||||
|
||||
def FX_FLIP(self, layout, fx):
|
||||
layout.prop(fx, "flip_horizontal")
|
||||
layout.prop(fx, "flip_vertical")
|
||||
layout.template_shaderfx()
|
||||
|
||||
|
||||
classes = (
|
||||
|
@@ -38,6 +38,9 @@ struct bPoseChannel;
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** For building the panel UI for constraints. */
|
||||
#define CONSTRAINT_TYPE_PANEL_PREFIX "OBJECT_PT_"
|
||||
|
||||
/* special struct for use in constraint evaluation */
|
||||
typedef struct bConstraintOb {
|
||||
/** to get evaluated armature. */
|
||||
@@ -136,6 +139,8 @@ typedef struct bConstraintTypeInfo {
|
||||
const bConstraintTypeInfo *BKE_constraint_typeinfo_get(struct bConstraint *con);
|
||||
const bConstraintTypeInfo *BKE_constraint_typeinfo_from_type(int type);
|
||||
|
||||
void BKE_constraint_panel_id(int type, char *r_name);
|
||||
|
||||
/* ---------------------------------------------------------------------------- */
|
||||
|
||||
/* Constraint function prototypes */
|
||||
|
@@ -20,12 +20,14 @@
|
||||
* \ingroup bke
|
||||
*/
|
||||
|
||||
#include "BLI_compiler_attrs.h"
|
||||
#include "DNA_gpencil_modifier_types.h" /* needed for all enum typdefs */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct ARegionType;
|
||||
struct Depsgraph;
|
||||
struct GpencilModifierData;
|
||||
struct ID;
|
||||
@@ -255,11 +257,17 @@ typedef struct GpencilModifierTypeInfo {
|
||||
struct Object *ob,
|
||||
GreasePencilTexWalkFunc walk,
|
||||
void *userData);
|
||||
|
||||
/* Register the panel types for the modifier's UI. */
|
||||
void (*panelRegister)(struct ARegionType *region_type);
|
||||
} GpencilModifierTypeInfo;
|
||||
|
||||
#define GPENCIL_MODIFIER_TYPE_PANEL_PREFIX "MOD_PT_gpencil_"
|
||||
|
||||
/* Initialize modifier's global data (type info and some common global storages). */
|
||||
void BKE_gpencil_modifier_init(void);
|
||||
|
||||
void BKE_gpencil_modifierType_panel_id(GpencilModifierType type, char *r_idname);
|
||||
const GpencilModifierTypeInfo *BKE_gpencil_modifier_get_info(GpencilModifierType type);
|
||||
struct GpencilModifierData *BKE_gpencil_modifier_new(int type);
|
||||
void BKE_gpencil_modifier_free_ex(struct GpencilModifierData *md, const int flag);
|
||||
@@ -276,6 +284,8 @@ void BKE_gpencil_modifier_copydata(struct GpencilModifierData *md,
|
||||
void BKE_gpencil_modifier_copydata_ex(struct GpencilModifierData *md,
|
||||
struct GpencilModifierData *target,
|
||||
const int flag);
|
||||
void BKE_gpencil_modifier_set_error(struct GpencilModifierData *md, const char *format, ...)
|
||||
ATTR_PRINTF_FORMAT(2, 3);
|
||||
void BKE_gpencil_modifiers_foreach_ID_link(struct Object *ob,
|
||||
GreasePencilIDWalkFunc walk,
|
||||
void *userData);
|
||||
|
@@ -28,6 +28,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct ARegionType;
|
||||
struct ID;
|
||||
struct ListBase;
|
||||
struct ModifierUpdateDepsgraphContext;
|
||||
@@ -157,11 +158,17 @@ typedef struct ShaderFxTypeInfo {
|
||||
struct Object *ob,
|
||||
ShaderFxIDWalkFunc walk,
|
||||
void *userData);
|
||||
|
||||
/* Register the panel types for the effect's UI. */
|
||||
void (*panelRegister)(struct ARegionType *region_type);
|
||||
} ShaderFxTypeInfo;
|
||||
|
||||
#define SHADERFX_TYPE_PANEL_PREFIX "FX_PT_"
|
||||
|
||||
/* Initialize global data (type info and some common global storages). */
|
||||
void BKE_shaderfx_init(void);
|
||||
|
||||
void BKE_shaderfxType_panel_id(ShaderFxType type, char *panel_id);
|
||||
const ShaderFxTypeInfo *BKE_shaderfx_get_info(ShaderFxType type);
|
||||
struct ShaderFxData *BKE_shaderfx_new(int type);
|
||||
void BKE_shaderfx_free_ex(struct ShaderFxData *fx, const int flag);
|
||||
|
@@ -5288,6 +5288,20 @@ const bConstraintTypeInfo *BKE_constraint_typeinfo_from_type(int type)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the idname of the constraint type's panel, which was defined elsewhere.
|
||||
*
|
||||
* \note: Constraint panel types are assumed to be named with the struct name field concatenated to
|
||||
* the defined prefix.
|
||||
*/
|
||||
void BKE_constraint_panel_id(int type, char *r_idname)
|
||||
{
|
||||
const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_from_type(type);
|
||||
|
||||
strcpy(r_idname, CONSTRAINT_TYPE_PANEL_PREFIX);
|
||||
strcat(r_idname, cti->structName);
|
||||
}
|
||||
|
||||
/* This function should always be used to get the appropriate type-info, as it
|
||||
* has checks which prevent segfaults in some weird cases.
|
||||
*/
|
||||
@@ -5412,9 +5426,14 @@ static bConstraint *add_new_constraint_internal(const char *name, short type)
|
||||
|
||||
/* Set up a generic constraint data-block. */
|
||||
con->type = type;
|
||||
con->flag |= CONSTRAINT_EXPAND | CONSTRAINT_OVERRIDE_LIBRARY_LOCAL;
|
||||
con->flag |= CONSTRAINT_OVERRIDE_LIBRARY_LOCAL;
|
||||
con->ui_expand_flag = 1; /* Only expand the parent panel by default. */
|
||||
con->enforce = 1.0f;
|
||||
|
||||
/* Only open the main panel when constraints are created, not the subpanels.
|
||||
* Note: This can be overriden for individual constraint types. */
|
||||
con->ui_expand_flag = 1;
|
||||
|
||||
/* Determine a basic name, and info */
|
||||
if (cti) {
|
||||
/* initialize constraint data */
|
||||
|
@@ -53,6 +53,9 @@
|
||||
|
||||
#include "MOD_gpencil_modifiertypes.h"
|
||||
|
||||
#include "CLG_log.h"
|
||||
|
||||
static CLG_LogRef LOG = {"bke.modifier"};
|
||||
static GpencilModifierTypeInfo *modifier_gpencil_types[NUM_GREASEPENCIL_MODIFIER_TYPES] = {NULL};
|
||||
|
||||
/* *************************************************** */
|
||||
@@ -428,9 +431,9 @@ GpencilModifierData *BKE_gpencil_modifier_new(int type)
|
||||
BLI_strncpy(md->name, DATA_(mti->name), sizeof(md->name));
|
||||
|
||||
md->type = type;
|
||||
md->mode = eGpencilModifierMode_Realtime | eGpencilModifierMode_Render |
|
||||
eGpencilModifierMode_Expanded;
|
||||
md->mode = eGpencilModifierMode_Realtime | eGpencilModifierMode_Render;
|
||||
md->flag = eGpencilModifierFlag_OverrideLibrary_Local;
|
||||
md->ui_expand_flag = 1; /* Only expand the parent panel at first. */
|
||||
|
||||
if (mti->flags & eGpencilModifierTypeFlag_EnableInEditmode) {
|
||||
md->mode |= eGpencilModifierMode_Editmode;
|
||||
@@ -508,7 +511,8 @@ bool BKE_gpencil_modifier_depends_ontime(GpencilModifierData *md)
|
||||
const GpencilModifierTypeInfo *BKE_gpencil_modifier_get_info(GpencilModifierType type)
|
||||
{
|
||||
/* type unsigned, no need to check < 0 */
|
||||
if (type < NUM_GREASEPENCIL_MODIFIER_TYPES && modifier_gpencil_types[type]->name[0] != '\0') {
|
||||
if (type < NUM_GREASEPENCIL_MODIFIER_TYPES && type > 0 &&
|
||||
modifier_gpencil_types[type]->name[0] != '\0') {
|
||||
return modifier_gpencil_types[type];
|
||||
}
|
||||
else {
|
||||
@@ -516,6 +520,17 @@ const GpencilModifierTypeInfo *BKE_gpencil_modifier_get_info(GpencilModifierType
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the idname of the modifier type's panel, which was defined in the #panelRegister callback.
|
||||
*/
|
||||
void BKE_gpencil_modifierType_panel_id(GpencilModifierType type, char *r_idname)
|
||||
{
|
||||
const GpencilModifierTypeInfo *mti = BKE_gpencil_modifier_get_info(type);
|
||||
|
||||
strcpy(r_idname, GPENCIL_MODIFIER_TYPE_PANEL_PREFIX);
|
||||
strcat(r_idname, mti->name);
|
||||
}
|
||||
|
||||
void BKE_gpencil_modifier_copydata_generic(const GpencilModifierData *md_src,
|
||||
GpencilModifierData *md_dst)
|
||||
{
|
||||
@@ -553,6 +568,7 @@ void BKE_gpencil_modifier_copydata_ex(GpencilModifierData *md,
|
||||
|
||||
target->mode = md->mode;
|
||||
target->flag = md->flag;
|
||||
target->ui_expand_flag = md->ui_expand_flag; /* Expand the parent panel by default. */
|
||||
|
||||
if (mti->copyData) {
|
||||
mti->copyData(md, target);
|
||||
@@ -587,6 +603,26 @@ GpencilModifierData *BKE_gpencil_modifiers_findby_type(Object *ob, GpencilModifi
|
||||
return md;
|
||||
}
|
||||
|
||||
void BKE_gpencil_modifier_set_error(GpencilModifierData *md, const char *_format, ...)
|
||||
{
|
||||
char buffer[512];
|
||||
va_list ap;
|
||||
const char *format = TIP_(_format);
|
||||
|
||||
va_start(ap, _format);
|
||||
vsnprintf(buffer, sizeof(buffer), format, ap);
|
||||
va_end(ap);
|
||||
buffer[sizeof(buffer) - 1] = '\0';
|
||||
|
||||
if (md->error) {
|
||||
MEM_freeN(md->error);
|
||||
}
|
||||
|
||||
md->error = BLI_strdup(buffer);
|
||||
|
||||
CLOG_STR_ERROR(&LOG, md->error);
|
||||
}
|
||||
|
||||
void BKE_gpencil_modifiers_foreach_ID_link(Object *ob, GreasePencilIDWalkFunc walk, void *userData)
|
||||
{
|
||||
GpencilModifierData *md = ob->greasepencil_modifiers.first;
|
||||
|
@@ -82,8 +82,9 @@ ShaderFxData *BKE_shaderfx_new(int type)
|
||||
BLI_strncpy(fx->name, DATA_(fxi->name), sizeof(fx->name));
|
||||
|
||||
fx->type = type;
|
||||
fx->mode = eShaderFxMode_Realtime | eShaderFxMode_Render | eShaderFxMode_Expanded;
|
||||
fx->mode = eShaderFxMode_Realtime | eShaderFxMode_Render;
|
||||
fx->flag = eShaderFxFlag_OverrideLibrary_Local;
|
||||
fx->ui_expand_flag = 1; /* Expand only the parent panel by default. */
|
||||
|
||||
if (fxi->flags & eShaderFxTypeFlag_EnableInEditmode) {
|
||||
fx->mode |= eShaderFxMode_Editmode;
|
||||
@@ -156,7 +157,7 @@ bool BKE_shaderfx_depends_ontime(ShaderFxData *fx)
|
||||
const ShaderFxTypeInfo *BKE_shaderfx_get_info(ShaderFxType type)
|
||||
{
|
||||
/* type unsigned, no need to check < 0 */
|
||||
if (type < NUM_SHADER_FX_TYPES && shader_fx_types[type]->name[0] != '\0') {
|
||||
if (type < NUM_SHADER_FX_TYPES && type > 0 && shader_fx_types[type]->name[0] != '\0') {
|
||||
return shader_fx_types[type];
|
||||
}
|
||||
else {
|
||||
@@ -164,6 +165,20 @@ const ShaderFxTypeInfo *BKE_shaderfx_get_info(ShaderFxType type)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an effect's panel type, which was defined in the #panelRegister callback.
|
||||
*
|
||||
* \note: ShaderFx panel types are assumed to be named with the struct name field concatenated to
|
||||
* the defined prefix.
|
||||
*/
|
||||
void BKE_shaderfxType_panel_id(ShaderFxType type, char *r_idname)
|
||||
{
|
||||
const ShaderFxTypeInfo *fxi = BKE_shaderfx_get_info(type);
|
||||
|
||||
strcpy(r_idname, SHADERFX_TYPE_PANEL_PREFIX);
|
||||
strcat(r_idname, fxi->name);
|
||||
}
|
||||
|
||||
void BKE_shaderfx_copydata_generic(const ShaderFxData *fx_src, ShaderFxData *fx_dst)
|
||||
{
|
||||
const ShaderFxTypeInfo *fxi = BKE_shaderfx_get_info(fx_src->type);
|
||||
@@ -198,6 +213,7 @@ void BKE_shaderfx_copydata_ex(ShaderFxData *fx, ShaderFxData *target, const int
|
||||
|
||||
target->mode = fx->mode;
|
||||
target->flag = fx->flag;
|
||||
target->ui_expand_flag = fx->ui_expand_flag;
|
||||
|
||||
if (fxi->copyData) {
|
||||
fxi->copyData(fx, target);
|
||||
|
@@ -24,6 +24,7 @@
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "DNA_brush_types.h"
|
||||
#include "DNA_constraint_types.h"
|
||||
#include "DNA_genfile.h"
|
||||
#include "DNA_gpencil_modifier_types.h"
|
||||
#include "DNA_modifier_types.h"
|
||||
@@ -267,6 +268,7 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
||||
{
|
||||
/* Keep this block, even when empty. */
|
||||
|
||||
/* Transition to saving expansion for all of a modifier's subpanels. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "ModifierData", "short", "ui_expand_flag")) {
|
||||
for (Object *object = bmain->objects.first; object != NULL; object = object->id.next) {
|
||||
LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) {
|
||||
@@ -279,5 +281,33 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Transition to saving expansion for all of a constraint's subpanels. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "bConstraint", "short", "ui_expand_flag")) {
|
||||
for (Object *object = bmain->objects.first; object != NULL; object = object->id.next) {
|
||||
LISTBASE_FOREACH (bConstraint *, con, &object->constraints) {
|
||||
if (con->flag & CONSTRAINT_EXPAND_DEPRECATED) {
|
||||
con->ui_expand_flag = 1;
|
||||
}
|
||||
else {
|
||||
con->ui_expand_flag = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Transition to saving expansion for all of grease pencil modifier's subpanels. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "GpencilModifierData", "short", "ui_expand_flag")) {
|
||||
for (Object *object = bmain->objects.first; object != NULL; object = object->id.next) {
|
||||
LISTBASE_FOREACH (GpencilModifierData *, md, &object->greasepencil_modifiers) {
|
||||
if (md->mode & eGpencilModifierMode_Expanded_DEPRECATED) {
|
||||
md->ui_expand_flag = 1;
|
||||
}
|
||||
else {
|
||||
md->ui_expand_flag = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1318,7 +1318,7 @@ static void OVERLAY_relationship_lines(OVERLAY_ExtraCallBuffers *cb,
|
||||
else {
|
||||
const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(curcon);
|
||||
|
||||
if ((cti && cti->get_constraint_targets) && (curcon->flag & CONSTRAINT_EXPAND)) {
|
||||
if ((cti && cti->get_constraint_targets) && (curcon->ui_expand_flag)) {
|
||||
ListBase targets = {NULL, NULL};
|
||||
bConstraintTarget *ct;
|
||||
|
||||
|
@@ -425,6 +425,10 @@ int ED_object_gpencil_modifier_move_down(struct ReportList *reports,
|
||||
int ED_object_gpencil_modifier_move_up(struct ReportList *reports,
|
||||
struct Object *ob,
|
||||
struct GpencilModifierData *md);
|
||||
bool ED_object_gpencil_modifier_move_to_index(struct ReportList *reports,
|
||||
struct Object *ob,
|
||||
struct GpencilModifierData *md,
|
||||
const int index);
|
||||
int ED_object_gpencil_modifier_apply(struct Main *bmain,
|
||||
struct ReportList *reports,
|
||||
struct Depsgraph *depsgraph,
|
||||
@@ -453,6 +457,10 @@ int ED_object_shaderfx_move_down(struct ReportList *reports,
|
||||
int ED_object_shaderfx_move_up(struct ReportList *reports,
|
||||
struct Object *ob,
|
||||
struct ShaderFxData *fx);
|
||||
bool ED_object_shaderfx_move_to_index(struct ReportList *reports,
|
||||
struct Object *ob,
|
||||
struct ShaderFxData *fx,
|
||||
const int index);
|
||||
|
||||
/* object_select.c */
|
||||
void ED_object_select_linked_by_id(struct bContext *C, struct ID *id);
|
||||
|
@@ -2003,6 +2003,10 @@ void uiTemplatePathBuilder(uiLayout *layout,
|
||||
struct PointerRNA *root_ptr,
|
||||
const char *text);
|
||||
void uiTemplateModifiers(uiLayout *layout, struct bContext *C);
|
||||
void uiTemplateGpencilModifiers(uiLayout *layout, struct bContext *C);
|
||||
void uiTemplateConstraints(uiLayout *layout, struct bContext *C);
|
||||
void uiTemplateShaderFx(uiLayout *layout, struct bContext *C);
|
||||
|
||||
uiLayout *uiTemplateGpencilModifier(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr);
|
||||
void uiTemplateGpencilColorPreview(uiLayout *layout,
|
||||
struct bContext *C,
|
||||
@@ -2013,11 +2017,9 @@ void uiTemplateGpencilColorPreview(uiLayout *layout,
|
||||
float scale,
|
||||
int filter);
|
||||
|
||||
uiLayout *uiTemplateShaderFx(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr);
|
||||
|
||||
void uiTemplateOperatorRedoProperties(uiLayout *layout, const struct bContext *C);
|
||||
|
||||
uiLayout *uiTemplateConstraint(uiLayout *layout, struct PointerRNA *ptr);
|
||||
void uiTemplateConstraintHeader(uiLayout *layout, struct PointerRNA *ptr);
|
||||
void uiTemplatePreview(uiLayout *layout,
|
||||
struct bContext *C,
|
||||
struct ID *id,
|
||||
|
@@ -1851,7 +1851,7 @@ void uiTemplateModifiers(uiLayout *UNUSED(layout), bContext *C)
|
||||
const ModifierTypeInfo *mti = BKE_modifier_get_info(md->type);
|
||||
if (mti->panelRegister) {
|
||||
char panel_idname[MAX_NAME];
|
||||
modifier_panel_id(md, panel_idname);
|
||||
modifier_panel_id((void *)md, panel_idname);
|
||||
|
||||
Panel *new_panel = UI_panel_add_instanced(sa, region, ®ion->panels, panel_idname, i);
|
||||
if (new_panel != NULL) {
|
||||
@@ -1872,268 +1872,185 @@ void uiTemplateModifiers(uiLayout *UNUSED(layout), bContext *C)
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Grease Pencil Modifier Template
|
||||
/** \name Grease Pencil Modifiers Template
|
||||
*
|
||||
* Template for building the panel layout for the active object's modifiers.
|
||||
* \{ */
|
||||
|
||||
#define ERROR_LIBDATA_MESSAGE TIP_("Can't edit external library data")
|
||||
|
||||
static uiLayout *gpencil_draw_modifier(uiLayout *layout, Object *ob, GpencilModifierData *md)
|
||||
/**
|
||||
* Function with void * argument for #uiListPanelIDFromDataFunc.
|
||||
*/
|
||||
static void gpencil_modifier_panel_id(void *md_link, char *r_name)
|
||||
{
|
||||
const GpencilModifierTypeInfo *mti = BKE_gpencil_modifier_get_info(md->type);
|
||||
PointerRNA ptr;
|
||||
uiBlock *block;
|
||||
uiLayout *box, *column, *row, *sub;
|
||||
uiLayout *result = NULL;
|
||||
|
||||
/* create RNA pointer */
|
||||
RNA_pointer_create(&ob->id, &RNA_GpencilModifier, md, &ptr);
|
||||
|
||||
column = uiLayoutColumn(layout, true);
|
||||
uiLayoutSetContextPointer(column, "modifier", &ptr);
|
||||
|
||||
/* rounded header ------------------------------------------------------------------- */
|
||||
box = uiLayoutBox(column);
|
||||
|
||||
row = uiLayoutRow(box, false);
|
||||
block = uiLayoutGetBlock(row);
|
||||
|
||||
UI_block_emboss_set(block, UI_EMBOSS_NONE);
|
||||
/* Open/Close ................................. */
|
||||
uiItemR(row, &ptr, "show_expanded", 0, "", ICON_NONE);
|
||||
|
||||
/* modifier-type icon */
|
||||
uiItemL(row, "", RNA_struct_ui_icon(ptr.type));
|
||||
UI_block_emboss_set(block, UI_EMBOSS);
|
||||
|
||||
/* modifier name */
|
||||
if (mti->isDisabled && mti->isDisabled(md, 0)) {
|
||||
uiLayoutSetRedAlert(row, true);
|
||||
}
|
||||
uiItemR(row, &ptr, "name", 0, "", ICON_NONE);
|
||||
uiLayoutSetRedAlert(row, false);
|
||||
|
||||
/* mode enabling buttons */
|
||||
UI_block_align_begin(block);
|
||||
uiItemR(row, &ptr, "show_render", 0, "", ICON_NONE);
|
||||
uiItemR(row, &ptr, "show_viewport", 0, "", ICON_NONE);
|
||||
|
||||
if (mti->flags & eGpencilModifierTypeFlag_SupportsEditmode) {
|
||||
sub = uiLayoutRow(row, true);
|
||||
uiLayoutSetActive(sub, false);
|
||||
uiItemR(sub, &ptr, "show_in_editmode", 0, "", ICON_NONE);
|
||||
}
|
||||
|
||||
UI_block_align_end(block);
|
||||
|
||||
/* Up/Down + Delete ........................... */
|
||||
UI_block_align_begin(block);
|
||||
uiItemO(row, "", ICON_TRIA_UP, "OBJECT_OT_gpencil_modifier_move_up");
|
||||
uiItemO(row, "", ICON_TRIA_DOWN, "OBJECT_OT_gpencil_modifier_move_down");
|
||||
UI_block_align_end(block);
|
||||
|
||||
UI_block_emboss_set(block, UI_EMBOSS_NONE);
|
||||
uiItemO(row, "", ICON_X, "OBJECT_OT_gpencil_modifier_remove");
|
||||
UI_block_emboss_set(block, UI_EMBOSS);
|
||||
|
||||
/* modifier settings (under the header) --------------------------------------------------- */
|
||||
if (md->mode & eGpencilModifierMode_Expanded) {
|
||||
/* apply/convert/copy */
|
||||
box = uiLayoutBox(column);
|
||||
row = uiLayoutRow(box, false);
|
||||
|
||||
/* only here obdata, the rest of modifiers is ob level */
|
||||
UI_block_lock_set(block, BKE_object_obdata_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
|
||||
|
||||
uiLayoutSetOperatorContext(row, WM_OP_INVOKE_DEFAULT);
|
||||
|
||||
sub = uiLayoutRow(row, false);
|
||||
if (mti->flags & eGpencilModifierTypeFlag_NoApply) {
|
||||
uiLayoutSetEnabled(sub, false);
|
||||
}
|
||||
uiItemEnumO(sub,
|
||||
"OBJECT_OT_gpencil_modifier_apply",
|
||||
CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply"),
|
||||
0,
|
||||
"apply_as",
|
||||
MODIFIER_APPLY_DATA);
|
||||
|
||||
UI_block_lock_clear(block);
|
||||
UI_block_lock_set(block, ob && ID_IS_LINKED(ob), ERROR_LIBDATA_MESSAGE);
|
||||
|
||||
uiItemO(row,
|
||||
CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy"),
|
||||
ICON_NONE,
|
||||
"OBJECT_OT_gpencil_modifier_copy");
|
||||
|
||||
/* result is the layout block inside the box,
|
||||
* that we return so that modifier settings can be drawn */
|
||||
result = uiLayoutColumn(box, false);
|
||||
block = uiLayoutAbsoluteBlock(box);
|
||||
}
|
||||
|
||||
/* error messages */
|
||||
if (md->error) {
|
||||
box = uiLayoutBox(column);
|
||||
row = uiLayoutRow(box, false);
|
||||
uiItemL(row, md->error, ICON_ERROR);
|
||||
}
|
||||
|
||||
return result;
|
||||
ModifierData *md = (ModifierData *)md_link;
|
||||
BKE_gpencil_modifierType_panel_id(md->type, r_name);
|
||||
}
|
||||
|
||||
uiLayout *uiTemplateGpencilModifier(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
void uiTemplateGpencilModifiers(uiLayout *UNUSED(layout), bContext *C)
|
||||
{
|
||||
Object *ob;
|
||||
GpencilModifierData *md, *vmd;
|
||||
int i;
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
ListBase *modifiers = &ob->greasepencil_modifiers;
|
||||
|
||||
/* verify we have valid data */
|
||||
if (!RNA_struct_is_a(ptr->type, &RNA_GpencilModifier)) {
|
||||
RNA_warning("Expected modifier on object");
|
||||
return NULL;
|
||||
}
|
||||
bool panels_match = UI_panel_list_matches_data(region, modifiers, gpencil_modifier_panel_id);
|
||||
|
||||
ob = (Object *)ptr->owner_id;
|
||||
md = ptr->data;
|
||||
if (!panels_match) {
|
||||
UI_panels_free_instanced(C, region);
|
||||
GpencilModifierData *md = modifiers->first;
|
||||
for (int i = 0; md; i++, md = md->next) {
|
||||
const GpencilModifierTypeInfo *mti = BKE_gpencil_modifier_get_info(md->type);
|
||||
if (mti->panelRegister) {
|
||||
char panel_idname[MAX_NAME];
|
||||
gpencil_modifier_panel_id(md, panel_idname);
|
||||
|
||||
if (!ob || !(GS(ob->id.name) == ID_OB)) {
|
||||
RNA_warning("Expected modifier on object");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
UI_block_lock_set(uiLayoutGetBlock(layout), (ob && ID_IS_LINKED(ob)), ERROR_LIBDATA_MESSAGE);
|
||||
|
||||
/* find modifier and draw it */
|
||||
vmd = ob->greasepencil_modifiers.first;
|
||||
for (i = 0; vmd; i++, vmd = vmd->next) {
|
||||
if (md == vmd) {
|
||||
return gpencil_draw_modifier(layout, ob, md);
|
||||
Panel *new_panel = UI_panel_add_instanced(sa, region, ®ion->panels, panel_idname, i);
|
||||
if (new_panel != NULL) {
|
||||
UI_panel_set_expand_from_list_data(C, new_panel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Grease Pencil Shader FX Template
|
||||
/** \name Constraints Template
|
||||
*
|
||||
* Template for building the panel layout for the active object or bone's constraints.
|
||||
* \{ */
|
||||
|
||||
static uiLayout *gpencil_draw_shaderfx(uiLayout *layout, Object *ob, ShaderFxData *md)
|
||||
/**
|
||||
* Move a constraint to the index it's moved to after a drag and drop.
|
||||
*/
|
||||
static void constraint_reorder(bContext *C, Panel *panel, int new_index)
|
||||
{
|
||||
const ShaderFxTypeInfo *mti = BKE_shaderfx_get_info(md->type);
|
||||
PointerRNA ptr;
|
||||
uiBlock *block;
|
||||
uiLayout *box, *column, *row, *sub;
|
||||
uiLayout *result = NULL;
|
||||
|
||||
/* create RNA pointer */
|
||||
RNA_pointer_create(&ob->id, &RNA_ShaderFx, md, &ptr);
|
||||
|
||||
column = uiLayoutColumn(layout, true);
|
||||
uiLayoutSetContextPointer(column, "shaderfx", &ptr);
|
||||
|
||||
/* rounded header ------------------------------------------------------------------- */
|
||||
box = uiLayoutBox(column);
|
||||
|
||||
row = uiLayoutRow(box, false);
|
||||
block = uiLayoutGetBlock(row);
|
||||
|
||||
UI_block_emboss_set(block, UI_EMBOSS_NONE);
|
||||
/* Open/Close ................................. */
|
||||
uiItemR(row, &ptr, "show_expanded", 0, "", ICON_NONE);
|
||||
|
||||
/* shader-type icon */
|
||||
uiItemL(row, "", RNA_struct_ui_icon(ptr.type));
|
||||
UI_block_emboss_set(block, UI_EMBOSS);
|
||||
|
||||
/* effect name */
|
||||
if (mti->isDisabled && mti->isDisabled(md, 0)) {
|
||||
uiLayoutSetRedAlert(row, true);
|
||||
}
|
||||
uiItemR(row, &ptr, "name", 0, "", ICON_NONE);
|
||||
uiLayoutSetRedAlert(row, false);
|
||||
|
||||
/* mode enabling buttons */
|
||||
UI_block_align_begin(block);
|
||||
uiItemR(row, &ptr, "show_render", 0, "", ICON_NONE);
|
||||
uiItemR(row, &ptr, "show_viewport", 0, "", ICON_NONE);
|
||||
|
||||
if (mti->flags & eShaderFxTypeFlag_SupportsEditmode) {
|
||||
sub = uiLayoutRow(row, true);
|
||||
uiLayoutSetActive(sub, false);
|
||||
uiItemR(sub, &ptr, "show_in_editmode", 0, "", ICON_NONE);
|
||||
}
|
||||
|
||||
UI_block_align_end(block);
|
||||
|
||||
/* Up/Down + Delete ........................... */
|
||||
UI_block_align_begin(block);
|
||||
uiItemO(row, "", ICON_TRIA_UP, "OBJECT_OT_shaderfx_move_up");
|
||||
uiItemO(row, "", ICON_TRIA_DOWN, "OBJECT_OT_shaderfx_move_down");
|
||||
UI_block_align_end(block);
|
||||
|
||||
UI_block_emboss_set(block, UI_EMBOSS_NONE);
|
||||
uiItemO(row, "", ICON_X, "OBJECT_OT_shaderfx_remove");
|
||||
UI_block_emboss_set(block, UI_EMBOSS);
|
||||
|
||||
/* effect settings (under the header) --------------------------------------------------- */
|
||||
if (md->mode & eShaderFxMode_Expanded) {
|
||||
/* apply/convert/copy */
|
||||
box = uiLayoutBox(column);
|
||||
row = uiLayoutRow(box, false);
|
||||
|
||||
/* only here obdata, the rest of effect is ob level */
|
||||
UI_block_lock_set(block, BKE_object_obdata_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
|
||||
|
||||
/* result is the layout block inside the box,
|
||||
* that we return so that effect settings can be drawn */
|
||||
result = uiLayoutColumn(box, false);
|
||||
block = uiLayoutAbsoluteBlock(box);
|
||||
}
|
||||
|
||||
/* error messages */
|
||||
if (md->error) {
|
||||
box = uiLayoutBox(column);
|
||||
row = uiLayoutRow(box, false);
|
||||
uiItemL(row, md->error, ICON_ERROR);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
uiLayout *uiTemplateShaderFx(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
Object *ob;
|
||||
ShaderFxData *fx, *vfx;
|
||||
int i;
|
||||
|
||||
/* verify we have valid data */
|
||||
if (!RNA_struct_is_a(ptr->type, &RNA_ShaderFx)) {
|
||||
RNA_warning("Expected shader fx on object");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ob = (Object *)ptr->owner_id;
|
||||
fx = ptr->data;
|
||||
|
||||
if (!ob || !(GS(ob->id.name) == ID_OB)) {
|
||||
RNA_warning("Expected shader fx on object");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
UI_block_lock_set(uiLayoutGetBlock(layout), (ob && ID_IS_LINKED(ob)), ERROR_LIBDATA_MESSAGE);
|
||||
|
||||
/* find modifier and draw it */
|
||||
vfx = ob->shader_fx.first;
|
||||
for (i = 0; vfx; i++, vfx = vfx->next) {
|
||||
if (fx == vfx) {
|
||||
return gpencil_draw_shaderfx(layout, ob, fx);
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
ListBase *lb = ED_object_constraint_list_from_context(ob);
|
||||
bool constraint_from_bone = false;
|
||||
if (ob->mode & OB_MODE_POSE) {
|
||||
bPoseChannel *pchan;
|
||||
pchan = BKE_pose_channel_active(ob);
|
||||
if (pchan) {
|
||||
constraint_from_bone = true;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
bConstraint *con = BLI_findlink(lb, panel->runtime.list_index);
|
||||
PointerRNA props_ptr;
|
||||
wmOperatorType *ot = WM_operatortype_find("CONSTRAINT_OT_move_to_index", false);
|
||||
WM_operator_properties_create_ptr(&props_ptr, ot);
|
||||
RNA_string_set(&props_ptr, "constraint", con->name);
|
||||
RNA_int_set(&props_ptr, "index", new_index);
|
||||
/* Set owner to #EDIT_CONSTRAINT_OWNER_OBJECT or #EDIT_CONSTRAINT_OWNER_BONE. */
|
||||
RNA_enum_set(&props_ptr, "owner", constraint_from_bone ? 1 : 0);
|
||||
WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &props_ptr);
|
||||
WM_operator_properties_free(&props_ptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the expand flag from the active constraint to use for the panel.
|
||||
*/
|
||||
static short get_constraint_expand_flag(const bContext *C, Panel *panel)
|
||||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
ListBase *lb = ED_object_constraint_list_from_context(ob);
|
||||
bConstraint *con = BLI_findlink(lb, panel->runtime.list_index);
|
||||
return con->ui_expand_flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the expand flag for the panel and subpanels to the constraint.
|
||||
*/
|
||||
static void set_constraint_expand_flag(const bContext *C, Panel *panel, short expand_flag)
|
||||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
ListBase *lb = ED_object_constraint_list_from_context(ob);
|
||||
bConstraint *con = BLI_findlink(lb, panel->runtime.list_index);
|
||||
con->ui_expand_flag = expand_flag;
|
||||
}
|
||||
|
||||
static void constraint_panel_id(void *md_link, char *r_name)
|
||||
{
|
||||
bConstraint *con = (bConstraint *)md_link;
|
||||
BKE_constraint_panel_id(con->type, r_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the constraint panels don't match the data and rebuild the panels if so.
|
||||
*/
|
||||
void uiTemplateConstraints(uiLayout *UNUSED(layout), bContext *C)
|
||||
{
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
ListBase *constraints = ED_object_constraint_list_from_context(ob);
|
||||
|
||||
bool panels_match = UI_panel_list_matches_data(region, constraints, constraint_panel_id);
|
||||
|
||||
if (!panels_match) {
|
||||
UI_panels_free_instanced(C, region);
|
||||
bConstraint *con = constraints->first;
|
||||
for (int i = 0; con; i++, con = con->next) {
|
||||
char panel_idname[MAX_NAME];
|
||||
constraint_panel_id(con, panel_idname);
|
||||
|
||||
Panel *new_panel = UI_panel_add_instanced(sa, region, ®ion->panels, panel_idname, i);
|
||||
if (new_panel) {
|
||||
/* Set the list panel functionality function pointers since we don't do it with python. */
|
||||
new_panel->type->set_list_data_expand_flag = set_constraint_expand_flag;
|
||||
new_panel->type->get_list_data_expand_flag = get_constraint_expand_flag;
|
||||
new_panel->type->reorder = constraint_reorder;
|
||||
|
||||
UI_panel_set_expand_from_list_data(C, new_panel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name ShaderFx Template
|
||||
*
|
||||
* Template for building the panel layout for the active object's grease pencil shader effects.
|
||||
* \{ */
|
||||
|
||||
/**
|
||||
* Function with void * argument for #uiListPanelIDFromDataFunc.
|
||||
*/
|
||||
static void shaderfx_panel_id(void *fx_v, char *r_idname)
|
||||
{
|
||||
ShaderFxData *fx = (ShaderFxData *)fx_v;
|
||||
BKE_shaderfxType_panel_id(fx->type, r_idname);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the shader effect panels don't match the data and rebuild the panels if so.
|
||||
*/
|
||||
void uiTemplateShaderFx(uiLayout *UNUSED(layout), bContext *C)
|
||||
{
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
ListBase *shaderfx = &ob->shader_fx;
|
||||
|
||||
bool panels_match = UI_panel_list_matches_data(region, shaderfx, shaderfx_panel_id);
|
||||
|
||||
if (!panels_match) {
|
||||
UI_panels_free_instanced(C, region);
|
||||
ShaderFxData *fx = shaderfx->first;
|
||||
for (int i = 0; fx; i++, fx = fx->next) {
|
||||
char panel_idname[MAX_NAME];
|
||||
shaderfx_panel_id(fx, panel_idname);
|
||||
|
||||
Panel *new_panel = UI_panel_add_instanced(sa, region, ®ion->panels, panel_idname, i);
|
||||
if (new_panel != NULL) {
|
||||
UI_panel_set_expand_from_list_data(C, new_panel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** \} */
|
||||
@@ -2442,18 +2359,19 @@ void uiTemplateOperatorRedoProperties(uiLayout *layout, const bContext *C)
|
||||
/** \name Constraint Template
|
||||
* \{ */
|
||||
|
||||
#define ERROR_LIBDATA_MESSAGE TIP_("Can't edit external library data")
|
||||
|
||||
static void constraint_active_func(bContext *UNUSED(C), void *ob_v, void *con_v)
|
||||
{
|
||||
ED_object_constraint_active_set(ob_v, con_v);
|
||||
}
|
||||
|
||||
/* draw panel showing settings for a constraint */
|
||||
static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
|
||||
static void draw_constraint_header(uiLayout *layout, Object *ob, bConstraint *con)
|
||||
{
|
||||
bPoseChannel *pchan = BKE_pose_channel_active(ob);
|
||||
const bConstraintTypeInfo *cti;
|
||||
uiBlock *block;
|
||||
uiLayout *result = NULL, *col, *box, *row;
|
||||
uiLayout *sub;
|
||||
PointerRNA ptr;
|
||||
char typestr[32];
|
||||
short proxy_protected, xco = 0, yco = 0;
|
||||
@@ -2485,36 +2403,23 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
|
||||
|
||||
RNA_pointer_create(&ob->id, &RNA_Constraint, con, &ptr);
|
||||
|
||||
col = uiLayoutColumn(layout, true);
|
||||
uiLayoutSetContextPointer(col, "constraint", &ptr);
|
||||
|
||||
box = uiLayoutBox(col);
|
||||
row = uiLayoutRow(box, false);
|
||||
block = uiLayoutGetBlock(box);
|
||||
|
||||
/* Draw constraint header */
|
||||
|
||||
/* open/close */
|
||||
UI_block_emboss_set(block, UI_EMBOSS_NONE);
|
||||
uiItemR(row, &ptr, "show_expanded", 0, "", ICON_NONE);
|
||||
uiLayoutSetContextPointer(layout, "constraint", &ptr);
|
||||
|
||||
/* constraint-type icon */
|
||||
uiItemL(row, "", RNA_struct_ui_icon(ptr.type));
|
||||
sub = uiLayoutRow(layout, false);
|
||||
uiLayoutSetEmboss(sub, false);
|
||||
uiLayoutSetRedAlert(sub, (con->flag & CONSTRAINT_DISABLE));
|
||||
uiItemL(sub, "", RNA_struct_ui_icon(ptr.type));
|
||||
|
||||
UI_block_emboss_set(block, UI_EMBOSS);
|
||||
|
||||
if (con->flag & CONSTRAINT_DISABLE) {
|
||||
uiLayoutSetRedAlert(row, true);
|
||||
}
|
||||
|
||||
if (proxy_protected == 0) {
|
||||
uiItemR(row, &ptr, "name", 0, "", ICON_NONE);
|
||||
uiItemR(layout, &ptr, "name", 0, "", ICON_NONE);
|
||||
}
|
||||
else {
|
||||
uiItemL(row, con->name, ICON_NONE);
|
||||
uiItemL(layout, con->name, ICON_NONE);
|
||||
}
|
||||
|
||||
uiLayoutSetRedAlert(row, false);
|
||||
|
||||
/* proxy-protected constraints cannot be edited, so hide up/down + close buttons */
|
||||
if (proxy_protected) {
|
||||
UI_block_emboss_set(block, UI_EMBOSS_NONE);
|
||||
@@ -2553,54 +2458,20 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
|
||||
UI_block_emboss_set(block, UI_EMBOSS);
|
||||
}
|
||||
else {
|
||||
short prev_proxylock, show_upbut, show_downbut;
|
||||
|
||||
/* Up/Down buttons:
|
||||
* Proxy-constraints are not allowed to occur after local (non-proxy) constraints
|
||||
* as that poses problems when restoring them, so disable the "up" button where
|
||||
* it may cause this situation.
|
||||
*
|
||||
* Up/Down buttons should only be shown (or not grayed - todo) if they serve some purpose.
|
||||
*/
|
||||
if (BKE_constraints_proxylocked_owner(ob, pchan)) {
|
||||
if (con->prev) {
|
||||
prev_proxylock = (con->prev->flag & CONSTRAINT_PROXY_LOCAL) ? 0 : 1;
|
||||
}
|
||||
else {
|
||||
prev_proxylock = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
prev_proxylock = 0;
|
||||
}
|
||||
|
||||
show_upbut = ((prev_proxylock == 0) && (con->prev));
|
||||
show_downbut = (con->next) ? 1 : 0;
|
||||
|
||||
/* enabled */
|
||||
UI_block_emboss_set(block, UI_EMBOSS_NONE);
|
||||
uiItemR(row, &ptr, "mute", 0, "", 0);
|
||||
uiItemR(layout, &ptr, "mute", 0, "", 0);
|
||||
UI_block_emboss_set(block, UI_EMBOSS);
|
||||
|
||||
uiLayoutSetOperatorContext(row, WM_OP_INVOKE_DEFAULT);
|
||||
|
||||
/* up/down */
|
||||
if (show_upbut || show_downbut) {
|
||||
UI_block_align_begin(block);
|
||||
if (show_upbut) {
|
||||
uiItemO(row, "", ICON_TRIA_UP, "CONSTRAINT_OT_move_up");
|
||||
}
|
||||
|
||||
if (show_downbut) {
|
||||
uiItemO(row, "", ICON_TRIA_DOWN, "CONSTRAINT_OT_move_down");
|
||||
}
|
||||
UI_block_align_end(block);
|
||||
}
|
||||
uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_DEFAULT);
|
||||
|
||||
/* Close 'button' - emboss calls here disable drawing of 'button' behind X */
|
||||
UI_block_emboss_set(block, UI_EMBOSS_NONE);
|
||||
uiItemO(row, "", ICON_X, "CONSTRAINT_OT_delete");
|
||||
uiItemO(layout, "", ICON_X, "CONSTRAINT_OT_delete");
|
||||
UI_block_emboss_set(block, UI_EMBOSS);
|
||||
|
||||
/* Some extra padding at the end, so 'x' icon isn't too close to drag button. */
|
||||
uiItemS(layout);
|
||||
}
|
||||
|
||||
/* Set but-locks for protected settings (magic numbers are used here!) */
|
||||
@@ -2608,23 +2479,11 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
|
||||
UI_block_lock_set(block, true, TIP_("Cannot edit Proxy-Protected Constraint"));
|
||||
}
|
||||
|
||||
/* Draw constraint data */
|
||||
if ((con->flag & CONSTRAINT_EXPAND) == 0) {
|
||||
(yco) -= 10.5f * UI_UNIT_Y;
|
||||
}
|
||||
else {
|
||||
box = uiLayoutBox(col);
|
||||
block = uiLayoutAbsoluteBlock(box);
|
||||
result = box;
|
||||
}
|
||||
|
||||
/* clear any locks set up for proxies/lib-linking */
|
||||
UI_block_lock_clear(block);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
uiLayout *uiTemplateConstraint(uiLayout *layout, PointerRNA *ptr)
|
||||
void uiTemplateConstraintHeader(uiLayout *layout, PointerRNA *ptr)
|
||||
{
|
||||
Object *ob;
|
||||
bConstraint *con;
|
||||
@@ -2632,7 +2491,7 @@ uiLayout *uiTemplateConstraint(uiLayout *layout, PointerRNA *ptr)
|
||||
/* verify we have valid data */
|
||||
if (!RNA_struct_is_a(ptr->type, &RNA_Constraint)) {
|
||||
RNA_warning("Expected constraint on object");
|
||||
return NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
ob = (Object *)ptr->owner_id;
|
||||
@@ -2640,7 +2499,7 @@ uiLayout *uiTemplateConstraint(uiLayout *layout, PointerRNA *ptr)
|
||||
|
||||
if (!ob || !(GS(ob->id.name) == ID_OB)) {
|
||||
RNA_warning("Expected constraint on object");
|
||||
return NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
UI_block_lock_set(uiLayoutGetBlock(layout), (ob && ID_IS_LINKED(ob)), ERROR_LIBDATA_MESSAGE);
|
||||
@@ -2649,11 +2508,11 @@ uiLayout *uiTemplateConstraint(uiLayout *layout, PointerRNA *ptr)
|
||||
if (con->type == CONSTRAINT_TYPE_KINEMATIC) {
|
||||
bKinematicConstraint *data = con->data;
|
||||
if (data->flag & CONSTRAINT_IK_TEMP) {
|
||||
return NULL;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
return draw_constraint(layout, ob, con);
|
||||
draw_constraint_header(layout, ob, con);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
@@ -1556,6 +1556,76 @@ void CONSTRAINT_OT_move_up(wmOperatorType *ot)
|
||||
|
||||
/** \} */
|
||||
|
||||
/* ------------------------------------------------------------------- */
|
||||
/** \name Move Constraint To Index Operator
|
||||
* \{ */
|
||||
|
||||
static int constraint_move_to_index_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob = ED_object_active_context(C);
|
||||
bConstraint *con = edit_constraint_property_get(op, ob, 0);
|
||||
|
||||
int new_index = RNA_int_get(op->ptr, "index");
|
||||
if (new_index < 0) {
|
||||
new_index = 0;
|
||||
}
|
||||
|
||||
if (con) {
|
||||
ListBase *conlist = ED_object_constraint_list_from_constraint(ob, con, NULL);
|
||||
int current_index = BLI_findindex(conlist, con);
|
||||
BLI_assert(current_index >= 0);
|
||||
|
||||
BLI_listbase_link_move(conlist, con, new_index - current_index);
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, ob);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
static int constraint_move_to_index_invoke(bContext *C,
|
||||
wmOperator *op,
|
||||
const wmEvent *UNUSED(event))
|
||||
{
|
||||
if (edit_constraint_invoke_properties(C, op)) {
|
||||
return constraint_move_to_index_exec(C, op);
|
||||
}
|
||||
else {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
}
|
||||
|
||||
void CONSTRAINT_OT_move_to_index(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name = "Move Constraint To Index";
|
||||
ot->idname = "CONSTRAINT_OT_move_to_index";
|
||||
ot->description =
|
||||
"Change the constraint's index in the list so it evaluates after the set number of others";
|
||||
|
||||
/* callbacks */
|
||||
ot->exec = constraint_move_to_index_exec;
|
||||
ot->invoke = constraint_move_to_index_invoke;
|
||||
ot->poll = edit_constraint_poll;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
edit_constraint_properties(ot);
|
||||
RNA_def_int(ot->srna,
|
||||
"index",
|
||||
0,
|
||||
0,
|
||||
INT_MAX,
|
||||
"Index",
|
||||
"The index to move the constraint to",
|
||||
0,
|
||||
INT_MAX);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* ------------------------------------------------------------------- */
|
||||
/** \name Clear Pose Constraints Operator
|
||||
* \{ */
|
||||
|
@@ -211,6 +211,40 @@ int ED_object_gpencil_modifier_move_down(ReportList *UNUSED(reports),
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool ED_object_gpencil_modifier_move_to_index(ReportList *reports,
|
||||
Object *ob,
|
||||
GpencilModifierData *md,
|
||||
const int index)
|
||||
{
|
||||
BLI_assert(md != NULL);
|
||||
BLI_assert(index >= 0);
|
||||
if (index >= BLI_listbase_count(&ob->greasepencil_modifiers)) {
|
||||
BKE_report(reports, RPT_WARNING, "Cannot move modifier beyond the end of the stack");
|
||||
return false;
|
||||
}
|
||||
|
||||
int md_index = BLI_findindex(&ob->greasepencil_modifiers, md);
|
||||
BLI_assert(md_index != -1);
|
||||
if (md_index < index) {
|
||||
/* Move modifier down in list. */
|
||||
for (; md_index < index; md_index++) {
|
||||
if (!ED_object_gpencil_modifier_move_down(reports, ob, md)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Move modifier up in list. */
|
||||
for (; md_index > index; md_index--) {
|
||||
if (!ED_object_gpencil_modifier_move_up(reports, ob, md)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static int gpencil_modifier_apply_obdata(
|
||||
ReportList *reports, Main *bmain, Depsgraph *depsgraph, Object *ob, GpencilModifierData *md)
|
||||
{
|
||||
@@ -596,6 +630,58 @@ void OBJECT_OT_gpencil_modifier_move_down(wmOperatorType *ot)
|
||||
gpencil_edit_modifier_properties(ot);
|
||||
}
|
||||
|
||||
/* ************************* Move to Index Gpencil Modifier Operator ************************* */
|
||||
|
||||
static bool gpencil_modifier_move_to_index_poll(bContext *C)
|
||||
{
|
||||
return gpencil_edit_modifier_poll(C);
|
||||
}
|
||||
|
||||
static int gpencil_modifier_move_to_index_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob = ED_object_active_context(C);
|
||||
GpencilModifierData *md = gpencil_edit_modifier_property_get(op, ob, 0);
|
||||
int index = RNA_int_get(op->ptr, "index");
|
||||
|
||||
if (!ED_object_gpencil_modifier_move_to_index(op->reports, ob, md, index)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static int gpencil_modifier_move_to_index_invoke(bContext *C,
|
||||
wmOperator *op,
|
||||
const wmEvent *UNUSED(event))
|
||||
{
|
||||
if (gpencil_edit_modifier_invoke_properties(C, op)) {
|
||||
return gpencil_modifier_move_to_index_exec(C, op);
|
||||
}
|
||||
else {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
}
|
||||
|
||||
void OBJECT_OT_gpencil_modifier_move_to_index(wmOperatorType *ot)
|
||||
{
|
||||
ot->name = "Move Active Modifier to Index";
|
||||
ot->description = "Move the active modifier to an index in the stack";
|
||||
ot->idname = "OBJECT_OT_gpencil_modifier_move_to_index";
|
||||
|
||||
ot->invoke = gpencil_modifier_move_to_index_invoke;
|
||||
ot->exec = gpencil_modifier_move_to_index_exec;
|
||||
ot->poll = gpencil_modifier_move_to_index_poll;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
|
||||
edit_modifier_properties(ot);
|
||||
RNA_def_int(
|
||||
ot->srna, "index", 0, 0, INT_MAX, "Index", "The index to move the modifier to", 0, INT_MAX);
|
||||
}
|
||||
|
||||
/************************ apply modifier operator *********************/
|
||||
|
||||
static int gpencil_modifier_apply_exec(bContext *C, wmOperator *op)
|
||||
|
@@ -190,6 +190,7 @@ void OBJECT_OT_gpencil_modifier_add(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_gpencil_modifier_remove(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_gpencil_modifier_move_up(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_gpencil_modifier_move_down(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_gpencil_modifier_move_to_index(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_gpencil_modifier_apply(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_gpencil_modifier_copy(struct wmOperatorType *ot);
|
||||
|
||||
@@ -198,6 +199,7 @@ void OBJECT_OT_shaderfx_add(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_shaderfx_remove(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_shaderfx_move_up(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_shaderfx_move_down(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_shaderfx_move_to_index(struct wmOperatorType *ot);
|
||||
|
||||
/* object_constraint.c */
|
||||
void OBJECT_OT_constraint_add(struct wmOperatorType *ot);
|
||||
@@ -218,6 +220,7 @@ void CONSTRAINT_OT_delete(struct wmOperatorType *ot);
|
||||
|
||||
void CONSTRAINT_OT_move_up(struct wmOperatorType *ot);
|
||||
void CONSTRAINT_OT_move_down(struct wmOperatorType *ot);
|
||||
void CONSTRAINT_OT_move_to_index(struct wmOperatorType *ot);
|
||||
|
||||
void CONSTRAINT_OT_stretchto_reset(struct wmOperatorType *ot);
|
||||
void CONSTRAINT_OT_limitdistance_reset(struct wmOperatorType *ot);
|
||||
|
@@ -152,6 +152,7 @@ void ED_operatortypes_object(void)
|
||||
WM_operatortype_append(OBJECT_OT_gpencil_modifier_remove);
|
||||
WM_operatortype_append(OBJECT_OT_gpencil_modifier_move_up);
|
||||
WM_operatortype_append(OBJECT_OT_gpencil_modifier_move_down);
|
||||
WM_operatortype_append(OBJECT_OT_gpencil_modifier_move_to_index);
|
||||
WM_operatortype_append(OBJECT_OT_gpencil_modifier_apply);
|
||||
WM_operatortype_append(OBJECT_OT_gpencil_modifier_copy);
|
||||
|
||||
@@ -160,6 +161,7 @@ void ED_operatortypes_object(void)
|
||||
WM_operatortype_append(OBJECT_OT_shaderfx_remove);
|
||||
WM_operatortype_append(OBJECT_OT_shaderfx_move_up);
|
||||
WM_operatortype_append(OBJECT_OT_shaderfx_move_down);
|
||||
WM_operatortype_append(OBJECT_OT_shaderfx_move_to_index);
|
||||
|
||||
WM_operatortype_append(OBJECT_OT_correctivesmooth_bind);
|
||||
WM_operatortype_append(OBJECT_OT_meshdeform_bind);
|
||||
@@ -178,6 +180,7 @@ void ED_operatortypes_object(void)
|
||||
WM_operatortype_append(POSE_OT_ik_clear);
|
||||
WM_operatortype_append(CONSTRAINT_OT_delete);
|
||||
WM_operatortype_append(CONSTRAINT_OT_move_up);
|
||||
WM_operatortype_append(CONSTRAINT_OT_move_to_index);
|
||||
WM_operatortype_append(CONSTRAINT_OT_move_down);
|
||||
WM_operatortype_append(CONSTRAINT_OT_stretchto_reset);
|
||||
WM_operatortype_append(CONSTRAINT_OT_limitdistance_reset);
|
||||
|
@@ -200,6 +200,41 @@ int ED_object_shaderfx_move_down(ReportList *UNUSED(reports), Object *ob, Shader
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool ED_object_shaderfx_move_to_index(ReportList *reports,
|
||||
Object *ob,
|
||||
ShaderFxData *fx,
|
||||
const int index)
|
||||
{
|
||||
BLI_assert(fx != NULL);
|
||||
BLI_assert(index >= 0);
|
||||
if (index >= BLI_listbase_count(&ob->greasepencil_modifiers)) {
|
||||
BKE_report(reports, RPT_WARNING, "Cannot move effect beyond the end of the stack");
|
||||
return false;
|
||||
}
|
||||
|
||||
int fx_index = BLI_findindex(&ob->shader_fx, fx);
|
||||
printf("moving fx at %d to %d\n", fx_index, index);
|
||||
BLI_assert(fx_index != -1);
|
||||
if (fx_index < index) {
|
||||
/* Move shaderfx down in list. */
|
||||
for (; fx_index < index; fx_index++) {
|
||||
if (!ED_object_shaderfx_move_up(reports, ob, fx)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Move shaderfx up in list. */
|
||||
for (; fx_index > index; fx_index--) {
|
||||
if (!ED_object_shaderfx_move_down(reports, ob, fx)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/************************ add effect operator *********************/
|
||||
|
||||
static int shaderfx_add_exec(bContext *C, wmOperator *op)
|
||||
@@ -487,3 +522,53 @@ void OBJECT_OT_shaderfx_move_down(wmOperatorType *ot)
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
|
||||
edit_shaderfx_properties(ot);
|
||||
}
|
||||
|
||||
/************************ move shaderfx to index operator *********************/
|
||||
|
||||
static bool shaderfx_move_to_index_poll(bContext *C)
|
||||
{
|
||||
return edit_shaderfx_poll_generic(C, &RNA_ShaderFx, 0);
|
||||
}
|
||||
|
||||
static int shaderfx_move_to_index_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob = ED_object_active_context(C);
|
||||
ShaderFxData *fx = edit_shaderfx_property_get(op, ob, 0);
|
||||
int index = RNA_int_get(op->ptr, "index");
|
||||
|
||||
if (!fx || !ED_object_shaderfx_move_to_index(op->reports, ob, fx, index)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static int shaderfx_move_to_index_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
|
||||
{
|
||||
if (edit_shaderfx_invoke_properties(C, op)) {
|
||||
return shaderfx_move_to_index_exec(C, op);
|
||||
}
|
||||
else {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
}
|
||||
|
||||
void OBJECT_OT_shaderfx_move_to_index(wmOperatorType *ot)
|
||||
{
|
||||
ot->name = "Move Effect to Index";
|
||||
ot->description = "Move shaderfx to an index in the stack";
|
||||
ot->idname = "OBJECT_OT_shaderfx_move_to_index";
|
||||
|
||||
ot->invoke = shaderfx_move_to_index_invoke;
|
||||
ot->exec = shaderfx_move_to_index_exec;
|
||||
ot->poll = shaderfx_move_to_index_poll;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
|
||||
edit_shaderfx_properties(ot);
|
||||
RNA_def_int(
|
||||
ot->srna, "index", 0, 0, INT_MAX, "Index", "The index to move the effect to", 0, INT_MAX);
|
||||
}
|
||||
|
@@ -30,10 +30,10 @@
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_gpencil_modifier.h" /* Types for registering panels. */
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "DNA_modifier_types.h"
|
||||
#include "BKE_shader_fx.h"
|
||||
|
||||
#include "ED_screen.h"
|
||||
#include "ED_space_api.h"
|
||||
@@ -643,6 +643,21 @@ void ED_spacetype_buttons(void)
|
||||
mti->panelRegister(art);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < NUM_GREASEPENCIL_MODIFIER_TYPES; i++) {
|
||||
const GpencilModifierTypeInfo *mti = BKE_gpencil_modifier_get_info(i);
|
||||
if (mti != NULL && mti->panelRegister != NULL) {
|
||||
mti->panelRegister(art);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < NUM_SHADER_FX_TYPES; i++) {
|
||||
if (i == eShaderFxType_Light_deprecated) {
|
||||
continue;
|
||||
}
|
||||
const ShaderFxTypeInfo *fxti = BKE_shaderfx_get_info(i);
|
||||
if (fxti != NULL && fxti->panelRegister != NULL) {
|
||||
fxti->panelRegister(art);
|
||||
}
|
||||
}
|
||||
|
||||
/* regions: header */
|
||||
art = MEM_callocN(sizeof(ARegionType), "spacetype buttons region");
|
||||
|
@@ -25,11 +25,14 @@ set(INC
|
||||
../blenfont
|
||||
../blenkernel
|
||||
../blenlib
|
||||
../blentranslation
|
||||
../bmesh
|
||||
../depsgraph
|
||||
../editors/include
|
||||
../makesdna
|
||||
../makesrna
|
||||
../render/extern/include
|
||||
../windowmanager
|
||||
../../../intern/eigen
|
||||
../../../intern/guardedalloc
|
||||
)
|
||||
@@ -40,6 +43,7 @@ set(INC_SYS
|
||||
|
||||
set(SRC
|
||||
intern/MOD_gpencil_util.h
|
||||
intern/MOD_gpencil_ui_common.c
|
||||
|
||||
intern/MOD_gpencil_util.c
|
||||
intern/MOD_gpencilarmature.c
|
||||
@@ -61,6 +65,7 @@ set(SRC
|
||||
intern/MOD_gpenciltime.c
|
||||
intern/MOD_gpenciltint.c
|
||||
|
||||
intern/MOD_gpencil_ui_common.h
|
||||
MOD_gpencil_modifiertypes.h
|
||||
)
|
||||
|
||||
|
413
source/blender/gpencil_modifiers/intern/MOD_gpencil_ui_common.c
Normal file
413
source/blender/gpencil_modifiers/intern/MOD_gpencil_ui_common.c
Normal file
@@ -0,0 +1,413 @@
|
||||
/* This program 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 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program 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, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \ingroup modifiers
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "BLI_listbase.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_gpencil_modifier.h"
|
||||
#include "BKE_material.h"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "DNA_object_force_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_particle_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
#include "DNA_space_types.h"
|
||||
|
||||
#include "ED_object.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
|
||||
#include "MOD_gpencil_ui_common.h" /* Self include */
|
||||
|
||||
static Object *get_gpencilmodifier_object(const bContext *C)
|
||||
{
|
||||
SpaceProperties *sbuts = CTX_wm_space_properties(C);
|
||||
if (sbuts != NULL && (sbuts->pinid != NULL) && GS(sbuts->pinid->name) == ID_OB) {
|
||||
return (Object *)sbuts->pinid;
|
||||
}
|
||||
else {
|
||||
return CTX_data_active_object(C);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Poll function so these modifier panels only show for grease pencil objects.
|
||||
*/
|
||||
static bool gpencil_modifier_ui_poll(const bContext *C, PanelType *UNUSED(pt))
|
||||
{
|
||||
Object *ob = get_gpencilmodifier_object(C);
|
||||
|
||||
return (ob != NULL) && (ob->type == OB_GPENCIL);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Panel Drag and Drop, Expansion Saving
|
||||
* \{ */
|
||||
|
||||
/**
|
||||
* Move a modifier to the index it's moved to after a drag and drop.
|
||||
*/
|
||||
static void gpencil_modifier_reorder(bContext *C, Panel *panel, int new_index)
|
||||
{
|
||||
Object *ob = get_gpencilmodifier_object(C);
|
||||
|
||||
GpencilModifierData *md = BLI_findlink(&ob->greasepencil_modifiers, panel->runtime.list_index);
|
||||
PointerRNA props_ptr;
|
||||
wmOperatorType *ot = WM_operatortype_find("OBJECT_OT_gpencil_modifier_move_to_index", false);
|
||||
WM_operator_properties_create_ptr(&props_ptr, ot);
|
||||
RNA_string_set(&props_ptr, "modifier", md->name);
|
||||
RNA_int_set(&props_ptr, "index", new_index);
|
||||
WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &props_ptr);
|
||||
WM_operator_properties_free(&props_ptr);
|
||||
}
|
||||
|
||||
static short get_gpencil_modifier_expand_flag(const bContext *C, Panel *panel)
|
||||
{
|
||||
Object *ob = get_gpencilmodifier_object(C);
|
||||
GpencilModifierData *md = BLI_findlink(&ob->greasepencil_modifiers, panel->runtime.list_index);
|
||||
return md->ui_expand_flag;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void set_gpencil_modifier_expand_flag(const bContext *C, Panel *panel, short expand_flag)
|
||||
{
|
||||
Object *ob = get_gpencilmodifier_object(C);
|
||||
GpencilModifierData *md = BLI_findlink(&ob->greasepencil_modifiers, panel->runtime.list_index);
|
||||
md->ui_expand_flag = expand_flag;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Modifier Panel Layouts
|
||||
* \{ */
|
||||
|
||||
void gpencil_modifier_masking_panel_draw(const bContext *C,
|
||||
Panel *panel,
|
||||
bool use_material,
|
||||
bool use_vertex)
|
||||
{
|
||||
uiLayout *row, *col, *sub;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
gpencil_modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
PointerRNA obj_data_ptr = RNA_pointer_get(&ob_ptr, "data");
|
||||
bool has_layer = RNA_string_length(&ptr, "layer") != 0;
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
col = uiLayoutColumn(layout, true);
|
||||
row = uiLayoutRow(col, true);
|
||||
uiItemPointerR(row, &ptr, "layer", &obj_data_ptr, "layers", NULL, ICON_GREASEPENCIL);
|
||||
sub = uiLayoutRow(row, true);
|
||||
uiLayoutSetActive(sub, has_layer);
|
||||
uiLayoutSetPropDecorate(sub, false);
|
||||
uiItemR(sub, &ptr, "invert_layers", 0, "", ICON_ARROW_LEFTRIGHT);
|
||||
|
||||
row = uiLayoutRow(col, true);
|
||||
uiItemR(row, &ptr, "layer_pass", 0, NULL, ICON_NONE);
|
||||
sub = uiLayoutRow(row, true);
|
||||
uiLayoutSetActive(sub, RNA_int_get(&ptr, "layer_pass") != 0);
|
||||
uiLayoutSetPropDecorate(sub, false);
|
||||
uiItemR(sub, &ptr, "invert_layer_pass", 0, "", ICON_ARROW_LEFTRIGHT);
|
||||
|
||||
if (use_material) {
|
||||
PointerRNA material_ptr = RNA_pointer_get(&ptr, "material");
|
||||
bool has_material = !RNA_pointer_is_null(&material_ptr);
|
||||
|
||||
/* Because the Gpencil modifier material property used to be a string in an earlier version of
|
||||
* Blender, we need to check if the material is valid and display it differently if so. */
|
||||
bool valid = false;
|
||||
{
|
||||
if (!has_material) {
|
||||
valid = true;
|
||||
}
|
||||
else {
|
||||
Material *current_material = material_ptr.data;
|
||||
Object *ob = ob_ptr.data;
|
||||
for (int i = 0; i <= ob->totcol; i++) {
|
||||
Material *mat = BKE_object_material_get(ob, i);
|
||||
if (mat == current_material) {
|
||||
valid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
col = uiLayoutColumn(layout, true);
|
||||
row = uiLayoutRow(col, true);
|
||||
uiLayoutSetRedAlert(row, !valid);
|
||||
uiItemPointerR(row,
|
||||
&ptr,
|
||||
"material",
|
||||
&obj_data_ptr,
|
||||
"materials",
|
||||
NULL,
|
||||
valid ? ICON_SHADING_TEXTURE : ICON_ERROR);
|
||||
sub = uiLayoutRow(row, true);
|
||||
uiLayoutSetActive(sub, has_material);
|
||||
uiLayoutSetPropDecorate(sub, false);
|
||||
uiItemR(sub, &ptr, "invert_materials", 0, "", ICON_ARROW_LEFTRIGHT);
|
||||
|
||||
row = uiLayoutRow(col, true);
|
||||
uiItemR(row, &ptr, "pass_index", 0, NULL, ICON_NONE);
|
||||
sub = uiLayoutRow(row, true);
|
||||
uiLayoutSetActive(sub, RNA_int_get(&ptr, "pass_index") != 0);
|
||||
uiLayoutSetPropDecorate(sub, false);
|
||||
uiItemR(sub, &ptr, "invert_material_pass", 0, "", ICON_ARROW_LEFTRIGHT);
|
||||
}
|
||||
|
||||
if (use_vertex) {
|
||||
bool has_vertex_group = RNA_string_length(&ptr, "vertex_group") != 0;
|
||||
|
||||
row = uiLayoutRow(layout, true);
|
||||
uiItemPointerR(row, &ptr, "vertex_group", &ob_ptr, "vertex_groups", NULL, ICON_NONE);
|
||||
sub = uiLayoutRow(row, true);
|
||||
uiLayoutSetActive(sub, has_vertex_group);
|
||||
uiLayoutSetPropDecorate(sub, false);
|
||||
uiItemR(sub, &ptr, "invert_vertex", 0, "", ICON_ARROW_LEFTRIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
void gpencil_modifier_curve_header_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiItemR(layout, &ptr, "use_custom_curve", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
void gpencil_modifier_curve_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiTemplateCurveMapping(layout, &ptr, "curve", 0, false, false, false, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw modifier error message.
|
||||
*/
|
||||
void gpencil_modifier_panel_end(uiLayout *layout, PointerRNA *ptr)
|
||||
{
|
||||
GpencilModifierData *md = ptr->data;
|
||||
if (md->error) {
|
||||
uiLayout *row = uiLayoutRow(layout, false);
|
||||
uiItemL(row, IFACE_(md->error), ICON_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets RNA pointers for the active object and the panel's modifier data.
|
||||
*/
|
||||
#define ERROR_LIBDATA_MESSAGE TIP_("External library data")
|
||||
void gpencil_modifier_panel_get_property_pointers(const bContext *C,
|
||||
Panel *panel,
|
||||
PointerRNA *r_ob_ptr,
|
||||
PointerRNA *r_md_ptr)
|
||||
{
|
||||
Object *ob = get_gpencilmodifier_object(C);
|
||||
GpencilModifierData *md = BLI_findlink(&ob->greasepencil_modifiers, panel->runtime.list_index);
|
||||
|
||||
RNA_pointer_create(&ob->id, &RNA_GpencilModifier, md, r_md_ptr);
|
||||
|
||||
if (r_ob_ptr != NULL) {
|
||||
RNA_pointer_create(&ob->id, &RNA_Object, ob, r_ob_ptr);
|
||||
}
|
||||
|
||||
uiBlock *block = uiLayoutGetBlock(panel->layout);
|
||||
UI_block_lock_clear(block);
|
||||
UI_block_lock_set(block, ob && ID_IS_LINKED(ob), ERROR_LIBDATA_MESSAGE);
|
||||
|
||||
uiLayoutSetContextPointer(panel->layout, "modifier", r_md_ptr);
|
||||
}
|
||||
|
||||
static void gpencil_modifier_ops_extra_draw(bContext *UNUSED(C), uiLayout *layout, void *md_v)
|
||||
{
|
||||
GpencilModifierData *md = (GpencilModifierData *)md_v;
|
||||
const GpencilModifierTypeInfo *mti = BKE_gpencil_modifier_get_info(md->type);
|
||||
|
||||
uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_DEFAULT);
|
||||
|
||||
if (!(mti->flags & eGpencilModifierTypeFlag_NoApply)) {
|
||||
uiItemEnumO(layout,
|
||||
"OBJECT_OT_gpencil_modifier_apply",
|
||||
CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply"),
|
||||
0,
|
||||
"apply_as",
|
||||
MODIFIER_APPLY_DATA);
|
||||
}
|
||||
|
||||
uiItemO(layout,
|
||||
CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Duplicate"),
|
||||
ICON_DUPLICATE,
|
||||
"OBJECT_OT_gpencil_modifier_copy");
|
||||
|
||||
uiItemO(layout,
|
||||
CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Delete"),
|
||||
ICON_X,
|
||||
"OBJECT_OT_gpencil_modifier_remove");
|
||||
}
|
||||
|
||||
static void gpencil_modifier_panel_header(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *row, *sub;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
Object *ob = get_gpencilmodifier_object(C);
|
||||
GpencilModifierData *md = BLI_findlink(&ob->greasepencil_modifiers, panel->runtime.list_index);
|
||||
PointerRNA ptr;
|
||||
RNA_pointer_create(&ob->id, &RNA_GpencilModifier, md, &ptr);
|
||||
uiLayoutSetContextPointer(panel->layout, "modifier", &ptr);
|
||||
|
||||
const GpencilModifierTypeInfo *mti = BKE_gpencil_modifier_get_info(md->type);
|
||||
bool narrow_panel = (panel->sizex < UI_UNIT_X * 8 && panel->sizex != 0);
|
||||
|
||||
/* Modifier Icon. */
|
||||
row = uiLayoutRow(layout, false);
|
||||
if (mti->isDisabled && mti->isDisabled(md, 0)) {
|
||||
uiLayoutSetRedAlert(row, true);
|
||||
}
|
||||
uiItemL(row, "", RNA_struct_ui_icon(ptr.type));
|
||||
|
||||
/* Modifier Name. */
|
||||
if (!narrow_panel) {
|
||||
uiItemR(layout, &ptr, "name", 0, "", ICON_NONE);
|
||||
}
|
||||
|
||||
row = uiLayoutRow(layout, true);
|
||||
if (mti->flags & eGpencilModifierTypeFlag_SupportsEditmode) {
|
||||
sub = uiLayoutRow(row, true);
|
||||
uiItemR(sub, &ptr, "show_in_editmode", 0, "", ICON_NONE);
|
||||
}
|
||||
uiItemR(row, &ptr, "show_viewport", 0, "", ICON_NONE);
|
||||
uiItemR(row, &ptr, "show_render", 0, "", ICON_NONE);
|
||||
|
||||
row = uiLayoutRow(layout, false);
|
||||
uiItemMenuF(row, "", ICON_DOWNARROW_HLT, gpencil_modifier_ops_extra_draw, md);
|
||||
|
||||
/* Some extra padding at the end, so 'x' icon isn't too close to drag button. */
|
||||
uiItemS(layout);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Modifier Registration Helpers
|
||||
* \{ */
|
||||
|
||||
/**
|
||||
* Create a panel in the context's region
|
||||
*/
|
||||
PanelType *gpencil_modifier_panel_register(ARegionType *region_type,
|
||||
GpencilModifierType type,
|
||||
PanelDrawFn draw)
|
||||
{
|
||||
|
||||
/* Get the name for the modifier's panel. */
|
||||
char panel_idname[BKE_ST_MAXNAME];
|
||||
BKE_gpencil_modifierType_panel_id(type, panel_idname);
|
||||
|
||||
PanelType *panel_type = MEM_callocN(sizeof(PanelType), panel_idname);
|
||||
|
||||
strcpy(panel_type->idname, panel_idname);
|
||||
strcpy(panel_type->label, "");
|
||||
strcpy(panel_type->context, "modifier");
|
||||
strcpy(panel_type->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
|
||||
|
||||
panel_type->draw_header = gpencil_modifier_panel_header;
|
||||
panel_type->draw = draw;
|
||||
panel_type->poll = gpencil_modifier_ui_poll;
|
||||
|
||||
/* Give the panel the special flag that says it was built here and corresponds to a
|
||||
* modifer rather than a PanelType. */
|
||||
panel_type->flag = PNL_LAYOUT_HEADER_EXPAND | PNL_DRAW_BOX | PNL_INSTANCED;
|
||||
panel_type->reorder = gpencil_modifier_reorder;
|
||||
panel_type->get_list_data_expand_flag = get_gpencil_modifier_expand_flag;
|
||||
panel_type->set_list_data_expand_flag = set_gpencil_modifier_expand_flag;
|
||||
|
||||
BLI_addtail(®ion_type->paneltypes, panel_type);
|
||||
|
||||
return panel_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a child panel to the parent.
|
||||
*
|
||||
* \note To create the panel type's idname, it appends the \a name argument to the \a parent's
|
||||
* idname.
|
||||
*/
|
||||
PanelType *gpencil_modifier_subpanel_register(ARegionType *region_type,
|
||||
const char *name,
|
||||
const char *label,
|
||||
PanelDrawFn draw_header,
|
||||
PanelDrawFn draw,
|
||||
PanelType *parent)
|
||||
{
|
||||
/* Create the subpanel's ID name. */
|
||||
char panel_idname[BKE_ST_MAXNAME];
|
||||
strcpy(panel_idname, parent->idname);
|
||||
strcat(panel_idname, "_");
|
||||
strcat(panel_idname, name);
|
||||
|
||||
PanelType *panel_type = MEM_callocN(sizeof(PanelType), panel_idname);
|
||||
|
||||
strcpy(panel_type->idname, panel_idname);
|
||||
strcpy(panel_type->label, label);
|
||||
strcpy(panel_type->context, "modifier");
|
||||
strcpy(panel_type->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
|
||||
|
||||
panel_type->draw_header = draw_header;
|
||||
panel_type->draw = draw;
|
||||
panel_type->poll = gpencil_modifier_ui_poll;
|
||||
panel_type->flag = (PNL_DEFAULT_CLOSED | PNL_DRAW_BOX);
|
||||
|
||||
BLI_assert(parent != NULL);
|
||||
strcpy(panel_type->parent_id, parent->idname);
|
||||
panel_type->parent = parent;
|
||||
BLI_addtail(&parent->children, BLI_genericNodeN(panel_type));
|
||||
BLI_addtail(®ion_type->paneltypes, panel_type);
|
||||
|
||||
return panel_type;
|
||||
}
|
||||
|
||||
/** \} */
|
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* This program 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 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program 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, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \ingroup modifiers
|
||||
*/
|
||||
|
||||
#ifndef __MOD_UI_COMMON__GPENCIL_H__
|
||||
#define __MOD_UI_COMMON__GPENCIL_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "MOD_gpencil_modifiertypes.h"
|
||||
|
||||
struct ARegionType;
|
||||
struct bContext;
|
||||
struct PanelType;
|
||||
struct uiLayout;
|
||||
typedef void (*PanelDrawFn)(const bContext *, Panel *);
|
||||
|
||||
void gpencil_modifier_masking_panel_draw(const bContext *C,
|
||||
Panel *panel,
|
||||
bool use_material,
|
||||
bool use_vertex);
|
||||
|
||||
void gpencil_modifier_curve_header_draw(const bContext *C, Panel *panel);
|
||||
void gpencil_modifier_curve_panel_draw(const bContext *C, Panel *panel);
|
||||
|
||||
void gpencil_modifier_panel_end(struct uiLayout *layout, PointerRNA *ptr);
|
||||
|
||||
void gpencil_modifier_panel_get_property_pointers(const bContext *C,
|
||||
struct Panel *panel,
|
||||
struct PointerRNA *r_ob_ptr,
|
||||
struct PointerRNA *r_ptr);
|
||||
|
||||
PanelType *gpencil_modifier_panel_register(struct ARegionType *region_type,
|
||||
GpencilModifierType type,
|
||||
PanelDrawFn draw);
|
||||
|
||||
struct PanelType *gpencil_modifier_subpanel_register(struct ARegionType *region_type,
|
||||
const char *name,
|
||||
const char *label,
|
||||
PanelDrawFn draw_header,
|
||||
PanelDrawFn draw,
|
||||
struct PanelType *parent);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __MOD_UI_COMMON__GPENCIL_H__ */
|
@@ -28,6 +28,8 @@
|
||||
|
||||
#include "BLI_math.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_armature_types.h"
|
||||
#include "DNA_gpencil_modifier_types.h"
|
||||
#include "DNA_gpencil_types.h"
|
||||
@@ -35,7 +37,9 @@
|
||||
#include "DNA_modifier_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_gpencil.h"
|
||||
#include "BKE_gpencil_geom.h"
|
||||
#include "BKE_gpencil_modifier.h"
|
||||
@@ -44,10 +48,17 @@
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "MOD_gpencil_modifiertypes.h"
|
||||
#include "MOD_gpencil_ui_common.h"
|
||||
#include "MOD_gpencil_util.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
@@ -186,6 +197,39 @@ static void foreachObjectLink(GpencilModifierData *md,
|
||||
walk(userData, ob, &mmd->object, IDWALK_CB_NOP);
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *sub, *row, *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
gpencil_modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
bool has_vertex_group = RNA_string_length(&ptr, "vertex_group") != 0;
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "object", 0, NULL, ICON_NONE);
|
||||
row = uiLayoutRow(layout, true);
|
||||
uiItemPointerR(row, &ptr, "vertex_group", &ob_ptr, "vertex_groups", NULL, ICON_NONE);
|
||||
sub = uiLayoutRow(row, true);
|
||||
uiLayoutSetActive(sub, has_vertex_group);
|
||||
uiLayoutSetPropDecorate(sub, false);
|
||||
uiItemR(sub, &ptr, "invert_vertex_group", 0, "", ICON_ARROW_LEFTRIGHT);
|
||||
|
||||
col = uiLayoutColumnWithHeading(layout, true, "Bind to");
|
||||
uiItemR(col, &ptr, "use_vertex_groups", 0, IFACE_("Vertex Groups"), ICON_NONE);
|
||||
uiItemR(col, &ptr, "use_bone_envelopes", 0, IFACE_("Bone Envelopes"), ICON_NONE);
|
||||
|
||||
gpencil_modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
gpencil_modifier_panel_register(region_type, eGpencilModifierType_Armature, panel_draw);
|
||||
}
|
||||
|
||||
GpencilModifierTypeInfo modifierType_Gpencil_Armature = {
|
||||
/* name */ "Armature",
|
||||
/* structName */ "ArmatureGpencilModifierData",
|
||||
@@ -207,4 +251,5 @@ GpencilModifierTypeInfo modifierType_Gpencil_Armature = {
|
||||
/* foreachObjectLink */ foreachObjectLink,
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
@@ -35,12 +35,16 @@
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_rand.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_gpencil_modifier_types.h"
|
||||
#include "DNA_gpencil_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_collection.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_gpencil.h"
|
||||
#include "BKE_gpencil_geom.h"
|
||||
@@ -51,12 +55,19 @@
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
#include "DEG_depsgraph_build.h"
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "MOD_gpencil_modifiertypes.h"
|
||||
#include "MOD_gpencil_ui_common.h"
|
||||
#include "MOD_gpencil_util.h"
|
||||
|
||||
typedef struct tmpStrokes {
|
||||
@@ -330,6 +341,143 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
|
||||
foreachObjectLink(md, ob, (ObjectWalkFunc)walk, userData);
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "count", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "replace_material", 0, IFACE_("Material Override"), ICON_NONE);
|
||||
|
||||
gpencil_modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void relative_offset_header_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiItemR(layout, &ptr, "use_relative_offset", 0, IFACE_("Relative Offset"), ICON_NONE);
|
||||
}
|
||||
|
||||
static void relative_offset_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiLayout *col = uiLayoutColumn(layout, false);
|
||||
|
||||
uiLayoutSetActive(col, RNA_boolean_get(&ptr, "use_relative_offset"));
|
||||
uiItemR(col, &ptr, "relative_offset", 0, IFACE_("Factor"), ICON_NONE);
|
||||
}
|
||||
|
||||
static void constant_offset_header_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiItemR(layout, &ptr, "use_constant_offset", 0, IFACE_("Constant Offset"), ICON_NONE);
|
||||
}
|
||||
|
||||
static void constant_offset_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiLayout *col = uiLayoutColumn(layout, false);
|
||||
|
||||
uiLayoutSetActive(col, RNA_boolean_get(&ptr, "use_constant_offset"));
|
||||
uiItemR(col, &ptr, "constant_offset", 0, IFACE_("Distance"), ICON_NONE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Object offset in a subpanel for consistency with the other offset types.
|
||||
*/
|
||||
static void object_offset_header_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiItemR(layout, &ptr, "use_object_offset", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
static void object_offset_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiLayout *col = uiLayoutColumn(layout, false);
|
||||
|
||||
uiLayoutSetActive(col, RNA_boolean_get(&ptr, "use_object_offset"));
|
||||
uiItemR(col, &ptr, "offset_object", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
static void random_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "random_offset", 0, IFACE_("Offset"), ICON_NONE);
|
||||
uiItemR(layout, &ptr, "random_rotation", 0, IFACE_("Rotation"), ICON_NONE);
|
||||
uiItemR(layout, &ptr, "random_scale", 0, IFACE_("Scale"), ICON_NONE);
|
||||
uiItemR(layout, &ptr, "seed", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
static void mask_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
gpencil_modifier_masking_panel_draw(C, panel, true, false);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = gpencil_modifier_panel_register(
|
||||
region_type, eGpencilModifierType_Array, panel_draw);
|
||||
gpencil_modifier_subpanel_register(region_type,
|
||||
"relative_offset",
|
||||
"",
|
||||
relative_offset_header_draw,
|
||||
relative_offset_draw,
|
||||
panel_type);
|
||||
gpencil_modifier_subpanel_register(region_type,
|
||||
"constant_offset",
|
||||
"",
|
||||
constant_offset_header_draw,
|
||||
constant_offset_draw,
|
||||
panel_type);
|
||||
gpencil_modifier_subpanel_register(
|
||||
region_type, "object_offset", "", object_offset_header_draw, object_offset_draw, panel_type);
|
||||
gpencil_modifier_subpanel_register(
|
||||
region_type, "randomize", "Randomize", NULL, random_panel_draw, panel_type);
|
||||
gpencil_modifier_subpanel_register(
|
||||
region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
|
||||
}
|
||||
|
||||
GpencilModifierTypeInfo modifierType_Gpencil_Array = {
|
||||
/* name */ "Array",
|
||||
/* structName */ "ArrayGpencilModifierData",
|
||||
@@ -352,4 +500,5 @@ GpencilModifierTypeInfo modifierType_Gpencil_Array = {
|
||||
/* foreachObjectLink */ foreachObjectLink,
|
||||
/* foreachIDLink */ foreachIDLink,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
@@ -30,20 +30,31 @@
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_gpencil_modifier_types.h"
|
||||
#include "DNA_gpencil_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_gpencil.h"
|
||||
#include "BKE_gpencil_geom.h"
|
||||
#include "BKE_gpencil_modifier.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "MOD_gpencil_modifiertypes.h"
|
||||
#include "MOD_gpencil_ui_common.h"
|
||||
#include "MOD_gpencil_util.h"
|
||||
|
||||
static void initData(GpencilModifierData *md)
|
||||
@@ -537,6 +548,86 @@ static void generateStrokes(GpencilModifierData *md, Depsgraph *depsgraph, Objec
|
||||
}
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *row, *sub;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
gpencil_modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
int mode = RNA_enum_get(&ptr, "mode");
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "mode", 0, NULL, ICON_NONE);
|
||||
if (mode == GP_BUILD_MODE_CONCURRENT) {
|
||||
uiItemR(layout, &ptr, "concurrent_time_alignment", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
uiItemR(layout, &ptr, "transition", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "start_delay", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "length", 0, IFACE_("Frames"), ICON_NONE);
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
row = uiLayoutRowWithHeading(layout, true, IFACE_("Use Factor"));
|
||||
uiItemR(row, &ptr, "use_percentage", 0, "", ICON_NONE);
|
||||
sub = uiLayoutRow(row, true);
|
||||
uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_percentage"));
|
||||
uiItemR(sub, &ptr, "percentage_factor", 0, "", ICON_NONE);
|
||||
|
||||
/* Check for incompatible time modifier. */
|
||||
Object *ob = ob_ptr.data;
|
||||
GpencilModifierData *md = ptr.data;
|
||||
if (BKE_gpencil_modifiers_findby_type(ob, eGpencilModifierType_Time) != NULL) {
|
||||
BKE_gpencil_modifier_set_error(md, "Build and Time Offset modifiers are incompatible");
|
||||
}
|
||||
|
||||
gpencil_modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void frame_range_header_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiItemR(layout, &ptr, "use_restrict_frame_range", 0, IFACE_("Custom Range"), ICON_NONE);
|
||||
}
|
||||
|
||||
static void frame_range_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "frame_start", 0, IFACE_("Start"), ICON_NONE);
|
||||
uiItemR(layout, &ptr, "frame_end", 0, IFACE_("End"), ICON_NONE);
|
||||
}
|
||||
|
||||
static void mask_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
gpencil_modifier_masking_panel_draw(C, panel, false, false);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = gpencil_modifier_panel_register(
|
||||
region_type, eGpencilModifierType_Build, panel_draw);
|
||||
gpencil_modifier_subpanel_register(
|
||||
region_type, "frame_range", "", frame_range_header_draw, frame_range_panel_draw, panel_type);
|
||||
gpencil_modifier_subpanel_register(
|
||||
region_type, "_mask", "Influence", NULL, mask_panel_draw, panel_type);
|
||||
}
|
||||
|
||||
/* ******************************************** */
|
||||
|
||||
GpencilModifierTypeInfo modifierType_Gpencil_Build = {
|
||||
@@ -561,4 +652,5 @@ GpencilModifierTypeInfo modifierType_Gpencil_Build = {
|
||||
/* foreachObjectLink */ NULL,
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
@@ -29,22 +29,33 @@
|
||||
#include "BLI_math_color.h"
|
||||
#include "BLI_math_vector.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_gpencil_modifier_types.h"
|
||||
#include "DNA_gpencil_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_colortools.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_gpencil.h"
|
||||
#include "BKE_gpencil_modifier.h"
|
||||
#include "BKE_lib_query.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_material.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "BKE_modifier.h"
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
|
||||
#include "MOD_gpencil_modifiertypes.h"
|
||||
#include "MOD_gpencil_ui_common.h"
|
||||
#include "MOD_gpencil_util.h"
|
||||
|
||||
static void initData(GpencilModifierData *md)
|
||||
@@ -186,6 +197,42 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
|
||||
walk(userData, ob, (ID **)&mmd->material, IDWALK_CB_USER);
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "modify_color", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "hue", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "saturation", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "value", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
|
||||
|
||||
gpencil_modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void mask_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
gpencil_modifier_masking_panel_draw(C, panel, true, false);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = gpencil_modifier_panel_register(
|
||||
region_type, eGpencilModifierType_Color, panel_draw);
|
||||
PanelType *mask_panel_type = gpencil_modifier_subpanel_register(
|
||||
region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
|
||||
gpencil_modifier_subpanel_register(region_type,
|
||||
"curve",
|
||||
"",
|
||||
gpencil_modifier_curve_header_draw,
|
||||
gpencil_modifier_curve_panel_draw,
|
||||
mask_panel_type);
|
||||
}
|
||||
|
||||
GpencilModifierTypeInfo modifierType_Gpencil_Color = {
|
||||
/* name */ "Hue/Saturation",
|
||||
/* structName */ "ColorGpencilModifierData",
|
||||
@@ -208,4 +255,5 @@ GpencilModifierTypeInfo modifierType_Gpencil_Color = {
|
||||
/* foreachObjectLink */ NULL,
|
||||
/* foreachIDLink */ foreachIDLink,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
@@ -28,15 +28,19 @@
|
||||
|
||||
#include "BLI_math.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_gpencil_modifier_types.h"
|
||||
#include "DNA_gpencil_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_modifier_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_action.h"
|
||||
#include "BKE_colortools.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_gpencil_geom.h"
|
||||
#include "BKE_gpencil_modifier.h"
|
||||
@@ -45,10 +49,17 @@
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "MOD_gpencil_modifiertypes.h"
|
||||
#include "MOD_gpencil_ui_common.h"
|
||||
#include "MOD_gpencil_util.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
@@ -345,6 +356,81 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
|
||||
foreachObjectLink(md, ob, (ObjectWalkFunc)walk, userData);
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *sub, *row, *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
gpencil_modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
PointerRNA hook_object_ptr = RNA_pointer_get(&ptr, "object");
|
||||
bool has_vertex_group = RNA_string_length(&ptr, "vertex_group") != 0;
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
col = uiLayoutColumn(layout, false);
|
||||
uiItemR(col, &ptr, "object", 0, NULL, ICON_NONE);
|
||||
if (!RNA_pointer_is_null(&hook_object_ptr) &&
|
||||
RNA_enum_get(&hook_object_ptr, "type") == OB_ARMATURE) {
|
||||
PointerRNA hook_object_data_ptr = RNA_pointer_get(&hook_object_ptr, "data");
|
||||
uiItemPointerR(
|
||||
col, &ptr, "subtarget", &hook_object_data_ptr, "bones", IFACE_("Bone"), ICON_NONE);
|
||||
}
|
||||
|
||||
row = uiLayoutRow(layout, true);
|
||||
uiItemPointerR(row, &ptr, "vertex_group", &ob_ptr, "vertex_groups", NULL, ICON_NONE);
|
||||
sub = uiLayoutRow(row, true);
|
||||
uiLayoutSetActive(sub, has_vertex_group);
|
||||
uiLayoutSetPropSep(sub, false);
|
||||
uiItemR(sub, &ptr, "invert_vertex", 0, "", ICON_ARROW_LEFTRIGHT);
|
||||
|
||||
uiItemR(layout, &ptr, "strength", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
|
||||
|
||||
gpencil_modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void falloff_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *row;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
bool use_falloff = RNA_enum_get(&ptr, "falloff_type") != eWarp_Falloff_None;
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "falloff_type", 0, IFACE_("Type"), ICON_NONE);
|
||||
|
||||
row = uiLayoutRow(layout, false);
|
||||
uiLayoutSetActive(row, use_falloff);
|
||||
uiItemR(row, &ptr, "falloff_radius", 0, NULL, ICON_NONE);
|
||||
|
||||
uiItemR(layout, &ptr, "use_falloff_uniform", 0, NULL, ICON_NONE);
|
||||
|
||||
if (RNA_enum_get(&ptr, "falloff_type") == eWarp_Falloff_Curve) {
|
||||
uiTemplateCurveMapping(layout, &ptr, "falloff_curve", 0, false, false, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
static void mask_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
gpencil_modifier_masking_panel_draw(C, panel, true, false);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = gpencil_modifier_panel_register(
|
||||
region_type, eGpencilModifierType_Hook, panel_draw);
|
||||
gpencil_modifier_subpanel_register(
|
||||
region_type, "falloff", "Falloff", NULL, falloff_panel_draw, panel_type);
|
||||
gpencil_modifier_subpanel_register(
|
||||
region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
|
||||
}
|
||||
|
||||
GpencilModifierTypeInfo modifierType_Gpencil_Hook = {
|
||||
/* name */ "Hook",
|
||||
/* structName */ "HookGpencilModifierData",
|
||||
@@ -367,4 +453,5 @@ GpencilModifierTypeInfo modifierType_Gpencil_Hook = {
|
||||
/* foreachObjectLink */ foreachObjectLink,
|
||||
/* foreachIDLink */ foreachIDLink,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
@@ -26,12 +26,16 @@
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_gpencil_modifier_types.h"
|
||||
#include "DNA_gpencil_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_gpencil_geom.h"
|
||||
#include "BKE_gpencil_modifier.h"
|
||||
@@ -41,10 +45,17 @@
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "MOD_gpencil_modifiertypes.h"
|
||||
#include "MOD_gpencil_ui_common.h"
|
||||
#include "MOD_gpencil_util.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
@@ -207,6 +218,54 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
|
||||
foreachObjectLink(md, ob, (ObjectWalkFunc)walk, userData);
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *sub, *row, *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
gpencil_modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
PointerRNA hook_object_ptr = RNA_pointer_get(&ptr, "object");
|
||||
bool has_vertex_group = RNA_string_length(&ptr, "vertex_group") != 0;
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
col = uiLayoutColumn(layout, false);
|
||||
uiItemR(col, &ptr, "object", 0, NULL, ICON_NONE);
|
||||
if (!RNA_pointer_is_null(&hook_object_ptr) &&
|
||||
RNA_enum_get(&hook_object_ptr, "type") == OB_ARMATURE) {
|
||||
PointerRNA hook_object_data_ptr = RNA_pointer_get(&hook_object_ptr, "data");
|
||||
uiItemPointerR(
|
||||
col, &ptr, "subtarget", &hook_object_data_ptr, "bones", IFACE_("Bone"), ICON_NONE);
|
||||
}
|
||||
|
||||
row = uiLayoutRow(layout, true);
|
||||
uiItemPointerR(row, &ptr, "vertex_group", &ob_ptr, "vertex_groups", NULL, ICON_NONE);
|
||||
sub = uiLayoutRow(row, true);
|
||||
uiLayoutSetActive(sub, has_vertex_group);
|
||||
uiLayoutSetPropSep(sub, false);
|
||||
uiItemR(sub, &ptr, "invert_vertex", 0, "", ICON_ARROW_LEFTRIGHT);
|
||||
|
||||
uiItemR(layout, &ptr, "strength", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
|
||||
|
||||
gpencil_modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void mask_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
gpencil_modifier_masking_panel_draw(C, panel, true, false);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = gpencil_modifier_panel_register(
|
||||
region_type, eGpencilModifierType_Lattice, panel_draw);
|
||||
gpencil_modifier_subpanel_register(
|
||||
region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
|
||||
}
|
||||
|
||||
GpencilModifierTypeInfo modifierType_Gpencil_Lattice = {
|
||||
/* name */ "Lattice",
|
||||
/* structName */ "LatticeGpencilModifierData",
|
||||
@@ -229,4 +288,5 @@ GpencilModifierTypeInfo modifierType_Gpencil_Lattice = {
|
||||
/* foreachObjectLink */ foreachObjectLink,
|
||||
/* foreachIDLink */ foreachIDLink,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
@@ -28,12 +28,16 @@
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_gpencil_modifier_types.h"
|
||||
#include "DNA_gpencil_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_gpencil.h"
|
||||
#include "BKE_gpencil_modifier.h"
|
||||
@@ -43,10 +47,17 @@
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "MOD_gpencil_modifiertypes.h"
|
||||
#include "MOD_gpencil_ui_common.h"
|
||||
#include "MOD_gpencil_util.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
@@ -254,6 +265,40 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
|
||||
foreachObjectLink(md, ob, (ObjectWalkFunc)walk, userData);
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *row;
|
||||
uiLayout *layout = panel->layout;
|
||||
int toggles_flag = UI_ITEM_R_TOGGLE | UI_ITEM_R_FORCE_BLANK_DECORATE;
|
||||
|
||||
PointerRNA ptr;
|
||||
gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
row = uiLayoutRowWithHeading(layout, true, IFACE_("Axis"));
|
||||
uiItemR(row, &ptr, "x_axis", toggles_flag, NULL, ICON_NONE);
|
||||
uiItemR(row, &ptr, "y_axis", toggles_flag, NULL, ICON_NONE);
|
||||
uiItemR(row, &ptr, "z_axis", toggles_flag, NULL, ICON_NONE);
|
||||
|
||||
uiItemR(layout, &ptr, "object", 0, NULL, ICON_NONE);
|
||||
|
||||
gpencil_modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void mask_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
gpencil_modifier_masking_panel_draw(C, panel, true, false);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = gpencil_modifier_panel_register(
|
||||
region_type, eGpencilModifierType_Mirror, panel_draw);
|
||||
gpencil_modifier_subpanel_register(
|
||||
region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
|
||||
}
|
||||
|
||||
GpencilModifierTypeInfo modifierType_Gpencil_Mirror = {
|
||||
/* name */ "Mirror",
|
||||
/* structName */ "MirrorGpencilModifierData",
|
||||
@@ -276,4 +321,5 @@ GpencilModifierTypeInfo modifierType_Gpencil_Mirror = {
|
||||
/* foreachObjectLink */ foreachObjectLink,
|
||||
/* foreachIDLink */ foreachIDLink,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
@@ -29,6 +29,7 @@
|
||||
#include "DNA_gpencil_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BLI_alloca.h"
|
||||
#include "BLI_blenlib.h"
|
||||
@@ -37,6 +38,8 @@
|
||||
#include "BLI_rand.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "BKE_collection.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_global.h"
|
||||
@@ -51,6 +54,7 @@
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "bmesh.h"
|
||||
#include "bmesh_tools.h"
|
||||
@@ -59,7 +63,13 @@
|
||||
#include "DEG_depsgraph_build.h"
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "MOD_gpencil_modifiertypes.h"
|
||||
#include "MOD_gpencil_ui_common.h"
|
||||
#include "MOD_gpencil_util.h"
|
||||
|
||||
static void initData(GpencilModifierData *md)
|
||||
@@ -305,8 +315,71 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
|
||||
walk(userData, ob, (ID **)&mmd->material, IDWALK_CB_USER);
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "duplicates", 0, NULL, ICON_NONE);
|
||||
|
||||
col = uiLayoutColumn(layout, false);
|
||||
uiLayoutSetActive(layout, RNA_int_get(&ptr, "duplicates") > 0);
|
||||
uiItemR(col, &ptr, "distance", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, &ptr, "offset", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
|
||||
|
||||
gpencil_modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void fade_header_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiItemR(layout, &ptr, "use_fade", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
static void fade_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiLayoutSetActive(layout, RNA_boolean_get(&ptr, "use_fade"));
|
||||
|
||||
col = uiLayoutColumn(layout, false);
|
||||
uiItemR(col, &ptr, "fading_center", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, &ptr, "fading_thickness", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
|
||||
uiItemR(col, &ptr, "fading_opacity", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
static void mask_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
gpencil_modifier_masking_panel_draw(C, panel, true, false);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = gpencil_modifier_panel_register(
|
||||
region_type, eGpencilModifierType_Multiply, panel_draw);
|
||||
gpencil_modifier_subpanel_register(
|
||||
region_type, "fade", "", fade_header_draw, fade_panel_draw, panel_type);
|
||||
gpencil_modifier_subpanel_register(
|
||||
region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
|
||||
}
|
||||
|
||||
GpencilModifierTypeInfo modifierType_Gpencil_Multiply = {
|
||||
/* name */ "Multiple Strokes",
|
||||
/* name */ "MultipleStrokes",
|
||||
/* structName */ "MultiplyGpencilModifierData",
|
||||
/* structSize */ sizeof(MultiplyGpencilModifierData),
|
||||
/* type */ eGpencilModifierTypeType_Gpencil,
|
||||
@@ -327,4 +400,5 @@ GpencilModifierTypeInfo modifierType_Gpencil_Multiply = {
|
||||
/* foreachObjectLink */ NULL,
|
||||
/* foreachIDLink */ foreachIDLink,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
@@ -31,6 +31,8 @@
|
||||
#include "BLI_math_vector.h"
|
||||
#include "BLI_rand.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "DNA_gpencil_modifier_types.h"
|
||||
@@ -38,8 +40,10 @@
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_colortools.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_gpencil.h"
|
||||
#include "BKE_gpencil_geom.h"
|
||||
@@ -47,11 +51,18 @@
|
||||
#include "BKE_lib_query.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "MOD_gpencil_modifiertypes.h"
|
||||
#include "MOD_gpencil_ui_common.h"
|
||||
#include "MOD_gpencil_util.h"
|
||||
|
||||
static void initData(GpencilModifierData *md)
|
||||
@@ -269,6 +280,72 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
|
||||
walk(userData, ob, (ID **)&mmd->material, IDWALK_CB_USER);
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
col = uiLayoutColumn(layout, false);
|
||||
uiItemR(col, &ptr, "factor", 0, IFACE_("Position"), ICON_NONE);
|
||||
uiItemR(col, &ptr, "factor_strength", 0, IFACE_("Strength"), ICON_NONE);
|
||||
uiItemR(col, &ptr, "factor_thickness", 0, IFACE_("Thickness"), ICON_NONE);
|
||||
uiItemR(col, &ptr, "factor_uvs", 0, IFACE_("UV"), ICON_NONE);
|
||||
uiItemR(col, &ptr, "noise_scale", 0, NULL, ICON_NONE);
|
||||
|
||||
gpencil_modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void random_header_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiItemR(layout, &ptr, "random", 0, IFACE_("Randomize"), ICON_NONE);
|
||||
}
|
||||
|
||||
static void random_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiLayoutSetActive(layout, RNA_boolean_get(&ptr, "random"));
|
||||
|
||||
uiItemR(layout, &ptr, "step", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "seed", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
static void mask_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
gpencil_modifier_masking_panel_draw(C, panel, true, false);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = gpencil_modifier_panel_register(
|
||||
region_type, eGpencilModifierType_Noise, panel_draw);
|
||||
gpencil_modifier_subpanel_register(
|
||||
region_type, "randomize", "", random_header_draw, random_panel_draw, panel_type);
|
||||
PanelType *mask_panel_type = gpencil_modifier_subpanel_register(
|
||||
region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
|
||||
gpencil_modifier_subpanel_register(region_type,
|
||||
"curve",
|
||||
"",
|
||||
gpencil_modifier_curve_header_draw,
|
||||
gpencil_modifier_curve_panel_draw,
|
||||
mask_panel_type);
|
||||
}
|
||||
|
||||
GpencilModifierTypeInfo modifierType_Gpencil_Noise = {
|
||||
/* name */ "Noise",
|
||||
/* structName */ "NoiseGpencilModifierData",
|
||||
@@ -291,4 +368,5 @@ GpencilModifierTypeInfo modifierType_Gpencil_Noise = {
|
||||
/* foreachObjectLink */ NULL,
|
||||
/* foreachIDLink */ foreachIDLink,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
@@ -28,22 +28,33 @@
|
||||
|
||||
#include "BLI_math.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_gpencil_modifier_types.h"
|
||||
#include "DNA_gpencil_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_colortools.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_gpencil_geom.h"
|
||||
#include "BKE_gpencil_modifier.h"
|
||||
#include "BKE_lib_query.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "MOD_gpencil_modifiertypes.h"
|
||||
#include "MOD_gpencil_ui_common.h"
|
||||
#include "MOD_gpencil_util.h"
|
||||
|
||||
static void initData(GpencilModifierData *md)
|
||||
@@ -136,6 +147,35 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
|
||||
walk(userData, ob, (ID **)&mmd->material, IDWALK_CB_USER);
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "location", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "rotation", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "scale", 0, NULL, ICON_NONE);
|
||||
|
||||
gpencil_modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void mask_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
gpencil_modifier_masking_panel_draw(C, panel, true, true);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = gpencil_modifier_panel_register(
|
||||
region_type, eGpencilModifierType_Offset, panel_draw);
|
||||
gpencil_modifier_subpanel_register(
|
||||
region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
|
||||
}
|
||||
|
||||
GpencilModifierTypeInfo modifierType_Gpencil_Offset = {
|
||||
/* name */ "Offset",
|
||||
/* structName */ "OffsetGpencilModifierData",
|
||||
@@ -158,4 +198,5 @@ GpencilModifierTypeInfo modifierType_Gpencil_Offset = {
|
||||
/* foreachObjectLink */ NULL,
|
||||
/* foreachIDLink */ foreachIDLink,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
@@ -28,13 +28,17 @@
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_math_vector.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_gpencil_modifier_types.h"
|
||||
#include "DNA_gpencil_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_colortools.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_gpencil.h"
|
||||
#include "BKE_gpencil_modifier.h"
|
||||
@@ -42,10 +46,17 @@
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_material.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "MOD_gpencil_modifiertypes.h"
|
||||
#include "MOD_gpencil_ui_common.h"
|
||||
#include "MOD_gpencil_util.h"
|
||||
|
||||
static void initData(GpencilModifierData *md)
|
||||
@@ -180,6 +191,7 @@ static void bakeModifier(Main *UNUSED(bmain),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void freeData(GpencilModifierData *md)
|
||||
{
|
||||
OpacityGpencilModifierData *gpmd = (OpacityGpencilModifierData *)md;
|
||||
@@ -196,6 +208,79 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
|
||||
walk(userData, ob, (ID **)&mmd->material, IDWALK_CB_USER);
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
int modify_color = RNA_enum_get(&ptr, "modify_color");
|
||||
|
||||
uiItemR(layout, &ptr, "modify_color", 0, NULL, ICON_NONE);
|
||||
|
||||
if (modify_color == GP_MODIFY_COLOR_HARDNESS) {
|
||||
uiItemR(layout, &ptr, "hardness", 0, NULL, ICON_NONE);
|
||||
}
|
||||
else {
|
||||
uiItemR(layout, &ptr, "normalize_opacity", 0, NULL, ICON_NONE);
|
||||
const char *text = (RNA_boolean_get(&ptr, "normalize_opacity")) ? IFACE_("Strength") :
|
||||
IFACE_("Opacity Factor");
|
||||
uiItemR(layout, &ptr, "hardness", 0, text, ICON_NONE);
|
||||
}
|
||||
|
||||
gpencil_modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void mask_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
PointerRNA ptr;
|
||||
gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
int modify_color = RNA_enum_get(&ptr, "modify_color");
|
||||
bool show_vertex = (modify_color != GP_MODIFY_COLOR_HARDNESS);
|
||||
|
||||
gpencil_modifier_masking_panel_draw(C, panel, true, show_vertex);
|
||||
}
|
||||
|
||||
static void curve_header_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
int modify_color = RNA_enum_get(&ptr, "modify_color");
|
||||
uiLayoutSetActive(layout, modify_color != GP_MODIFY_COLOR_HARDNESS);
|
||||
|
||||
gpencil_modifier_curve_header_draw(C, panel);
|
||||
}
|
||||
|
||||
static void curve_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
int modify_color = RNA_enum_get(&ptr, "modify_color");
|
||||
uiLayoutSetActive(layout, modify_color != GP_MODIFY_COLOR_HARDNESS);
|
||||
|
||||
gpencil_modifier_curve_panel_draw(C, panel);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = gpencil_modifier_panel_register(
|
||||
region_type, eGpencilModifierType_Opacity, panel_draw);
|
||||
PanelType *mask_panel_type = gpencil_modifier_subpanel_register(
|
||||
region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
|
||||
gpencil_modifier_subpanel_register(
|
||||
region_type, "curve", "", curve_header_draw, curve_panel_draw, mask_panel_type);
|
||||
}
|
||||
|
||||
GpencilModifierTypeInfo modifierType_Gpencil_Opacity = {
|
||||
/* name */ "Opacity",
|
||||
/* structName */ "OpacityGpencilModifierData",
|
||||
@@ -218,4 +303,5 @@ GpencilModifierTypeInfo modifierType_Gpencil_Opacity = {
|
||||
/* foreachObjectLink */ NULL,
|
||||
/* foreachIDLink */ foreachIDLink,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
@@ -26,20 +26,31 @@
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_gpencil_modifier_types.h"
|
||||
#include "DNA_gpencil_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
#include "DNA_vec_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_gpencil_geom.h"
|
||||
#include "BKE_gpencil_modifier.h"
|
||||
#include "BKE_lib_query.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "MOD_gpencil_modifiertypes.h"
|
||||
#include "MOD_gpencil_ui_common.h"
|
||||
#include "MOD_gpencil_util.h"
|
||||
|
||||
static void initData(GpencilModifierData *md)
|
||||
@@ -131,6 +142,48 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
|
||||
walk(userData, ob, (ID **)&mmd->material, IDWALK_CB_USER);
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
int mode = RNA_enum_get(&ptr, "mode");
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "mode", 0, NULL, ICON_NONE);
|
||||
|
||||
if (mode == GP_SIMPLIFY_FIXED) {
|
||||
uiItemR(layout, &ptr, "step", 0, NULL, ICON_NONE);
|
||||
}
|
||||
else if (mode == GP_SIMPLIFY_ADAPTIVE) {
|
||||
uiItemR(layout, &ptr, "factor", 0, NULL, ICON_NONE);
|
||||
}
|
||||
else if (mode == GP_SIMPLIFY_SAMPLE) {
|
||||
uiItemR(layout, &ptr, "length", 0, NULL, ICON_NONE);
|
||||
}
|
||||
else if (mode == GP_SIMPLIFY_MERGE) {
|
||||
uiItemR(layout, &ptr, "distance", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
gpencil_modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void mask_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
gpencil_modifier_masking_panel_draw(C, panel, true, false);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = gpencil_modifier_panel_register(
|
||||
region_type, eGpencilModifierType_Simplify, panel_draw);
|
||||
gpencil_modifier_subpanel_register(
|
||||
region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
|
||||
}
|
||||
|
||||
GpencilModifierTypeInfo modifierType_Gpencil_Simplify = {
|
||||
/* name */ "Simplify",
|
||||
/* structName */ "SimplifyGpencilModifierData",
|
||||
@@ -153,4 +206,5 @@ GpencilModifierTypeInfo modifierType_Gpencil_Simplify = {
|
||||
/* foreachObjectLink */ NULL,
|
||||
/* foreachIDLink */ foreachIDLink,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
@@ -26,21 +26,32 @@
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_gpencil_modifier_types.h"
|
||||
#include "DNA_gpencil_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_colortools.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_gpencil_geom.h"
|
||||
#include "BKE_gpencil_modifier.h"
|
||||
#include "BKE_lib_query.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "MOD_gpencil_modifiertypes.h"
|
||||
#include "MOD_gpencil_ui_common.h"
|
||||
#include "MOD_gpencil_util.h"
|
||||
|
||||
static void initData(GpencilModifierData *md)
|
||||
@@ -174,6 +185,47 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
|
||||
walk(userData, ob, (ID **)&mmd->material, IDWALK_CB_USER);
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *row;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
row = uiLayoutRow(layout, true);
|
||||
uiItemR(row, &ptr, "use_edit_position", UI_ITEM_R_TOGGLE, IFACE_("Position"), ICON_NONE);
|
||||
uiItemR(row, &ptr, "use_edit_strength", UI_ITEM_R_TOGGLE, IFACE_("Stength"), ICON_NONE);
|
||||
uiItemR(row, &ptr, "use_edit_thickness", UI_ITEM_R_TOGGLE, IFACE_("Thickness"), ICON_NONE);
|
||||
uiItemR(row, &ptr, "use_edit_uv", UI_ITEM_R_TOGGLE, IFACE_("UV"), ICON_NONE);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "factor", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "step", 0, IFACE_("Repeat"), ICON_NONE);
|
||||
|
||||
gpencil_modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void mask_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
gpencil_modifier_masking_panel_draw(C, panel, true, true);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = gpencil_modifier_panel_register(
|
||||
region_type, eGpencilModifierType_Smooth, panel_draw);
|
||||
PanelType *mask_panel_type = gpencil_modifier_subpanel_register(
|
||||
region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
|
||||
gpencil_modifier_subpanel_register(region_type,
|
||||
"curve",
|
||||
"",
|
||||
gpencil_modifier_curve_header_draw,
|
||||
gpencil_modifier_curve_panel_draw,
|
||||
mask_panel_type);
|
||||
}
|
||||
|
||||
GpencilModifierTypeInfo modifierType_Gpencil_Smooth = {
|
||||
/* name */ "Smooth",
|
||||
/* structName */ "SmoothGpencilModifierData",
|
||||
@@ -196,4 +248,5 @@ GpencilModifierTypeInfo modifierType_Gpencil_Smooth = {
|
||||
/* foreachObjectLink */ NULL,
|
||||
/* foreachIDLink */ foreachIDLink,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
@@ -28,20 +28,31 @@
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_gpencil_modifier_types.h"
|
||||
#include "DNA_gpencil_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_gpencil_geom.h"
|
||||
#include "BKE_gpencil_modifier.h"
|
||||
#include "BKE_lib_query.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "MOD_gpencil_modifiertypes.h"
|
||||
#include "MOD_gpencil_ui_common.h"
|
||||
#include "MOD_gpencil_util.h"
|
||||
|
||||
static void initData(GpencilModifierData *md)
|
||||
@@ -112,6 +123,34 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
|
||||
walk(userData, ob, (ID **)&mmd->material, IDWALK_CB_USER);
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "subdivision_type", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "level", 0, IFACE_("Subdivisions"), ICON_NONE);
|
||||
|
||||
gpencil_modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void mask_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
gpencil_modifier_masking_panel_draw(C, panel, true, false);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = gpencil_modifier_panel_register(
|
||||
region_type, eGpencilModifierType_Subdiv, panel_draw);
|
||||
gpencil_modifier_subpanel_register(
|
||||
region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
|
||||
}
|
||||
|
||||
GpencilModifierTypeInfo modifierType_Gpencil_Subdiv = {
|
||||
/* name */ "Subdivide",
|
||||
/* structName */ "SubdivGpencilModifierData",
|
||||
@@ -134,4 +173,5 @@ GpencilModifierTypeInfo modifierType_Gpencil_Subdiv = {
|
||||
/* foreachObjectLink */ NULL,
|
||||
/* foreachIDLink */ foreachIDLink,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
@@ -27,23 +27,34 @@
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_gpencil_modifier_types.h"
|
||||
#include "DNA_gpencil_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_colortools.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_gpencil.h"
|
||||
#include "BKE_gpencil_geom.h"
|
||||
#include "BKE_gpencil_modifier.h"
|
||||
#include "BKE_lib_query.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "MOD_gpencil_modifiertypes.h"
|
||||
#include "MOD_gpencil_ui_common.h"
|
||||
#include "MOD_gpencil_util.h"
|
||||
|
||||
static void initData(GpencilModifierData *md)
|
||||
@@ -147,8 +158,56 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
|
||||
walk(userData, ob, (ID **)&mmd->material, IDWALK_CB_USER);
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
int mode = RNA_enum_get(&ptr, "mode");
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "mode", 0, NULL, ICON_NONE);
|
||||
|
||||
if (ELEM(mode, STROKE, STROKE_AND_FILL)) {
|
||||
col = uiLayoutColumn(layout, false);
|
||||
uiItemR(col, &ptr, "fit_method", 0, IFACE_("Stroke Fit Method"), ICON_NONE);
|
||||
uiItemR(col, &ptr, "uv_offset", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, &ptr, "uv_scale", 0, IFACE_("Scale"), ICON_NONE);
|
||||
}
|
||||
|
||||
if (mode == STROKE_AND_FILL) {
|
||||
uiItemS(layout);
|
||||
}
|
||||
|
||||
if (ELEM(mode, FILL, STROKE_AND_FILL)) {
|
||||
col = uiLayoutColumn(layout, false);
|
||||
uiItemR(col, &ptr, "fill_rotation", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, &ptr, "fill_offset", 0, IFACE_("Offset"), ICON_NONE);
|
||||
uiItemR(col, &ptr, "fill_scale", 0, IFACE_("Scale"), ICON_NONE);
|
||||
}
|
||||
|
||||
gpencil_modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void mask_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
gpencil_modifier_masking_panel_draw(C, panel, true, true);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = gpencil_modifier_panel_register(
|
||||
region_type, eGpencilModifierType_Texture, panel_draw);
|
||||
gpencil_modifier_subpanel_register(
|
||||
region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
|
||||
}
|
||||
|
||||
GpencilModifierTypeInfo modifierType_Gpencil_Texture = {
|
||||
/* name */ "Texture Mapping",
|
||||
/* name */ "TextureMapping",
|
||||
/* structName */ "TextureGpencilModifierData",
|
||||
/* structSize */ sizeof(TextureGpencilModifierData),
|
||||
/* type */ eGpencilModifierTypeType_Gpencil,
|
||||
@@ -169,4 +228,5 @@ GpencilModifierTypeInfo modifierType_Gpencil_Texture = {
|
||||
/* foreachObjectLink */ NULL,
|
||||
/* foreachIDLink */ foreachIDLink,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
@@ -27,22 +27,33 @@
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_gpencil_modifier_types.h"
|
||||
#include "DNA_gpencil_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_colortools.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_gpencil.h"
|
||||
#include "BKE_gpencil_modifier.h"
|
||||
#include "BKE_lib_query.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "MOD_gpencil_modifiertypes.h"
|
||||
#include "MOD_gpencil_ui_common.h"
|
||||
#include "MOD_gpencil_util.h"
|
||||
|
||||
static void initData(GpencilModifierData *md)
|
||||
@@ -166,6 +177,46 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
|
||||
walk(userData, ob, (ID **)&mmd->material, IDWALK_CB_USER);
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "normalize_thickness", 0, NULL, ICON_NONE);
|
||||
|
||||
if (RNA_boolean_get(&ptr, "normalize_thickness")) {
|
||||
uiItemR(layout, &ptr, "thickness", 0, NULL, ICON_NONE);
|
||||
}
|
||||
else {
|
||||
uiItemR(layout, &ptr, "thickness_factor", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
gpencil_modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void mask_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
gpencil_modifier_masking_panel_draw(C, panel, true, true);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = gpencil_modifier_panel_register(
|
||||
region_type, eGpencilModifierType_Thick, panel_draw);
|
||||
PanelType *mask_panel_type = gpencil_modifier_subpanel_register(
|
||||
region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
|
||||
gpencil_modifier_subpanel_register(region_type,
|
||||
"curve",
|
||||
"",
|
||||
gpencil_modifier_curve_header_draw,
|
||||
gpencil_modifier_curve_panel_draw,
|
||||
mask_panel_type);
|
||||
}
|
||||
|
||||
GpencilModifierTypeInfo modifierType_Gpencil_Thick = {
|
||||
/* name */ "Thickness",
|
||||
/* structName */ "ThickGpencilModifierData",
|
||||
@@ -188,4 +239,5 @@ GpencilModifierTypeInfo modifierType_Gpencil_Thick = {
|
||||
/* foreachObjectLink */ NULL,
|
||||
/* foreachIDLink */ foreachIDLink,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
@@ -26,20 +26,31 @@
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_gpencil_modifier_types.h"
|
||||
#include "DNA_gpencil_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_colortools.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_gpencil.h"
|
||||
#include "BKE_gpencil_modifier.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "MOD_gpencil_modifiertypes.h"
|
||||
#include "MOD_gpencil_ui_common.h"
|
||||
#include "MOD_gpencil_util.h"
|
||||
|
||||
static void initData(GpencilModifierData *md)
|
||||
@@ -165,8 +176,91 @@ static int remapTime(struct GpencilModifierData *md,
|
||||
return cfra + offset;
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *row, *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
int mode = RNA_enum_get(&ptr, "mode");
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "mode", 0, NULL, ICON_NONE);
|
||||
|
||||
col = uiLayoutColumn(layout, false);
|
||||
|
||||
const char *text = (mode == GP_TIME_MODE_FIX) ? IFACE_("Frame") : IFACE_("Frame Offset");
|
||||
uiItemR(col, &ptr, "offset", 0, text, ICON_NONE);
|
||||
|
||||
row = uiLayoutRow(col, false);
|
||||
uiLayoutSetActive(row, mode != GP_TIME_MODE_FIX);
|
||||
uiItemR(row, &ptr, "frame_scale", 0, IFACE_("Scale"), ICON_NONE);
|
||||
|
||||
row = uiLayoutRow(layout, false);
|
||||
uiLayoutSetActive(row, mode != GP_TIME_MODE_FIX);
|
||||
uiItemR(row, &ptr, "use_keep_loop", 0, NULL, ICON_NONE);
|
||||
|
||||
gpencil_modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void custom_range_header_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
int mode = RNA_enum_get(&ptr, "mode");
|
||||
|
||||
uiLayoutSetActive(layout, mode != GP_TIME_MODE_FIX);
|
||||
|
||||
uiItemR(layout, &ptr, "use_custom_frame_range", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
static void custom_range_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
int mode = RNA_enum_get(&ptr, "mode");
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiLayoutSetActive(
|
||||
layout, (mode != GP_TIME_MODE_FIX) && (RNA_boolean_get(&ptr, "use_custom_frame_range")));
|
||||
|
||||
col = uiLayoutColumn(layout, false);
|
||||
uiItemR(col, &ptr, "frame_start", 0, IFACE_("Frame Start"), ICON_NONE);
|
||||
uiItemR(col, &ptr, "frame_end", 0, IFACE_("End"), ICON_NONE);
|
||||
}
|
||||
|
||||
static void mask_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
gpencil_modifier_masking_panel_draw(C, panel, false, false);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = gpencil_modifier_panel_register(
|
||||
region_type, eGpencilModifierType_Time, panel_draw);
|
||||
gpencil_modifier_subpanel_register(region_type,
|
||||
"custom_range",
|
||||
"",
|
||||
custom_range_header_draw,
|
||||
custom_range_panel_draw,
|
||||
panel_type);
|
||||
gpencil_modifier_subpanel_register(
|
||||
region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
|
||||
}
|
||||
|
||||
GpencilModifierTypeInfo modifierType_Gpencil_Time = {
|
||||
/* name */ "Time Offset",
|
||||
/* name */ "TimeOffset",
|
||||
/* structName */ "TimeGpencilModifierData",
|
||||
/* structSize */ sizeof(TimeGpencilModifierData),
|
||||
/* type */ eGpencilModifierTypeType_Gpencil,
|
||||
@@ -187,4 +281,5 @@ GpencilModifierTypeInfo modifierType_Gpencil_Time = {
|
||||
/* foreachObjectLink */ NULL,
|
||||
/* foreachIDLink */ NULL,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
@@ -28,16 +28,20 @@
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_gpencil_modifier_types.h"
|
||||
#include "DNA_gpencil_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_modifier_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_action.h"
|
||||
#include "BKE_colorband.h"
|
||||
#include "BKE_colortools.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_gpencil.h"
|
||||
#include "BKE_gpencil_modifier.h"
|
||||
@@ -47,10 +51,17 @@
|
||||
#include "BKE_material.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "MOD_gpencil_modifiertypes.h"
|
||||
#include "MOD_gpencil_ui_common.h"
|
||||
#include "MOD_gpencil_util.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
@@ -330,6 +341,56 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
|
||||
foreachObjectLink(md, ob, (ObjectWalkFunc)walk, userData);
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
int tint_type = RNA_enum_get(&ptr, "tint_type");
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "vertex_mode", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "factor", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "tint_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
||||
|
||||
if (tint_type == GP_TINT_UNIFORM) {
|
||||
uiItemR(layout, &ptr, "color", 0, NULL, ICON_NONE);
|
||||
}
|
||||
else {
|
||||
col = uiLayoutColumn(layout, false);
|
||||
uiLayoutSetPropSep(col, false);
|
||||
uiTemplateColorRamp(col, &ptr, "colors", true);
|
||||
uiItemS(layout);
|
||||
uiItemR(layout, &ptr, "object", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "radius", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
gpencil_modifier_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void mask_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
gpencil_modifier_masking_panel_draw(C, panel, true, true);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = gpencil_modifier_panel_register(
|
||||
region_type, eGpencilModifierType_Tint, panel_draw);
|
||||
PanelType *mask_panel_type = gpencil_modifier_subpanel_register(
|
||||
region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
|
||||
gpencil_modifier_subpanel_register(region_type,
|
||||
"curve",
|
||||
"",
|
||||
gpencil_modifier_curve_header_draw,
|
||||
gpencil_modifier_curve_panel_draw,
|
||||
mask_panel_type);
|
||||
}
|
||||
|
||||
GpencilModifierTypeInfo modifierType_Gpencil_Tint = {
|
||||
/* name */ "Tint",
|
||||
/* structName */ "TintGpencilModifierData",
|
||||
@@ -352,4 +413,5 @@ GpencilModifierTypeInfo modifierType_Gpencil_Tint = {
|
||||
/* foreachObjectLink */ foreachObjectLink,
|
||||
/* foreachIDLink */ foreachIDLink,
|
||||
/* foreachTexLink */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
@@ -61,7 +61,8 @@ typedef struct bConstraint {
|
||||
/** Constraint name, MAX_NAME. */
|
||||
char name[64];
|
||||
|
||||
char _pad[2];
|
||||
/* Flag for panel and subpanel closed / open state in the UI. */
|
||||
short ui_expand_flag;
|
||||
|
||||
/** Amount of influence exherted by constraint (0.0-1.0). */
|
||||
float enforce;
|
||||
@@ -689,8 +690,8 @@ typedef enum eBConstraint_Types {
|
||||
/* flag 0x20 (1 << 5) was used to indicate that a constraint was evaluated
|
||||
* using a 'local' hack for posebones only. */
|
||||
typedef enum eBConstraint_Flags {
|
||||
/* expand for UI */
|
||||
CONSTRAINT_EXPAND = (1 << 0),
|
||||
/* Expansion for old box constraint layouts. Just for versioning. */
|
||||
CONSTRAINT_EXPAND_DEPRECATED = (1 << 0),
|
||||
/* pre-check for illegal object name or bone name */
|
||||
CONSTRAINT_DISABLE = (1 << 2),
|
||||
/* to indicate which Ipo should be shown, maybe for 3d access later too */
|
||||
|
@@ -56,7 +56,7 @@ typedef enum GpencilModifierMode {
|
||||
eGpencilModifierMode_Realtime = (1 << 0),
|
||||
eGpencilModifierMode_Render = (1 << 1),
|
||||
eGpencilModifierMode_Editmode = (1 << 2),
|
||||
eGpencilModifierMode_Expanded = (1 << 3),
|
||||
eGpencilModifierMode_Expanded_DEPRECATED = (1 << 3),
|
||||
} GpencilModifierMode;
|
||||
|
||||
typedef enum {
|
||||
@@ -70,7 +70,7 @@ typedef struct GpencilModifierData {
|
||||
int type, mode;
|
||||
int stackindex;
|
||||
short flag;
|
||||
short _pad;
|
||||
short ui_expand_flag;
|
||||
/** MAX_NAME. */
|
||||
char name[64];
|
||||
|
||||
|
@@ -50,7 +50,7 @@ typedef enum ShaderFxMode {
|
||||
eShaderFxMode_Realtime = (1 << 0),
|
||||
eShaderFxMode_Render = (1 << 1),
|
||||
eShaderFxMode_Editmode = (1 << 2),
|
||||
eShaderFxMode_Expanded = (1 << 3),
|
||||
eShaderFxMode_Expanded_DEPRECATED = (1 << 3),
|
||||
} ShaderFxMode;
|
||||
|
||||
typedef enum {
|
||||
@@ -64,7 +64,8 @@ typedef struct ShaderFxData {
|
||||
int type, mode;
|
||||
int stackindex;
|
||||
short flag;
|
||||
char _pad[2];
|
||||
/* Expansion for constraint panels. */
|
||||
short ui_expand_flag;
|
||||
/** MAX_NAME. */
|
||||
char name[64];
|
||||
|
||||
|
@@ -2483,7 +2483,7 @@ static void rna_def_constraint_location_limit(BlenderRNA *brna)
|
||||
prop = RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag2", LIMIT_TRANSFORM);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "For Transform", "Transforms are affected by this constraint as well");
|
||||
prop, "Affect Transform", "Transforms are affected by this constraint as well");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
||||
|
||||
RNA_define_lib_overridable(false);
|
||||
@@ -3380,8 +3380,8 @@ void RNA_def_constraint(BlenderRNA *brna)
|
||||
|
||||
prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_EXPAND);
|
||||
RNA_def_property_ui_text(prop, "Expanded", "Constraint's panel is expanded in UI");
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "ui_expand_flag", 0);
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
|
||||
|
||||
/* XXX this is really an internal flag,
|
||||
|
@@ -1490,7 +1490,7 @@ static void rna_def_modifier_gpencilarray(BlenderRNA *brna)
|
||||
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
|
||||
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
|
||||
|
||||
prop = RNA_def_property(srna, "relative_offset", PROP_FLOAT, PROP_NONE);
|
||||
prop = RNA_def_property(srna, "relative_offset", PROP_FLOAT, PROP_XYZ);
|
||||
RNA_def_property_float_sdna(prop, NULL, "shift");
|
||||
RNA_def_property_ui_text(
|
||||
prop,
|
||||
@@ -2127,8 +2127,7 @@ static void rna_def_modifier_gpencilmultiply(BlenderRNA *brna)
|
||||
|
||||
prop = RNA_def_property(srna, "use_fade", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flags", GP_MULTIPLY_ENABLE_FADING);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Enable Fade", "Fade the stroke thickness for each generated stroke");
|
||||
RNA_def_property_ui_text(prop, "Fade", "Fade the stroke thickness for each generated stroke");
|
||||
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
|
||||
|
||||
prop = RNA_def_property(srna, "split_angle", PROP_FLOAT, PROP_ANGLE);
|
||||
@@ -2183,12 +2182,12 @@ static void rna_def_modifier_gpenciltexture(BlenderRNA *brna)
|
||||
{GP_TEX_CONSTANT_LENGTH,
|
||||
"CONSTANT_LENGTH",
|
||||
0,
|
||||
"Keep Texture at Constant Length",
|
||||
"Constant Length",
|
||||
"Keep the texture at a constant length regardless of the length of each stroke"},
|
||||
{GP_TEX_FIT_STROKE,
|
||||
"FIT_STROKE",
|
||||
0,
|
||||
"Fit Texture to Stroke Length",
|
||||
"Stroke Length",
|
||||
"Scale the texture to fit the length of each stroke"},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
};
|
||||
@@ -2269,7 +2268,7 @@ static void rna_def_modifier_gpenciltexture(BlenderRNA *brna)
|
||||
RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
|
||||
RNA_def_property_ui_range(prop, -100.0, 100.0, 0.1, 3);
|
||||
RNA_def_property_float_default(prop, 0.0f);
|
||||
RNA_def_property_ui_text(prop, "Offset UVs", "Offset value to add to stroke UVs");
|
||||
RNA_def_property_ui_text(prop, "UV Offset", "Offset value to add to stroke UVs");
|
||||
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
|
||||
|
||||
prop = RNA_def_property(srna, "uv_scale", PROP_FLOAT, PROP_NONE);
|
||||
@@ -2360,7 +2359,7 @@ void RNA_def_greasepencil_modifier(BlenderRNA *brna)
|
||||
|
||||
prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "mode", eGpencilModifierMode_Expanded);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "ui_expand_flag", 0);
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
RNA_def_property_ui_text(prop, "Expanded", "Set modifier expanded in the user interface");
|
||||
RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
|
||||
|
@@ -424,7 +424,7 @@ static void rna_def_shader_fx_shadow(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "Offset", "Offset of the shadow");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
|
||||
|
||||
prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE);
|
||||
prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
|
||||
RNA_def_property_float_sdna(prop, NULL, "scale");
|
||||
RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
|
||||
RNA_def_property_ui_text(prop, "Scale", "Offset of the shadow");
|
||||
@@ -681,9 +681,9 @@ void RNA_def_shader_fx(BlenderRNA *brna)
|
||||
|
||||
prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "mode", eShaderFxMode_Expanded);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "ui_expand_flag", 0);
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
RNA_def_property_ui_text(prop, "Expanded", "Set effect expanded in the user interface");
|
||||
RNA_def_property_ui_text(prop, "Expanded", "Set effect expansion in the user interface");
|
||||
RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
|
||||
|
||||
/* types */
|
||||
|
@@ -1213,21 +1213,18 @@ void RNA_api_ui_layout(StructRNA *srna)
|
||||
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
||||
RNA_def_function_ui_description(func, "Generates the UI layout for the modifier stack");
|
||||
|
||||
func = RNA_def_function(srna, "template_greasepencil_modifier", "uiTemplateGpencilModifier");
|
||||
func = RNA_def_function(srna, "template_grease_pencil_modifiers", "uiTemplateGpencilModifiers");
|
||||
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
||||
RNA_def_function_ui_description(func, "Generates the UI layout for grease pencil modifiers");
|
||||
parm = RNA_def_pointer(func, "data", "GpencilModifier", "", "Modifier data");
|
||||
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
||||
parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
|
||||
RNA_def_function_return(func, parm);
|
||||
RNA_def_function_ui_description(func,
|
||||
"Generates the panels for the grease pencil modifier stack");
|
||||
|
||||
func = RNA_def_function(srna, "template_constraints", "uiTemplateConstraints");
|
||||
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
||||
RNA_def_function_ui_description(func, "Generates the panels for the constraint stack");
|
||||
|
||||
func = RNA_def_function(srna, "template_shaderfx", "uiTemplateShaderFx");
|
||||
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
||||
RNA_def_function_ui_description(func, "Generates the UI layout for shader effect");
|
||||
parm = RNA_def_pointer(func, "data", "ShaderFx", "", "Shader data");
|
||||
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
||||
parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
|
||||
RNA_def_function_return(func, parm);
|
||||
RNA_def_function_ui_description(func, "Generates the panels for the shader effect stack");
|
||||
|
||||
func = RNA_def_function(srna, "template_greasepencil_color", "uiTemplateGpencilColorPreview");
|
||||
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
||||
@@ -1251,12 +1248,10 @@ void RNA_api_ui_layout(StructRNA *srna)
|
||||
"",
|
||||
"Optionally limit the items which can be selected");
|
||||
|
||||
func = RNA_def_function(srna, "template_constraint", "uiTemplateConstraint");
|
||||
RNA_def_function_ui_description(func, "Generates the UI layout for constraints");
|
||||
func = RNA_def_function(srna, "template_constraint_header", "uiTemplateConstraintHeader");
|
||||
RNA_def_function_ui_description(func, "Generates the header for constraint panels");
|
||||
parm = RNA_def_pointer(func, "data", "Constraint", "", "Constraint data");
|
||||
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
||||
parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
|
||||
RNA_def_function_return(func, parm);
|
||||
|
||||
func = RNA_def_function(srna, "template_preview", "uiTemplatePreview");
|
||||
RNA_def_function_ui_description(
|
||||
|
@@ -24,12 +24,15 @@ set(INC
|
||||
intern
|
||||
../blenfont
|
||||
../blenkernel
|
||||
../blentranslation
|
||||
../blenlib
|
||||
../bmesh
|
||||
../depsgraph
|
||||
../editors/include
|
||||
../makesdna
|
||||
../makesrna
|
||||
../render/extern/include
|
||||
../windowmanager
|
||||
../../../intern/eigen
|
||||
../../../intern/guardedalloc
|
||||
)
|
||||
@@ -40,6 +43,7 @@ set(INC_SYS
|
||||
|
||||
set(SRC
|
||||
intern/FX_shader_util.h
|
||||
intern/FX_ui_common.c
|
||||
|
||||
intern/FX_shader_blur.c
|
||||
intern/FX_shader_colorize.c
|
||||
@@ -52,6 +56,7 @@ set(SRC
|
||||
intern/FX_shader_util.c
|
||||
intern/FX_shader_wave.c
|
||||
|
||||
intern/FX_ui_common.h
|
||||
FX_shader_types.h
|
||||
)
|
||||
|
||||
|
@@ -26,7 +26,20 @@
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "FX_shader_types.h"
|
||||
#include "FX_ui_common.h"
|
||||
|
||||
static void initData(ShaderFxData *fx)
|
||||
{
|
||||
@@ -41,6 +54,32 @@ static void copyData(const ShaderFxData *md, ShaderFxData *target)
|
||||
BKE_shaderfx_copydata_generic(md, target);
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
shaderfx_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "samples", 0, NULL, ICON_NONE);
|
||||
|
||||
uiItemR(layout, &ptr, "use_dof_mode", 0, IFACE_("Use Depth of Field"), ICON_NONE);
|
||||
col = uiLayoutColumn(layout, false);
|
||||
uiLayoutSetActive(col, !RNA_boolean_get(&ptr, "use_dof_mode"));
|
||||
uiItemR(col, &ptr, "size", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, &ptr, "rotation", 0, NULL, ICON_NONE);
|
||||
|
||||
shaderfx_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
shaderfx_panel_register(region_type, eShaderFxType_Blur, panel_draw);
|
||||
}
|
||||
|
||||
ShaderFxTypeInfo shaderfx_Type_Blur = {
|
||||
/* name */ "Blur",
|
||||
/* structName */ "BlurShaderFxData",
|
||||
@@ -57,4 +96,5 @@ ShaderFxTypeInfo shaderfx_Type_Blur = {
|
||||
/* dependsOnTime */ NULL,
|
||||
/* foreachObjectLink */ NULL,
|
||||
/* foreachIDLink */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
@@ -23,11 +23,23 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "DNA_shader_fx_types.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "DNA_screen_types.h"
|
||||
#include "DNA_shader_fx_types.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "FX_shader_types.h"
|
||||
#include "FX_ui_common.h"
|
||||
|
||||
static void initData(ShaderFxData *fx)
|
||||
{
|
||||
@@ -43,6 +55,38 @@ static void copyData(const ShaderFxData *md, ShaderFxData *target)
|
||||
BKE_shaderfx_copydata_generic(md, target);
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
shaderfx_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
int mode = RNA_enum_get(&ptr, "mode");
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "mode", 0, NULL, ICON_NONE);
|
||||
|
||||
if (ELEM(mode, eShaderFxColorizeMode_Custom, eShaderFxColorizeMode_Duotone)) {
|
||||
const char *text = (mode == eShaderFxColorizeMode_Duotone) ? IFACE_("Low Color") :
|
||||
IFACE_("Color");
|
||||
uiItemR(layout, &ptr, "low_color", 0, text, ICON_NONE);
|
||||
}
|
||||
if (mode == eShaderFxColorizeMode_Duotone) {
|
||||
uiItemR(layout, &ptr, "high_color", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
uiItemR(layout, &ptr, "factor", 0, NULL, ICON_NONE);
|
||||
|
||||
shaderfx_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
shaderfx_panel_register(region_type, eShaderFxType_Colorize, panel_draw);
|
||||
}
|
||||
|
||||
ShaderFxTypeInfo shaderfx_Type_Colorize = {
|
||||
/* name */ "Colorize",
|
||||
/* structName */ "ColorizeShaderFxData",
|
||||
@@ -59,4 +103,5 @@ ShaderFxTypeInfo shaderfx_Type_Colorize = {
|
||||
/* dependsOnTime */ NULL,
|
||||
/* foreachObjectLink */ NULL,
|
||||
/* foreachIDLink */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
@@ -26,10 +26,22 @@
|
||||
#include "DNA_gpencil_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "FX_shader_types.h"
|
||||
#include "FX_ui_common.h"
|
||||
|
||||
static void initData(ShaderFxData *fx)
|
||||
{
|
||||
@@ -42,6 +54,29 @@ static void copyData(const ShaderFxData *md, ShaderFxData *target)
|
||||
BKE_shaderfx_copydata_generic(md, target);
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *row;
|
||||
uiLayout *layout = panel->layout;
|
||||
int toggles_flag = UI_ITEM_R_TOGGLE | UI_ITEM_R_FORCE_BLANK_DECORATE;
|
||||
|
||||
PointerRNA ptr;
|
||||
shaderfx_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
row = uiLayoutRowWithHeading(layout, true, IFACE_("Axis"));
|
||||
uiItemR(row, &ptr, "flip_horizontal", toggles_flag, NULL, ICON_NONE);
|
||||
uiItemR(row, &ptr, "flip_vertical", toggles_flag, NULL, ICON_NONE);
|
||||
|
||||
shaderfx_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
shaderfx_panel_register(region_type, eShaderFxType_Flip, panel_draw);
|
||||
}
|
||||
|
||||
ShaderFxTypeInfo shaderfx_Type_Flip = {
|
||||
/* name */ "Flip",
|
||||
/* structName */ "FlipShaderFxData",
|
||||
@@ -58,4 +93,5 @@ ShaderFxTypeInfo shaderfx_Type_Flip = {
|
||||
/* dependsOnTime */ NULL,
|
||||
/* foreachObjectLink */ NULL,
|
||||
/* foreachIDLink */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
@@ -26,14 +26,23 @@
|
||||
#include "DNA_gpencil_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_screen.h"
|
||||
#include "BKE_shader_fx.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "FX_shader_types.h"
|
||||
#include "FX_ui_common.h"
|
||||
|
||||
static void initData(ShaderFxData *md)
|
||||
{
|
||||
@@ -50,6 +59,44 @@ static void copyData(const ShaderFxData *md, ShaderFxData *target)
|
||||
BKE_shaderfx_copydata_generic(md, target);
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
shaderfx_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
int mode = RNA_enum_get(&ptr, "mode");
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "mode", 0, NULL, ICON_NONE);
|
||||
|
||||
if (mode == eShaderFxGlowMode_Luminance) {
|
||||
uiItemR(layout, &ptr, "threshold", 0, NULL, ICON_NONE);
|
||||
}
|
||||
else {
|
||||
uiItemR(layout, &ptr, "select_color", 0, NULL, ICON_NONE);
|
||||
}
|
||||
uiItemR(layout, &ptr, "glow_color", 0, NULL, ICON_NONE);
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
uiItemR(layout, &ptr, "blend_mode", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "opacity", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "size", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "rotation", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "samples", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "use_glow_under", 0, NULL, ICON_NONE);
|
||||
|
||||
shaderfx_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
shaderfx_panel_register(region_type, eShaderFxType_Glow, panel_draw);
|
||||
}
|
||||
|
||||
ShaderFxTypeInfo shaderfx_Type_Glow = {
|
||||
/* name */ "Glow",
|
||||
/* structName */ "GlowShaderFxData",
|
||||
@@ -66,4 +113,5 @@ ShaderFxTypeInfo shaderfx_Type_Glow = {
|
||||
/* dependsOnTime */ NULL,
|
||||
/* foreachObjectLink */ NULL,
|
||||
/* foreachIDLink */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
@@ -26,14 +26,23 @@
|
||||
#include "DNA_gpencil_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_lib_query.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_screen.h"
|
||||
#include "BKE_shader_fx.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "FX_shader_types.h"
|
||||
#include "FX_ui_common.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
#include "DEG_depsgraph_build.h"
|
||||
@@ -93,4 +102,5 @@ ShaderFxTypeInfo shaderfx_Type_Light = {
|
||||
/* dependsOnTime */ NULL,
|
||||
/* foreachObjectLink */ foreachObjectLink,
|
||||
/* foreachIDLink */ NULL,
|
||||
/* panelRegister */ NULL,
|
||||
};
|
||||
|
@@ -25,7 +25,20 @@
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "FX_shader_types.h"
|
||||
#include "FX_ui_common.h"
|
||||
|
||||
static void initData(ShaderFxData *fx)
|
||||
{
|
||||
@@ -39,6 +52,30 @@ static void copyData(const ShaderFxData *md, ShaderFxData *target)
|
||||
BKE_shaderfx_copydata_generic(md, target);
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
shaderfx_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
/* Add the X, Y labels manually because size is a #PROP_PIXEL. */
|
||||
col = uiLayoutColumn(layout, true);
|
||||
PropertyRNA *prop = RNA_struct_find_property(&ptr, "size");
|
||||
uiItemFullR(col, &ptr, prop, 0, 0, 0, IFACE_("Size X"), ICON_NONE);
|
||||
uiItemFullR(col, &ptr, prop, 1, 0, 0, IFACE_("Y"), ICON_NONE);
|
||||
|
||||
shaderfx_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
shaderfx_panel_register(region_type, eShaderFxType_Pixel, panel_draw);
|
||||
}
|
||||
|
||||
ShaderFxTypeInfo shaderfx_Type_Pixel = {
|
||||
/* name */ "Pixelate",
|
||||
/* structName */ "PixelShaderFxData",
|
||||
@@ -55,4 +92,5 @@ ShaderFxTypeInfo shaderfx_Type_Pixel = {
|
||||
/* dependsOnTime */ NULL,
|
||||
/* foreachObjectLink */ NULL,
|
||||
/* foreachIDLink */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
@@ -23,11 +23,23 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "DNA_screen_types.h"
|
||||
#include "DNA_shader_fx_types.h"
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "FX_shader_types.h"
|
||||
#include "FX_ui_common.h"
|
||||
|
||||
static void initData(ShaderFxData *fx)
|
||||
{
|
||||
@@ -46,6 +58,42 @@ static void copyData(const ShaderFxData *md, ShaderFxData *target)
|
||||
BKE_shaderfx_copydata_generic(md, target);
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
shaderfx_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "rim_color", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "mask_color", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "mode", 0, IFACE_("Blend"), ICON_NONE);
|
||||
uiItemR(layout, &ptr, "offset", 0, NULL, ICON_NONE);
|
||||
|
||||
shaderfx_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void blur_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
shaderfx_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "blur", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "samples", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = shaderfx_panel_register(region_type, eShaderFxType_Rim, panel_draw);
|
||||
shaderfx_subpanel_register(region_type, "blur", "Blur", NULL, blur_panel_draw, panel_type);
|
||||
}
|
||||
|
||||
ShaderFxTypeInfo shaderfx_Type_Rim = {
|
||||
/* name */ "Rim",
|
||||
/* structName */ "RimShaderFxData",
|
||||
@@ -62,4 +110,5 @@ ShaderFxTypeInfo shaderfx_Type_Rim = {
|
||||
/* dependsOnTime */ NULL,
|
||||
/* foreachObjectLink */ NULL,
|
||||
/* foreachIDLink */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
@@ -26,14 +26,25 @@
|
||||
#include "DNA_gpencil_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_lib_query.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_screen.h"
|
||||
#include "BKE_shader_fx.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "FX_shader_types.h"
|
||||
#include "FX_ui_common.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
#include "DEG_depsgraph_build.h"
|
||||
@@ -88,6 +99,88 @@ static void foreachObjectLink(ShaderFxData *fx,
|
||||
walk(userData, ob, &fxd->object, IDWALK_CB_NOP);
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *row, *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
shaderfx_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "shadow_color", 0, NULL, ICON_NONE);
|
||||
|
||||
/* Add the X, Y labels manually because size is a #PROP_PIXEL. */
|
||||
col = uiLayoutColumn(layout, true);
|
||||
PropertyRNA *prop = RNA_struct_find_property(&ptr, "offset");
|
||||
uiItemFullR(col, &ptr, prop, 0, 0, 0, IFACE_("Offset X"), ICON_NONE);
|
||||
uiItemFullR(col, &ptr, prop, 1, 0, 0, IFACE_("Y"), ICON_NONE);
|
||||
|
||||
uiItemR(layout, &ptr, "scale", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "rotation", 0, NULL, ICON_NONE);
|
||||
|
||||
row = uiLayoutRowWithHeading(layout, true, IFACE_("Object Pivot"));
|
||||
uiItemR(row, &ptr, "use_object", 0, "", ICON_NONE);
|
||||
uiItemR(row, &ptr, "object", 0, "", ICON_NONE);
|
||||
|
||||
shaderfx_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void blur_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *col;
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
shaderfx_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
/* Add the X, Y labels manually because size is a #PROP_PIXEL. */
|
||||
col = uiLayoutColumn(layout, true);
|
||||
PropertyRNA *prop = RNA_struct_find_property(&ptr, "blur");
|
||||
uiItemFullR(col, &ptr, prop, 0, 0, 0, IFACE_("Blur X"), ICON_NONE);
|
||||
uiItemFullR(col, &ptr, prop, 1, 0, 0, IFACE_("Y"), ICON_NONE);
|
||||
|
||||
uiItemR(layout, &ptr, "samples", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
static void wave_header_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
shaderfx_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiItemR(layout, &ptr, "use_wave", 0, IFACE_("Wave Effect"), ICON_NONE);
|
||||
}
|
||||
|
||||
static void wave_panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
shaderfx_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiLayoutSetActive(layout, RNA_boolean_get(&ptr, "use_wave"));
|
||||
|
||||
uiItemR(layout, &ptr, "orientation", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "amplitude", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "period", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "phase", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
PanelType *panel_type = shaderfx_panel_register(region_type, eShaderFxType_Shadow, panel_draw);
|
||||
shaderfx_subpanel_register(region_type, "blur", "Blur", NULL, blur_panel_draw, panel_type);
|
||||
shaderfx_subpanel_register(
|
||||
region_type, "wave", "", wave_header_draw, wave_panel_draw, panel_type);
|
||||
}
|
||||
|
||||
ShaderFxTypeInfo shaderfx_Type_Shadow = {
|
||||
/* name */ "Shadow",
|
||||
/* structName */ "ShadowShaderFxData",
|
||||
@@ -104,4 +197,5 @@ ShaderFxTypeInfo shaderfx_Type_Shadow = {
|
||||
/* dependsOnTime */ NULL,
|
||||
/* foreachObjectLink */ foreachObjectLink,
|
||||
/* foreachIDLink */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
@@ -26,15 +26,24 @@
|
||||
#include "DNA_gpencil_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BLI_math_base.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_lib_query.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_screen.h"
|
||||
#include "BKE_shader_fx.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "FX_shader_types.h"
|
||||
#include "FX_ui_common.h"
|
||||
|
||||
#include "DEG_depsgraph.h"
|
||||
#include "DEG_depsgraph_build.h"
|
||||
@@ -77,6 +86,28 @@ static void foreachObjectLink(ShaderFxData *fx,
|
||||
walk(userData, ob, &fxd->object, IDWALK_CB_NOP);
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
PointerRNA ob_ptr;
|
||||
shaderfx_panel_get_property_pointers(C, panel, &ob_ptr, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "object", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "radius", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "angle", 0, NULL, ICON_NONE);
|
||||
|
||||
shaderfx_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
shaderfx_panel_register(region_type, eShaderFxType_Swirl, panel_draw);
|
||||
}
|
||||
|
||||
ShaderFxTypeInfo shaderfx_Type_Swirl = {
|
||||
/* name */ "Swirl",
|
||||
/* structName */ "SwirlShaderFxData",
|
||||
@@ -93,4 +124,5 @@ ShaderFxTypeInfo shaderfx_Type_Swirl = {
|
||||
/* dependsOnTime */ NULL,
|
||||
/* foreachObjectLink */ foreachObjectLink,
|
||||
/* foreachIDLink */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
@@ -26,10 +26,20 @@
|
||||
#include "DNA_gpencil_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "FX_shader_types.h"
|
||||
#include "FX_ui_common.h"
|
||||
|
||||
static void initData(ShaderFxData *fx)
|
||||
{
|
||||
@@ -45,8 +55,30 @@ static void copyData(const ShaderFxData *md, ShaderFxData *target)
|
||||
BKE_shaderfx_copydata_generic(md, target);
|
||||
}
|
||||
|
||||
static void panel_draw(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
|
||||
PointerRNA ptr;
|
||||
shaderfx_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "orientation", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "amplitude", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "period", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "phase", 0, NULL, ICON_NONE);
|
||||
|
||||
shaderfx_panel_end(layout, &ptr);
|
||||
}
|
||||
|
||||
static void panelRegister(ARegionType *region_type)
|
||||
{
|
||||
shaderfx_panel_register(region_type, eShaderFxType_Wave, panel_draw);
|
||||
}
|
||||
|
||||
ShaderFxTypeInfo shaderfx_Type_Wave = {
|
||||
/* name */ "Wave Distortion",
|
||||
/* name */ "WaveDistortion",
|
||||
/* structName */ "WaveShaderFxData",
|
||||
/* structSize */ sizeof(WaveShaderFxData),
|
||||
/* type */ eShaderFxType_GpencilType,
|
||||
@@ -61,4 +93,5 @@ ShaderFxTypeInfo shaderfx_Type_Wave = {
|
||||
/* dependsOnTime */ NULL,
|
||||
/* foreachObjectLink */ NULL,
|
||||
/* foreachIDLink */ NULL,
|
||||
/* panelRegister */ panelRegister,
|
||||
};
|
||||
|
261
source/blender/shader_fx/intern/FX_ui_common.c
Normal file
261
source/blender/shader_fx/intern/FX_ui_common.c
Normal file
@@ -0,0 +1,261 @@
|
||||
/* This program 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 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program 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, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \ingroup modifiers
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "BLI_listbase.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_screen.h"
|
||||
#include "BKE_shader_fx.h"
|
||||
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
#include "DNA_shader_fx_types.h"
|
||||
|
||||
#include "ED_object.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
|
||||
#include "FX_ui_common.h" /* Self include */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Panel Drag and Drop, Expansion Saving
|
||||
* \{ */
|
||||
|
||||
/**
|
||||
* Move an effect to the index it's moved to after a drag and drop.
|
||||
*/
|
||||
static void shaderfx_reorder(bContext *C, Panel *panel, int new_index)
|
||||
{
|
||||
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
|
||||
ShaderFxData *fx = BLI_findlink(&ob->shader_fx, panel->runtime.list_index);
|
||||
PointerRNA props_ptr;
|
||||
wmOperatorType *ot = WM_operatortype_find("OBJECT_OT_shaderfx_move_to_index", false);
|
||||
WM_operator_properties_create_ptr(&props_ptr, ot);
|
||||
RNA_string_set(&props_ptr, "shaderfx", fx->name);
|
||||
RNA_int_set(&props_ptr, "index", new_index);
|
||||
WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &props_ptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the expand flag from the active effect to use for the panel.
|
||||
*/
|
||||
static short get_shaderfx_expand_flag(const bContext *C, Panel *panel)
|
||||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
ShaderFxData *fx = BLI_findlink(&ob->shader_fx, panel->runtime.list_index);
|
||||
return fx->ui_expand_flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the expand flag for the panel and subpanels to the effect.
|
||||
*/
|
||||
static void set_shaderfx_expand_flag(const bContext *C, Panel *panel, short expand_flag)
|
||||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
ShaderFxData *fx = BLI_findlink(&ob->shader_fx, panel->runtime.list_index);
|
||||
fx->ui_expand_flag = expand_flag;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name ShaderFx Panel Layouts
|
||||
* \{ */
|
||||
|
||||
/**
|
||||
* Draw shaderfx error message.
|
||||
*/
|
||||
void shaderfx_panel_end(uiLayout *layout, PointerRNA *ptr)
|
||||
{
|
||||
ShaderFxData *fx = ptr->data;
|
||||
if (fx->error) {
|
||||
uiLayout *row = uiLayoutRow(layout, false);
|
||||
uiItemL(row, IFACE_(fx->error), ICON_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets RNA pointers for the active object and the panel's shaderfx data.
|
||||
*/
|
||||
void shaderfx_panel_get_property_pointers(const bContext *C,
|
||||
Panel *panel,
|
||||
PointerRNA *r_ob_ptr,
|
||||
PointerRNA *r_md_ptr)
|
||||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
ShaderFxData *md = BLI_findlink(&ob->shader_fx, panel->runtime.list_index);
|
||||
|
||||
RNA_pointer_create(&ob->id, &RNA_ShaderFx, md, r_md_ptr);
|
||||
|
||||
if (r_ob_ptr != NULL) {
|
||||
RNA_pointer_create(&ob->id, &RNA_Object, ob, r_ob_ptr);
|
||||
}
|
||||
|
||||
uiLayoutSetContextPointer(panel->layout, "shaderfx", r_md_ptr);
|
||||
}
|
||||
|
||||
#define ERROR_LIBDATA_MESSAGE TIP_("Can't edit external library data")
|
||||
|
||||
static void shaderfx_panel_header(const bContext *C, Panel *panel)
|
||||
{
|
||||
uiLayout *layout = panel->layout;
|
||||
bool narrow_panel = (panel->sizex < UI_UNIT_X * 7 && panel->sizex != 0);
|
||||
|
||||
PointerRNA ptr;
|
||||
shaderfx_panel_get_property_pointers(C, panel, NULL, &ptr);
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
ShaderFxData *fx = (ShaderFxData *)ptr.data;
|
||||
|
||||
const ShaderFxTypeInfo *fxti = BKE_shaderfx_get_info(fx->type);
|
||||
|
||||
UI_block_lock_set(uiLayoutGetBlock(layout), (ob && ID_IS_LINKED(ob)), ERROR_LIBDATA_MESSAGE);
|
||||
|
||||
/* Effect type icon. */
|
||||
uiLayout *row = uiLayoutRow(layout, false);
|
||||
if (fxti->isDisabled && fxti->isDisabled(fx, 0)) {
|
||||
uiLayoutSetRedAlert(row, true);
|
||||
}
|
||||
uiItemL(row, "", RNA_struct_ui_icon(ptr.type));
|
||||
|
||||
/* Effect name. */
|
||||
if (!narrow_panel) {
|
||||
uiItemR(layout, &ptr, "name", 0, "", ICON_NONE);
|
||||
}
|
||||
|
||||
/* Mode enabling buttons. */
|
||||
row = uiLayoutRow(layout, true);
|
||||
if (fxti->flags & eShaderFxTypeFlag_SupportsEditmode) {
|
||||
uiLayout *sub = uiLayoutRow(row, true);
|
||||
uiLayoutSetActive(sub, false);
|
||||
uiItemR(sub, &ptr, "show_in_editmode", 0, "", ICON_NONE);
|
||||
}
|
||||
uiItemR(row, &ptr, "show_viewport", 0, "", ICON_NONE);
|
||||
uiItemR(row, &ptr, "show_render", 0, "", ICON_NONE);
|
||||
|
||||
row = uiLayoutRow(layout, false);
|
||||
uiLayoutSetEmboss(row, UI_EMBOSS_NONE);
|
||||
uiItemO(row, "", ICON_X, "OBJECT_OT_shaderfx_remove");
|
||||
|
||||
/* Some padding so the X isn't too close to the drag icon. */
|
||||
uiItemS(layout);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name ShaderFx Registration Helpers
|
||||
* \{ */
|
||||
|
||||
static bool shaderfx_ui_poll(const bContext *C, PanelType *UNUSED(pt))
|
||||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
|
||||
return (ob != NULL) && (ob->type == OB_GPENCIL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a panel in the context's region
|
||||
*/
|
||||
PanelType *shaderfx_panel_register(ARegionType *region_type, ShaderFxType type, PanelDrawFn draw)
|
||||
{
|
||||
|
||||
/* Get the name for the effect's panel. */
|
||||
char panel_idname[BKE_ST_MAXNAME];
|
||||
BKE_shaderfxType_panel_id(type, panel_idname);
|
||||
|
||||
PanelType *panel_type = MEM_callocN(sizeof(PanelType), panel_idname);
|
||||
|
||||
strcpy(panel_type->idname, panel_idname);
|
||||
strcpy(panel_type->label, "");
|
||||
strcpy(panel_type->context, "shaderfx");
|
||||
strcpy(panel_type->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
|
||||
|
||||
panel_type->draw_header = shaderfx_panel_header;
|
||||
panel_type->draw = draw;
|
||||
panel_type->poll = shaderfx_ui_poll;
|
||||
|
||||
/* Give the panel the special flag that says it was built here and corresponds to a
|
||||
* shader effect rather than a PanelType. */
|
||||
panel_type->flag = PNL_LAYOUT_HEADER_EXPAND | PNL_DRAW_BOX | PNL_INSTANCED;
|
||||
panel_type->reorder = shaderfx_reorder;
|
||||
panel_type->get_list_data_expand_flag = get_shaderfx_expand_flag;
|
||||
panel_type->set_list_data_expand_flag = set_shaderfx_expand_flag;
|
||||
|
||||
BLI_addtail(®ion_type->paneltypes, panel_type);
|
||||
|
||||
return panel_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a child panel to the parent.
|
||||
*
|
||||
* \note To create the panel type's idname, it appends the \a name argument to the \a parent's
|
||||
* idname.
|
||||
*/
|
||||
PanelType *shaderfx_subpanel_register(ARegionType *region_type,
|
||||
const char *name,
|
||||
const char *label,
|
||||
PanelDrawFn draw_header,
|
||||
PanelDrawFn draw,
|
||||
PanelType *parent)
|
||||
{
|
||||
/* Create the subpanel's ID name. */
|
||||
char panel_idname[BKE_ST_MAXNAME];
|
||||
strcpy(panel_idname, parent->idname);
|
||||
strcat(panel_idname, "_");
|
||||
strcat(panel_idname, name);
|
||||
|
||||
PanelType *panel_type = MEM_callocN(sizeof(PanelType), panel_idname);
|
||||
|
||||
strcpy(panel_type->idname, panel_idname);
|
||||
strcpy(panel_type->label, label);
|
||||
strcpy(panel_type->context, "shaderfx");
|
||||
strcpy(panel_type->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
|
||||
|
||||
panel_type->draw_header = draw_header;
|
||||
panel_type->draw = draw;
|
||||
panel_type->poll = shaderfx_ui_poll;
|
||||
panel_type->flag = (PNL_DEFAULT_CLOSED | PNL_DRAW_BOX);
|
||||
|
||||
BLI_assert(parent != NULL);
|
||||
strcpy(panel_type->parent_id, parent->idname);
|
||||
panel_type->parent = parent;
|
||||
BLI_addtail(&parent->children, BLI_genericNodeN(panel_type));
|
||||
BLI_addtail(®ion_type->paneltypes, panel_type);
|
||||
|
||||
return panel_type;
|
||||
}
|
||||
|
||||
/** \} */
|
56
source/blender/shader_fx/intern/FX_ui_common.h
Normal file
56
source/blender/shader_fx/intern/FX_ui_common.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* This program 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 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program 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, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \ingroup modifiers
|
||||
*/
|
||||
|
||||
#ifndef __FX_UI_COMMON_H__
|
||||
#define __FX_UI_COMMON_H__
|
||||
|
||||
#include "FX_shader_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct ARegionType;
|
||||
struct bContext;
|
||||
struct PanelType;
|
||||
struct uiLayout;
|
||||
typedef void (*PanelDrawFn)(const bContext *, Panel *);
|
||||
|
||||
void shaderfx_panel_end(struct uiLayout *layout, PointerRNA *ptr);
|
||||
|
||||
void shaderfx_panel_get_property_pointers(const bContext *C,
|
||||
struct Panel *panel,
|
||||
struct PointerRNA *r_ob_ptr,
|
||||
struct PointerRNA *r_ptr);
|
||||
|
||||
PanelType *shaderfx_panel_register(ARegionType *region_type, ShaderFxType type, PanelDrawFn draw);
|
||||
|
||||
struct PanelType *shaderfx_subpanel_register(struct ARegionType *region_type,
|
||||
const char *name,
|
||||
const char *label,
|
||||
PanelDrawFn draw_header,
|
||||
PanelDrawFn draw,
|
||||
struct PanelType *parent);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __FX_UI_COMMON_H__ */
|
Reference in New Issue
Block a user