Giter Club home page Giter Club logo

Comments (13)

timothyqiu avatar timothyqiu commented on June 24, 2024 1

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 shares name 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.

AThousandShips avatar AThousandShips commented on June 24, 2024 1

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.

JekSun97 avatar JekSun97 commented on June 24, 2024 1

Please. Demonstration of the problem with the second argument.
test3.zip

from godot.

JekSun97 avatar JekSun97 commented on June 24, 2024 1

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.

AThousandShips avatar AThousandShips commented on June 24, 2024 1

Closing in favor of:

Thank you for your contribution

from godot.

JekSun97 avatar JekSun97 commented on June 24, 2024

@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.

32

from godot.

AThousandShips avatar AThousandShips commented on June 24, 2024

What problem? It worked according to your previous comment? Are you talking about the default value?

from godot.

JekSun97 avatar JekSun97 commented on June 24, 2024

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.

AThousandShips avatar AThousandShips commented on June 24, 2024

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.

JekSun97 avatar JekSun97 commented on June 24, 2024

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

32

Run my project, make sure its name is not "Node2D"

from godot.

JekSun97 avatar JekSun97 commented on June 24, 2024

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.

AThousandShips avatar AThousandShips commented on June 24, 2024

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.

AThousandShips avatar AThousandShips commented on June 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.