Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Default impl for CubicCurve #11335

Merged
merged 2 commits into from Jan 14, 2024

Conversation

BD103
Copy link
Member

@BD103 BD103 commented Jan 13, 2024

Objective

Solution

  • Remove Default from CubicCurve's derive statement.

Based off of @mockersf comment (#11211 (comment)):

CubicCurve can't be updated once created... I would prefer to remove the Default impl as it doesn't make sense


Changelog

  • Removed the Default implementation for CubicCurve.

Migration Guide

  • Remove CubicCurve from any structs that implement Default.
  • Wrap CubicCurve in a new type and provide your own default.
#[derive(Deref)]
struct MyCubicCurve<P: Point>(pub CubicCurve<P>);

impl Default for MyCubicCurve<Vec2> {
    fn default() -> Self {
        let points = [[
            vec2(-1.0, -20.0),
            vec2(3.0, 2.0),
            vec2(5.0, 3.0),
            vec2(9.0, 8.0),
        ]];

        Self(CubicBezier::new(points).to_curve())
    }
}

@alice-i-cecile alice-i-cecile added C-Bug An unexpected or incorrect behavior C-Breaking-Change A breaking change to Bevy's public API that needs to be noted in a migration guide labels Jan 13, 2024
@alice-i-cecile alice-i-cecile added the A-Math Fundamental domain-agnostic mathematical operations label Jan 13, 2024
@alice-i-cecile alice-i-cecile added this to the 0.13 milestone Jan 13, 2024
@mockersf mockersf added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Jan 14, 2024
@mockersf mockersf added this pull request to the merge queue Jan 14, 2024
Merged via the queue into bevyengine:main with commit 6f6269e Jan 14, 2024
26 checks passed
@BD103 BD103 deleted the rm-cubic-curve-default branch January 14, 2024 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Math Fundamental domain-agnostic mathematical operations C-Breaking-Change A breaking change to Bevy's public API that needs to be noted in a migration guide C-Bug An unexpected or incorrect behavior S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
3 participants