Comments (13)
This is intended behavior (see Node.add_child()).
If
force_readable_name
is true, improves the readability of the added node. If not named, the node is renamed to its type, and if it sharesname
with a sibling, a number is suffixed more appropriately. This operation is very slow. As such, it is recommended leaving this to false, which assigns a dummy name featuring@
in both situations.
Pass true for the second parameter if you want the adjusted name to be based on the original one.
How the @
names are generated is an implementation detail I believe.
from godot.
I would suggest changing the second argument to true by default.
This would break compatibility so won't be possible, it's also undesirable for default performance
from godot.
Please. Demonstration of the problem with the second argument.
test3.zip
from godot.
I'm not very well versed in the source code, but this is only one condition, checking the project settings for add_child, compatibility would not be broken if this setting was not found in the project settings, the usual add_child would be used as before
If I migrate my entire old project to version 4, I will have to rewrite all the add_child functions in order to find them quickly in "Remote" and change them for testing
and when the project passes the test, all these functions will again have to be rewritten with a negative second argument for performance
from godot.
Closing in favor of:
Thank you for your contribution
from godot.
@timothyqiu The second argument in my test project doesn't change anything.
In cases where this problem is fixed, I would suggest changing the second argument to true by default. I often use "Remote" in my projects, and searching by name is quite logical, rather than by type.
from godot.
What problem? It worked according to your previous comment? Are you talking about the default value?
from godot.
What problem? It worked according to your previous comment? Are you talking about the default value?
Perhaps I am not sufficiently informed about the big changes in the fourth version, and to be honest I’m surprised by this behavior of “Remote”, but I write add_child(scn,true) and add_child(scn,false), nothing changes, the name remains the name of the node type
from godot.
The node is just named Node2D
so what's wrong here? It's named what the node is named?
[node name="Node2D" type="Node2D"]
You've not named it Test
like in 3.x
from godot.
The node is just named
Node2D
so what's wrong here? It's named what the node is named?[node name="Node2D" type="Node2D"]
You've not named it
Test
like in 3.x
Run my project, make sure its name is not "Node2D"
from godot.
I'm sorry, I renamed the file itself, but not the node name, my fault...
Maybe we should add an option to the project settings that adds all nodes readable in "Remote" by default, for testing?
from godot.
That would be a lot of extra fragile code instead of just using the function properly, I'm sorry but this isn't really a good change, it's well documented and can't be changed for compatibility, and a project setting would be a significant cost to performance and be confusing
I'd suggest making a proposal if you really want that change, but I doubt it'll be approved, otherwise it's an easy mistake and it's solved by reading the documentation and discovering how to use things like intended
from godot.
It would hurt performance since you'd have to check the settings each time the method is called, and it'd be confusing that the argument to the method is ignored if the setting is set, that's not done anywhere else
The desired default is to not make the name readable, as explained in the documentation description, if you want it the simple solution is to just set the argument to true
, this is not a big task
Further the usage to test things is not really generally how this would be used, you don't have to change the condition back and forth like that, that's not how most people use this AFAIK
But I could be wrong about how likely this is to be relevant, so please open a proposal if you want that feature and that'll let us know if others have the same need for this
Edit: What do you mean by migrating your project? The argument default is the exact same in 3.x as in 4.x?
from godot.
Related Issues (20)
- Rotating a node 90/180 degrees through the Euler angle rotation mode in inspector does not produce the same basis as using the quaternion or matrix properties. HOT 1
- Script editor wrongly replaces and quotes non-ASCII letters HOT 1
- Game (DEBUG) immediately Crashes when calling AddLines() on an EditorNode3DGizmo HOT 1
- [3.x] `Input.is_action_just_pressed()` regression in physics_process HOT 1
- Physics tick counter is incorrect within frame HOT 2
- Godot 4 dynamically evaluating C# script then crash, Fatal error.System.AccessViolationException HOT 4
- [TRACKER] External file changes issues
- Unicode Character “¨” (U+00A8) breaks the Script Editor (edition/save no longer possible) HOT 4
- [Android Editor] Gridmap doesn't render and causes crash when renderer is set to `compatibility` HOT 3
- Same file returns different modified time in different Godot builds HOT 9
- Script editor find highlight gets stuck when find panel is closed in another tab
- The more scenes and resources that are open in the editor, the longer it takes for the project to run
- System.AccessViolationException when creating a new Node2D in a unit test with xUnit HOT 8
- v3.6.beta5.official [2a347ab86] Environment node visual errors
- Custom Icon for Resource needs re-opening editor to show up in the Inspector
- Custom Icons inherited from base classes don't show for Resources
- StateMachine in AnimationTree does not return to its original state
- Nav agent is not restricted to the 'connecting' area when traversing between two nav regions HOT 2
- Godot Editor will not update the changes of material when reloading the current project or when using an imported material
- Godot crashes when calling `open_scene_from_path` on mouse release of Move Mode HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from godot.