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
|
||||
|
||||
# MODIFIERS
|
||||
if hasattr(instance, 'modifiers'):
|
||||
modifiers = getattr(instance,'modifiers', None )
|
||||
if modifiers:
|
||||
dumper.include_filter = None
|
||||
dumper.depth = 1
|
||||
data["modifiers"] = {}
|
||||
for index, modifier in enumerate(instance.modifiers):
|
||||
for index, modifier in enumerate(modifiers):
|
||||
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
|
||||
if hasattr(instance, 'constraints'):
|
||||
dumper.depth = 3
|
||||
|
@ -506,12 +506,14 @@ class Loader:
|
||||
T.ColorRampElement: (CONSTRUCTOR_NEW, ["position"]),
|
||||
T.ParticleSettingsTextureSlot: (CONSTRUCTOR_ADD, []),
|
||||
T.Modifier: (CONSTRUCTOR_NEW, ["name", "type"]),
|
||||
T.GpencilModifier: (CONSTRUCTOR_NEW, ["name", "type"]),
|
||||
T.Constraint: (CONSTRUCTOR_NEW, ["type"]),
|
||||
}
|
||||
|
||||
destructors = {
|
||||
T.ColorRampElement: DESTRUCTOR_REMOVE,
|
||||
T.Modifier: DESTRUCTOR_CLEAR,
|
||||
T.GpencilModifier: DESTRUCTOR_CLEAR,
|
||||
T.Constraint: CONSTRUCTOR_NEW,
|
||||
}
|
||||
element_type = element.bl_rna_property.fixed_type
|
||||
@ -574,6 +576,7 @@ class Loader:
|
||||
dst_curve.points[int(point_idx)].location = pos
|
||||
else:
|
||||
dst_curve.points.new(pos[0], pos[1])
|
||||
curves.update()
|
||||
|
||||
def _load_pointer(self, instance, dump):
|
||||
rna_property_type = instance.bl_rna_property.fixed_type
|
||||
|
Reference in New Issue
Block a user