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

glTF labels: add enum to avoid misspelling and keep up-to-date list documented #13586

Merged
merged 8 commits into from
May 31, 2024

Conversation

mockersf
Copy link
Member

Objective

Solution

  • Add an enum that can create all the labels possible, and encourage its use rather than manually typed labels

@mockersf mockersf added C-Docs An addition or correction to our documentation A-Assets Load files from disk to use for things like images, models, and sounds labels May 30, 2024
@mockersf mockersf requested a review from IceSentry May 30, 2024 22:42
@mockersf mockersf changed the title glTF labels: add enums to avoid type and keep up-to-date list documented glTF labels: add enum to avoid misspelling and keep up-to-date list documented May 30, 2024
@alice-i-cecile alice-i-cecile added the C-Usability A targeted quality-of-life change that makes Bevy easier to use label May 30, 2024
Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

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

Much nicer pattern: I really like this.

@alice-i-cecile alice-i-cecile added S-Needs-Review Needs reviewer attention (from anyone!) to move forward X-Uncontroversial This work is generally agreed upon D-Straightforward Simple bug fixes and API improvements, docs, test and examples labels May 30, 2024
Copy link
Contributor

@IceSentry IceSentry left a comment

Choose a reason for hiding this comment

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

The from_asset(path) thing reads a little weird, it would be nice if the asset label was a postfix thing like the string labels are but I'm not sure how that would even be implemented. Maybe something like GltfPath::new(<path>).label(<GltAssetLabel>).

Anyway, not a huge deal, having the enum in place is definitely a good thing and makes it way more self documenting.

LGTM

@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels May 31, 2024
@alice-i-cecile alice-i-cecile added this pull request to the merge queue May 31, 2024
@alice-i-cecile alice-i-cecile removed this pull request from the merge queue due to a manual request May 31, 2024
@alice-i-cecile
Copy link
Member

alice-i-cecile commented May 31, 2024

Maybe something like GltfPath::new().label().

I have a moderate preference for this syntax, but if you don't get to it by this weekend I'm merging this on Monday anyways.

@alice-i-cecile alice-i-cecile added the M-Needs-Release-Note Work that should be called out in the blog due to impact label May 31, 2024
@alice-i-cecile
Copy link
Member

Great! I think this is impactful enough to have a small section in the release note.

@mockersf
Copy link
Member Author

mockersf commented May 31, 2024

GltfPath::new(<path>).label(<GltAssetLabel>)

I didn't manage to have an impl of this that I like, with the fact that <path> is a Into<AssetPath<'a>>, <label> a Into<CowArc<'a, str>>, and that some things must be only for 'static

@IceSentry
Copy link
Contributor

I didn't manage to have an impl of this that I like,

Well it was worth a try, but it's not a huge deal if there's no clean solution. I'm happy with the PR as is and if someone finds something cleaner in the future we can always change it.

@alice-i-cecile alice-i-cecile added this pull request to the merge queue May 31, 2024
Merged via the queue into bevyengine:main with commit 5559632 May 31, 2024
28 checks passed
@alice-i-cecile
Copy link
Member

Thank you to everyone involved with the authoring or reviewing of this PR! This work is relatively important and needs release notes! Head over to bevyengine/bevy-website#1327 if you'd like to help out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Assets Load files from disk to use for things like images, models, and sounds C-Docs An addition or correction to our documentation C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Straightforward Simple bug fixes and API improvements, docs, test and examples M-Needs-Release-Note Work that should be called out in the blog due to impact S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it X-Uncontroversial This work is generally agreed upon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants