diff --git a/tools/blenvy/assets/operators.py b/tools/blenvy/assets/operators.py index b80b76b..3320d9d 100644 --- a/tools/blenvy/assets/operators.py +++ b/tools/blenvy/assets/operators.py @@ -199,16 +199,16 @@ class OT_test_bevy_assets(Operator): bl_options = {"UNDO"} def execute(self, context): + blenvy = context.window_manager.blenvy blueprints_registry = context.window_manager.blueprints_registry blueprints_registry.add_blueprints_data() blueprints_data = blueprints_registry.blueprints_data settings = {"blueprints_path": "blueprints", "export_gltf_extension": ".glb"} settings = SimpleNamespace(**settings) - for scene in bpy.data.scenes: - if scene.name != "Library": - assets_hierarchy = get_main_scene_assets_tree(scene, blueprints_data, settings) - scene["assets"] = json.dumps(assets_hierarchy) - write_ron_assets_file(scene.name, assets_hierarchy, internal_only=False) + for scene in blenvy.main_scenes: + assets_hierarchy = get_main_scene_assets_tree(scene, blueprints_data, settings) + scene["assets"] = json.dumps(assets_hierarchy) + write_ron_assets_file(scene.name, assets_hierarchy, internal_only=False) return {'FINISHED'} diff --git a/tools/blenvy/assets/ui.py b/tools/blenvy/assets/ui.py index bd0882f..8a474bf 100644 --- a/tools/blenvy/assets/ui.py +++ b/tools/blenvy/assets/ui.py @@ -68,6 +68,7 @@ class Blenvy_assets(bpy.types.Panel): layout = self.layout layout.use_property_split = True layout.use_property_decorate = False # No animation. + blenvy = context.window_manager.blenvy layout.operator(operator="bevyassets.test") @@ -84,18 +85,16 @@ class Blenvy_assets(bpy.types.Panel): settings = SimpleNamespace(**settings) if panel: - for scene in bpy.data.scenes: - if scene.name != "Library": # FIXME: hack for testing - #get_main_scene_assets_tree(scene, blueprints_data, settings) - - user_assets = get_user_assets(scene) - row = panel.row() - 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) - """if scene.name in blueprints_data.blueprint_instances_per_main_scene: - for blueprint_name in blueprints_data.blueprint_instances_per_main_scene[scene.name].keys(): - blueprint = blueprints_data.blueprints_per_name[blueprint_name] - blueprint_assets = get_user_assets(blueprint.collection) - if scene_assets_panel: - 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) + for scene in blenvy.main_scenes: + #get_main_scene_assets_tree(scene, blueprints_data, settings) + user_assets = get_user_assets(scene) + row = panel.row() + 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) + """if scene.name in blueprints_data.blueprint_instances_per_main_scene: + for blueprint_name in blueprints_data.blueprint_instances_per_main_scene[scene.name].keys(): + blueprint = blueprints_data.blueprints_per_name[blueprint_name] + blueprint_assets = get_user_assets(blueprint.collection) + if scene_assets_panel: + 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) """ \ No newline at end of file