From c7eb5c653ee8492d293bb3b94c9940fa7da2fcd9 Mon Sep 17 00:00:00 2001 From: Aevyrie Roessler Date: Fri, 28 Feb 2025 17:18:58 -0800 Subject: [PATCH] Fix tests --- crates/bevy_transform/src/systems.rs | 15 ++++++--------- crates/bevy_ui/src/layout/mod.rs | 5 +++-- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/crates/bevy_transform/src/systems.rs b/crates/bevy_transform/src/systems.rs index 55408e92cd..71357dc90a 100644 --- a/crates/bevy_transform/src/systems.rs +++ b/crates/bevy_transform/src/systems.rs @@ -9,7 +9,7 @@ pub use serial::propagate_parent_transforms; /// Update [`GlobalTransform`] component of entities that aren't in the hierarchy /// /// Third party plugins should ensure that this is used in concert with -/// [`propagate_parent_transforms`] and [`compute_transform_leaves`]. +/// [`propagate_parent_transforms`] and [`mark_dirty_trees`]. pub fn sync_simple_transforms( mut query: ParamSet<( Query< @@ -57,11 +57,12 @@ pub fn mark_dirty_trees( while let Ok((parent, mut tree)) = transforms.get_mut(next) { if tree.is_changed() { break; // Tree has already been processed - } else { - tree.set_changed(); } + tree.set_changed(); if let Some(parent) = parent.map(ChildOf::get) { next = parent; + } else { + break; }; } } @@ -409,12 +410,8 @@ mod parallel { } } - /// Propagate transforms from `parent` to its non-leaf `children`, pushing updated child - /// entities to the `outbox`. Propagation does not visit leaf nodes; instead, they are computed - /// in [`compute_transform_leaves`](super::compute_transform_leaves), which can optimize much - /// more efficiently. - /// - /// This function will continue propagating transforms to descendants in a depth-first + /// Propagate transforms from `parent` to its `children`, pushing updated child entities to the + /// `outbox`. This function will continue propagating transforms to descendants in a depth-first /// traversal, while simultaneously pushing unvisited branches to the outbox, for other threads /// to take when idle. /// diff --git a/crates/bevy_ui/src/layout/mod.rs b/crates/bevy_ui/src/layout/mod.rs index 16a663b07b..e2a1e15397 100644 --- a/crates/bevy_ui/src/layout/mod.rs +++ b/crates/bevy_ui/src/layout/mod.rs @@ -353,9 +353,10 @@ mod tests { use bevy_math::{Rect, UVec2, Vec2}; use bevy_platform_support::collections::HashMap; use bevy_render::{camera::ManualTextureViews, prelude::Camera}; + use bevy_transform::systems::mark_dirty_trees; use bevy_transform::{ prelude::GlobalTransform, - systems::{compute_transform_leaves, propagate_parent_transforms, sync_simple_transforms}, + systems::{propagate_parent_transforms, sync_simple_transforms}, }; use bevy_utils::prelude::default; use bevy_window::{ @@ -408,9 +409,9 @@ mod tests { update_ui_context_system, ApplyDeferred, ui_layout_system, + mark_dirty_trees, sync_simple_transforms, propagate_parent_transforms, - compute_transform_leaves, ) .chain(), );