Skip to content

Low level Component Reflection utiliites for Animation #4985

Closed
@james7132

Description

@james7132

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. Preferably unsafe fn(Ptr<'a>) -> Option<&'a dyn Reflect> and unsafe fn(PtrMut<'a>) -> &'a mut dyn Reflect. Only the latter is really neededThis can be combined with Entity{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 same EntityRef internally and TypeId -> ComponentId hashmap lookup for every property on every component on every animated entity.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-AnimationMake things move and change over timeA-ECSEntities, components, systems, and eventsA-ReflectionRuntime information about typesC-FeatureA new feature, making something new possibleC-PerformanceA change motivated by improving speed, memory usage or compile times

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions