mirror of
https://github.com/kaosat-dev/Blender_bevy_components_workflow.git
synced 2024-11-26 21:37:01 +00:00
Compare commits
No commits in common. "ec95ab5541eef93cc32b45d2f99cae030be01fd9" and "f9cb6de4bc89068afe7169239089faeec7a58c1f" have entirely different histories.
ec95ab5541
...
f9cb6de4bc
@ -65,10 +65,10 @@ Components:
|
|||||||
- [ ] handle missing types in registry for keys & values
|
- [ ] handle missing types in registry for keys & values
|
||||||
|
|
||||||
- [ ] Add correct upgrade handling from individual component to bevy_components
|
- [ ] Add correct upgrade handling from individual component to bevy_components
|
||||||
- [x] Settings handling:
|
- [ ] Settings handling:
|
||||||
- [x] move saveable settings out to a settings file
|
- [ ] move saveable settings out to a settings file
|
||||||
- [x] update save & load
|
- [ ] update save & load
|
||||||
- [x] add handling of polling frequency & enabling
|
- [ ] add handling of polling frequency & enabling
|
||||||
|
|
||||||
|
|
||||||
General things to solve:
|
General things to solve:
|
||||||
@ -103,7 +103,7 @@ General issues:
|
|||||||
- [x] fix auto export workflow
|
- [x] fix auto export workflow
|
||||||
- [ ] should we write the previous _xxx data only AFTER a sucessfull export only ?
|
- [ ] should we write the previous _xxx data only AFTER a sucessfull export only ?
|
||||||
- [x] add hashing of modifiers/ geometry nodes in serialize scene
|
- [x] add hashing of modifiers/ geometry nodes in serialize scene
|
||||||
- [x] add ability to FORCE export specific blueprints & levels
|
- [ ] add ability to FORCE export specific blueprints & levels
|
||||||
- [ ] undo after a save removes any saved "serialized scene" data ? DIG into this
|
- [ ] undo after a save removes any saved "serialized scene" data ? DIG into this
|
||||||
- [ ] handle scene renames between saves (breaks diffing)
|
- [ ] handle scene renames between saves (breaks diffing)
|
||||||
- [ ] change scene selector to work on actual scenes aka to deal with renamed scenes
|
- [ ] change scene selector to work on actual scenes aka to deal with renamed scenes
|
||||||
|
@ -2,11 +2,7 @@
|
|||||||
from blenvy.core.scene_helpers import get_main_and_library_scenes
|
from blenvy.core.scene_helpers import get_main_and_library_scenes
|
||||||
from blenvy.blueprints.blueprint_helpers import find_blueprints_not_on_disk
|
from blenvy.blueprints.blueprint_helpers import find_blueprints_not_on_disk
|
||||||
|
|
||||||
|
# TODO: this should also take the split/embed mode into account: if a nested collection changes AND embed is active, its container collection should also be exported
|
||||||
def is_blueprint_always_export(blueprint):
|
|
||||||
return blueprint.collection['always_export'] if 'always_export' in blueprint.collection else False
|
|
||||||
|
|
||||||
# this also takes the split/embed mode into account: if a nested collection changes AND embed is active, its container collection should also be exported
|
|
||||||
def get_blueprints_to_export(changes_per_scene, changed_export_parameters, blueprints_data, settings):
|
def get_blueprints_to_export(changes_per_scene, changed_export_parameters, blueprints_data, settings):
|
||||||
export_gltf_extension = getattr(settings, "export_gltf_extension", ".glb")
|
export_gltf_extension = getattr(settings, "export_gltf_extension", ".glb")
|
||||||
blueprints_path_full = getattr(settings,"blueprints_path_full", "")
|
blueprints_path_full = getattr(settings,"blueprints_path_full", "")
|
||||||
@ -37,10 +33,8 @@ def get_blueprints_to_export(changes_per_scene, changed_export_parameters, bluep
|
|||||||
# FIXME: double check this: why are we combining these two ?
|
# FIXME: double check this: why are we combining these two ?
|
||||||
changed_blueprints += changed_local_blueprints
|
changed_blueprints += changed_local_blueprints
|
||||||
|
|
||||||
# also deal with blueprints that are always marked as "always_export"
|
|
||||||
blueprints_always_export = [blueprint for blueprint in internal_blueprints if is_blueprint_always_export(blueprint)]
|
|
||||||
|
|
||||||
blueprints_to_export = list(set(changed_blueprints + blueprints_not_on_disk + blueprints_always_export))
|
blueprints_to_export = list(set(changed_blueprints + blueprints_not_on_disk))
|
||||||
|
|
||||||
|
|
||||||
# filter out blueprints that are not marked & deal with the different combine modes
|
# filter out blueprints that are not marked & deal with the different combine modes
|
||||||
|
@ -15,10 +15,9 @@ def prepare_and_export():
|
|||||||
# determine changed objects
|
# determine changed objects
|
||||||
per_scene_changes = get_changes_per_scene(settings=blenvy)
|
per_scene_changes = get_changes_per_scene(settings=blenvy)
|
||||||
# determine changed parameters
|
# determine changed parameters
|
||||||
setting_changes = False # get_setting_changes()
|
setting_changes = get_setting_changes()
|
||||||
# do the actual export
|
# do the actual export
|
||||||
blenvy.auto_export.dry_run = 'NO_EXPORT'#'DISABLED'#
|
# auto_export(per_scene_changes, setting_changes, blenvy)
|
||||||
auto_export(per_scene_changes, setting_changes, blenvy)
|
|
||||||
|
|
||||||
# cleanup
|
# cleanup
|
||||||
# TODO: these are likely obsolete
|
# TODO: these are likely obsolete
|
||||||
|
@ -77,14 +77,14 @@ class AutoExportTracker(PropertyGroup):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def deps_post_update_handler(cls, scene, depsgraph):
|
def deps_post_update_handler(cls, scene, depsgraph):
|
||||||
# print("change detection enabled", cls.change_detection_enabled)
|
# print("change detection enabled", cls.change_detection_enabled)
|
||||||
#print("change detected", list(map(lambda x: x.name, list(bpy.data.scenes))))
|
print("change detected", list(map(lambda x: x.name, list(bpy.data.scenes))))
|
||||||
|
|
||||||
"""ops = bpy.context.window_manager.operators
|
"""ops = bpy.context.window_manager.operators
|
||||||
print("last operators", ops)
|
print("last operators", ops)
|
||||||
for op in ops:
|
for op in ops:
|
||||||
print("operator", op)"""
|
print("operator", op)"""
|
||||||
active_operator = getattr(bpy.context.active_operator, 'active_operator' , None)
|
active_operator = bpy.context.active_operator
|
||||||
if active_operator is not None:
|
if active_operator:
|
||||||
#print("Operator", active_operator.bl_label, active_operator.bl_idname)
|
#print("Operator", active_operator.bl_label, active_operator.bl_idname)
|
||||||
if active_operator.bl_idname == "EXPORT_SCENE_OT_gltf" and active_operator.gltf_export_id == "gltf_auto_export":
|
if active_operator.bl_idname == "EXPORT_SCENE_OT_gltf" and active_operator.gltf_export_id == "gltf_auto_export":
|
||||||
# we backup any existing gltf export settings, if there were any
|
# we backup any existing gltf export settings, if there were any
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import bpy
|
|
||||||
from blenvy.core.scene_helpers import get_main_and_library_scenes
|
from blenvy.core.scene_helpers import get_main_and_library_scenes
|
||||||
from blenvy.blueprints.blueprint_helpers import check_if_blueprint_on_disk
|
from blenvy.blueprints.blueprint_helpers import check_if_blueprint_on_disk
|
||||||
|
|
||||||
@ -34,32 +33,19 @@ def changed_object_in_scene(scene_name, changes_per_scene, blueprints_data, coll
|
|||||||
return level_needs_export
|
return level_needs_export
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def is_level_always_export(scene_name):
|
|
||||||
scene = bpy.data.scenes[scene_name]
|
|
||||||
return scene['always_export'] if 'always_export' in scene else False
|
|
||||||
|
|
||||||
def should_level_be_exported(scene_name, changed_export_parameters, changes_per_scene, blueprints_data, settings):
|
# this also takes the split/embed mode into account: if a collection instance changes AND embed is active, its container level/world should also be exported
|
||||||
|
def get_levels_to_export(changes_per_scene, changed_export_parameters, blueprints_data, settings):
|
||||||
export_gltf_extension = getattr(settings, "export_gltf_extension")
|
export_gltf_extension = getattr(settings, "export_gltf_extension")
|
||||||
levels_path_full = getattr(settings, "levels_path_full")
|
levels_path_full = getattr(settings, "levels_path_full")
|
||||||
|
|
||||||
change_detection = getattr(settings.auto_export, "change_detection")
|
change_detection = getattr(settings.auto_export, "change_detection")
|
||||||
collection_instances_combine_mode = getattr(settings.auto_export, "collection_instances_combine_mode")
|
collection_instances_combine_mode = getattr(settings.auto_export, "collection_instances_combine_mode")
|
||||||
|
|
||||||
# the list of conditions to determine IF a level should be exported or not
|
|
||||||
return (
|
|
||||||
not change_detection
|
|
||||||
or changed_export_parameters
|
|
||||||
or is_level_always_export(scene_name)
|
|
||||||
or scene_name in changes_per_scene.keys()
|
|
||||||
or changed_object_in_scene(scene_name, changes_per_scene, blueprints_data, collection_instances_combine_mode)
|
|
||||||
or not check_if_blueprint_on_disk(scene_name, levels_path_full, export_gltf_extension)
|
|
||||||
)
|
|
||||||
|
|
||||||
# this also takes the split/embed mode into account: if a collection instance changes AND embed is active, its container level/world should also be exported
|
|
||||||
def get_levels_to_export(changes_per_scene, changed_export_parameters, blueprints_data, settings):
|
|
||||||
[main_scene_names, level_scenes, library_scene_names, library_scenes] = get_main_and_library_scenes(settings)
|
[main_scene_names, level_scenes, library_scene_names, library_scenes] = get_main_and_library_scenes(settings)
|
||||||
|
|
||||||
# determine list of main scenes to export
|
# determine list of main scenes to export
|
||||||
# we have more relaxed rules to determine if the main scenes have changed : any change is ok, (allows easier handling of changes, render settings etc)
|
# we have more relaxed rules to determine if the main scenes have changed : any change is ok, (allows easier handling of changes, render settings etc)
|
||||||
main_scenes_to_export = [scene_name for scene_name in main_scene_names if should_level_be_exported(scene_name, changed_export_parameters, changes_per_scene, blueprints_data, settings)]
|
main_scenes_to_export = [scene_name for scene_name in main_scene_names if not change_detection or changed_export_parameters or scene_name in changes_per_scene.keys() or changed_object_in_scene(scene_name, changes_per_scene, blueprints_data, collection_instances_combine_mode) or not check_if_blueprint_on_disk(scene_name, levels_path_full, export_gltf_extension) ]
|
||||||
|
|
||||||
return (main_scenes_to_export)
|
return (main_scenes_to_export)
|
@ -5,7 +5,7 @@ def get_user_assets(scene_or_collection):
|
|||||||
return user_assets
|
return user_assets
|
||||||
|
|
||||||
def get_generated_assets(scene_or_collection):
|
def get_generated_assets(scene_or_collection):
|
||||||
generated_assets = getattr(scene_or_collection, 'generated_assets', [])
|
generated_assets = []
|
||||||
return generated_assets
|
return generated_assets
|
||||||
|
|
||||||
def get_user_assets_as_list(scene_or_collection):
|
def get_user_assets_as_list(scene_or_collection):
|
||||||
@ -20,20 +20,8 @@ def upsert_asset(scene_or_collection, asset):
|
|||||||
new_asset.name = asset["name"]
|
new_asset.name = asset["name"]
|
||||||
new_asset.path = asset["path"]
|
new_asset.path = asset["path"]
|
||||||
|
|
||||||
def remove_asset(scene_or_collection, ref_asset):
|
def remove_asset(scene_or_collection, asset):
|
||||||
print("to remove", ref_asset["path"], scene_or_collection.user_assets.find(ref_asset["path"]), scene_or_collection.user_assets)
|
scene_or_collection.user_assets.remove(scene_or_collection.user_assets.find(asset["path"]))
|
||||||
removal_index = -1
|
|
||||||
for index, asset in enumerate(scene_or_collection.user_assets):
|
|
||||||
print("asset in list", asset.name, asset.path)
|
|
||||||
if asset.path == ref_asset["path"]:
|
|
||||||
print("FOUND", index)
|
|
||||||
removal_index = index
|
|
||||||
break
|
|
||||||
#scene_or_collection.user_assets.find(lambda x,y : print(x))
|
|
||||||
if removal_index != -1 :
|
|
||||||
print("REMOVE")
|
|
||||||
scene_or_collection.user_assets.remove(removal_index)
|
|
||||||
#scene_or_collection.user_assets.remove(scene_or_collection.user_assets.find(ref_asset["path"]))
|
|
||||||
|
|
||||||
def does_asset_exist(scene_or_collection, ref_asset):
|
def does_asset_exist(scene_or_collection, ref_asset):
|
||||||
user_assets = getattr(scene_or_collection, 'user_assets', [])
|
user_assets = getattr(scene_or_collection, 'user_assets', [])
|
||||||
|
@ -32,7 +32,7 @@ class AssetsRegistry(PropertyGroup):
|
|||||||
asset_path_selector: StringProperty(
|
asset_path_selector: StringProperty(
|
||||||
name="asset path",
|
name="asset path",
|
||||||
description="path of asset to add",
|
description="path of asset to add",
|
||||||
#subtype='FILE_PATH'
|
subtype='FILE_PATH'
|
||||||
) # type: ignore
|
) # type: ignore
|
||||||
|
|
||||||
|
|
||||||
@ -40,10 +40,6 @@ class AssetsRegistry(PropertyGroup):
|
|||||||
def register(cls):
|
def register(cls):
|
||||||
bpy.types.Scene.user_assets = CollectionProperty(name="user assets", type=Asset)
|
bpy.types.Scene.user_assets = CollectionProperty(name="user assets", type=Asset)
|
||||||
bpy.types.Collection.user_assets = CollectionProperty(name="user assets", type=Asset)
|
bpy.types.Collection.user_assets = CollectionProperty(name="user assets", type=Asset)
|
||||||
|
|
||||||
bpy.types.Scene.generated_assets = CollectionProperty(name="generated assets", type=Asset)
|
|
||||||
bpy.types.Collection.generated_assets = CollectionProperty(name="generated assets", type=Asset)
|
|
||||||
|
|
||||||
bpy.types.WindowManager.assets_registry = PointerProperty(type=AssetsRegistry)
|
bpy.types.WindowManager.assets_registry = PointerProperty(type=AssetsRegistry)
|
||||||
|
|
||||||
|
|
||||||
@ -53,9 +49,6 @@ class AssetsRegistry(PropertyGroup):
|
|||||||
del bpy.types.Scene.user_assets
|
del bpy.types.Scene.user_assets
|
||||||
del bpy.types.Collection.user_assets
|
del bpy.types.Collection.user_assets
|
||||||
|
|
||||||
del bpy.types.Scene.generated_assets
|
|
||||||
del bpy.types.Collection.generated_assets
|
|
||||||
|
|
||||||
def add_asset(self, name, type, path, internal): # internal means it cannot be edited by the user, aka auto generated
|
def add_asset(self, name, type, path, internal): # internal means it cannot be edited by the user, aka auto generated
|
||||||
in_list = [asset for asset in self.assets_list if (asset["path"] == path)]
|
in_list = [asset for asset in self.assets_list if (asset["path"] == path)]
|
||||||
in_list = len(in_list) > 0
|
in_list = len(in_list) > 0
|
||||||
|
@ -63,7 +63,7 @@ def get_userTextures():
|
|||||||
|
|
||||||
def get_blueprint_assets_tree(blueprint, blueprints_data, parent, settings):
|
def get_blueprint_assets_tree(blueprint, blueprints_data, parent, settings):
|
||||||
blueprints_path = getattr(settings, "blueprints_path")
|
blueprints_path = getattr(settings, "blueprints_path")
|
||||||
export_gltf_extension = getattr(settings.auto_export, "export_gltf_extension", ".glb")
|
export_gltf_extension = getattr(settings, "export_gltf_extension")
|
||||||
assets_list = []
|
assets_list = []
|
||||||
|
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ def get_blueprint_assets_tree(blueprint, blueprints_data, parent, settings):
|
|||||||
|
|
||||||
def get_main_scene_assets_tree(main_scene, blueprints_data, settings):
|
def get_main_scene_assets_tree(main_scene, blueprints_data, settings):
|
||||||
blueprints_path = getattr(settings, "blueprints_path")
|
blueprints_path = getattr(settings, "blueprints_path")
|
||||||
export_gltf_extension = getattr(settings.auto_export, "export_gltf_extension", ".glb")
|
export_gltf_extension = getattr(settings, "export_gltf_extension")
|
||||||
blueprint_instance_names_for_scene = blueprints_data.blueprint_instances_per_main_scene.get(main_scene.name, None)
|
blueprint_instance_names_for_scene = blueprints_data.blueprint_instances_per_main_scene.get(main_scene.name, None)
|
||||||
|
|
||||||
assets_list = get_user_assets_as_list(main_scene)
|
assets_list = get_user_assets_as_list(main_scene)
|
||||||
|
@ -115,14 +115,12 @@ class OT_remove_bevy_asset(Operator):
|
|||||||
|
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
print("REMOVE ASSET", self.target_name, self.target_type, self.asset_path)
|
|
||||||
assets = []
|
assets = []
|
||||||
blueprint_assets = self.target_type == 'BLUEPRINT'
|
blueprint_assets = self.target_type == 'BLUEPRINT'
|
||||||
if blueprint_assets:
|
if blueprint_assets:
|
||||||
target = bpy.data.collections[self.target_name]
|
target = bpy.data.collections[self.target_name]
|
||||||
else:
|
else:
|
||||||
target = bpy.data.scenes[self.target_name]
|
target = bpy.data.scenes[self.target_name]
|
||||||
print("removing this", target)
|
|
||||||
remove_asset(target, {"path": self.asset_path})
|
remove_asset(target, {"path": self.asset_path})
|
||||||
|
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
@ -130,7 +128,6 @@ class OT_remove_bevy_asset(Operator):
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
from bpy_extras.io_utils import ImportHelper
|
from bpy_extras.io_utils import ImportHelper
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
class OT_Add_asset_filebrowser(Operator, ImportHelper):
|
class OT_Add_asset_filebrowser(Operator, ImportHelper):
|
||||||
"""Browse for asset files"""
|
"""Browse for asset files"""
|
||||||
@ -145,7 +142,7 @@ class OT_Add_asset_filebrowser(Operator, ImportHelper):
|
|||||||
) # type: ignore
|
) # type: ignore
|
||||||
|
|
||||||
# Filters files
|
# Filters files
|
||||||
filter_glob: StringProperty(options={'HIDDEN'}, default='*.*') # type: ignore
|
filter_glob: StringProperty(options={'HIDDEN'}, default='*.jpg;*.jpeg;*.png;*.bmp') # type: ignore
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
blenvy = context.window_manager.blenvy
|
blenvy = context.window_manager.blenvy
|
||||||
@ -160,13 +157,9 @@ class OT_Add_asset_filebrowser(Operator, ImportHelper):
|
|||||||
|
|
||||||
assets_registry = context.window_manager.assets_registry
|
assets_registry = context.window_manager.assets_registry
|
||||||
assets_registry.asset_path_selector = asset_path
|
assets_registry.asset_path_selector = asset_path
|
||||||
if assets_registry.asset_name_selector == "":
|
|
||||||
assets_registry.asset_name_selector = Path(os.path.basename(asset_path)).stem
|
|
||||||
|
|
||||||
print("SELECTED ASSET PATH", asset_path)
|
print("SELECTED ASSET PATH", asset_path)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,41 +1,34 @@
|
|||||||
from types import SimpleNamespace
|
from types import SimpleNamespace
|
||||||
import bpy
|
import bpy
|
||||||
from .assets_scan import get_main_scene_assets_tree
|
from .assets_scan import get_main_scene_assets_tree
|
||||||
from .asset_helpers import get_user_assets, does_asset_exist
|
from .asset_helpers import get_user_assets
|
||||||
|
|
||||||
|
|
||||||
def draw_assets(layout, name, title, asset_registry, target_type, target_name, editable=True, user_assets= [], generated_assets = []):
|
def draw_assets(layout, name, title, asset_registry, target_type, target_name, editable=True, user_assets= [], generated_assets = []):
|
||||||
number_of_user_assets = len(user_assets)
|
|
||||||
number_of_generated_assets = len(generated_assets)
|
|
||||||
|
|
||||||
header, panel = layout.panel(f"assets{name}", default_closed=False)
|
header, panel = layout.panel(f"assets{name}", default_closed=False)
|
||||||
header.label(text=title + f"({number_of_user_assets + number_of_generated_assets})", icon="ASSET_MANAGER")
|
header.label(text=title)
|
||||||
|
|
||||||
if panel:
|
if panel:
|
||||||
if editable:
|
if editable:
|
||||||
row = panel.row()
|
row = panel.row()
|
||||||
blueprint_assets = target_type == 'BLUEPRINT'
|
|
||||||
if blueprint_assets:
|
|
||||||
target = bpy.data.collections[target_name]
|
|
||||||
else:
|
|
||||||
target = bpy.data.scenes[target_name]
|
|
||||||
|
|
||||||
add_possible = does_asset_exist(target, {"path": asset_registry.asset_path_selector}) #"name": asset_registry.asset_name_selector,
|
|
||||||
|
|
||||||
row.alert = add_possible
|
|
||||||
row.prop(asset_registry, "asset_name_selector", text="")
|
row.prop(asset_registry, "asset_name_selector", text="")
|
||||||
row.label(text=asset_registry.asset_path_selector)
|
row.prop(asset_registry, "asset_type_selector", text="")
|
||||||
asset_selector = row.operator(operator="asset.open_filebrowser", text="", icon="FILE_FOLDER")
|
asset_selector = row.operator(operator="asset.open_filebrowser", text="", icon="FILE_FOLDER")
|
||||||
|
|
||||||
add_asset_layout = row.column()
|
if asset_registry.asset_type_selector == 'IMAGE':
|
||||||
add_asset_layout.enabled = not add_possible
|
asset_selector.filter_glob = '*.jpg;*.jpeg;*.png;*.bmp'
|
||||||
|
if asset_registry.asset_type_selector == 'MODEL':
|
||||||
|
asset_selector.filter_glob="*.glb;*.gltf"
|
||||||
|
if asset_registry.asset_type_selector == 'TEXT':
|
||||||
|
asset_selector.filter_glob="*.txt;*.md;*.ron;*.json"
|
||||||
|
if asset_registry.asset_type_selector == 'AUDIO':
|
||||||
|
asset_selector.filter_glob="*.mp3;*.wav;*.flac"
|
||||||
|
|
||||||
add_asset = add_asset_layout.operator(operator="bevyassets.add", text="", icon="ADD")
|
add_asset = row.operator(operator="bevyassets.add", text="", icon="ADD")
|
||||||
add_asset.target_type = target_type
|
add_asset.target_type = target_type
|
||||||
add_asset.target_name = target_name
|
add_asset.target_name = target_name
|
||||||
add_asset.asset_name = asset_registry.asset_name_selector
|
add_asset.asset_name = asset_registry.asset_name_selector
|
||||||
add_asset.asset_type = asset_registry.asset_type_selector
|
add_asset.asset_type = asset_registry.asset_type_selector
|
||||||
add_asset.asset_path = asset_registry.asset_path_selector
|
add_asset.asset_path = asset_registry.asset_path_selector
|
||||||
|
|
||||||
panel.separator()
|
panel.separator()
|
||||||
|
|
||||||
for asset in user_assets:
|
for asset in user_assets:
|
||||||
@ -95,8 +88,9 @@ class Blenvy_assets(bpy.types.Panel):
|
|||||||
#print("dfs")
|
#print("dfs")
|
||||||
for scene_selector in blenvy.main_scenes:
|
for scene_selector in blenvy.main_scenes:
|
||||||
scene = bpy.data.scenes[scene_selector.name]
|
scene = bpy.data.scenes[scene_selector.name]
|
||||||
|
#get_main_scene_assets_tree(scene, blueprints_data, settings)
|
||||||
user_assets = get_user_assets(scene)
|
user_assets = get_user_assets(scene)
|
||||||
|
#print("user assets", user_assets, scene)
|
||||||
row = panel.row()
|
row = panel.row()
|
||||||
row.prop(scene, "always_export")
|
row.prop(scene, "always_export")
|
||||||
|
|
||||||
|
@ -72,3 +72,6 @@ class BlueprintsRegistry(PropertyGroup):
|
|||||||
blueprints_data = blueprints_scan(level_scenes, library_scenes, settings)
|
blueprints_data = blueprints_scan(level_scenes, library_scenes, settings)
|
||||||
self.blueprints_data = blueprints_data
|
self.blueprints_data = blueprints_data
|
||||||
return blueprints_data
|
return blueprints_data
|
||||||
|
#print("bla", self.blueprints_data)
|
||||||
|
"""for blueprint in blueprints_data.blueprints:
|
||||||
|
self.add_blueprint(blueprint)"""
|
||||||
|
@ -2,7 +2,6 @@ import os
|
|||||||
import bpy
|
import bpy
|
||||||
from bpy_types import (Operator)
|
from bpy_types import (Operator)
|
||||||
from bpy.props import (StringProperty)
|
from bpy.props import (StringProperty)
|
||||||
from blenvy.core.helpers_collections import set_active_collection
|
|
||||||
|
|
||||||
class OT_select_blueprint(Operator):
|
class OT_select_blueprint(Operator):
|
||||||
"""Select blueprint """
|
"""Select blueprint """
|
||||||
@ -28,8 +27,7 @@ class OT_select_blueprint(Operator):
|
|||||||
bpy.ops.object.select_all(action='DESELECT')
|
bpy.ops.object.select_all(action='DESELECT')
|
||||||
bpy.context.window.scene = scene
|
bpy.context.window.scene = scene
|
||||||
bpy.context.view_layer.objects.active = None
|
bpy.context.view_layer.objects.active = None
|
||||||
set_active_collection(scene, self.blueprint_collection_name)
|
bpy.context.view_layer.active_layer_collection = bpy.context.view_layer.layer_collection.children[self.blueprint_collection_name]
|
||||||
#bpy.context.view_layer.active_layer_collection = bpy.context.view_layer.layer_collection.children[self.blueprint_collection_name]
|
|
||||||
#bpy.context.view_layer.collections.active = collection
|
#bpy.context.view_layer.collections.active = collection
|
||||||
# bpy.context.view_layer.active_layer_collection = collection
|
# bpy.context.view_layer.active_layer_collection = collection
|
||||||
"""for o in collection.objects:
|
"""for o in collection.objects:
|
||||||
|
@ -26,30 +26,24 @@ class GLTF_PT_auto_export_blueprints_list(bpy.types.Panel):
|
|||||||
blueprint_registry.refresh_blueprints()
|
blueprint_registry.refresh_blueprints()
|
||||||
|
|
||||||
for blueprint in blueprint_registry.blueprints_data.blueprints:
|
for blueprint in blueprint_registry.blueprints_data.blueprints:
|
||||||
|
row = layout.row()
|
||||||
|
row.label(icon="RIGHTARROW")
|
||||||
|
row.label(text=blueprint.name)
|
||||||
|
|
||||||
header, panel = layout.box().panel(f"blueprint_assets{blueprint.name}", default_closed=True)
|
row.prop(blueprint.collection, "always_export")
|
||||||
if header:
|
|
||||||
header.label(text=blueprint.name)
|
|
||||||
header.prop(blueprint.collection, "always_export")
|
|
||||||
|
|
||||||
if blueprint.local:
|
if blueprint.local:
|
||||||
select_blueprint = header.operator(operator="blueprint.select", text="", icon="RESTRICT_SELECT_OFF")
|
|
||||||
|
select_blueprint = row.operator(operator="blueprint.select", text="", icon="RESTRICT_SELECT_OFF")
|
||||||
|
|
||||||
if blueprint.collection and blueprint.collection.name:
|
if blueprint.collection and blueprint.collection.name:
|
||||||
select_blueprint.blueprint_collection_name = blueprint.collection.name
|
select_blueprint.blueprint_collection_name = blueprint.collection.name
|
||||||
select_blueprint.blueprint_scene_name = blueprint.scene.name
|
select_blueprint.blueprint_scene_name = blueprint.scene.name
|
||||||
|
|
||||||
if panel:
|
|
||||||
split = panel.split(factor=0.005)
|
|
||||||
col = split.column()
|
|
||||||
col.label(text=" ")
|
|
||||||
|
|
||||||
col = split.column()
|
|
||||||
|
|
||||||
if blueprint.local:
|
|
||||||
user_assets = get_user_assets(blueprint.collection)
|
user_assets = get_user_assets(blueprint.collection)
|
||||||
draw_assets(layout=col, name=blueprint.name, title="Assets", asset_registry=asset_registry, user_assets=user_assets, target_type="BLUEPRINT", target_name=blueprint.name)
|
draw_assets(layout=layout, name=blueprint.name, title="Assets", asset_registry=asset_registry, user_assets=user_assets, target_type="BLUEPRINT", target_name=blueprint.name)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
assets = get_user_assets(blueprint.collection)
|
assets = get_user_assets(blueprint.collection)
|
||||||
draw_assets(layout=col, name=blueprint.name, title="Assets", asset_registry=asset_registry, user_assets=user_assets, target_type="BLUEPRINT", target_name=blueprint.name, editable=False)
|
draw_assets(layout=layout, name=blueprint.name, title="Assets", asset_registry=asset_registry, user_assets=user_assets, target_type="BLUEPRINT", target_name=blueprint.name, editable=False)
|
||||||
panel.label(text="External")
|
row.label(text="External")
|
||||||
|
@ -58,12 +58,12 @@ class BLENVY_PT_SidePanel(bpy.types.Panel):
|
|||||||
tool_switch_components.tool = "BLUEPRINTS"
|
tool_switch_components.tool = "BLUEPRINTS"
|
||||||
|
|
||||||
target = row.box() if active_mode == 'LEVELS' else row
|
target = row.box() if active_mode == 'LEVELS' else row
|
||||||
tool_switch_components = target.operator(operator="bevy.tooling_switch", text="", icon="ASSET_MANAGER")
|
tool_switch_components = target.operator(operator="bevy.tooling_switch", text="", icon="PACKAGE")
|
||||||
tool_switch_components.tool = "LEVELS"
|
tool_switch_components.tool = "LEVELS"
|
||||||
|
|
||||||
'''target = row.box() if active_mode == 'ASSETS' else row
|
target = row.box() if active_mode == 'ASSETS' else row
|
||||||
tool_switch_components = target.operator(operator="bevy.tooling_switch", text="", icon="ASSET_MANAGER")
|
tool_switch_components = target.operator(operator="bevy.tooling_switch", text="", icon="ASSET_MANAGER")
|
||||||
tool_switch_components.tool = "ASSETS"'''
|
tool_switch_components.tool = "ASSETS"
|
||||||
|
|
||||||
target = row.box() if active_mode == 'SETTINGS' else row
|
target = row.box() if active_mode == 'SETTINGS' else row
|
||||||
tool_switch_components = target.operator(operator="bevy.tooling_switch", text="", icon="SETTINGS")
|
tool_switch_components = target.operator(operator="bevy.tooling_switch", text="", icon="SETTINGS")
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
from types import SimpleNamespace
|
from types import SimpleNamespace
|
||||||
import bpy
|
import bpy
|
||||||
from ..assets.asset_helpers import get_generated_assets, get_user_assets
|
from ..assets.assets_scan import get_main_scene_assets_tree
|
||||||
|
from ..assets.asset_helpers import get_user_assets
|
||||||
from ..assets.ui import draw_assets
|
from ..assets.ui import draw_assets
|
||||||
|
|
||||||
class Blenvy_levels(bpy.types.Panel):
|
class Blenvy_levels(bpy.types.Panel):
|
||||||
@ -27,16 +28,15 @@ class Blenvy_levels(bpy.types.Panel):
|
|||||||
|
|
||||||
for scene_selector in blenvy.main_scenes:
|
for scene_selector in blenvy.main_scenes:
|
||||||
scene = bpy.data.scenes[scene_selector.name]
|
scene = bpy.data.scenes[scene_selector.name]
|
||||||
header, panel = layout.box().panel(f"level_assets{scene.name}", default_closed=False)
|
header, panel = layout.box().panel(f"assets{scene.name}", default_closed=False)
|
||||||
if header:
|
if header:
|
||||||
header.label(text=scene.name)#, icon="HIDE_OFF")
|
header.label(text=scene.name, icon="HIDE_OFF")
|
||||||
header.prop(scene, "always_export")
|
header.prop(scene, "always_export")
|
||||||
select_level = header.operator(operator="level.select", text="", icon="RESTRICT_SELECT_OFF")
|
select_level = header.operator(operator="level.select", text="", icon="RESTRICT_SELECT_OFF")
|
||||||
select_level.level_name = scene.name
|
select_level.level_name = scene.name
|
||||||
|
|
||||||
if panel:
|
if panel:
|
||||||
user_assets = get_user_assets(scene)
|
user_assets = get_user_assets(scene)
|
||||||
generated_assets = get_generated_assets(scene)
|
|
||||||
row = panel.row()
|
row = panel.row()
|
||||||
#row.label(text="row")
|
#row.label(text="row")
|
||||||
"""col = row.column()
|
"""col = row.column()
|
||||||
@ -53,9 +53,25 @@ class Blenvy_levels(bpy.types.Panel):
|
|||||||
col.label(text=" ")
|
col.label(text=" ")
|
||||||
|
|
||||||
col = split.column()
|
col = split.column()
|
||||||
|
#col.label(text="col in row 2")
|
||||||
|
|
||||||
scene_assets_panel = draw_assets(layout=col, name=f"{scene.name}_assets", title=f"Assets", asset_registry=asset_registry, user_assets=user_assets, generated_assets=generated_assets, target_type="SCENE", target_name=scene.name)
|
scene_assets_panel = draw_assets(layout=col, name=f"{scene.name}_assets", title=f"Assets", asset_registry=asset_registry, user_assets=user_assets, target_type="SCENE", target_name=scene.name)
|
||||||
|
|
||||||
|
|
||||||
settings = {"blueprints_path": "blueprints", "export_gltf_extension": ".glb"}
|
settings = {"blueprints_path": "blueprints", "export_gltf_extension": ".glb"}
|
||||||
settings = SimpleNamespace(**settings)
|
settings = SimpleNamespace(**settings)
|
||||||
|
|
||||||
|
"""if panel:
|
||||||
|
for scene_selector in blenvy.main_scenes:
|
||||||
|
scene = bpy.data.scenes[scene_selector.name]
|
||||||
|
#get_main_scene_assets_tree(scene, blueprints_data, settings)
|
||||||
|
user_assets = get_user_assets(scene)
|
||||||
|
#print("user assets", user_assets, scene)
|
||||||
|
row = panel.row()
|
||||||
|
header.prop(scene, "always_export")
|
||||||
|
|
||||||
|
sub_header, sub_panel = row.box().panel(f"assets{name}", default_closed=False)
|
||||||
|
|
||||||
|
|
||||||
|
scene_assets_panel = draw_assets(layout=sub_panel, name=scene.name, title=f"{scene.name} Assets", asset_registry=asset_registry, user_assets=user_assets, target_type="SCENE", target_name=scene.name)
|
||||||
|
"""
|
Loading…
Reference in New Issue
Block a user