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.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant