From cdcecd5cab0e49114a726cf4ee91318e4e7eac26 Mon Sep 17 00:00:00 2001 From: Yuki Kitagawa Date: Thu, 11 May 2023 22:14:52 +0800 Subject: [PATCH] fix: test object type before executing --- src/solstice/export_constraint.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/solstice/export_constraint.py b/src/solstice/export_constraint.py index c137e7e..d19e637 100644 --- a/src/solstice/export_constraint.py +++ b/src/solstice/export_constraint.py @@ -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