-
What would be the best way to limit view to subset of entities without using Tags.
the obvious primitive solution would be emplace every child with ChildTag and then add the tag to the view. However tags would have to be added, cleared and calling this function from multiple threads would add another level of complexity. Can i somehow create temporary storage, fill it with children entities and create on it view that would do the trick and then return them both?
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Yeah, definitely. You can create the storage as a standlone member of your class or within the registry with its own name: struct foo {
// as member
entt::storage_type_t<void> storage{};
};
// as managed by the registry
auto &storage = registry.storage<void>("my_name"_hs); Consider that in the first case you have to manually cleanup it while ie for(auto [entt, my_t]: (entt::basic_view{storage} | registry.view<T>()).each()) {
// here you get only the entities that are in storage and also have a T
} Is this what you're looking for? |
Beta Was this translation helpful? Give feedback.
-
@ostorek @skypjack I have implemented a small example based on your suggestion.
I am not sure about the following:
Thanks |
Beta Was this translation helpful? Give feedback.
-
The
What do you mean with the object?
Wut?
It depends on the criteria, of course. The pipe returns a view that iterates all the entities that have
I barely get the goal of it. At first glance, |
Beta Was this translation helpful? Give feedback.
Yeah, definitely. You can create the storage as a standlone member of your class or within the registry with its own name:
Consider that in the first case you have to manually cleanup it while ie
destroy
would work on the storage managed by the registry too.Anyway, when you have it, you can slap it into a view and combine the latter with a second view as you like. For example: