Compare commits

...

3 Commits

Author SHA1 Message Date
5a2ec0c328 clean: logging 2022-02-10 11:11:21 +01:00
cc5ceafea9 refactor: use np_load 2022-02-10 10:53:51 +01:00
b1464c9e14 feat: bevel custom profile support 2022-02-10 10:53:40 +01:00
2 changed files with 28 additions and 3 deletions

View File

@ -47,7 +47,10 @@ SHAPEKEY_BLOCK_ATTR = [
'slider_max',
]
CURVE_POINT = [
'location',
'handle_type_2',
]
if bpy.app.version >= (2,93,0):
SUPPORTED_GEOMETRY_NODE_PARAMETERS = (int, str, float)
else:
@ -418,7 +421,8 @@ def dump_modifiers(modifiers: bpy.types.bpy_prop_collection)->dict:
dumped_modifier['settings'] = dumper.dump(modifier.settings)
elif modifier.type == 'UV_PROJECT':
dumped_modifier['projectors'] =[p.object.name for p in modifier.projectors if p and p.object]
elif modifier.type == 'BEVEL' and modifier.profile_type == 'CUSTOM':
dumped_modifier['custom_profile'] = np_dump_collection(modifier.custom_profile.points, CURVE_POINT)
dumped_modifiers.append(dumped_modifier)
return dumped_modifiers
@ -490,11 +494,31 @@ def load_modifiers(dumped_modifiers: list, modifiers: bpy.types.bpy_prop_collect
loaded_modifier.projectors[projector_index].object = target_object
else:
logging.error("Could't load projector target object {projector_object}")
elif loaded_modifier.type == 'BEVEL':
src_cust_profile = dumped_modifier.get('custom_profile')
if src_cust_profile:
dst_points = loaded_modifier.custom_profile.points
# TODO: refactor to be diff-compatible
for p in dst_points:
try:
dst_points.remove(dst_points[0])
except Exception:
break
for i in range(len(src_cust_profile['handle_type_2'])-len(dst_points)):
dst_points.add(0,0)
np_load_collection(src_cust_profile, dst_points, CURVE_POINT)
loaded_modifier.custom_profile.points.update()
def load_modifiers_custom_data(dumped_modifiers: dict, modifiers: bpy.types.bpy_prop_collection):
""" Load modifiers custom data not managed by the dump_anything loader
git
:param dumped_modifiers: modifiers to load
:type dumped_modifiers: dict
:param modifiers: target modifiers collection

View File

@ -581,6 +581,7 @@ class Loader:
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