-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Curves:
FromReflect
boogaloo part 2 (#15714)
# Objective Allow curve adaptors to be reliably `Reflect` even if the curves they hold are not `FromReflect`. This allows them, for example, to be used in `bevy_animation`. I previously addressed this with the functional adaptors, but I forgot to address this in the case of fields that hold other curves and not arbitrary functions. ## Solution Do the following on every curve adaptor that holds another curve: ```rust // old: #[derive(Reflect)] ``` ```rust // new: #[derive(Reflect, FromReflect)] #[reflect(from_reflect = false)] ``` This looks inane, but it's necessary because the default `#[derive(Reflect)]` macro places `FromReflect` bounds on everything. To avoid this, we opt out of deriving `FromReflect` with that macro by adding `#[reflect(from_reflect = false)]`, then separately derive `FromReflect`. (Of course, the latter still has the `FromReflect` bounds, which is fine.)
- Loading branch information
1 parent
bef44d7
commit 9b863be
Showing
2 changed files
with
52 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters