Merge pull request #79452 from /ysort-update-first-item-position
This commit is contained in:
commit
dc2d1e3f47
2 changed files with 5 additions and 3 deletions
|
@ -606,7 +606,7 @@
|
||||||
[b]Note:[/b] For controls that inherit [Popup], the correct way to make them visible is to call one of the multiple [code]popup*()[/code] functions instead.
|
[b]Note:[/b] For controls that inherit [Popup], the correct way to make them visible is to call one of the multiple [code]popup*()[/code] functions instead.
|
||||||
</member>
|
</member>
|
||||||
<member name="y_sort_enabled" type="bool" setter="set_y_sort_enabled" getter="is_y_sort_enabled" default="false">
|
<member name="y_sort_enabled" type="bool" setter="set_y_sort_enabled" getter="is_y_sort_enabled" default="false">
|
||||||
If [code]true[/code], child nodes with the lowest Y position are drawn before those with a higher Y position. If [code]false[/code], Y-sorting is disabled. Y-sorting only affects children that inherit from [CanvasItem].
|
If [code]true[/code], this [CanvasItem] and its [CanvasItem] child nodes are sorted according to the Y position. Nodes with a lower Y position are drawn before those with a higher Y position. If [code]false[/code], Y-sorting is disabled.
|
||||||
You can nest nodes with Y-sorting. Child Y-sorted nodes are sorted in the same space as the parent Y-sort. This feature allows you to organize a scene better or divide it into multiple ones without changing your scene tree.
|
You can nest nodes with Y-sorting. Child Y-sorted nodes are sorted in the same space as the parent Y-sort. This feature allows you to organize a scene better or divide it into multiple ones without changing your scene tree.
|
||||||
</member>
|
</member>
|
||||||
<member name="z_as_relative" type="bool" setter="set_z_as_relative" getter="is_z_relative" default="true">
|
<member name="z_as_relative" type="bool" setter="set_z_as_relative" getter="is_z_relative" default="true">
|
||||||
|
|
|
@ -311,12 +311,14 @@ void RendererCanvasCull::_cull_canvas_item(Item *p_canvas_item, const Transform2
|
||||||
child_item_count = ci->ysort_children_count + 1;
|
child_item_count = ci->ysort_children_count + 1;
|
||||||
child_items = (Item **)alloca(child_item_count * sizeof(Item *));
|
child_items = (Item **)alloca(child_item_count * sizeof(Item *));
|
||||||
|
|
||||||
|
ci->ysort_xform = ci->xform.affine_inverse();
|
||||||
|
ci->ysort_pos = Vector2();
|
||||||
|
ci->ysort_modulate = Color(1, 1, 1, 1);
|
||||||
|
ci->ysort_index = 0;
|
||||||
ci->ysort_parent_abs_z_index = parent_z;
|
ci->ysort_parent_abs_z_index = parent_z;
|
||||||
child_items[0] = ci;
|
child_items[0] = ci;
|
||||||
int i = 1;
|
int i = 1;
|
||||||
_collect_ysort_children(ci, Transform2D(), p_material_owner, Color(1, 1, 1, 1), child_items, i, p_z);
|
_collect_ysort_children(ci, Transform2D(), p_material_owner, Color(1, 1, 1, 1), child_items, i, p_z);
|
||||||
ci->ysort_xform = ci->xform.affine_inverse();
|
|
||||||
ci->ysort_modulate = Color(1, 1, 1, 1);
|
|
||||||
|
|
||||||
SortArray<Item *, ItemPtrSort> sorter;
|
SortArray<Item *, ItemPtrSort> sorter;
|
||||||
sorter.sort(child_items, child_item_count);
|
sorter.sort(child_items, child_item_count);
|
||||||
|
|
Loading…
Reference in a new issue