feat: added initial gpencil modifer support
Related to https://gitlab.com/slumber/multi-user/-/issues/147
This commit is contained in:
@ -271,13 +271,35 @@ class BlObject(BlDatablock):
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
# MODIFIERS
|
# MODIFIERS
|
||||||
if hasattr(instance, 'modifiers'):
|
modifiers = getattr(instance,'modifiers', None )
|
||||||
|
if modifiers:
|
||||||
dumper.include_filter = None
|
dumper.include_filter = None
|
||||||
dumper.depth = 1
|
dumper.depth = 1
|
||||||
data["modifiers"] = {}
|
data["modifiers"] = {}
|
||||||
for index, modifier in enumerate(instance.modifiers):
|
for index, modifier in enumerate(modifiers):
|
||||||
data["modifiers"][modifier.name] = dumper.dump(modifier)
|
data["modifiers"][modifier.name] = dumper.dump(modifier)
|
||||||
|
|
||||||
|
gp_modifiers = getattr(instance, 'grease_pencil_modifiers', None)
|
||||||
|
|
||||||
|
if gp_modifiers:
|
||||||
|
dumper.include_filter = None
|
||||||
|
dumper.depth = 1
|
||||||
|
gp_modifiers_data = data["grease_pencil_modifiers"] = {}
|
||||||
|
|
||||||
|
for index, modifier in enumerate(gp_modifiers):
|
||||||
|
gp_mod_data = gp_modifiers_data[modifier.name] = dict()
|
||||||
|
gp_mod_data.update(dumper.dump(modifier))
|
||||||
|
|
||||||
|
if hasattr(modifier, 'use_custom_curve') \
|
||||||
|
and modifier.use_custom_curve:
|
||||||
|
curve_dumper = Dumper()
|
||||||
|
curve_dumper.depth = 5
|
||||||
|
curve_dumper.include_filter = [
|
||||||
|
'curves',
|
||||||
|
'points',
|
||||||
|
'location']
|
||||||
|
gp_mod_data['curve'] = curve_dumper.dump(modifier.curve)
|
||||||
|
|
||||||
# CONSTRAINTS
|
# CONSTRAINTS
|
||||||
if hasattr(instance, 'constraints'):
|
if hasattr(instance, 'constraints'):
|
||||||
dumper.depth = 3
|
dumper.depth = 3
|
||||||
|
@ -506,12 +506,14 @@ class Loader:
|
|||||||
T.ColorRampElement: (CONSTRUCTOR_NEW, ["position"]),
|
T.ColorRampElement: (CONSTRUCTOR_NEW, ["position"]),
|
||||||
T.ParticleSettingsTextureSlot: (CONSTRUCTOR_ADD, []),
|
T.ParticleSettingsTextureSlot: (CONSTRUCTOR_ADD, []),
|
||||||
T.Modifier: (CONSTRUCTOR_NEW, ["name", "type"]),
|
T.Modifier: (CONSTRUCTOR_NEW, ["name", "type"]),
|
||||||
|
T.GpencilModifier: (CONSTRUCTOR_NEW, ["name", "type"]),
|
||||||
T.Constraint: (CONSTRUCTOR_NEW, ["type"]),
|
T.Constraint: (CONSTRUCTOR_NEW, ["type"]),
|
||||||
}
|
}
|
||||||
|
|
||||||
destructors = {
|
destructors = {
|
||||||
T.ColorRampElement: DESTRUCTOR_REMOVE,
|
T.ColorRampElement: DESTRUCTOR_REMOVE,
|
||||||
T.Modifier: DESTRUCTOR_CLEAR,
|
T.Modifier: DESTRUCTOR_CLEAR,
|
||||||
|
T.GpencilModifier: DESTRUCTOR_CLEAR,
|
||||||
T.Constraint: CONSTRUCTOR_NEW,
|
T.Constraint: CONSTRUCTOR_NEW,
|
||||||
}
|
}
|
||||||
element_type = element.bl_rna_property.fixed_type
|
element_type = element.bl_rna_property.fixed_type
|
||||||
@ -574,6 +576,7 @@ class Loader:
|
|||||||
dst_curve.points[int(point_idx)].location = pos
|
dst_curve.points[int(point_idx)].location = pos
|
||||||
else:
|
else:
|
||||||
dst_curve.points.new(pos[0], pos[1])
|
dst_curve.points.new(pos[0], pos[1])
|
||||||
|
curves.update()
|
||||||
|
|
||||||
def _load_pointer(self, instance, dump):
|
def _load_pointer(self, instance, dump):
|
||||||
rna_property_type = instance.bl_rna_property.fixed_type
|
rna_property_type = instance.bl_rna_property.fixed_type
|
||||||
|
Reference in New Issue
Block a user