Godot Version
4.6
Question
Is there a way to await until just before the tree updates all the positioning of the nodes in the tree?
I am trying to make a vertical list menu using control nodes and have managed to get things almost working the way I want
The nodes are set up like this:
PlaylistVBox is the main container, I want it to center vertically based on which child GameEntry is selected.
The bit of code that is attached to the PlaylistVBox and centers the text looks like this:
func update_selected(dir: int = 0): # Increment which Game Entry is selected, clamp the value selected += dir if selected > children.size() - 1: selected = 0 elif selected < 0: selected = children.size() - 1 # Go through children and set selected. Selected children's text gets much larger and changes the shape and size so we can't predict where the center should be before we do this var original_position = global_position var i = 0 for child in children: child.set_unselected() if i == selected: child.set_selected() selected_child = child i += 1 # Apparently this is needed I'm guessing this is because node positions update at the END of a frame, and process_frame triggers at the START of the next one. This gets the right positioning, but makes the positions wrong for one frame causing an ugly flash :( await get_tree().process_frame # Now that all of the entries are changed appropriately, center the box based on the new sizing global_position.y = global_position.y + (center.global_position.y - (selected_child.global_position.y + selected_child.size.y * 0.5))
Is there a way to await until just before the tree nodes update their positions? Or is there another solution to get around this?
I’ve also tried adding force_transform_update() after each child has changed their size and on all of the parent nodes as well. Nothing has worked other than the process_frame and the frame flash is driving me crazy!
Thanks in advance for any help

