0 votes

So, here we are!

I have the following structure:

-Panel
--Control_0
---Button
---TextureFrame
--Control_1
---Button
---TextureFrame
--Control_2
---Button
---TextureFrame
--Control_3
---Button
---TextureFrame
--Control_4
---Button
---TextureFrame

And I try to reorganize it like

-Panel
--Control_0
---Button
---TextureFrame
---Control_1
--------Button
--------TextureFrame
---Control_2
--------Button
--------TextureFrame
--------Control_3
-----------Button
-----------TextureFrame
-----------Control_4
-------------------Button
-------------------TextureFrame

What I do is:

var my_node = get_node( "path" ); 
remove_child( my_node ); 
new_parent.add_child( my_node )

Why when doing "newparent.addchild(mynode)" the children of mynode are not visible? How can I make the TextureFrame and the Button appear again?

Thank you in advance, I don't really know how to debug this issue.

EDIT: I found that the nodes appear actually, but they are moved to places like 3478,6102

What is happening? I don't modify their position at all

asked Jul 15, 2016 in Engine by Not_a_Robot (86 points)
edited Jul 15, 2016 by Not_a_Robot

I guess Control_3 and Control_4 are located relative to Control_2 node.
Try to reset Control_3 and Control_4 position by set_pos(Vector2(0,0))

Ok, FINALLY! Thank you volzhs!
What you said helped me to find the solution! I set their global positions to the same position as their parent and done!

Thank you for your help! I didn't think about that.

1 Answer

0 votes
Best answer

I guess Control3 and Control4 are located relative to Control2 node.
Try to reset Control
3 and Control4 position by setpos(Vector2(0,0))

from comment

answered Jul 15, 2016 by volzhs (9,462 points)
selected Jul 15, 2016 by Not_a_Robot
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.