Skip to content

Commit

Permalink
cleaned up unneeded changes to ComponentCloneBehavior
Browse files Browse the repository at this point in the history
  • Loading branch information
ElliottjPierce committed Feb 24, 2025
1 parent fe23d37 commit 76df23a
Showing 1 changed file with 7 additions and 18 deletions.
25 changes: 7 additions & 18 deletions crates/bevy_ecs/src/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1113,13 +1113,16 @@ impl ComponentCloneBehavior {

/// Set clone handler based on `Reflect` trait.
#[cfg(feature = "bevy_reflect")]
pub fn reflect_handler() -> Self {
pub fn reflect() -> Self {
Self::Custom(component_clone_via_reflect)
}

/// Set a custom handler for the component.
pub fn custom_handler(handler: ComponentCloneFn) -> Self {
Self::Custom(handler)
/// Returns the "global default"
pub fn global_default_fn() -> ComponentCloneFn {
#[cfg(feature = "bevy_reflect")]
return component_clone_via_reflect;
#[cfg(not(feature = "bevy_reflect"))]
return component_clone_ignore;
}

/// Resolves the [`ComponentCloneBehavior`] to a [`ComponentCloneFn`]. If [`ComponentCloneBehavior::Default`] is
Expand All @@ -1132,20 +1135,6 @@ impl ComponentCloneBehavior {
| ComponentCloneBehavior::RelationshipTarget(custom) => *custom,
}
}

/// Set clone handler based on `Reflect` trait.
#[cfg(feature = "bevy_reflect")]
pub fn reflect() -> Self {
Self::Custom(component_clone_via_reflect)
}

/// Returns the "global default"
pub fn global_default_fn() -> ComponentCloneFn {
#[cfg(feature = "bevy_reflect")]
return component_clone_via_reflect;
#[cfg(not(feature = "bevy_reflect"))]
return component_clone_ignore;
}
}

/// Stores metadata associated with each kind of [`Component`] in a given [`World`].
Expand Down

0 comments on commit 76df23a

Please sign in to comment.