feat(blenvy): now iterating over main scenes instead of manually filtering scenes out
for blueprints & assets
This commit is contained in:
parent
c2a847934b
commit
70bdd489a1
|
@ -199,16 +199,16 @@ class OT_test_bevy_assets(Operator):
|
||||||
bl_options = {"UNDO"}
|
bl_options = {"UNDO"}
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
|
blenvy = context.window_manager.blenvy
|
||||||
blueprints_registry = context.window_manager.blueprints_registry
|
blueprints_registry = context.window_manager.blueprints_registry
|
||||||
blueprints_registry.add_blueprints_data()
|
blueprints_registry.add_blueprints_data()
|
||||||
blueprints_data = blueprints_registry.blueprints_data
|
blueprints_data = blueprints_registry.blueprints_data
|
||||||
|
|
||||||
settings = {"blueprints_path": "blueprints", "export_gltf_extension": ".glb"}
|
settings = {"blueprints_path": "blueprints", "export_gltf_extension": ".glb"}
|
||||||
settings = SimpleNamespace(**settings)
|
settings = SimpleNamespace(**settings)
|
||||||
for scene in bpy.data.scenes:
|
for scene in blenvy.main_scenes:
|
||||||
if scene.name != "Library":
|
assets_hierarchy = get_main_scene_assets_tree(scene, blueprints_data, settings)
|
||||||
assets_hierarchy = get_main_scene_assets_tree(scene, blueprints_data, settings)
|
scene["assets"] = json.dumps(assets_hierarchy)
|
||||||
scene["assets"] = json.dumps(assets_hierarchy)
|
write_ron_assets_file(scene.name, assets_hierarchy, internal_only=False)
|
||||||
write_ron_assets_file(scene.name, assets_hierarchy, internal_only=False)
|
|
||||||
|
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
|
@ -68,6 +68,7 @@ class Blenvy_assets(bpy.types.Panel):
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
layout.use_property_split = True
|
layout.use_property_split = True
|
||||||
layout.use_property_decorate = False # No animation.
|
layout.use_property_decorate = False # No animation.
|
||||||
|
blenvy = context.window_manager.blenvy
|
||||||
|
|
||||||
layout.operator(operator="bevyassets.test")
|
layout.operator(operator="bevyassets.test")
|
||||||
|
|
||||||
|
@ -84,18 +85,16 @@ class Blenvy_assets(bpy.types.Panel):
|
||||||
settings = SimpleNamespace(**settings)
|
settings = SimpleNamespace(**settings)
|
||||||
|
|
||||||
if panel:
|
if panel:
|
||||||
for scene in bpy.data.scenes:
|
for scene in blenvy.main_scenes:
|
||||||
if scene.name != "Library": # FIXME: hack for testing
|
#get_main_scene_assets_tree(scene, blueprints_data, settings)
|
||||||
#get_main_scene_assets_tree(scene, blueprints_data, settings)
|
user_assets = get_user_assets(scene)
|
||||||
|
row = panel.row()
|
||||||
user_assets = get_user_assets(scene)
|
scene_assets_panel = draw_assets(layout=row, name=scene.name, title=f"{scene.name} Assets", asset_registry=asset_registry, user_assets=user_assets, target_type="SCENE", target_name=scene.name)
|
||||||
row = panel.row()
|
"""if scene.name in blueprints_data.blueprint_instances_per_main_scene:
|
||||||
scene_assets_panel = draw_assets(layout=row, name=scene.name, title=f"{scene.name} Assets", asset_registry=asset_registry, user_assets=user_assets, target_type="SCENE", target_name=scene.name)
|
for blueprint_name in blueprints_data.blueprint_instances_per_main_scene[scene.name].keys():
|
||||||
"""if scene.name in blueprints_data.blueprint_instances_per_main_scene:
|
blueprint = blueprints_data.blueprints_per_name[blueprint_name]
|
||||||
for blueprint_name in blueprints_data.blueprint_instances_per_main_scene[scene.name].keys():
|
blueprint_assets = get_user_assets(blueprint.collection)
|
||||||
blueprint = blueprints_data.blueprints_per_name[blueprint_name]
|
if scene_assets_panel:
|
||||||
blueprint_assets = get_user_assets(blueprint.collection)
|
row = scene_assets_panel.row()
|
||||||
if scene_assets_panel:
|
draw_assets(layout=row, name=blueprint.name, title=f"{blueprint.name} Assets", asset_registry=asset_registry, assets=blueprint_assets, target_type="BLUEPRINT", target_name=blueprint.name)
|
||||||
row = scene_assets_panel.row()
|
|
||||||
draw_assets(layout=row, name=blueprint.name, title=f"{blueprint.name} Assets", asset_registry=asset_registry, assets=blueprint_assets, target_type="BLUEPRINT", target_name=blueprint.name)
|
|
||||||
"""
|
"""
|
Loading…
Reference in New Issue