Skip to content

Commit

Permalink
Tweak for action filter in Collection Export
Browse files Browse the repository at this point in the history
Waiting a proper solution for props declaration:
- Filter now happen even if the list is not displayed
- Avoid spaming console with error, display a label saying what to do
  • Loading branch information
julienduroure committed Jan 22, 2025
1 parent d66ec14 commit 65e344a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
9 changes: 9 additions & 0 deletions addons/io_scene_gltf2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1109,6 +1109,15 @@ def execute(self, context):
# All custom export settings are stored in this container.
export_settings = {}

# Collection Export does not handle correctly props declaration for now
# So use this tweak to manage it, waiting for a better solution
is_file_browser = context.space_data.type == 'FILE_BROWSER'
if not is_file_browser:
if not hasattr(context.scene, "gltf_action_filter") and self.export_action_filter:
bpy.types.Scene.gltf_action_filter = bpy.props.CollectionProperty(type=GLTF2_filter_action)
bpy.types.Scene.gltf_action_filter_active = bpy.props.IntProperty()


# Get log level from parameters
# If not set, get it from Blender app debug value
export_settings['gltf_loglevel'] = self.export_loglevel
Expand Down
7 changes: 7 additions & 0 deletions addons/io_scene_gltf2/blender/com/gltf2_blender_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,13 @@ def export_panel_animation_action_filter(layout, operator):

row = body.row()

# Collection Export does not handle correctly property declaration
# So use this tweak to avoid spaming the console, waiting for a better solution
is_file_browser = bpy.context.space_data.type == 'FILE_BROWSER'
if not is_file_browser and not hasattr(bpy.data.scenes[0], "gltf_action_filter"):
row.label(text="Please disable/enable 'action filter' to refresh the list")
return

if len(bpy.data.actions) > 0:
row.template_list(
"SCENE_UL_gltf2_filter_action",
Expand Down

0 comments on commit 65e344a

Please sign in to comment.