Skip to content

Conversation

@molikto
Copy link
Contributor

@molikto molikto commented Dec 6, 2025

Objective

  • Make bevy_transform/systems generic by introduce trait DownPropagate. Can be reused in other places.
  • Future plan: also change visibility propagate to use DownPropagate
  • Future plan: add a UpPropagate trait

All changes are very mechanical and I tried to not do any refactors that changes any logic. Easier to review by individual commits.

Solution

  • make it generic.

Testing

  • old tests pass

@molikto molikto changed the title Generic hierachy propogate Generic hierarchy propogate Dec 6, 2025
nodes: &NodeQuery<'_, '_, T>,
) {
#[cfg(feature = "std")]
//let _span = bevy_log::info_span!("input propagation worker").entered();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is just commented out because bevy_log isn't a dependency of bevy_ecs. Not sure if it's necessary to have it. bevy_log::info_span is only called once in entire codebase.

@molikto molikto force-pushed the generic-hierachy-2 branch 2 times, most recently from 6d8860b to fa31466 Compare December 7, 2025 01:31
@molikto molikto changed the title Generic hierarchy propogate Generic hierarchy propagate Dec 7, 2025
@molikto molikto force-pushed the generic-hierachy-2 branch from 9951aae to b1084ec Compare December 7, 2025 01:38
@molikto molikto force-pushed the generic-hierachy-2 branch from b1084ec to cb43707 Compare December 7, 2025 01:47
hierarchy_propagate_simple::<Transform>,
hierarchy_propagate_complex::<Transform>,
)
.chain(),
Copy link
Contributor Author

@molikto molikto Dec 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible to write fn hierarchy_down_propagate_chain(): ? { } I don't know that type should this be. I think only this should be pub, the systems should be private

/// Propagates data down the hierarchy from parent to children (like transforms, visibility).
pub trait DownPropagate {
/// The input component type that contains the local data to be propagated.
type Input: Component;
Copy link
Contributor Author

@molikto molikto Dec 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible to have Input: Bundle so we have multiple input components? I don't think so, does this means we need to have DownPropagate2 etc.

@alice-i-cecile alice-i-cecile added C-Feature A new feature, making something new possible A-ECS Entities, components, systems, and events A-Transform Translations, rotations and scales X-Contentious There are nontrivial implications that should be thought through S-Needs-Review Needs reviewer attention (from anyone!) to move forward X-Controversial There is active debate or serious implications around merging this PR and removed X-Contentious There are nontrivial implications that should be thought through labels Dec 10, 2025
@alice-i-cecile
Copy link
Member

I'm fairly skeptical of adding more complexity here, especially since we already added a simpler generic inheritance system in #17575.

The transform propagation code is extremely perf sensitive, and I don't want it accidentally getting tweaked to improve things for other generic users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ECS Entities, components, systems, and events A-Transform Translations, rotations and scales C-Feature A new feature, making something new possible S-Needs-Review Needs reviewer attention (from anyone!) to move forward X-Controversial There is active debate or serious implications around merging this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants