Low level Component Reflection utiliites for Animation #4985
Labels
A-Animation
Make things move and change over time
A-ECS
Entities, components, systems, and events
A-Reflection
Runtime information about types
C-Feature
A new feature, making something new possible
C-Performance
A change motivated by improving speed, memory usage or compile times
What problem does this solve or what need does it fill?
For property based animation (i.e. "animate anything"), we need lower level Reflect utilities than
ReflectComponent
for performant writes of the animated properties. For these systems we will likely have on hand a ComponentId, Entity (and thus EntityLocation), and a pre-parsed property path (see #4081).What solution would you like?
Add another optional entry to the
ComponentInfo
vtable. Preferablyunsafe fn(Ptr<'a>) -> Option<&'a dyn Reflect>
andunsafe fn(PtrMut<'a>) -> &'a mut dyn Reflect
. Only the latter is really neededThis can be combined withEntity{Ref,Mut}::get_by_id
. Realistically these functions are going to just add the vtable pointer metadata to the underlying pointer.Preferably we should be able to find a way to automatically register these hooks for all types that are registered that implement
Component + Reflect
.What alternative(s) have you considered?
Using
ReflectComponent
as is, repeatedly fetching the sameEntityRef
internally andTypeId
->ComponentId
hashmap lookup for every property on every component on every animated entity.The text was updated successfully, but these errors were encountered: