You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am working on extending Godot with custom node types. Just slowly over time when I have time, as I can't dedicate a lot of time to this. But I'd like to create Node4D and NodeH3D (Hyperbolic 3D) during the 2020s. I have already made the base Node4D node and the supporting math classes. Nothing inherits it yet, but it exists in 4D, sitting there doing nothing.
Describe the problem or limitation you are having in your project
Godot's 2D and 3D nodes have a visibility system, with is_visible, set_visible, and is_visible_in_tree functions, and the visibility_changed signal. An eyeball appears in the scene tree that shows the state and allows clicking to change it.
It is not possible for custom node types to use the eyeball. Godot's editor code is hard-coded for a few node types.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Change the code to be more generic so that it will work with any node type that implements the visibility API.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Basically, use if (p_node->has_method("is_visible") && p_node->has_method("set_visible") && p_node->has_signal("visibility_changed")) { instead of if (p_node->is_class("CanvasItem")) {, } else if (p_node->is_class("CanvasLayer") || p_node->is_class("Window")) {, } else if (p_node->is_class("Node3D")) {. This also simplifies the code quite a lot because it avoids unnecessary repetition.
If this enhancement will not be used often, can it be worked around with a few lines of script?
No, this is behavior the scene tree editor's C++ code, this can't be modified by GDScript.
Is there a reason why this should be core and not an add-on in the asset library?
The scene tree editor's eyeball feature is already a part of the Godot editor.
The text was updated successfully, but these errors were encountered:
I feel like a virtual method on the node class that determines how editor visibility works would be better. In my case, I want to adjust the visibility of elements of a grid-based game, where everything is made up of basic nodes. Either way, it allows more custom implementations with less headache for the scene tree editor.
Something like virtual bool _has_scene_editor_visibility_button(), virtual bool _get_scene_editor_visibility_button_state(), and virtual bool _scene_editor_visibility_button_state_updated. Similar to the configuration warning methods.
I think I'll try my hand at it...
Actually, if there's an enum for the button state that's better, as more states are required to represent a node being visible but not in the tree (so greyed out).
Describe the project you are working on
I am working on extending Godot with custom node types. Just slowly over time when I have time, as I can't dedicate a lot of time to this. But I'd like to create Node4D and NodeH3D (Hyperbolic 3D) during the 2020s. I have already made the base Node4D node and the supporting math classes. Nothing inherits it yet, but it exists in 4D, sitting there doing nothing.
Describe the problem or limitation you are having in your project
Godot's 2D and 3D nodes have a visibility system, with
is_visible
,set_visible
, andis_visible_in_tree
functions, and thevisibility_changed
signal. An eyeball appears in the scene tree that shows the state and allows clicking to change it.It is not possible for custom node types to use the eyeball. Godot's editor code is hard-coded for a few node types.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Change the code to be more generic so that it will work with any node type that implements the visibility API.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
godotengine/godot#86268
Basically, use
if (p_node->has_method("is_visible") && p_node->has_method("set_visible") && p_node->has_signal("visibility_changed")) {
instead ofif (p_node->is_class("CanvasItem")) {
,} else if (p_node->is_class("CanvasLayer") || p_node->is_class("Window")) {
,} else if (p_node->is_class("Node3D")) {
. This also simplifies the code quite a lot because it avoids unnecessary repetition.If this enhancement will not be used often, can it be worked around with a few lines of script?
No, this is behavior the scene tree editor's C++ code, this can't be modified by GDScript.
Is there a reason why this should be core and not an add-on in the asset library?
The scene tree editor's eyeball feature is already a part of the Godot editor.
The text was updated successfully, but these errors were encountered: