Apply skin pose modifications to mesh gizmo collision
WIP PR to make to make skinned meshes selectable. Adds an optional skinning parameter to the Mesh class's generate_triangle_mesh function. Function seems to work, but need to add code to allow the gizmo to update itself based on the state of the skeleton and updates to the assigned Skin resource.
Would like to also add support for blendshapes too, but that can be a seperate PR I think
I'd like to poke for some advice in terms of where I'd like to go with this. As it stands right now, the addition of a pose array does seem to do the job in terms of modifying the TriangleMesh so that it's easier to select rigged models where the rigging of the model can be vastly differently scaled or rotated from the underlying mesh. This already provides some significant usability improvements.
The main thing I want to add to this to finish it is making sure pose updates from the skeleton trigger updates in the underlying TriangleMesh. However, in order to make this efficent, I would like to make it so that instead of a pose update simply calling the gizmo's redraw function, it would be nice if gizmos could hold some kind of internal dirty flag, so that animated characters aren't constantly updating the collision. Since ray intersects for gizmos first work by gathering up a list of bounding box results from the rendering server, this seems like the point I would want to apply some callback to test for that flag, and subseqently update the triangle collision if it's required. Does this sound okay, or is there potentially another way of addressing this?
Likewise, if I add that, I might as well go and add blendshape support too since it doesn't seem that hard to support and would bring full consistent selection for all mesh instances
Instead of adding a dirty flag to gizmos, we could add a new update_colliders() method, which is called right before a ray test is performed. Then the Node itself would be in charge of caching the colliders data, like we do in many places i.e. Shape3D::get_debug_mesh() or Mesh::generate_triangle_mesh().
This way simple colliders can still be generated in redraw() and more complex/time consuming ones can be delayed until they are actually needed.
@JFonS Can you find some time to take this under your wing? We're all trying to get the 4 milestone items done.