Conversation
|
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
|
any updates? |
|
The team is focused on 0.15.1, i'm in wait until 0.16 becames the target, then i will merge and do the comments |
3469d1a to
73970d0
Compare
|
there were too many changes on bevy_gltf since my last commit, will restart from main, will reopen when i commit something |
|
@alice-i-cecile can we get this moving now? who would be SME on this topic to do the reviews? |
thepackett
left a comment
There was a problem hiding this comment.
Overall this seems like a good PR. Having read through the GltfLoader code before, this is a significant improvement. I ran CI locally successfully and was able to confirm that examples using Gltf assets were working as expected. The only question I have is whether or not the extension traits should be public or not.
There was a problem hiding this comment.
I am not a fan of how many extension traits there are. This doesn't seem necessary, and results in a bunch of tiny files which hurts readability IMO. For example crates/bevy_gltf/src/ext/scene.rs is a whopping 14 lines. Jumping to this file just to see "oh this is just an extension trait" is quite underwhelming.
I would prefer just free functions for most of these (like the original implementation), just organized into modules more. For example, rather than node.node_name(), we just have node_name(&node) and node_transform(&node) and so on. But with the important part being that node_name and node_transform should be in a mod node.
One case where "extension traits" is likely desirable is labels - these could all be a single trait ToLabel which Scene, Skin, Texture, etc can implement. Now all these disparate label stuffs can be brought under one roof and we can see how all of these are really the same thing over and over again. Of course whether this really is the way we want to go I'm not sure (for example Skin already breaks this pattern since it wants a inverse_bind_matrics_label version - though this could just sit next to the trait implementations as inverse_bind_matrics_label_for_skin to again keep the similar implementations together.
|
@andriyDev see if this solution is satisfactory |
There was a problem hiding this comment.
I added some specific suggestions about the ext module, though I think I generally agree that this is feeling excessively "enterprise-grade."
I don't really agree with the way the changeset is presented. The current arrangement of "the loader stuff is in loader.rs" is logical and not necessarily worse than an "arbitrary" split.
|
@mockersf This PR makes more small files than I personally would, but it's definitely better than the current monster |
|
I see following code by jumping between different files easier that jumping between different locations on the same file |
There's a balance to reach, and this PR takes it too far in the other direction in my opinion |
|
Throwing in my 2 cents as someone who's looking to do work on gltf in future:
|
my first go into this at the tail end of 0.14 was a lot more aggressive with the changes, including breaking the contents of |
… call their respective method once
|
I've finally taken a proper look at this, and I'm broadly on board with this. Definitely a bit aggressive, but it's at least clear. It's much better than the status quo, so I'm going to merge this now. |
alice-i-cecile
left a comment
There was a problem hiding this comment.
Sorry, I changed my mind. I do think this is better than the status quo, but I'm uncomfortable with the single item files, especially since these files feel mostly complete.
Is there another splitting strategy that we can use?
|
|
|
Let's go with 1 and 4, and then resolve 5 by moving them back into lib.rs for now? I like the extensions being separate too. |
|
4 by moving to |
|
Let's go with the |
|
is my solution for 4 satisfactory? |
|
I quite like your final solution for 4. I think this is a nicer balance now; thanks for your patience. These sorts of reorganization PRs are quite painful due to merge conflicts and bikeshedding, but it's important to do them every now and then. |
Objective
Refactor
bevy_gltf, the criteria for the split is kind of arbitrary but at least it is not a 2.6k line file.Solution
Move methods and structs found in
bevy_gltf/loader.rsinto multiple new modules.Testing
cargo run -p ci