Can I change the render order of a node?

I have a node in a gui that have render_order(0), I need to move that node, but it goes thought other gui nodes that have render order 1 or 2.

How can I change the render order of this node?(need to move above the other nodes, but his gui need to stay in render order 0.

thanks

gui.set_render_order() sets the render order of that entire scene context the script is in. This is so you can control the render order of different .gui files.

If you want to change the order of GUI nodes you can use gui.move_above() and gui.move_below() along with gui.set_parent() to move stuff between top level nodes which you can order in specific ways in the editor itself.

2 Likes

but with move_above the node will be below other gui elements. I have 3 guis, and the gui A needs always be in 0, but a node of gui A , need to be above gui B and C, but being part of gui A

Are you talking about multiple .gui components or multiple GUI nodes?

Both. Node 1 in gui A need to go from render 0 to render 4 without change the render position oh his gui.

Let me try and explain how it works:

  • The nodes within one gui scene (ie one .gui file) can be arranged using hierarchy and layers to control in which order they are rendered. You can also use gui.move_above() and gui.move_below() to change the order of two nodes in a scene that are in the same position in the hierarchy.
  • You can order all the nodes from one gui scene to be above or below all of the nodes from another gui scene using gui.set_render_order()

You can never make an individual node of one gui scene be on top of the nodes from another scene while the rest of the nodes from the first scene are below, or vice versa.

You can learn more about gui draw order in the manual.

3 Likes

Hi britzl,

While we’re here, may I ask if we can set the Gui under another scene (not Gui)?
I may want the background image to be in the Gui and the game on top of that.

Thanks!

This was discussed recently. Check here: [From Gideros] Generate spinning rays dynamically

1 Like

:frowning: this is a big issue, How can I do a workaround?

A workaround for what? Can you please explain in a bit more detail what you want to achieve?

I have a gui (A) with different nodes, (cards, buttons and a background) . I have another gui (B), with card nodes, button nodes, and another background, this gui(B) need to be below gui A.

a button starts a gui animation of a gui B node. this node moves along the screen and goes out. Now, the node , when reach the elements of gui A, dissapears below them (as expected), but I need that this node( a card) , is visible during the entire animation.

Can you perhaps delete the node in B and recreate it in A before starting the animation?

Im using clone_tree from an existing node(with children), and then I animate that.
Can I send a message to gui A, this node tree?
I think I need to create in gui A a copy of the node clone_tree(node). How can I do that?

thanks

thinking… or I can pass the clone tree reference to gui A , and then use clone tree, in that node

Pass the position of the node to create in a message to the other gui.

Cant understand how can I create a node with his children passing only the position…

Im trying to do:

local node=gui.clone_tree(self.nodos[node_selected])
msg.post("gui#anotherGui", "move_node",{node})

but geeting “keys in table must be of type number or string (found userdata)”

I cloned a node in the other gui, and set the img, and text of the selected node. done

Like you said, now the best idea is to have a default node like you will need, and when you need it, cloning, set the data and move it inside viewport.

Thanks