Skip to content

Commit

Permalink
Added check for tagged bones
Browse files Browse the repository at this point in the history
  • Loading branch information
Psycrow101 committed Feb 28, 2023
1 parent 4da456f commit 24a3ece
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions io_scene_rw_anm/export_rw_anm.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ def missing_action(self, context):
self.layout.label(text='No action for active armature. Nothing to export')


def no_tagged_bones(self, context):
self.layout.label(text='No tagged bones in armature. To export animation, you must first import the dff model')


def is_bone_taged(bone):
return bone.get('bone_id') is not None

Expand Down Expand Up @@ -115,6 +119,10 @@ def save(context, filepath, fps, export_version):
context.window_manager.popup_menu(missing_action, title='Error', icon='ERROR')
return {'CANCELLED'}

if not any(is_bone_taged(bone) for bone in arm_obj.data.bones):
context.window_manager.popup_menu(no_tagged_bones, title='Error', icon='ERROR')
return {'CANCELLED'}

anm_act = create_anm_action(context, arm_obj, act, fps)
anm = Anm([AnmChunk(ANM_CHUNK_ID, export_version, anm_act)])
anm.save(filepath)
Expand Down

0 comments on commit 24a3ece

Please sign in to comment.