glTF exporter: Tweak for action filter in Collection Export

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
This commit is contained in:
Julien Duroure
2025-01-22 09:08:36 +01:00
parent bec8581916
commit 71d3e32974
2 changed files with 17 additions and 1 deletions

View File

@@ -5,7 +5,7 @@
bl_info = {
'name': 'glTF 2.0 format',
'author': 'Julien Duroure, Scurest, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors',
"version": (4, 4, 34),
"version": (4, 4, 35),
'blender': (4, 4, 0),
'location': 'File > Import-Export',
'description': 'Import-Export as glTF 2.0',
@@ -1099,6 +1099,15 @@ class ExportGLTF2_Base(ConvertGLTF2_Base):
# 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

View File

@@ -650,6 +650,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",