-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Implement Reflect
for Mesh
#9779
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. Just need to add some registrations
primitive_topology: PrimitiveTopology, | ||
/// `std::collections::BTreeMap` with all defined vertex attributes (Positions, Normals, ...) | ||
/// for this mesh. Attribute ids to attribute values. | ||
/// Uses a BTreeMap because, unlike HashMap, it has a defined iteration order, | ||
/// which allows easy stable VertexBuffers (i.e. same buffer order) | ||
#[reflect(ignore)] | ||
attributes: BTreeMap<MeshVertexAttributeId, MeshAttributeData>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you feel like it I don't see anything preventing anyone from implementing Reflect
on PrimitiveTopology
and MeshAttributeData
.
# Objective - I want to associate `TypeData` with `Mesh`, to make it editable/inspectable in my reflection-based editor. `Mesh` has to implement `Reflect` for that. The precise reflection behavior does not matter. ## Solution - `#[derive(Reflect)]`, ignore fields whose types aren't reflectable. - Call `App::register_asset_reflect` in the `MeshPlugin`. --- ## Changelog - `Mesh` now implements `Reflect`.
Objective
TypeData
withMesh
, to make it editable/inspectable in my reflection-based editor.Mesh
has to implementReflect
for that. The precise reflection behavior does not matter.Solution
#[derive(Reflect)]
, ignore fields whose types aren't reflectable.App::register_asset_reflect
in theMeshPlugin
.Changelog
Mesh
now implementsReflect
.