adjust default layouts
This commit is contained in:
parent
63c1ba8854
commit
7c37e69687
|
|
@ -32,7 +32,7 @@
|
|||
"type": "vertical-grid",
|
||||
"percent": 10,
|
||||
"children": [
|
||||
{ "type": "pane", "name": "toolbar" },
|
||||
{ "type": "pane", "name": "infopanel" },
|
||||
{
|
||||
"type": "vertical-grid",
|
||||
"percent": 65,
|
||||
|
|
@ -42,7 +42,7 @@
|
|||
"percent": 50,
|
||||
"children": [
|
||||
{ "type": "pane", "name": "stage" },
|
||||
{ "type": "pane", "name": "infopanel" }
|
||||
{ "type": "pane", "name": "assetLibrary" }
|
||||
]
|
||||
},
|
||||
{ "type": "pane", "name": "timelineV2" }
|
||||
|
|
@ -53,17 +53,17 @@
|
|||
},
|
||||
{
|
||||
"name": "Audio/DAW",
|
||||
"description": "Audio tracks prominent with mixer, node editor, and preset browser",
|
||||
"description": "Audio tracks prominent with mixer, virtual piano, and preset browser",
|
||||
"layout": {
|
||||
"type": "horizontal-grid",
|
||||
"percent": 75,
|
||||
"children": [
|
||||
{
|
||||
"type": "vertical-grid",
|
||||
"percent": 50,
|
||||
"percent": 60,
|
||||
"children": [
|
||||
{ "type": "pane", "name": "timelineV2" },
|
||||
{ "type": "pane", "name": "nodeEditor" }
|
||||
{ "type": "pane", "name": "virtualPiano" }
|
||||
]
|
||||
},
|
||||
{ "type": "pane", "name": "presetBrowser" }
|
||||
|
|
@ -72,34 +72,20 @@
|
|||
},
|
||||
{
|
||||
"name": "Scripting",
|
||||
"description": "Code editor, object hierarchy, and console",
|
||||
"description": "Script editor with stage preview and timeline",
|
||||
"layout": {
|
||||
"type": "vertical-grid",
|
||||
"percent": 10,
|
||||
"children": [
|
||||
{ "type": "pane", "name": "toolbar" },
|
||||
{
|
||||
"type": "horizontal-grid",
|
||||
"percent": 70,
|
||||
"percent": 50,
|
||||
"children": [
|
||||
{
|
||||
"type": "vertical-grid",
|
||||
"percent": 50,
|
||||
"percent": 60,
|
||||
"children": [
|
||||
{ "type": "pane", "name": "stage" },
|
||||
{ "type": "pane", "name": "timelineV2" }
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "vertical-grid",
|
||||
"percent": 50,
|
||||
"children": [
|
||||
{ "type": "pane", "name": "infopanel" },
|
||||
{ "type": "pane", "name": "outlineer" }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
{ "type": "pane", "name": "scriptEditor" }
|
||||
]
|
||||
}
|
||||
},
|
||||
|
|
@ -129,32 +115,6 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "3D",
|
||||
"description": "3D viewport, camera controls, and lighting panel",
|
||||
"layout": {
|
||||
"type": "vertical-grid",
|
||||
"percent": 10,
|
||||
"children": [
|
||||
{ "type": "pane", "name": "toolbar" },
|
||||
{
|
||||
"type": "horizontal-grid",
|
||||
"percent": 70,
|
||||
"children": [
|
||||
{
|
||||
"type": "vertical-grid",
|
||||
"percent": 70,
|
||||
"children": [
|
||||
{ "type": "pane", "name": "stage" },
|
||||
{ "type": "pane", "name": "timelineV2" }
|
||||
]
|
||||
},
|
||||
{ "type": "pane", "name": "infopanel" }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Drawing/Painting",
|
||||
"description": "Minimal UI - just canvas and drawing tools",
|
||||
|
|
@ -180,31 +140,5 @@
|
|||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Shader Editor",
|
||||
"description": "Split between viewport preview and code editor",
|
||||
"layout": {
|
||||
"type": "vertical-grid",
|
||||
"percent": 10,
|
||||
"children": [
|
||||
{ "type": "pane", "name": "toolbar" },
|
||||
{
|
||||
"type": "horizontal-grid",
|
||||
"percent": 50,
|
||||
"children": [
|
||||
{ "type": "pane", "name": "stage" },
|
||||
{
|
||||
"type": "vertical-grid",
|
||||
"percent": 60,
|
||||
"children": [
|
||||
{ "type": "pane", "name": "infopanel" },
|
||||
{ "type": "pane", "name": "timelineV2" }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -4707,7 +4707,11 @@ impl eframe::App for EditorApp {
|
|||
egui::TopBottomPanel::top("menu_bar").show(ctx, |ui| {
|
||||
if let Some(menu_system) = &self.menu_system {
|
||||
let recent_files = self.config.get_recent_files();
|
||||
if let Some(action) = menu_system.render_egui_menu_bar(ui, &recent_files, Some(&self.keymap)) {
|
||||
let layout_names: Vec<String> = self.layouts.iter().map(|l| l.name.clone()).collect();
|
||||
if let Some(action) = menu_system.render_egui_menu_bar(
|
||||
ui, &recent_files, Some(&self.keymap),
|
||||
&layout_names, self.current_layout_index,
|
||||
) {
|
||||
self.handle_menu_action(action);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -766,12 +766,19 @@ impl MenuSystem {
|
|||
}
|
||||
|
||||
/// Render egui menu bar from the same menu structure (for Linux/Windows)
|
||||
pub fn render_egui_menu_bar(&self, ui: &mut egui::Ui, recent_files: &[std::path::PathBuf], keymap: Option<&crate::keymap::KeymapManager>) -> Option<MenuAction> {
|
||||
pub fn render_egui_menu_bar(
|
||||
&self,
|
||||
ui: &mut egui::Ui,
|
||||
recent_files: &[std::path::PathBuf],
|
||||
keymap: Option<&crate::keymap::KeymapManager>,
|
||||
layout_names: &[String],
|
||||
current_layout_index: usize,
|
||||
) -> Option<MenuAction> {
|
||||
let mut action = None;
|
||||
|
||||
egui::MenuBar::new().ui(ui, |ui| {
|
||||
for menu_def in MenuItemDef::menu_structure() {
|
||||
if let Some(a) = self.render_menu_def(ui, menu_def, recent_files, keymap) {
|
||||
if let Some(a) = self.render_menu_def(ui, menu_def, recent_files, keymap, layout_names, current_layout_index) {
|
||||
action = Some(a);
|
||||
}
|
||||
}
|
||||
|
|
@ -781,7 +788,15 @@ impl MenuSystem {
|
|||
}
|
||||
|
||||
/// Recursively render a MenuDef as egui UI
|
||||
fn render_menu_def(&self, ui: &mut egui::Ui, def: &MenuDef, recent_files: &[std::path::PathBuf], keymap: Option<&crate::keymap::KeymapManager>) -> Option<MenuAction> {
|
||||
fn render_menu_def(
|
||||
&self,
|
||||
ui: &mut egui::Ui,
|
||||
def: &MenuDef,
|
||||
recent_files: &[std::path::PathBuf],
|
||||
keymap: Option<&crate::keymap::KeymapManager>,
|
||||
layout_names: &[String],
|
||||
current_layout_index: usize,
|
||||
) -> Option<MenuAction> {
|
||||
match def {
|
||||
MenuDef::Item(item_def) => {
|
||||
if Self::render_menu_item(ui, item_def, keymap) {
|
||||
|
|
@ -797,9 +812,8 @@ impl MenuSystem {
|
|||
MenuDef::Submenu { label, children } => {
|
||||
let mut action = None;
|
||||
ui.menu_button(*label, |ui| {
|
||||
// Special handling for "Open Recent" submenu
|
||||
if *label == "Open Recent" {
|
||||
// Render dynamic recent files
|
||||
// Special handling for "Open Recent" submenu
|
||||
for (index, path) in recent_files.iter().enumerate() {
|
||||
let display_name = path
|
||||
.file_name()
|
||||
|
|
@ -812,7 +826,6 @@ impl MenuSystem {
|
|||
}
|
||||
}
|
||||
|
||||
// Add separator and clear option if we have items
|
||||
if !recent_files.is_empty() {
|
||||
ui.separator();
|
||||
}
|
||||
|
|
@ -821,10 +834,34 @@ impl MenuSystem {
|
|||
action = Some(MenuAction::ClearRecentFiles);
|
||||
ui.close();
|
||||
}
|
||||
} else if *label == "Layout" {
|
||||
// Render static items first (Next/Previous Layout)
|
||||
for child in *children {
|
||||
if let Some(a) = self.render_menu_def(ui, child, recent_files, keymap, layout_names, current_layout_index) {
|
||||
action = Some(a);
|
||||
ui.close();
|
||||
}
|
||||
}
|
||||
|
||||
// Dynamic layout list
|
||||
if !layout_names.is_empty() {
|
||||
ui.separator();
|
||||
for (index, name) in layout_names.iter().enumerate() {
|
||||
let label = if index == current_layout_index {
|
||||
format!("* {}", name)
|
||||
} else {
|
||||
name.clone()
|
||||
};
|
||||
if ui.button(label).clicked() {
|
||||
action = Some(MenuAction::SwitchLayout(index));
|
||||
ui.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Normal submenu rendering
|
||||
for child in *children {
|
||||
if let Some(a) = self.render_menu_def(ui, child, recent_files, keymap) {
|
||||
if let Some(a) = self.render_menu_def(ui, child, recent_files, keymap, layout_names, current_layout_index) {
|
||||
action = Some(a);
|
||||
ui.close();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue