duplicate_vertices silently consumes indices
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 171
Description
## How can Bevy's documentation be improved?
[`Mesh::duplicate_vertices`](https://docs.rs/bevy/0.13.2/bevy/render/mesh/struct.Mesh.html#method.duplicate_vertices) silently takes `indices` from the `Mesh` but doesn't mention it in the method documentation.
This lead to my code breaking because it relied upon indices being present. I added a call to `duplicate_vertices` and didn't realise my later code that did something for each index was now not running.
I assume not rebuilding the index data is an optimisation. Either way this behaviour should be documented or the code should rebuild the index data if it was previously present.
An alternative could be to have a function `duplicate_vertices_without_indices` (naming aside) that would have the current behaviour, and change `duplicate_vertices` to rebuild the index data before finishing. I'm thinking along the same lines as `Vec::sort` and `Vec::sort_unstable`, or `Vec::remove` and `Vec::swap_remove` having longer/different names for behaviours that have side effects the programmer should take note of.
Contributor guide
Research direction
Start with the linked Mesh::duplicate_vertices documentation and its implementation in the Bevy source to confirm how existing indices are handled. Update the method documentation to state the effect on indices, or clarify the intended API behavior if maintainers choose a code change; done means the documented behavior matches the implementation and the reported usage is unambiguous.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- game-dev
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100