feat(Blenvy:Blender): settings/configuration is now also tabbed for less scrolling & confusion
This commit is contained in:
parent
4519fb94a5
commit
5aa666ef00
|
@ -49,7 +49,7 @@ from .blueprints.operators import BLENVY_OT_blueprint_select
|
||||||
|
|
||||||
# blenvy core
|
# blenvy core
|
||||||
from .core.blenvy_manager import BlenvyManager
|
from .core.blenvy_manager import BlenvyManager
|
||||||
from .core.operators import BLENVY_OT_tooling_switch
|
from .core.operators import BLENVY_OT_configuration_switch, BLENVY_OT_tooling_switch
|
||||||
from .core.ui.ui import (BLENVY_PT_SidePanel)
|
from .core.ui.ui import (BLENVY_PT_SidePanel)
|
||||||
from .core.ui.scenes_list import BLENVY_OT_scenes_list_actions
|
from .core.ui.scenes_list import BLENVY_OT_scenes_list_actions
|
||||||
from .assets.assets_folder_browser import BLENVY_OT_assets_paths_browse
|
from .assets.assets_folder_browser import BLENVY_OT_assets_paths_browse
|
||||||
|
@ -110,6 +110,7 @@ classes = [
|
||||||
# blenvy
|
# blenvy
|
||||||
BlenvyManager,
|
BlenvyManager,
|
||||||
BLENVY_OT_tooling_switch,
|
BLENVY_OT_tooling_switch,
|
||||||
|
BLENVY_OT_configuration_switch,
|
||||||
|
|
||||||
Asset,
|
Asset,
|
||||||
AssetsRegistry,
|
AssetsRegistry,
|
||||||
|
|
|
@ -54,6 +54,17 @@ class BlenvyManager(PropertyGroup):
|
||||||
update=save_settings
|
update=save_settings
|
||||||
) # type: ignore
|
) # type: ignore
|
||||||
|
|
||||||
|
config_mode: EnumProperty(
|
||||||
|
items=(
|
||||||
|
('COMMON', "Common", "Switch to common configuration"),
|
||||||
|
('COMPONENTS', "Components", "Switch to components configuration"),
|
||||||
|
('EXPORT', "Export", "Switch to export configuration"),
|
||||||
|
),
|
||||||
|
default="COMMON",
|
||||||
|
update=save_settings
|
||||||
|
) # type: ignore
|
||||||
|
|
||||||
|
|
||||||
project_root_path: StringProperty(
|
project_root_path: StringProperty(
|
||||||
name = "Project Root Path",
|
name = "Project Root Path",
|
||||||
description="The root folder of your (Bevy) project (not assets!)",
|
description="The root folder of your (Bevy) project (not assets!)",
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
from bpy_types import (Operator)
|
from bpy_types import (Operator)
|
||||||
from bpy.props import (EnumProperty)
|
from bpy.props import (EnumProperty)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class BLENVY_OT_tooling_switch(Operator):
|
class BLENVY_OT_tooling_switch(Operator):
|
||||||
"""Switch bevy tooling"""
|
"""Switch blenvy tooling"""
|
||||||
bl_idname = "bevy.tooling_switch"
|
bl_idname = "bevy.tooling_switch"
|
||||||
bl_label = "Switch bevy tooling"
|
bl_label = "Switch bevy tooling"
|
||||||
#bl_options = {}
|
#bl_options = {}
|
||||||
|
@ -29,3 +26,27 @@ class BLENVY_OT_tooling_switch(Operator):
|
||||||
context.window_manager.blenvy.mode = self.tool
|
context.window_manager.blenvy.mode = self.tool
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class BLENVY_OT_configuration_switch(Operator):
|
||||||
|
"""Switch tooling configuration"""
|
||||||
|
bl_idname = "bevy.config_switch"
|
||||||
|
bl_label = "Switch blenvy configuration"
|
||||||
|
#bl_options = {}
|
||||||
|
|
||||||
|
tool: EnumProperty(
|
||||||
|
items=(
|
||||||
|
('COMMON', "Common", "Switch to common configuration"),
|
||||||
|
('COMPONENTS', "Components", "Switch to components configuration"),
|
||||||
|
('EXPORT', "Export", "Switch to export configuration"),
|
||||||
|
)
|
||||||
|
) # type: ignore
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def description(cls, context, properties):
|
||||||
|
return properties.tool
|
||||||
|
|
||||||
|
def execute(self, context):
|
||||||
|
context.window_manager.blenvy.config_mode = self.tool
|
||||||
|
return {'FINISHED'}
|
||||||
|
|
|
@ -72,38 +72,66 @@ class BLENVY_PT_SidePanel(bpy.types.Panel):
|
||||||
tool_switch_components = target.operator(operator="bevy.tooling_switch", text="", icon="TOOL_SETTINGS")
|
tool_switch_components = target.operator(operator="bevy.tooling_switch", text="", icon="TOOL_SETTINGS")
|
||||||
tool_switch_components.tool = "TOOLS"
|
tool_switch_components.tool = "TOOLS"
|
||||||
|
|
||||||
# Debug stuff
|
|
||||||
"""layout.label(text="Active Blueprint: "+ active_collection.name.upper())
|
|
||||||
layout.label(text="World scene active: "+ str(world_scene_active))
|
|
||||||
layout.label(text="Library scene active: "+ str(library_scene_active))
|
|
||||||
layout.label(text=blenvy.mode)"""
|
|
||||||
|
|
||||||
if blenvy.mode == "SETTINGS":
|
if blenvy.mode == "SETTINGS":
|
||||||
|
config_mode = blenvy.config_mode
|
||||||
|
row = layout.row()
|
||||||
|
config_target = row.box() if config_mode == 'COMMON' else row
|
||||||
|
config_switch = config_target.operator(operator="bevy.config_switch", text="", icon="OPTIONS")
|
||||||
|
config_switch.tool = "COMMON"
|
||||||
|
|
||||||
|
config_target = row.box() if config_mode == 'COMPONENTS' else row
|
||||||
|
config_switch = config_target.operator(operator="bevy.config_switch", text="", icon="PROPERTIES")
|
||||||
|
config_switch.tool = "COMPONENTS"
|
||||||
|
|
||||||
|
config_target = row.box() if config_mode == 'EXPORT' else row
|
||||||
|
config_switch = config_target.operator(operator="bevy.config_switch", text="", icon="EXPORT")
|
||||||
|
config_switch.tool = "EXPORT"
|
||||||
|
|
||||||
|
if config_mode == 'COMMON':
|
||||||
header, panel = layout.panel("common", default_closed=False)
|
header, panel = layout.panel("common", default_closed=False)
|
||||||
header.label(text="Common")
|
header.label(text="Common")
|
||||||
if panel:
|
if panel:
|
||||||
row = panel.row()
|
draw_common_settings_ui(panel, blenvy)
|
||||||
|
|
||||||
|
if config_mode == 'COMPONENTS':
|
||||||
|
header, panel = layout.panel("components", default_closed=False)
|
||||||
|
header.label(text="Components")
|
||||||
|
if panel:
|
||||||
|
components_ui.draw_settings_ui(panel, blenvy.components)
|
||||||
|
|
||||||
|
if config_mode == 'EXPORT':
|
||||||
|
header, panel = layout.panel("auto_export", default_closed=False)
|
||||||
|
header.label(text="Auto Export")
|
||||||
|
if panel:
|
||||||
|
auto_export_ui.draw_settings_ui(panel, blenvy.auto_export)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def draw_common_settings_ui(layout, settings):
|
||||||
|
blenvy = settings
|
||||||
|
row = layout.row()
|
||||||
draw_folder_browser(layout=row, label="Root Folder", prop_origin=blenvy, target_property="project_root_path")
|
draw_folder_browser(layout=row, label="Root Folder", prop_origin=blenvy, target_property="project_root_path")
|
||||||
row = panel.row()
|
row = layout.row()
|
||||||
draw_folder_browser(layout=row, label="Assets Folder", prop_origin=blenvy, target_property="assets_path")
|
draw_folder_browser(layout=row, label="Assets Folder", prop_origin=blenvy, target_property="assets_path")
|
||||||
row = panel.row()
|
row = layout.row()
|
||||||
draw_folder_browser(layout=row, label="Blueprints Folder", prop_origin=blenvy, target_property="blueprints_path")
|
draw_folder_browser(layout=row, label="Blueprints Folder", prop_origin=blenvy, target_property="blueprints_path")
|
||||||
row = panel.row()
|
row = layout.row()
|
||||||
draw_folder_browser(layout=row, label="Levels Folder", prop_origin=blenvy, target_property="levels_path")
|
draw_folder_browser(layout=row, label="Levels Folder", prop_origin=blenvy, target_property="levels_path")
|
||||||
row = panel.row()
|
row = layout.row()
|
||||||
draw_folder_browser(layout=row, label="Materials Folder", prop_origin=blenvy, target_property="materials_path")
|
draw_folder_browser(layout=row, label="Materials Folder", prop_origin=blenvy, target_property="materials_path")
|
||||||
|
|
||||||
panel.separator()
|
layout.separator()
|
||||||
# scenes selection
|
# scenes selection
|
||||||
if len(blenvy.level_scenes) == 0 and len(blenvy.library_scenes) == 0:
|
if len(blenvy.level_scenes) == 0 and len(blenvy.library_scenes) == 0:
|
||||||
row = panel.row()
|
row = layout.row()
|
||||||
row.alert = True
|
row.alert = True
|
||||||
panel.alert = True
|
layout.alert = True
|
||||||
row.label(text="NO library or level scenes specified! at least one level scene or library scene is required!")
|
row.label(text="NO library or level scenes specified! at least one level scene or library scene is required!")
|
||||||
row = panel.row()
|
row = layout.row()
|
||||||
row.label(text="Please select and add one using the UI below")
|
row.label(text="Please select and add one using the UI below")
|
||||||
|
|
||||||
section = panel
|
section = layout
|
||||||
rows = 2
|
rows = 2
|
||||||
row = section.row()
|
row = section.row()
|
||||||
col = row.column()
|
col = row.column()
|
||||||
|
@ -152,15 +180,3 @@ class BLENVY_PT_SidePanel(bpy.types.Panel):
|
||||||
remove_operator.scene_type = 'LEVEL'
|
remove_operator.scene_type = 'LEVEL'
|
||||||
remove_operator.scene_name = scene.name
|
remove_operator.scene_name = scene.name
|
||||||
col.separator()
|
col.separator()
|
||||||
|
|
||||||
header, panel = layout.panel("components", default_closed=False)
|
|
||||||
header.label(text="Components")
|
|
||||||
if panel:
|
|
||||||
components_ui.draw_settings_ui(panel, blenvy.components)
|
|
||||||
|
|
||||||
header, panel = layout.panel("auto_export", default_closed=False)
|
|
||||||
header.label(text="Auto Export")
|
|
||||||
if panel:
|
|
||||||
auto_export_ui.draw_settings_ui(panel, blenvy.auto_export)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue