diff --git a/material_maker/doc/user_interface_main_menu.rst b/material_maker/doc/user_interface_main_menu.rst index a712dff27..ee5ddc1d9 100644 --- a/material_maker/doc/user_interface_main_menu.rst +++ b/material_maker/doc/user_interface_main_menu.rst @@ -97,8 +97,8 @@ View menu * *Reset zoom* Resets the zoom level of the current material graph view -* *Show/Hide side panels* (or the *Control+SpaceBar* keyboard shortcut) can - be used to hide the side panels so the space available for the main panel +* *Show/Hide side panels* (or the *Control/Cmd+Alt+SpaceBar* keyboard shortcut) can + be used to hide the other panels so the space available for the graph panel is maximized (which can be useful on smaller displays). * the *Panels* submenu can be used to show or hide all side panels diff --git a/material_maker/doc/user_interface_shortcuts.rst b/material_maker/doc/user_interface_shortcuts.rst index dd7b98d34..331f25200 100644 --- a/material_maker/doc/user_interface_shortcuts.rst +++ b/material_maker/doc/user_interface_shortcuts.rst @@ -34,6 +34,9 @@ General +-------------------------------------------------------+----------------------------------------------------+ | :kbd:`Ctrl/Cmd-E` | Export material again | +-------------------------------------------------------+----------------------------------------------------+ +| :kbd:`Ctrl/Cmd-Alt-Space` | Toggle side panels to maximize graph area | ++-------------------------------------------------------+----------------------------------------------------+ + Graph Editor ++++++++++++ diff --git a/material_maker/main_window.gd b/material_maker/main_window.gd index 1df3ba3de..9c47a7e6d 100644 --- a/material_maker/main_window.gd +++ b/material_maker/main_window.gd @@ -101,7 +101,7 @@ const MENU : Array[Dictionary] = [ { menu="View/Center view", command="view_center", shortcut="C" }, { menu="View/Reset zoom", command="view_reset_zoom", shortcut="Control+0" }, { menu="View/-" }, - # { menu="View/Show or Hide side panels", command="toggle_side_panels", shortcut="Control+Space" }, + { menu="View/Show or Hide side panels", command="toggle_side_panels", shortcut="Alt+Control+Space" }, { menu="View/Panels", submenu="show_panels" }, { menu="View/Presets", submenu="panels_preset" }, { menu="View/Reset Panels", command="view_reset_panels" }, diff --git a/material_maker/main_window_layout.gd b/material_maker/main_window_layout.gd index d9c7ab749..4c7d3827d 100644 --- a/material_maker/main_window_layout.gd +++ b/material_maker/main_window_layout.gd @@ -41,12 +41,22 @@ var current_mode : String = "material" var layout : Dictionary = {} var presets : Array[Dictionary] +var previous_layout : Dictionary + func _ready() -> void: previous_width = size.x func toggle_side_panels() -> void: - pass + if not previous_layout.is_empty(): + $FlexibleLayout.init(previous_layout) + previous_layout.clear() + else: + var main_layout : Dictionary = { + &"main": { &"type": "FlexTop",&"w": 1073.0, &"h": 939.0, + &"children": [{ &"type": "FlexMain", &"w": 1073.0, &"h": 939.0, &"children": [] }] }, &"windows": [] } + previous_layout = $FlexibleLayout.serialize() + $FlexibleLayout.init(main_layout) func load_panels() -> void: # Create panels @@ -81,6 +91,8 @@ func load_panels() -> void: func save_config() -> void: layout[current_mode] = $FlexibleLayout.serialize() + if not previous_layout.is_empty(): + layout[current_mode] = previous_layout for mode in [ "material", "paint" ]: if layout.has(mode): mm_globals.config.set_value("layout", mode, JSON.stringify(layout[mode])) @@ -107,6 +119,7 @@ func is_panel_visible(panel_name : String) -> bool: return $FlexibleLayout.flex_layout.is_panel_shown(panel_name) func set_panel_visible(panel_name : String, v : bool) -> void: + previous_layout.clear() $FlexibleLayout.show_panel(panel_name, v) $FlexibleLayout.layout()