mirror of
https://github.com/kaosat-dev/Blender_bevy_components_workflow.git
synced 2024-11-22 20:00:53 +00:00
chore(auto_export): cleanups
This commit is contained in:
parent
ff68109f0f
commit
f224148e1d
@ -5,9 +5,6 @@ from ..helpers.helpers_scenes import (get_scenes, )
|
|||||||
# IF collection_instances_combine_mode is not 'split' check for each scene if any object in changes_per_scene has an instance in the scene
|
# IF collection_instances_combine_mode is not 'split' check for each scene if any object in changes_per_scene has an instance in the scene
|
||||||
def changed_object_in_scene(scene_name, changes_per_scene, blueprints_data, collection_instances_combine_mode):
|
def changed_object_in_scene(scene_name, changes_per_scene, blueprints_data, collection_instances_combine_mode):
|
||||||
# Embed / EmbedExternal
|
# Embed / EmbedExternal
|
||||||
"""if collection_instances_combine_mode == "Split": # 1 => Embed
|
|
||||||
return False"""
|
|
||||||
|
|
||||||
blueprints_from_objects = blueprints_data.blueprints_from_objects
|
blueprints_from_objects = blueprints_data.blueprints_from_objects
|
||||||
|
|
||||||
blueprint_instances_in_scene = blueprints_data.blueprint_instances_per_main_scene.get(scene_name, None)
|
blueprint_instances_in_scene = blueprints_data.blueprint_instances_per_main_scene.get(scene_name, None)
|
||||||
@ -34,7 +31,6 @@ def changed_object_in_scene(scene_name, changes_per_scene, blueprints_data, coll
|
|||||||
# changes => list of changed objects (regardless of wether they have been changed in main scene or in lib scene)
|
# changes => list of changed objects (regardless of wether they have been changed in main scene or in lib scene)
|
||||||
# wich of those objects are blueprint instances
|
# wich of those objects are blueprint instances
|
||||||
# we need a list of changed objects that are blueprint instances
|
# we need a list of changed objects that are blueprint instances
|
||||||
|
|
||||||
return level_needs_export
|
return level_needs_export
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -178,10 +178,10 @@ class AutoExportGLTF(Operator, AutoExportGltfAddonPreferences):#, ExportHelper):
|
|||||||
# if there were no setting before, it is new, we need export
|
# if there were no setting before, it is new, we need export
|
||||||
changed = False
|
changed = False
|
||||||
if previous_auto_settings == None:
|
if previous_auto_settings == None:
|
||||||
print("previous settings missing, exporting")
|
#print("previous settings missing, exporting")
|
||||||
changed = True
|
changed = True
|
||||||
elif previous_gltf_settings == None:
|
elif previous_gltf_settings == None:
|
||||||
print("previous gltf settings missing, exporting")
|
#print("previous gltf settings missing, exporting")
|
||||||
previous_gltf_settings = bpy.data.texts.new(".gltf_auto_export_gltf_settings_previous")
|
previous_gltf_settings = bpy.data.texts.new(".gltf_auto_export_gltf_settings_previous")
|
||||||
previous_gltf_settings.write(json.dumps({}))
|
previous_gltf_settings.write(json.dumps({}))
|
||||||
if current_gltf_settings == None:
|
if current_gltf_settings == None:
|
||||||
@ -194,18 +194,17 @@ class AutoExportGLTF(Operator, AutoExportGltfAddonPreferences):#, ExportHelper):
|
|||||||
auto_settings_changed = sorted(json.loads(previous_auto_settings.as_string()).items()) != sorted(json.loads(current_auto_settings.as_string()).items()) if current_auto_settings != None else False
|
auto_settings_changed = sorted(json.loads(previous_auto_settings.as_string()).items()) != sorted(json.loads(current_auto_settings.as_string()).items()) if current_auto_settings != None else False
|
||||||
gltf_settings_changed = sorted(json.loads(previous_gltf_settings.as_string()).items()) != sorted(json.loads(current_gltf_settings.as_string()).items()) if current_gltf_settings != None else False
|
gltf_settings_changed = sorted(json.loads(previous_gltf_settings.as_string()).items()) != sorted(json.loads(current_gltf_settings.as_string()).items()) if current_gltf_settings != None else False
|
||||||
|
|
||||||
print("auto settings previous", sorted(json.loads(previous_auto_settings.as_string()).items()))
|
"""print("auto settings previous", sorted(json.loads(previous_auto_settings.as_string()).items()))
|
||||||
print("auto settings current", sorted(json.loads(current_auto_settings.as_string()).items()))
|
print("auto settings current", sorted(json.loads(current_auto_settings.as_string()).items()))
|
||||||
print("auto_settings_changed", auto_settings_changed)
|
print("auto_settings_changed", auto_settings_changed)
|
||||||
|
|
||||||
print("gltf settings previous", sorted(json.loads(previous_gltf_settings.as_string()).items()))
|
print("gltf settings previous", sorted(json.loads(previous_gltf_settings.as_string()).items()))
|
||||||
print("gltf settings current", sorted(json.loads(current_gltf_settings.as_string()).items()))
|
print("gltf settings current", sorted(json.loads(current_gltf_settings.as_string()).items()))
|
||||||
print("gltf_settings_changed", gltf_settings_changed)
|
print("gltf_settings_changed", gltf_settings_changed)"""
|
||||||
|
|
||||||
changed = auto_settings_changed or gltf_settings_changed
|
changed = auto_settings_changed or gltf_settings_changed
|
||||||
# now write the current settings to the "previous settings"
|
# now write the current settings to the "previous settings"
|
||||||
if current_auto_settings != None:
|
if current_auto_settings != None:
|
||||||
print("writing settings")
|
|
||||||
previous_auto_settings = bpy.data.texts[".gltf_auto_export_settings_previous"] if ".gltf_auto_export_settings_previous" in bpy.data.texts else bpy.data.texts.new(".gltf_auto_export_settings_previous")
|
previous_auto_settings = bpy.data.texts[".gltf_auto_export_settings_previous"] if ".gltf_auto_export_settings_previous" in bpy.data.texts else bpy.data.texts.new(".gltf_auto_export_settings_previous")
|
||||||
previous_auto_settings.clear()
|
previous_auto_settings.clear()
|
||||||
previous_auto_settings.write(current_auto_settings.as_string()) # TODO : check if this is always valid
|
previous_auto_settings.write(current_auto_settings.as_string()) # TODO : check if this is always valid
|
||||||
@ -294,15 +293,9 @@ class AutoExportGLTF(Operator, AutoExportGltfAddonPreferences):#, ExportHelper):
|
|||||||
changes_per_scene[scene][object_name] = bpy.data.objects[object_name]
|
changes_per_scene[scene][object_name] = bpy.data.objects[object_name]
|
||||||
bubble_up_changes(bpy.data.objects[object_name], changes_per_scene[scene])
|
bubble_up_changes(bpy.data.objects[object_name], changes_per_scene[scene])
|
||||||
# now bubble up for instances & parents
|
# now bubble up for instances & parents
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
previous_stored.clear()
|
previous_stored.clear()
|
||||||
previous_stored.write(json.dumps(current))
|
previous_stored.write(json.dumps(current))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print("changes per scene alternative", changes_per_scene)
|
print("changes per scene alternative", changes_per_scene)
|
||||||
return changes_per_scene
|
return changes_per_scene
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user