2024-06-04 21:16:16 +00:00
|
|
|
from types import SimpleNamespace
|
|
|
|
import bpy
|
2024-06-05 15:09:03 +00:00
|
|
|
from ..assets.asset_helpers import get_generated_assets, get_user_assets
|
2024-06-04 21:16:16 +00:00
|
|
|
from ..assets.ui import draw_assets
|
2024-06-06 18:16:32 +00:00
|
|
|
from ..blueprints.ui import draw_blueprints
|
2024-06-04 21:16:16 +00:00
|
|
|
|
2024-06-12 10:41:50 +00:00
|
|
|
class BLENVY_PT_levels_panel(bpy.types.Panel):
|
2024-06-04 21:16:16 +00:00
|
|
|
bl_space_type = 'VIEW_3D'
|
|
|
|
bl_region_type = 'UI'
|
|
|
|
bl_label = ""
|
|
|
|
bl_parent_id = "BLENVY_PT_SidePanel"
|
|
|
|
bl_options = {'DEFAULT_CLOSED','HIDE_HEADER'}
|
2024-06-12 10:41:50 +00:00
|
|
|
|
2024-06-04 21:16:16 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
|
|
|
return context.window_manager.blenvy.mode == 'LEVELS'
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
layout.use_property_split = True
|
|
|
|
layout.use_property_decorate = False # No animation.
|
|
|
|
blenvy = context.window_manager.blenvy
|
2024-06-12 10:41:50 +00:00
|
|
|
layout.operator(operator="blenvy.assets_generate_files", text="Generate")
|
2024-06-04 21:16:16 +00:00
|
|
|
|
|
|
|
asset_registry = context.window_manager.assets_registry
|
|
|
|
blueprints_registry = context.window_manager.blueprints_registry
|
|
|
|
#blueprints_registry.refresh_blueprints()
|
|
|
|
blueprints_data = blueprints_registry.blueprints_data
|
|
|
|
|
2024-06-07 11:55:00 +00:00
|
|
|
for scene in blenvy.main_scenes:
|
2024-06-05 09:17:49 +00:00
|
|
|
header, panel = layout.box().panel(f"level_assets{scene.name}", default_closed=False)
|
2024-06-04 21:16:16 +00:00
|
|
|
if header:
|
2024-06-05 09:17:49 +00:00
|
|
|
header.label(text=scene.name)#, icon="HIDE_OFF")
|
2024-06-04 21:16:16 +00:00
|
|
|
header.prop(scene, "always_export")
|
2024-06-12 10:41:50 +00:00
|
|
|
select_level = header.operator(operator="blenvy.level_select", text="", icon="RESTRICT_SELECT_OFF")
|
2024-06-04 21:16:16 +00:00
|
|
|
select_level.level_name = scene.name
|
|
|
|
|
|
|
|
if panel:
|
|
|
|
user_assets = get_user_assets(scene)
|
2024-06-05 15:09:03 +00:00
|
|
|
generated_assets = get_generated_assets(scene)
|
2024-06-04 21:16:16 +00:00
|
|
|
row = panel.row()
|
|
|
|
#row.label(text="row")
|
|
|
|
"""col = row.column()
|
|
|
|
col.label(text=" ")
|
|
|
|
|
|
|
|
col = row.column()
|
|
|
|
col.label(text="col in row 2")
|
|
|
|
|
|
|
|
column = panel.column()
|
|
|
|
column.label(text="col")"""
|
|
|
|
|
|
|
|
split = panel.split(factor=0.005)
|
|
|
|
col = split.column()
|
|
|
|
col.label(text=" ")
|
|
|
|
col = split.column()
|
|
|
|
|
2024-06-05 15:09:03 +00:00
|
|
|
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)
|
2024-06-06 18:16:32 +00:00
|
|
|
scene_blueprints_panel = draw_blueprints(layout=col, name=f"{scene.name}_blueprints", title=f"Blueprints", generated_assets=generated_assets, )
|
2024-06-04 21:16:16 +00:00
|
|
|
|
|
|
|
settings = {"blueprints_path": "blueprints", "export_gltf_extension": ".glb"}
|
|
|
|
settings = SimpleNamespace(**settings)
|