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

Give editor nodes descriptive names #8023

Closed
GuyUnger opened this issue Oct 7, 2023 · 9 comments
Closed

Give editor nodes descriptive names #8023

GuyUnger opened this issue Oct 7, 2023 · 9 comments

Comments

@GuyUnger
Copy link

GuyUnger commented Oct 7, 2023

Describe the project you are working on

addons

Describe the problem or limitation you are having in your project

Accessing parts of the editor interface is barely useable, I see many addons doing things like:

var scripts_panel: Control = get_editor_interface().get_script_editor().get_child(0).get_child(1).get_child(0)
if scripts_panel.visible:
	EditorInterface.get_script_editor().get_child(0).get_child(0).get_child(0).get_popup().emit_signal("id_pressed", 14)

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

Give all editor nodes useful names, then there can be a cheat sheet online to find all the names.

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

I'm not sure about the best practice method for accessing the nodes. get_tree().root.find_child("NodenName", true, false) isn't the most pretty, using unique names get_tree().root.get_node("%NodeName") could already be better, but I'm not sure if this works inside the editor?

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

NA

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

NA

@GuyUnger GuyUnger changed the title Give editor nodes unique names Give editor nodes descriptive names Oct 7, 2023
@AThousandShips
Copy link
Member

Them doing that is largely to try to gain access to things that aren't supposed to be exposed in the first place, because they are internal

@GuyUnger
Copy link
Author

GuyUnger commented Oct 7, 2023

Them doing that is largely to try to gain access to things that aren't supposed to be exposed in the first place, because they are internal

Addons can be much better with them exposed, there's no good reason to keep them locked away imo

@AThousandShips
Copy link
Member

there's no good reason to keep them locked away imo

I mean, there often is, can you give me some examples of cases where they should be exposed?

@passivestar
Copy link

One of the major pain points when doing editor scripting for Unity was the fact that there were a lot of cool stuff hidden behind internal methods, and the only way to access them was to use reflection. This proposal seems like a great opportunity for godot to be much cooler than unity and be more open to editor customization. I'd love to have better access to editor ui

@AThousandShips
Copy link
Member

So here's the primary reason to keep editor internals internal:
It frees development up to change things

If everything is exposed you can't change anything without breaking compatibility, that's why you use restricted ways to provide access, not freely allow people to easily access the internals, because then you're stuck in one very particular setup long term

@passivestar
Copy link

I'd prefer it to break compatibility with my addons than not to give me a way to make addons at all 🤷

@AThousandShips
Copy link
Member

I mean that's fine that you think that, but most people don't like to have to rewrite their code every so often because something changed, and we won't break compatibility except when absolutely necessary

@AThousandShips
Copy link
Member

My question still stands though, what are some examples of cases where direct access is required and what are the reasons for accessing those, because chances are there are better ways to access it

@Calinou
Copy link
Member

Calinou commented Oct 7, 2023

Thanks for the proposal! Consolidating in #1018.

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

4 participants