fix(tools/gltf_auto_export): correctly scan for sub collections in main scenes (#94)

* scans for 'in-use' collections now correctly looks inside sub collections as well
 * removed obsolete .gltf output (keeping only .glb & .gltf+bin+textures
 * closes #92 
 * closes #93
This commit is contained in:
Mark Moissette 2024-01-03 10:45:03 +01:00 committed by GitHub
parent 97e8e8d862
commit 42c1c71b03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 7 deletions

View File

@ -57,7 +57,7 @@ This is a workaround needed because of the way the settings are stored , perhaps
@persistent @persistent
def deps_update_handler(scene, depsgraph): def deps_update_handler(scene, depsgraph):
if scene.name != "temp_scene": # actually do we care about anything else than the main scene(s) ? if scene.name != "temp_scene": # actually do we care about anything else than the main scene(s) ?
print("depsgraph_update_post", scene.name) #print("depsgraph_update_post", scene.name)
print("-------------") print("-------------")
changed = scene.name or "" changed = scene.name or ""

View File

@ -2,11 +2,10 @@ import bpy
from .helpers import traverse_tree from .helpers import traverse_tree
# returns the list of the collections in use for a given scene # returns the list of the collections in use for a given scene
# FIXME: this should also look into sub collections
def get_used_collections(scene): def get_used_collections(scene):
root_collection = scene.collection root_collection = scene.collection
scene_objects = [o for o in root_collection.objects] scene_objects = [o for o in root_collection.all_objects]
collection_names = set() collection_names = set()
used_collections = [] used_collections = []
for object in scene_objects: for object in scene_objects:
@ -117,7 +116,7 @@ def get_exportable_collections(main_scenes, library_scenes, addon_prefs):
children_per_collection = {} children_per_collection = {}
flatten_collection_tree(root_node, children_per_collection) flatten_collection_tree(root_node, children_per_collection)
#print("ROOT NODE", children_per_collection) # #print("ROOT NODE", children_per_collection) #
return (all_collection_names, children_per_collection) return (all_collection_names, children_per_collection)
def get_collections_per_scene(collection_names, library_scenes): def get_collections_per_scene(collection_names, library_scenes):

View File

@ -128,9 +128,6 @@ class AutoExportGltfAddonPreferences(AddonPreferences):
('GLB', 'glTF Binary (.glb)', ('GLB', 'glTF Binary (.glb)',
'Exports a single file, with all data packed in binary form. ' 'Exports a single file, with all data packed in binary form. '
'Most efficient and portable, but more difficult to edit later'), 'Most efficient and portable, but more difficult to edit later'),
('GLTF_EMBEDDED', 'glTF Embedded (.gltf)',
'Exports a single file, with all data packed in JSON. '
'Less efficient than binary, but easier to edit later'),
('GLTF_SEPARATE', 'glTF Separate (.gltf + .bin + textures)', ('GLTF_SEPARATE', 'glTF Separate (.gltf + .bin + textures)',
'Exports multiple files, with separate JSON, binary and texture data. ' 'Exports multiple files, with separate JSON, binary and texture data. '
'Easiest to edit later') 'Easiest to edit later')