Skip to content
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

Low level Component Reflection utiliites for Animation #4985

Closed
james7132 opened this issue Jun 11, 2022 · 1 comment
Closed

Low level Component Reflection utiliites for Animation #4985

james7132 opened this issue Jun 11, 2022 · 1 comment
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

Comments

@james7132
Copy link
Member

james7132 commented Jun 11, 2022

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.

@james7132 james7132 added C-Feature A new feature, making something new possible A-ECS Entities, components, systems, and events C-Performance A change motivated by improving speed, memory usage or compile times A-Animation Make things move and change over time A-Reflection Runtime information about types labels Jun 11, 2022
@MrGVSV MrGVSV moved this to Open in Reflection Oct 15, 2022
@james7132
Copy link
Member Author

This has been resolved (safely) by #7206.

@github-project-automation github-project-automation bot moved this from Open to Done in Reflection Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
Status: Done
Development

No branches or pull requests

1 participant