adjust default layouts
This commit is contained in:
parent
63c1ba8854
commit
7c37e69687
|
|
@ -32,7 +32,7 @@
|
||||||
"type": "vertical-grid",
|
"type": "vertical-grid",
|
||||||
"percent": 10,
|
"percent": 10,
|
||||||
"children": [
|
"children": [
|
||||||
{ "type": "pane", "name": "toolbar" },
|
{ "type": "pane", "name": "infopanel" },
|
||||||
{
|
{
|
||||||
"type": "vertical-grid",
|
"type": "vertical-grid",
|
||||||
"percent": 65,
|
"percent": 65,
|
||||||
|
|
@ -42,7 +42,7 @@
|
||||||
"percent": 50,
|
"percent": 50,
|
||||||
"children": [
|
"children": [
|
||||||
{ "type": "pane", "name": "stage" },
|
{ "type": "pane", "name": "stage" },
|
||||||
{ "type": "pane", "name": "infopanel" }
|
{ "type": "pane", "name": "assetLibrary" }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{ "type": "pane", "name": "timelineV2" }
|
{ "type": "pane", "name": "timelineV2" }
|
||||||
|
|
@ -53,17 +53,17 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Audio/DAW",
|
"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": {
|
"layout": {
|
||||||
"type": "horizontal-grid",
|
"type": "horizontal-grid",
|
||||||
"percent": 75,
|
"percent": 75,
|
||||||
"children": [
|
"children": [
|
||||||
{
|
{
|
||||||
"type": "vertical-grid",
|
"type": "vertical-grid",
|
||||||
"percent": 50,
|
"percent": 60,
|
||||||
"children": [
|
"children": [
|
||||||
{ "type": "pane", "name": "timelineV2" },
|
{ "type": "pane", "name": "timelineV2" },
|
||||||
{ "type": "pane", "name": "nodeEditor" }
|
{ "type": "pane", "name": "virtualPiano" }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{ "type": "pane", "name": "presetBrowser" }
|
{ "type": "pane", "name": "presetBrowser" }
|
||||||
|
|
@ -72,34 +72,20 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Scripting",
|
"name": "Scripting",
|
||||||
"description": "Code editor, object hierarchy, and console",
|
"description": "Script editor with stage preview and timeline",
|
||||||
"layout": {
|
"layout": {
|
||||||
"type": "vertical-grid",
|
"type": "horizontal-grid",
|
||||||
"percent": 10,
|
"percent": 50,
|
||||||
"children": [
|
"children": [
|
||||||
{ "type": "pane", "name": "toolbar" },
|
|
||||||
{
|
{
|
||||||
"type": "horizontal-grid",
|
"type": "vertical-grid",
|
||||||
"percent": 70,
|
"percent": 60,
|
||||||
"children": [
|
"children": [
|
||||||
{
|
{ "type": "pane", "name": "stage" },
|
||||||
"type": "vertical-grid",
|
{ "type": "pane", "name": "timelineV2" }
|
||||||
"percent": 50,
|
|
||||||
"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",
|
"name": "Drawing/Painting",
|
||||||
"description": "Minimal UI - just canvas and drawing tools",
|
"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| {
|
egui::TopBottomPanel::top("menu_bar").show(ctx, |ui| {
|
||||||
if let Some(menu_system) = &self.menu_system {
|
if let Some(menu_system) = &self.menu_system {
|
||||||
let recent_files = self.config.get_recent_files();
|
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);
|
self.handle_menu_action(action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -766,12 +766,19 @@ impl MenuSystem {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Render egui menu bar from the same menu structure (for Linux/Windows)
|
/// 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;
|
let mut action = None;
|
||||||
|
|
||||||
egui::MenuBar::new().ui(ui, |ui| {
|
egui::MenuBar::new().ui(ui, |ui| {
|
||||||
for menu_def in MenuItemDef::menu_structure() {
|
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);
|
action = Some(a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -781,7 +788,15 @@ impl MenuSystem {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Recursively render a MenuDef as egui UI
|
/// 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 {
|
match def {
|
||||||
MenuDef::Item(item_def) => {
|
MenuDef::Item(item_def) => {
|
||||||
if Self::render_menu_item(ui, item_def, keymap) {
|
if Self::render_menu_item(ui, item_def, keymap) {
|
||||||
|
|
@ -797,9 +812,8 @@ impl MenuSystem {
|
||||||
MenuDef::Submenu { label, children } => {
|
MenuDef::Submenu { label, children } => {
|
||||||
let mut action = None;
|
let mut action = None;
|
||||||
ui.menu_button(*label, |ui| {
|
ui.menu_button(*label, |ui| {
|
||||||
// Special handling for "Open Recent" submenu
|
|
||||||
if *label == "Open Recent" {
|
if *label == "Open Recent" {
|
||||||
// Render dynamic recent files
|
// Special handling for "Open Recent" submenu
|
||||||
for (index, path) in recent_files.iter().enumerate() {
|
for (index, path) in recent_files.iter().enumerate() {
|
||||||
let display_name = path
|
let display_name = path
|
||||||
.file_name()
|
.file_name()
|
||||||
|
|
@ -812,7 +826,6 @@ impl MenuSystem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add separator and clear option if we have items
|
|
||||||
if !recent_files.is_empty() {
|
if !recent_files.is_empty() {
|
||||||
ui.separator();
|
ui.separator();
|
||||||
}
|
}
|
||||||
|
|
@ -821,10 +834,34 @@ impl MenuSystem {
|
||||||
action = Some(MenuAction::ClearRecentFiles);
|
action = Some(MenuAction::ClearRecentFiles);
|
||||||
ui.close();
|
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 {
|
} else {
|
||||||
// Normal submenu rendering
|
// Normal submenu rendering
|
||||||
for child in *children {
|
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);
|
action = Some(a);
|
||||||
ui.close();
|
ui.close();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue