Skip to content

Commit

Permalink
fix(exporter): handle collections and missing attributes to prevent e…
Browse files Browse the repository at this point in the history
…rrors (#255)

Make sure that Collections and Bones don't cause errors since they don't have `i3d_attributes`
  • Loading branch information
NMC-TBone authored Jan 14, 2025
1 parent 83d181d commit bba8269
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion addon/i3dio/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def _export(i3d: I3D, objects: List[BlenderObject], sort_alphabetical: bool = Tr
def _add_object_to_i3d(i3d: I3D, obj: BlenderObject, parent: SceneGraphNode = None,
export_candidates: list = None) -> None:
# Check if object should be excluded from export (including its children)
if obj.i3d_attributes.exclude_from_export:
if hasattr(obj, 'i3d_attributes') and obj.i3d_attributes.exclude_from_export:
logger.info(f"Skipping [{obj.name}] and its children. Excluded from export.")
return

Expand Down
2 changes: 1 addition & 1 deletion addon/i3dio/node_classes/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def populate_xml_element(self):
self._write_properties()
self._write_user_attributes()
self._add_transform_to_xml_element(self._transform_for_conversion)
if not isinstance(self.blender_object, bpy.types.Collection):
if hasattr(self.blender_object, 'i3d_reference') and self.blender_object.type == 'EMPTY':
self._add_reference_file()

def add_child(self, node: SceneGraphNode):
Expand Down

0 comments on commit bba8269

Please sign in to comment.