-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Changing a Node's type should rename it if the name was equal to the previous type #5462
Comments
Nodes may be referenced in scripts by name. If the editor automatically renames nodes it will break scripts and since it happens automatically the problem is more likely to go unnoticed by the developer. I get where you are coming from, but this will cause more harm than good. |
Yep, blocked on #899 |
There was a pull request for this in the past, but it was rejected: godotengine/godot#28817 However, if refactor tooling is implemented, this proposal could likely be accepted. |
I've been thinking about this for a really long while but I never felt like making a full-on proposal about it. The way this should work as I see it, and this is a personal opinion that may be agreed upon, that this should NOT be an automatic process, at all. Rather, if the conditions are met, the user should be prompted about it. A window popping up and saying something along the lines of "This Node shares the same name as a core class, would you like to rename it, too?" |
It simply could be an option in EditorSettings and disabled by default. |
Settings that are disabled by default have poor discoverability. The feature might as well not exist to 99% of users 🙂 I'd prefer we find a way to make this not annoying, so it can be enabled by default (or better, have no setting at all). |
A workaround mentioned in #7054: renaming a node to an empty name makes it automatically get its base class' name. Way easier than manually typing out the new name, which is what I was doing. |
Describe the project you are working on
Trying to build a test scene where a Control node has several icon.png and ColorRects as children. Wait, maybe it should be a Node2D instead...
Describe the problem or limitation you are having in your project
When changing a node's type in the editor, it will not change the node's name. This is sometimes confusing if the node was left with the default name, as you can end up with things like a
Control
node namedNode2D
. This often happens, for example, when first starting to build a scene, before the purpose and type of every node in it is clearly defined.I've never found a situation where I didn't immediately want to rename it manually, which is cumbersome because I have to check the exact spelling of the new type.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
The node whose type is changed should be renamed automatically because I don't care about the old name anymore.
If it has a custom name, it shows I do care about the name, so no change should happen.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
When changing a node's type in the editor, if the name is equal to the name of the previous type, or a variation of it ("Panel2", "Panel3", etc.), rename it according to the new type.
If this enhancement will not be used often, can it be worked around with a few lines of script?
You can manually rename the node.
Is there a reason why this should be core and not an add-on in the asset library?
It's a QOL feature that would improve editor usability, and it's too small of a change to bother installing an add-on just for it
The text was updated successfully, but these errors were encountered: