Open JekSun97 opened 1 month ago
This is caused by:
Our toolbar is placed on the left side of the screen via the EditorPlugin.CONTAINER_SPATIAL_EDITOR_SIDE_LEFT option. When Terrain3D is selected, the left toolbar appears and pushes down the bottom panels. Godot won't allow the bottom panels to slide above the sidebar.
Ultimately, I think there's a bug in the EditorPlugin UI. It gives a facility for placing a toolbar on the side, but doesn't provide any controls for what to do on small screens. We have no option to allow the bottom panel to go above those buttons and hide them, nor scale them.
We don't have a built-in option to go on the top of the viewport, which is what I'd like. However we might be able to hack something in there.
We can alleviate the pressure by reducing the number of buttons, which will come in #122.
For now, you can experiment with these changes which puts the sidebar on the bottom above the tool settings. It seems to work, but I don't love it.
Updated: 7/13
diff --git a/project/addons/terrain_3d/src/toolbar.gd b/project/addons/terrain_3d/src/toolbar.gd
index b26dbeb..28e1592 100644
--- a/project/addons/terrain_3d/src/toolbar.gd
+++ b/project/addons/terrain_3d/src/toolbar.gd
@@ -1,4 +1,4 @@
-extends VBoxContainer
+extends HBoxContainer
signal tool_changed(p_tool: Terrain3DEditor.Tool, p_operation: Terrain3DEditor.Operation)
@@ -36,7 +36,7 @@ func _ready() -> void:
"add_text":"Add Region", "add_op":Terrain3DEditor.ADD, "add_icon":ICON_REGION_ADD,
"sub_text":"Remove Region", "sub_op":Terrain3DEditor.SUBTRACT, "sub_icon":ICON_REGION_REMOVE })
- add_child(HSeparator.new())
+ add_child(VSeparator.new())
add_tool_button({ "tool":Terrain3DEditor.HEIGHT,
"add_text":"Raise", "add_op":Terrain3DEditor.ADD, "add_icon":ICON_HEIGHT_ADD,
@@ -55,7 +55,7 @@ func _ready() -> void:
add_tool_button({ "tool":Terrain3DEditor.HEIGHT,
"add_text":"Smooth", "add_op":Terrain3DEditor.AVERAGE, "add_icon":ICON_HEIGHT_SMOOTH })
- add_child(HSeparator.new())
+ add_child(VSeparator.new())
add_tool_button({ "tool":Terrain3DEditor.TEXTURE,
"add_text":"Paint Base Texture", "add_op":Terrain3DEditor.REPLACE, "add_icon":ICON_PAINT_TEXTURE })
@@ -67,7 +67,7 @@ func _ready() -> void:
"add_text":"Enable Autoshader", "add_op":Terrain3DEditor.ADD, "add_icon":ICON_AUTOSHADER,
"sub_text":"Disable Autoshader", "sub_op":Terrain3DEditor.SUBTRACT })
- add_child(HSeparator.new())
+ add_child(VSeparator.new())
add_tool_button({ "tool":Terrain3DEditor.COLOR,
"add_text":"Paint Color", "add_op":Terrain3DEditor.ADD, "add_icon":ICON_COLOR,
@@ -77,7 +77,7 @@ func _ready() -> void:
"add_text":"Paint Wetness", "add_op":Terrain3DEditor.ADD, "add_icon":ICON_WETNESS,
"sub_text":"Remove Wetness", "sub_op":Terrain3DEditor.SUBTRACT })
- add_child(HSeparator.new())
+ add_child(VSeparator.new())
add_tool_button({ "tool":Terrain3DEditor.HOLES,
"add_text":"Add Holes", "add_op":Terrain3DEditor.ADD, "add_icon":ICON_HOLES,
diff --git a/project/addons/terrain_3d/src/ui.gd b/project/addons/terrain_3d/src/ui.gd
index db77dda..46f87bb 100644
--- a/project/addons/terrain_3d/src/ui.gd
+++ b/project/addons/terrain_3d/src/ui.gd
@@ -35,6 +35,7 @@ const RING1: String = "res://addons/terrain_3d/brushes/ring1.exr"
@onready var ring_texture := ImageTexture.create_from_image(Terrain3DUtil.black_to_alpha(Image.load_from_file(RING1)))
var plugin: EditorPlugin # Actually Terrain3DEditorPlugin, but Godot still has CRC errors
+var bottom_bar: VBoxContainer
var toolbar: Toolbar
var tool_settings: ToolSettings
var terrain_menu: TerrainMenu
@@ -65,8 +66,10 @@ func _enter_tree() -> void:
terrain_menu.plugin = plugin
terrain_menu.hide()
- plugin.add_control_to_container(EditorPlugin.CONTAINER_SPATIAL_EDITOR_SIDE_LEFT, toolbar)
- plugin.add_control_to_container(EditorPlugin.CONTAINER_SPATIAL_EDITOR_BOTTOM, tool_settings)
+ bottom_bar = VBoxContainer.new()
+ bottom_bar.add_child(toolbar)
+ bottom_bar.add_child(tool_settings)
+ plugin.add_control_to_container(EditorPlugin.CONTAINER_SPATIAL_EDITOR_BOTTOM, bottom_bar)
plugin.add_control_to_container(EditorPlugin.CONTAINER_SPATIAL_EDITOR_MENU, terrain_menu)
_on_tool_changed(Terrain3DEditor.REGION, Terrain3DEditor.ADD)
@@ -83,8 +86,7 @@ func _enter_tree() -> void:
func _exit_tree() -> void:
- plugin.remove_control_from_container(EditorPlugin.CONTAINER_SPATIAL_EDITOR_SIDE_LEFT, toolbar)
- plugin.remove_control_from_container(EditorPlugin.CONTAINER_SPATIAL_EDITOR_BOTTOM, tool_settings)
+ plugin.remove_control_from_container(EditorPlugin.CONTAINER_SPATIAL_EDITOR_BOTTOM, bottom_bar)
toolbar.queue_free()
tool_settings.queue_free()
terrain_menu.queue_free()
@TokisanGames Selecting the "Spray Overlay Texture" tool also shifts the Inspector to the right a lot.
Here's a full screenshot:
It's all of the options on the bottom bar that move the inspector, and Godot has a bug where it moves it off screen instead of scales it. Moving the toolbar down to the bottom like I suggested earlier probably won't work well as it will just push everything to the side.
With such a small screen, you could reduce your side bars, consolidating them into one column instead of two.
I'm not sure how to redesign the UI to be usable for most people, yet accommodate tiny screens and godot's UI bugs.
Terrain3D version
v0.9.3-dev
System information
Godot v4.2.2.stable - Windows 10.0.19045 - Vulkan (Forward+) - dedicated Radeon RX 560 Series (Advanced Micro Devices, Inc.; 31.0.14001.45012) - Intel(R) Core(TM) i5-4570 CPU @ 3.20GHz (4 Threads)
Is the issue reproducable in the demo?
Not applicable
Issue description
When the Terrain3D tool window is active and we click on any of the buttons on the bottom panel, for example Output, the bottom panel goes out of view of the window, which makes it impossible to open one of the windows until we switch to any other node except Terrain3D
Screen resolution: 1600x900
Demonstration of the problem: https://youtu.be/twCqcZVWZ88
Logs
...