fix: test object type before executing

This commit is contained in:
Yuki Kitagawa 2023-05-11 22:14:52 +08:00
parent 9340c074b8
commit cdcecd5cab

View File

@ -90,6 +90,11 @@ class ExportConstraint(bpy.types.Operator):
filepath: bpy.props.StringProperty()
def execute(self, context):
# Assert the selected file is a bone
if context.active_object.type != 'ARMATURE':
self.report({'ERROR'}, "Active object is not an armature.")
return {'CANCELLED'}
# Do something with the selected file path
print("Selected file:", self.filepath)
# Call the function or perform the desired actions using the file path