-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Low level Component Reflection utiliites for Animation #4985
Copy link
Copy link
Closed
Labels
A-AnimationMake things move and change over timeMake things move and change over timeA-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsA-ReflectionRuntime information about typesRuntime information about typesC-FeatureA new feature, making something new possibleA new feature, making something new possibleC-PerformanceA change motivated by improving speed, memory usage or compile timesA change motivated by improving speed, memory usage or compile times
Metadata
Metadata
Assignees
Labels
A-AnimationMake things move and change over timeMake things move and change over timeA-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsA-ReflectionRuntime information about typesRuntime information about typesC-FeatureA new feature, making something new possibleA new feature, making something new possibleC-PerformanceA change motivated by improving speed, memory usage or compile timesA change motivated by improving speed, memory usage or compile times
Type
Fields
Give feedbackNo fields configured for issues without a type.
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
ReflectComponentfor 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
ComponentInfovtable. 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
ReflectComponentas is, repeatedly fetching the sameEntityRefinternally andTypeId->ComponentIdhashmap lookup for every property on every component on every animated entity.