fix(tools/gltf_auto_export): fixed issue with blueprints export not working anymore (#48)

* now passing the list of all available collections instead of only the dynamic ones
* fixes #47
This commit is contained in:
Mark Moissette 2023-11-14 11:51:49 +01:00 committed by GitHub
parent 66a3d71fe1
commit dd4a04f237
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 10 deletions

View File

@ -292,7 +292,6 @@ def generate_hollow_scene(scene, library_collections):
found = find_layer_collection_recursive(copy_root_collection, bpy.context.view_layer.layer_collection) found = find_layer_collection_recursive(copy_root_collection, bpy.context.view_layer.layer_collection)
if found: if found:
print("FOUND COLLECTION")
# once it's found, set the active layer collection to the one we found # once it's found, set the active layer collection to the one we found
bpy.context.view_layer.active_layer_collection = found bpy.context.view_layer.active_layer_collection = found
@ -305,10 +304,6 @@ def generate_hollow_scene(scene, library_collections):
if object.instance_type == 'COLLECTION' and (object.instance_collection.name in library_collections): if object.instance_type == 'COLLECTION' and (object.instance_collection.name in library_collections):
collection_name = object.instance_collection.name collection_name = object.instance_collection.name
#original_names[object.name] = object.name# + "____bak"
#print("custom properties", object, object.keys(), object.items())
#for k, e in object.items():
# print("custom properties ", k, e)
print("object location", object.location) print("object location", object.location)
original_name = object.name original_name = object.name
original_names.append(original_name) original_names.append(original_name)
@ -332,8 +327,6 @@ def generate_hollow_scene(scene, library_collections):
copy_hollowed_collection_into(root_collection, copy_root_collection) copy_hollowed_collection_into(root_collection, copy_root_collection)
# bpy.data.scenes.remove(temp_scene)
# objs = bpy.data.objects # objs = bpy.data.objects
#objs.remove(objs["Cube"], do_unlink=True) #objs.remove(objs["Cube"], do_unlink=True)
return (temp_scene, original_names) return (temp_scene, original_names)
@ -660,7 +653,7 @@ def auto_export(changes_per_scene, changed_export_parameters):
collections_per_scene = get_collections_per_scene(collections_to_export, library_scenes) collections_per_scene = get_collections_per_scene(collections_to_export, library_scenes)
# collections that do not come from a library should not be exported # collections that do not come from a library should not be exported as seperate blueprints
library_collections = [name for sublist in collections_per_scene.values() for name in sublist] library_collections = [name for sublist in collections_per_scene.values() for name in sublist]
collections_to_export = list(set(collections_to_export).intersection(set(library_collections))) collections_to_export = list(set(collections_to_export).intersection(set(library_collections)))
@ -682,7 +675,7 @@ def auto_export(changes_per_scene, changed_export_parameters):
do_export_main_scene = changed_export_parameters or (scene_name in changes_per_scene.keys() and len(changes_per_scene[scene_name].keys()) > 0) or not check_if_level_on_disk(scene_name, export_levels_path, gltf_extension) do_export_main_scene = changed_export_parameters or (scene_name in changes_per_scene.keys() and len(changes_per_scene[scene_name].keys()) > 0) or not check_if_level_on_disk(scene_name, export_levels_path, gltf_extension)
if do_export_main_scene: if do_export_main_scene:
print(" exporting scene:", scene_name) print(" exporting scene:", scene_name)
export_main_scene(bpy.data.scenes[scene_name], folder_path, addon_prefs, collections_to_export) export_main_scene(bpy.data.scenes[scene_name], folder_path, addon_prefs, collections)
# now deal with blueprints/collections # now deal with blueprints/collections
@ -705,7 +698,6 @@ def auto_export(changes_per_scene, changed_export_parameters):
else: else:
print("dsfsfsdf")
for scene_name in main_scene_names: for scene_name in main_scene_names:
export_main_scene(bpy.data.scenes[scene_name], folder_path, addon_prefs) export_main_scene(bpy.data.scenes[scene_name], folder_path, addon_prefs)