2024-05-12 09:05:11 +00:00
|
|
|
import bpy
|
2024-05-13 21:36:13 +00:00
|
|
|
import json
|
|
|
|
|
2024-05-16 12:09:40 +00:00
|
|
|
from ..assets.asset_helpers import get_user_assets
|
|
|
|
|
2024-05-13 21:36:13 +00:00
|
|
|
from ..assets.ui import draw_assets
|
2024-05-12 09:05:11 +00:00
|
|
|
|
|
|
|
class GLTF_PT_auto_export_blueprints_list(bpy.types.Panel):
|
|
|
|
bl_space_type = 'VIEW_3D'
|
|
|
|
bl_region_type = 'UI'
|
|
|
|
bl_label = "Blueprints"
|
2024-05-12 10:09:11 +00:00
|
|
|
bl_parent_id = "BLENVY_PT_SidePanel"
|
2024-05-13 21:36:13 +00:00
|
|
|
bl_options = {'DEFAULT_CLOSED','HIDE_HEADER'}
|
2024-05-12 09:05:11 +00:00
|
|
|
|
2024-05-12 10:09:11 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2024-05-25 08:46:14 +00:00
|
|
|
return context.window_manager.blenvy.mode == 'BLUEPRINTS' if 'blenvy' in context.window_manager else False
|
2024-05-12 10:09:11 +00:00
|
|
|
|
2024-05-12 09:05:11 +00:00
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
layout.use_property_split = True
|
|
|
|
layout.use_property_decorate = False # No animation.
|
2024-05-13 21:36:13 +00:00
|
|
|
asset_registry = context.window_manager.assets_registry
|
2024-05-25 08:46:14 +00:00
|
|
|
blueprint_registry = context.window_manager.blueprints_registry
|
2024-05-12 09:05:11 +00:00
|
|
|
|
2024-05-25 08:46:14 +00:00
|
|
|
blueprint_registry.refresh_blueprints()
|
|
|
|
|
|
|
|
for blueprint in blueprint_registry.blueprints_data.blueprints:
|
2024-05-12 09:05:11 +00:00
|
|
|
row = layout.row()
|
2024-05-13 21:36:13 +00:00
|
|
|
row.label(icon="RIGHTARROW")
|
2024-05-12 09:05:11 +00:00
|
|
|
row.label(text=blueprint.name)
|
|
|
|
|
|
|
|
if blueprint.local:
|
2024-05-15 11:25:30 +00:00
|
|
|
|
2024-05-13 21:36:13 +00:00
|
|
|
select_blueprint = row.operator(operator="blueprint.select", text="", icon="RESTRICT_SELECT_OFF")
|
2024-05-15 11:25:30 +00:00
|
|
|
|
|
|
|
if blueprint.collection and blueprint.collection.name:
|
|
|
|
select_blueprint.blueprint_collection_name = blueprint.collection.name
|
2024-05-12 09:05:11 +00:00
|
|
|
select_blueprint.blueprint_scene_name = blueprint.scene.name
|
2024-05-13 21:36:13 +00:00
|
|
|
|
2024-05-16 12:09:40 +00:00
|
|
|
user_assets = get_user_assets(blueprint.collection)
|
|
|
|
draw_assets(layout=layout, name=blueprint.name, title="Assets", asset_registry=asset_registry, user_assets=user_assets, target_type="BLUEPRINT", target_name=blueprint.name)
|
2024-05-13 21:36:13 +00:00
|
|
|
|
2024-05-12 09:05:11 +00:00
|
|
|
else:
|
2024-05-16 12:09:40 +00:00
|
|
|
assets = get_user_assets(blueprint.collection)
|
|
|
|
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)
|
2024-05-12 09:05:11 +00:00
|
|
|
row.label(text="External")
|