Expose transform propagate systems (#7145)
# Objective - I tried to create a fork of bevy_rapier to track latest bevy main branch. But bevy_rapier depends on bevy internal `propagate_transforms` system (see https://github.com/dimforge/bevy_rapier/blob/master/src/plugin/plugin.rs#L64). - `propagate_transforms` system was changed to private in https://github.com/bevyengine/bevy/pull/4775. I don't know if it's reasonable that making `propagate_transforms` public. I also created an issue to bevy_rapier https://github.com/dimforge/bevy_rapier/issues/307 to see how offical team will solve this issue. ## Solution - make `propagate_transforms` system public.
This commit is contained in:
		
							parent
							
								
									aa3dd14bad
								
							
						
					
					
						commit
						7783393c56
					
				| @ -28,6 +28,9 @@ use bevy_reflect::{std_traits::ReflectDefault, FromReflect, Reflect}; | ||||
| /// update the [`Transform`] of an entity in this stage or after, you will notice a 1 frame lag
 | ||||
| /// before the [`GlobalTransform`] is updated.
 | ||||
| ///
 | ||||
| /// Third party plugins should use [`transform_propagate_system_set`](crate::transform_propagate_system_set)
 | ||||
| /// to control when transforms are propagated from parents to children.
 | ||||
| ///
 | ||||
| /// # Examples
 | ||||
| ///
 | ||||
| /// - [`transform`]
 | ||||
|  | ||||
| @ -79,6 +79,13 @@ pub enum TransformSystem { | ||||
|     TransformPropagate, | ||||
| } | ||||
| 
 | ||||
| /// Transform propagation system set for third party plugins use
 | ||||
| pub fn transform_propagate_system_set() -> SystemSet { | ||||
|     SystemSet::new() | ||||
|         .with_system(systems::sync_simple_transforms) | ||||
|         .with_system(systems::propagate_transforms) | ||||
| } | ||||
| 
 | ||||
| /// The base plugin for handling [`Transform`] components
 | ||||
| #[derive(Default)] | ||||
| pub struct TransformPlugin; | ||||
|  | ||||
| @ -3,6 +3,9 @@ use bevy_ecs::prelude::{Changed, Entity, Query, With, Without}; | ||||
| use bevy_hierarchy::{Children, Parent}; | ||||
| 
 | ||||
| /// Update [`GlobalTransform`] component of entities that aren't in the hierarchy
 | ||||
| ///
 | ||||
| /// Third party plugins should use [`transform_propagate_system_set`](crate::transform_propagate_system_set)
 | ||||
| /// to propagate transforms correctly.
 | ||||
| pub fn sync_simple_transforms( | ||||
|     mut query: Query< | ||||
|         (&Transform, &mut GlobalTransform), | ||||
| @ -16,6 +19,9 @@ pub fn sync_simple_transforms( | ||||
| 
 | ||||
| /// Update [`GlobalTransform`] component of entities based on entity hierarchy and
 | ||||
| /// [`Transform`] component.
 | ||||
| ///
 | ||||
| /// Third party plugins should use [`transform_propagate_system_set`](crate::transform_propagate_system_set)
 | ||||
| /// to propagate transforms correctly.
 | ||||
| pub fn propagate_transforms( | ||||
|     mut root_query: Query< | ||||
|         ( | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 张林伟
						张林伟