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

Godot names nodes in reverse order when duplicating more then 1 #38162

Closed
Shadowblitz16 opened this issue Apr 23, 2020 · 3 comments · Fixed by #38376
Closed

Godot names nodes in reverse order when duplicating more then 1 #38162

Shadowblitz16 opened this issue Apr 23, 2020 · 3 comments · Fixed by #38376

Comments

@Shadowblitz16
Copy link

Godot version:
3.2.1

OS/device including version:
Windows 10 Pro Education 64 bit

Issue description:
when duplicating nodes the editor seems to name them in reverse order.
image

Steps to reproduce:

  • create two nodes 1 named Block0 and another named Block1
  • duplicate them
  • see that Block0 and Block3 are in the same position but Block 3 should be named Block2 and Block2 should be named Block3

Minimal reproduction project:
Not needed

@aaronfranke
Copy link
Member

I took a look at the code and couldn't figure it out. https://github.com/godotengine/godot/blob/master/editor/scene_tree_dock.cpp#L556

If I change the loop to .front() and ->next() instead of .back() and ->prev(), the behavior is the same somehow and has the same bug.

If I change selection_tail to move to the parent's next child each iteration, the result is that the duplicated nodes are placed after nodes after the selection (and the editor crashes if there are no more nodes to skip over).

If I change selection_tail to point to the previous duplicated node, then future duplicated nodes aren't added to the scene, and performing more operations with the same selection gives "Can't operate on nodes from a foreign scene!"

How do we place duplicated nodes after other duplicated nodes?

@TheDuriel
Copy link
Contributor

Might be because renaming is automatically done, and propagates up the tree, not down.

So you'd duplicate the nodes, wait for them to rename, then sort. Or rename them before adding the copy to the scene tree.

@sumit0190
Copy link
Contributor

@aaronfranke That's strange - I ran into this issue today and made the same change as you did to see if it fixes it (change back to front and prev to next) - and it worked. Now Block2 corresponds to Block0 and Block3 to Block1, but they are still added into the hierarchy incorrectly (i.e., Block3 comes before Block2).

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

Successfully merging a pull request may close this issue.

5 participants