Skip to content

Add Live Info Panel - #1002

Merged
TokisanGames merged 3 commits into
TokisanGames:mainfrom
aidandavey:Live-info-panel
Jul 25, 2026
Merged

Add Live Info Panel #1002
TokisanGames merged 3 commits into
TokisanGames:mainfrom
aidandavey:Live-info-panel

Conversation

@aidandavey

Copy link
Copy Markdown
Contributor

This adds the live info panel as discussed on Discord.

image image

Fixes #984

@TokisanGames

Copy link
Copy Markdown
Owner

Let's change the menu name to View LiveInfo Panel to match the entries under Perspective.

I loaded this up and got these errors, so I couldn't test it.

Godot Engine v4.5.2.stable.official.6ce3de25a - https://godotengine.org
Vulkan 1.4.329 - Forward+ - Using Device #0: NVIDIA - NVIDIA GeForce RTX 3070 Laptop GPU

ERROR: Cannot open file 'res://addons/terrain_3d/src/live_info_panel.tscn'.
   at: (scene/resources/resource_format_text.cpp:1387)
   GDScript backtrace (most recent call first):
       [0] setup_live_info_panel (res://addons/terrain_3d/src/ui.gd:682)
       [1] _enter_tree (res://addons/terrain_3d/src/ui.gd:117)
       [2] _enter_tree (res://addons/terrain_3d/src/editor_plugin.gd:58)
ERROR: Failed loading resource: res://addons/terrain_3d/src/live_info_panel.tscn.
   at: (core/io/resource_loader.cpp:343)
   GDScript backtrace (most recent call first):
       [0] setup_live_info_panel (res://addons/terrain_3d/src/ui.gd:682)
       [1] _enter_tree (res://addons/terrain_3d/src/ui.gd:117)
       [2] _enter_tree (res://addons/terrain_3d/src/editor_plugin.gd:58)
SCRIPT ERROR: Attempt to call function 'instantiate' in base 'null instance' on a null instance.
          at: setup_live_info_panel (res://addons/terrain_3d/src/ui.gd:682)
          GDScript backtrace (most recent call first):
              [0] setup_live_info_panel (res://addons/terrain_3d/src/ui.gd:682)
              [1] _enter_tree (res://addons/terrain_3d/src/ui.gd:117)
              [2] _enter_tree (res://addons/terrain_3d/src/editor_plugin.gd:58)
SCRIPT ERROR: Cannot call method 'set_visible' on a null value.
          at: set_visible (res://addons/terrain_3d/src/ui.gd:145)
          GDScript backtrace (most recent call first):
              [0] set_visible (res://addons/terrain_3d/src/ui.gd:145)
              [1] _edit (res://addons/terrain_3d/src/editor_plugin.gd:126)
SCRIPT ERROR: Cannot call method 'set_visible' on a null value.
          at: set_visible (res://addons/terrain_3d/src/ui.gd:145)
          GDScript backtrace (most recent call first):
              [0] set_visible (res://addons/terrain_3d/src/ui.gd:145)
              [1] _make_visible (res://addons/terrain_3d/src/editor_plugin.gd:147)


@aidandavey

Copy link
Copy Markdown
Contributor Author

I loaded this up and got these errors, so I couldn't test it.

Godot Engine v4.5.2.stable.official.6ce3de25a - https://godotengine.org
Vulkan 1.4.329 - Forward+ - Using Device #0: NVIDIA - NVIDIA GeForce RTX 3070 Laptop GPU

ERROR: Cannot open file 'res://addons/terrain_3d/src/live_info_panel.tscn'.
   at: (scene/resources/resource_format_text.cpp:1387)
   GDScript backtrace (most recent call first):
       [0] setup_live_info_panel (res://addons/terrain_3d/src/ui.gd:682)
       [1] _enter_tree (res://addons/terrain_3d/src/ui.gd:117)

Apologies - i didn't commit the new scene file! Now fixed and renamed the menu button.

@TokisanGames TokisanGames added this to the 1.1 milestone Jul 17, 2026
@TokisanGames TokisanGames moved this to In Progress in Terrain3D Roadmap Jul 17, 2026
Comment thread project/addons/terrain_3d/src/ui.gd Outdated
Comment thread project/addons/terrain_3d/src/ui.gd Outdated
Comment thread project/addons/terrain_3d/src/live_info_panel.gd Outdated
Comment thread project/addons/terrain_3d/src/live_info_panel.gd Outdated
@TokisanGames

TokisanGames commented Jul 17, 2026

Copy link
Copy Markdown
Owner

I get 2 errors just by loading and clicking on the Terrain3D menu (note slightly different call stack). The panel loads but doesn't update.

SCRIPT ERROR: Invalid access to property or key 'info_panel' on a base object of type 'EditorPlugin (editor_plugin.gd)'.
          at: _on_menu_about_to_popup (res://addons/terrain_3d/menu/terrain_menu.gd:89)
          GDScript backtrace (most recent call first):
              [0] _on_menu_about_to_popup (res://addons/terrain_3d/menu/terrain_menu.gd:89)
SCRIPT ERROR: Invalid access to property or key 'info_panel' on a base object of type 'EditorPlugin (editor_plugin.gd)'.
          at: _on_menu_about_to_popup (res://addons/terrain_3d/menu/terrain_menu.gd:89)
          GDScript backtrace (most recent call first):
              [0] _on_menu_about_to_popup (res://addons/terrain_3d/menu/terrain_menu.gd:89)
              [1] _on_menu_pressed (res://addons/terrain_3d/menu/terrain_menu.gd:79)

I also had this error, unknown cause:

SCRIPT ERROR: Invalid assignment of property or key 'text' with value of type 'bool' on a base object of type 'Label'.
          at: TerrainLiveInfoPanel.update (res://addons/terrain_3d/src/live_info_panel.gd:35)
          GDScript backtrace (most recent call first):
              [0] update (res://addons/terrain_3d/src/live_info_panel.gd:35)
              [1] _forward_3d_gui_input (res://addons/terrain_3d/src/editor_plugin.gd:208)

I looked at the panel in front of a white, unshaded cube.

  • The stock panel is darker. Ours is HSV v=72%, stock is v=65%, or 0.9027 the darkness. We don't know if that's applied to darkness or opacity though. It could be a 100% black panel with 65% opacity (most likely), or a middle grey frame with ~30-40% opacity or something else.
  • There's a tiny bit of border radius, maybe 1px, no more than 3.
  • The text has a 5px margin on left/right and a 10px margin top/bottom to the edge of the panel.
  • Your line spacing between capital tops and bottoms is 16px. Theirs is 14px. Font size looks accurate.
  • Cursor pos should look like a vector2 with a , separating the two.
  • Region should look like a vector2i, with the same.
  • Add the autoshader at the end of texture. Just have it pop up a | A if autoshader is true. Then we can cut off a line.
  • All of your numbers should be label:<one space># just like on the stock panel. Slope at least has multiple spaces, not sure about the others.
image
  • Does it work / fail gracefully outside of regions or the max region area?
  • What happens at large x/z values, do they overflow the edge of the panel (worst option), are they clipped (not good), or does the panel expand? The stock panel only uses 1 decimal of precision on the location. Maybe we don't need parentheses either. These would give more room for large numbers.
  • The stock panel has a 10px margin to the side and bottom of the viewport. You have 15px.
{52A13D87-46B6-459C-AC7C-19C789A31F9A}
  • The panel sticks to the top left in Godot 4.7.1. Also look at 4.6.3.
{A0B5FF62-A60E-4F00-AD69-092935D036E3}

Comment thread project/addons/terrain_3d/src/ui.gd Outdated
Comment thread project/addons/terrain_3d/src/live_info_panel.gd Outdated
@aidandavey

aidandavey commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

I get 2 errors just by loading and clicking on the Terrain3D menu (note slightly different call stack). The panel loads but doesn't update.

SCRIPT ERROR: Invalid access to property or key 'info_panel' on a base object of type 'EditorPlugin (editor_plugin.gd)'.
          at: _on_menu_about_to_popup (res://addons/terrain_3d/menu/terrain_menu.gd:89)
          GDScript backtrace (most recent call first):
              [0] _on_menu_about_to_popup (res://addons/terrain_3d/menu/terrain_menu.gd:89)
SCRIPT ERROR: Invalid access to property or key 'info_panel' on a base object of type 'EditorPlugin (editor_plugin.gd)'.
          at: _on_menu_about_to_popup (res://addons/terrain_3d/menu/terrain_menu.gd:89)
          GDScript backtrace (most recent call first):
              [0] _on_menu_about_to_popup (res://addons/terrain_3d/menu/terrain_menu.gd:89)
              [1] _on_menu_pressed (res://addons/terrain_3d/menu/terrain_menu.gd:79)

I also had this error, unknown cause:

SCRIPT ERROR: Invalid assignment of property or key 'text' with value of type 'bool' on a base object of type 'Label'.
          at: TerrainLiveInfoPanel.update (res://addons/terrain_3d/src/live_info_panel.gd:35)
          GDScript backtrace (most recent call first):
              [0] update (res://addons/terrain_3d/src/live_info_panel.gd:35)
              [1] _forward_3d_gui_input (res://addons/terrain_3d/src/editor_plugin.gd:208)

These are all fixed

I looked at the panel in front of a white, unshaded cube.

I wish I'd thought of this!

  • The stock panel is darker. Ours is HSV v=72%, stock is v=65%, or 0.9027 the darkness. We don't know if that's applied to darkness or opacity though. It could be a 100% black panel with 65% opacity (most likely), or a middle grey frame with ~30-40% opacity or something else.

I can't get it to look exactly right - but it is now much closer. Apparently (according to co-pilot) there is some trickery happening to adjust the contrast curve depending on the pixels behind which I don't think we can reasonably replicate.

  • There's a tiny bit of border radius, maybe 1px, no more than 3.
  • The text has a 5px margin on left/right and a 10px margin top/bottom to the edge of the panel.
  • Your line spacing between capital tops and bottoms is 16px. Theirs is 14px. Font size looks accurate.
  • Cursor pos should look like a vector2 with a , separating the two.
  • Region should look like a vector2i, with the same.
  • Add the autoshader at the end of texture. Just have it pop up a | A if autoshader is true. Then we can cut off a line.
  • All of your numbers should be label:<one space># just like on the stock panel. Slope at least has multiple spaces, not sure about the others.
  • The stock panel has a 10px margin to the side and bottom of the viewport. You have 15px.

I have changed my approach as I had a large node tree with HBoxes in Vboxes, name Labels and value Labels.

It is now presented in a PanelContainer with a single Label with all of the results combined in a single string. I believe this is how the information_panel works too.

I have addressed the above and it looks closer to the information panel to me.

  • Does it work / fail gracefully outside of regions or the max region area?

Yes, mouse pos and region still return results and the other values display nan.

  • What happens at large x/z values, do they overflow the edge of the panel (worst option), are they clipped (not good), or does the panel expand? The stock panel only uses 1 decimal of precision on the location. Maybe we don't need parentheses either. These would give more room for large numbers.

The panel expands, and I have removed parentheses and adjusted decimal precision.

  • The panel sticks to the top left in Godot 4.7.1. Also look at 4.6.3.

Weird... I loaded in 4.7.1, and fixed it by setting the vertical flag to shrink_end, not sure why that didn't behave the same between versions. It now appears reliably in the left bottom corner in 4.5.2, 4.6.3 and 4.7.1

@TokisanGames

Copy link
Copy Markdown
Owner

I can't get it to look exactly right - but it is now much closer.

It seems to me, the name of the style is "Information3dViewport"
https://github.com/godotengine/godot/blob/master/editor/scene/3d/node_3d_editor_viewport.cpp#L3867

Which looks right
{1F0357D6-AB3C-4D49-821E-BCCF0346C996}

And you can get the styling directly from the editor like this, which is common practice. That way if it changes because of the theme or code updates, ours will continue to match.
get_theme_stylebox("Information3dViewport", "EditorStyles")

@aidandavey

Copy link
Copy Markdown
Contributor Author

That works perfectly 👌

@TokisanGames

TokisanGames commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Looks and works much better now. Solid work.

When the region tool is selected the current position is off and the results are a bit off. So I've asterisked the position, and kept the only valid data: the region location.
https://github.com/TokisanGames/Terrain3D/blob/main/project/addons/terrain_3d/src/editor_plugin.gd#L193-L196
{FAFBBE5C-6B6E-4499-A956-BF2EF74E027A}

I've replaced nan with -.

{FB6237C5-B12E-4D95-A610-F73C4283B7C9}

Base and overlay are ints, so I've removed the period. I've also padded them with 0s so the pipes are fixed in place. Sadly padding with space doesn't work between 1 and 2 digit texture ids, even if done manually.

{8D744AC4-1E21-4035-9F3C-F57AB6BE4A39} {0FA5A28B-1590-4280-9E73-C1283EA9B3E7}

I also opened the live panel scene and saved it in 4.5.2 without making any changes. Godot gave the file some updates.

Please do the following and we can merge it:

  1. Add documentation w/ pics to the UI page explaining that they can turn on the panel, and what the parameters mean, including the region tool quirk, and to use any other tool with brush size=0 for the most accurate results. And link to the API where this info can be obtained by them.
  2. Save the panel enabled status as an editor setting under Terrain3D/Config, and enable the panel on start if set. See editor_plugin and tool_settings for examples.

You can squash my changes.

@aidandavey
aidandavey force-pushed the Live-info-panel branch 2 times, most recently from bba714f to d7d502b Compare July 21, 2026 17:57
func _ready() -> void:
_editor_settings = EditorInterface.get_editor_settings()
if not _editor_settings.has_setting("terrain3d/config/live_info_panel_enabled"):
_editor_settings.set_setting("terrain3d/config/live_info_panel_enabled", enabled)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better if you use plugin.set_setting() and maybe plugin.setup_editor_settings()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean to check if the setting exists in setup_editor_settings() and if not set a default value? I prefer it being part of the new script, self contained etc... Let me know what you think and/or if I misunderstood.

@TokisanGames

Copy link
Copy Markdown
Owner

Excellent work, thank you.

@TokisanGames
TokisanGames merged commit f37b84d into TokisanGames:main Jul 25, 2026
17 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Terrain3D Roadmap Jul 25, 2026
@aidandavey
aidandavey deleted the Live-info-panel branch July 25, 2026 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Live info panel

2 participants