Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option to mark a node and it's children as editor or debug only #11162

Open
funkysandwich opened this issue Nov 15, 2024 · 1 comment
Open

Comments

@funkysandwich
Copy link

Describe the project you are working on

A VR game with grabbable objects.

Describe the problem or limitation you are having in your project

I have a node that marks a 'grab point' on an interactable, and I would like a cleaner way to visualize these in the editor.

How I am doing this currently:

I have a scene with the grab point script on the root, and a meshinstance as a child of that, with the mesh set to a model of a hand.
I can toggle a custom 'visible' property on the grab point to set the visibility of this hand. This helps me position the grab points where I want them in the editor easily.
image

I want this to only be visible within the editor, regardless of if I left Show Visual on, and to have the node for the visual be removed from builds as it is not needed.

I can remove the node on spawn in builds, but if it's intended for the editor, why spawn it in builds at all?
I think there should be a built in way to do this.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Editor only nodes would be a clean way to help people quickly create their own helper visuals for the editor.
This proposal is asking for something similar, but for 2D sprites. #11105
I propose being able to mark a node as being editor or debug only, and this would work for all types of nodes.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

A new enum property would be added to Node with three options:

  • Everywhere: The default option. The node exists, is visible, and processes like it usually does.
  • Debug: Exists, but only visible/processible if an option is enabled.
  • Editor Only / Remove from builds: Node will not exist at all within built projects.

The editor would also have a new option under the Debug tab that would allow creating debug nodes, similar to how you can enable collision shape visibility when running from the editor.
image
The Editor Only option of this enum for all nodes would also replace the Editor Only checkbox for lights.
image

If this enhancement will not be used often, can it be worked around with a few lines of script?

Yes.

extends Node

func _ready() -> void:
	if not OS.get_cmdline_args().has("--debug-nodes"):
		print('Removing debug node %s' % get_path())
		queue_free()

Is there a reason why this should be core and not an add-on in the asset library?

A built in option to mark a node as an editor or debug node would be a convenient feature.

@Calinou
Copy link
Member

Calinou commented Nov 15, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants