From 4ed9d82bf608cda23398d7b5c3eced06159267af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milan=20Hrabovsk=C3=BD?= <70859762+LKAMinco@users.noreply.github.com> Date: Mon, 27 Nov 2023 13:42:00 +0100 Subject: [PATCH] fix(shape node): Fix merge group and skinned mesh export Fix a regression introduced in fbec1706c26ea7c5f5e5f15cc596e8bb407b203e, which renamed the `ShapeNode` constructor parameter `mesh_object` to `shape_object` without updating the super class constructor call for merge groups and skinned meshes. --- addon/i3dio/node_classes/merge_group.py | 2 +- addon/i3dio/node_classes/node.py | 4 +++- addon/i3dio/node_classes/skinned_mesh.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/addon/i3dio/node_classes/merge_group.py b/addon/i3dio/node_classes/merge_group.py index 74ca847..717a3ee 100644 --- a/addon/i3dio/node_classes/merge_group.py +++ b/addon/i3dio/node_classes/merge_group.py @@ -23,7 +23,7 @@ def __init__(self, id_: int, merge_group_object: [bpy.types.Object, None], i3d: parent: [SceneGraphNode or None] = None): self.merge_group_name = i3d.merge_groups[merge_group_object.i3d_merge_group_index].name self.skin_bind_ids = f"{id_:d} " - super().__init__(id_=id_, mesh_object=merge_group_object, i3d=i3d, parent=parent) + super().__init__(id_=id_, shape_object=merge_group_object, i3d=i3d, parent=parent) # Override default shape behaviour to use the merge group mesh name instead of the blender objects name def add_shape(self): diff --git a/addon/i3dio/node_classes/node.py b/addon/i3dio/node_classes/node.py index 0399298..0610100 100644 --- a/addon/i3dio/node_classes/node.py +++ b/addon/i3dio/node_classes/node.py @@ -154,7 +154,9 @@ def _write_user_attributes(self): pass def _add_reference_file(self): - if self.blender_object.i3d_reference_path == "" or not self.blender_object.i3d_reference_path.endswith('.i3d'): + if 'i3d_reference_path' not in self.blender_object.keys(): + return + elif self.blender_object.i3d_reference_path == "" or not self.blender_object.i3d_reference_path.endswith('.i3d'): return self.logger.debug(f"Adding reference file") file_id = self.i3d.add_file_reference(self.blender_object.i3d_reference_path) diff --git a/addon/i3dio/node_classes/skinned_mesh.py b/addon/i3dio/node_classes/skinned_mesh.py index 820baa3..c912675 100644 --- a/addon/i3dio/node_classes/skinned_mesh.py +++ b/addon/i3dio/node_classes/skinned_mesh.py @@ -99,7 +99,7 @@ def __init__(self, id_: int, skinned_mesh_object: bpy.types.Object, i3d: I3D, if modifier.type == 'ARMATURE': self.armature_nodes.append(i3d.add_armature(modifier.object)) self.bone_mapping = ChainMap(*[armature.bone_mapping for armature in self.armature_nodes]) - super().__init__(id_=id_, mesh_object=skinned_mesh_object, i3d=i3d, parent=parent) + super().__init__(id_=id_, shape_object=skinned_mesh_object, i3d=i3d, parent=parent) def add_shape(self): # Use a ChainMap to easily combine multiple bone mappings and get around any problems with multiple bones