|
|
@@ -25,17 +25,17 @@ namespace internal {
|
|
|
#define LABEL_OR(elem) label ? label : std::string{elem.info().name()}.data()
|
|
|
|
|
|
template<typename Entity, typename OnEntity>
|
|
|
-static void present_element(const entt::meta_any &obj, OnEntity on_entity) {
|
|
|
+static void present_element(const meta_any &obj, OnEntity on_entity) {
|
|
|
for([[maybe_unused]] const auto [id, data]: obj.type().data()) {
|
|
|
const auto elem = data.get(obj);
|
|
|
const char *label = data.name();
|
|
|
|
|
|
- if(auto type = data.type(); type.info() == entt::type_id<const char *>()) {
|
|
|
+ if(auto type = data.type(); type.info() == type_id<const char *>()) {
|
|
|
ImGui::Text("%s: %s", LABEL_OR(type), elem.template cast<const char *>());
|
|
|
- } else if(type.info() == entt::type_id<std::string>()) {
|
|
|
+ } else if(type.info() == type_id<std::string>()) {
|
|
|
ImGui::Text("%s: %s", LABEL_OR(type), elem.template cast<const std::string &>().data());
|
|
|
- } else if(type.info() == entt::type_id<Entity>()) {
|
|
|
- if(const auto entt = elem.template cast<Entity>(); entt == entt::null) {
|
|
|
+ } else if(type.info() == type_id<Entity>()) {
|
|
|
+ if(const auto entt = elem.template cast<Entity>(); entt == null) {
|
|
|
ImGui::Text("%s: %s", LABEL_OR(type), "null");
|
|
|
} else {
|
|
|
on_entity(LABEL_OR(type), entt);
|
|
|
@@ -56,11 +56,11 @@ static void present_element(const entt::meta_any &obj, OnEntity on_entity) {
|
|
|
ImGui::Text("%s: %zu", LABEL_OR(type), elem.template allow_cast<std::uint64_t>().template cast<std::uint64_t>());
|
|
|
}
|
|
|
} else if(type.is_arithmetic()) {
|
|
|
- if(type.info() == entt::type_id<bool>()) {
|
|
|
+ if(type.info() == type_id<bool>()) {
|
|
|
std::stringstream buffer{};
|
|
|
buffer << std::boolalpha << elem.template cast<bool>();
|
|
|
ImGui::Text("%s: %s", LABEL_OR(type), buffer.str().data());
|
|
|
- } else if(type.info() == entt::type_id<char>()) {
|
|
|
+ } else if(type.info() == type_id<char>()) {
|
|
|
ImGui::Text("%s: %c", LABEL_OR(type), elem.template cast<char>());
|
|
|
} else if(type.is_integral()) {
|
|
|
ImGui::Text("%s: %zu", LABEL_OR(type), elem.template allow_cast<std::uint64_t>().template cast<std::uint64_t>());
|
|
|
@@ -78,7 +78,7 @@ static void present_element(const entt::meta_any &obj, OnEntity on_entity) {
|
|
|
}
|
|
|
} else if(type.is_sequence_container()) {
|
|
|
if(ImGui::TreeNode(LABEL_OR(type))) {
|
|
|
- entt::meta_sequence_container view = elem.as_sequence_container();
|
|
|
+ meta_sequence_container view = elem.as_sequence_container();
|
|
|
|
|
|
for(std::size_t pos{}, last = view.size(); pos < last; ++pos) {
|
|
|
ImGui::PushID(static_cast<int>(pos));
|
|
|
@@ -95,7 +95,7 @@ static void present_element(const entt::meta_any &obj, OnEntity on_entity) {
|
|
|
}
|
|
|
} else if(type.is_associative_container()) {
|
|
|
if(ImGui::TreeNode(LABEL_OR(type))) {
|
|
|
- entt::meta_associative_container view = elem.as_associative_container();
|
|
|
+ meta_associative_container view = elem.as_associative_container();
|
|
|
auto it = view.begin();
|
|
|
|
|
|
for(std::size_t pos{}, last = view.size(); pos < last; ++pos, ++it) {
|
|
|
@@ -135,15 +135,15 @@ static void present_element(const entt::meta_any &obj, OnEntity on_entity) {
|
|
|
}
|
|
|
|
|
|
template<typename Entity, typename Allocator>
|
|
|
-static void present_storage(const meta_ctx &ctx, const entt::basic_sparse_set<Entity, Allocator> &storage) {
|
|
|
- if(auto type = entt::resolve(ctx, storage.info()); type) {
|
|
|
+static void present_storage(const meta_ctx &ctx, const basic_sparse_set<Entity, Allocator> &storage) {
|
|
|
+ if(auto type = resolve(ctx, storage.info()); type) {
|
|
|
for(auto entt: storage) {
|
|
|
- ImGui::PushID(static_cast<int>(entt::to_entity(entt)));
|
|
|
+ ImGui::PushID(static_cast<int>(to_entity(entt)));
|
|
|
|
|
|
- if(ImGui::TreeNode(&storage.info(), "%d [%d/%d]", entt::to_integral(entt), entt::to_entity(entt), entt::to_version(entt))) {
|
|
|
+ if(ImGui::TreeNode(&storage.info(), "%d [%d/%d]", to_integral(entt), to_entity(entt), to_version(entt))) {
|
|
|
if(const auto obj = type.from_void(storage.value(entt)); obj) {
|
|
|
present_element<typename std::decay_t<decltype(storage)>::entity_type>(obj, [](const char *name, const Entity entt) {
|
|
|
- ImGui::Text("%s: %d [%d/%d]", name, entt::to_integral(entt), entt::to_entity(entt), entt::to_version(entt));
|
|
|
+ ImGui::Text("%s: %d [%d/%d]", name, to_integral(entt), to_entity(entt), to_version(entt));
|
|
|
});
|
|
|
}
|
|
|
|
|
|
@@ -154,7 +154,7 @@ static void present_storage(const meta_ctx &ctx, const entt::basic_sparse_set<En
|
|
|
}
|
|
|
} else {
|
|
|
for(auto entt: storage) {
|
|
|
- ImGui::Text("%d [%d/%d]", entt::to_integral(entt), entt::to_entity(entt), entt::to_version(entt));
|
|
|
+ ImGui::Text("%d [%d/%d]", to_integral(entt), to_entity(entt), to_version(entt));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -163,11 +163,11 @@ template<typename Entity, typename It>
|
|
|
static void present_entity(const meta_ctx &ctx, const Entity entt, const It from, const It to) {
|
|
|
for(auto it = from; it != to; ++it) {
|
|
|
if(const auto &storage = it->second; storage.contains(entt)) {
|
|
|
- if(auto type = entt::resolve(ctx, storage.info()); type) {
|
|
|
+ if(auto type = resolve(ctx, storage.info()); type) {
|
|
|
if(const char *label = type.name(); ImGui::TreeNode(&storage.info(), "%s", LABEL_OR(storage))) {
|
|
|
if(const auto obj = type.from_void(storage.value(entt)); obj) {
|
|
|
present_element<Entity>(obj, [&ctx, from, to](const char *name, const Entity other) {
|
|
|
- if(ImGui::TreeNode(name, "%s: %d [%d/%d]", name, entt::to_integral(other), entt::to_entity(other), entt::to_version(other))) {
|
|
|
+ if(ImGui::TreeNode(name, "%s: %d [%d/%d]", name, to_integral(other), to_entity(other), to_version(other))) {
|
|
|
present_entity<Entity>(ctx, other, from, to);
|
|
|
ImGui::TreePop();
|
|
|
}
|
|
|
@@ -185,21 +185,21 @@ static void present_entity(const meta_ctx &ctx, const Entity entt, const It from
|
|
|
}
|
|
|
|
|
|
template<typename... Get, typename... Exclude, std::size_t... Index>
|
|
|
-static void present_view(const meta_ctx &ctx, const entt::basic_view<get_t<Get...>, exclude_t<Exclude...>> &view, std::index_sequence<Index...>) {
|
|
|
- using view_type = entt::basic_view<get_t<Get...>, exclude_t<Exclude...>>;
|
|
|
+static void present_view(const meta_ctx &ctx, const basic_view<get_t<Get...>, exclude_t<Exclude...>> &view, std::index_sequence<Index...>) {
|
|
|
+ using view_type = basic_view<get_t<Get...>, exclude_t<Exclude...>>;
|
|
|
const std::array<const typename view_type::common_type *, sizeof...(Index)> range{view.template storage<Index>()...};
|
|
|
|
|
|
for(auto tup: view.each()) {
|
|
|
const auto entt = std::get<0>(tup);
|
|
|
- ImGui::PushID(static_cast<int>(entt::to_entity(entt)));
|
|
|
+ ImGui::PushID(static_cast<int>(to_entity(entt)));
|
|
|
|
|
|
- if(ImGui::TreeNode(&entt::type_id<typename view_type::entity_type>(), "%d [%d/%d]", entt::to_integral(entt), entt::to_entity(entt), entt::to_version(entt))) {
|
|
|
+ if(ImGui::TreeNode(&type_id<typename view_type::entity_type>(), "%d [%d/%d]", to_integral(entt), to_entity(entt), to_version(entt))) {
|
|
|
for(const auto *storage: range) {
|
|
|
- if(auto type = entt::resolve(ctx, storage->info()); type) {
|
|
|
+ if(auto type = resolve(ctx, storage->info()); type) {
|
|
|
if(const char *label = type.name(); ImGui::TreeNode(&storage->info(), "%s", LABEL_OR((*storage)))) {
|
|
|
if(const auto obj = type.from_void(storage->value(entt)); obj) {
|
|
|
present_element<typename view_type::entity_type>(obj, [](const char *name, const typename view_type::entity_type entt) {
|
|
|
- ImGui::Text("%s: %d [%d/%d]", name, entt::to_integral(entt), entt::to_entity(entt), entt::to_version(entt));
|
|
|
+ ImGui::Text("%s: %d [%d/%d]", name, to_integral(entt), to_entity(entt), to_version(entt));
|
|
|
});
|
|
|
}
|
|
|
|
|
|
@@ -230,7 +230,7 @@ static void present_view(const meta_ctx &ctx, const entt::basic_view<get_t<Get..
|
|
|
* @param storage An instance of the storage type.
|
|
|
*/
|
|
|
template<typename Type, typename Entity, typename Allocator>
|
|
|
-void davey(const meta_ctx &ctx, const entt::basic_storage<Type, Entity, Allocator> &storage) {
|
|
|
+void davey(const meta_ctx &ctx, const basic_storage<Type, Entity, Allocator> &storage) {
|
|
|
internal::present_storage(ctx, storage);
|
|
|
}
|
|
|
|
|
|
@@ -242,7 +242,7 @@ void davey(const meta_ctx &ctx, const entt::basic_storage<Type, Entity, Allocato
|
|
|
* @param storage An instance of the storage type.
|
|
|
*/
|
|
|
template<typename Type, typename Entity, typename Allocator>
|
|
|
-void davey(const entt::basic_storage<Type, Entity, Allocator> &storage) {
|
|
|
+void davey(const basic_storage<Type, Entity, Allocator> &storage) {
|
|
|
davey(locator<meta_ctx>::value_or(), storage);
|
|
|
}
|
|
|
|
|
|
@@ -254,7 +254,7 @@ void davey(const entt::basic_storage<Type, Entity, Allocator> &storage) {
|
|
|
* @param view An instance of the view type.
|
|
|
*/
|
|
|
template<typename... Get, typename... Exclude>
|
|
|
-void davey(const meta_ctx &ctx, const entt::basic_view<get_t<Get...>, exclude_t<Exclude...>> &view) {
|
|
|
+void davey(const meta_ctx &ctx, const basic_view<get_t<Get...>, exclude_t<Exclude...>> &view) {
|
|
|
internal::present_view(ctx, view, std::index_sequence_for<Get...>{});
|
|
|
}
|
|
|
|
|
|
@@ -265,7 +265,7 @@ void davey(const meta_ctx &ctx, const entt::basic_view<get_t<Get...>, exclude_t<
|
|
|
* @param view An instance of the view type.
|
|
|
*/
|
|
|
template<typename... Get, typename... Exclude>
|
|
|
-void davey(const entt::basic_view<get_t<Get...>, exclude_t<Exclude...>> &view) {
|
|
|
+void davey(const basic_view<get_t<Get...>, exclude_t<Exclude...>> &view) {
|
|
|
davey(locator<meta_ctx>::value_or(), view);
|
|
|
}
|
|
|
|
|
|
@@ -277,14 +277,14 @@ void davey(const entt::basic_view<get_t<Get...>, exclude_t<Exclude...>> &view) {
|
|
|
* @param registry An instance of the registry type.
|
|
|
*/
|
|
|
template<typename Entity, typename Allocator>
|
|
|
-void davey(const meta_ctx &ctx, const entt::basic_registry<Entity, Allocator> ®istry) {
|
|
|
+void davey(const meta_ctx &ctx, const basic_registry<Entity, Allocator> ®istry) {
|
|
|
ImGui::BeginTabBar("#tabs");
|
|
|
|
|
|
if(ImGui::BeginTabItem("Entity")) {
|
|
|
for(const auto [entt]: registry.template storage<Entity>()->each()) {
|
|
|
- ImGui::PushID(static_cast<int>(entt::to_entity(entt)));
|
|
|
+ ImGui::PushID(static_cast<int>(to_entity(entt)));
|
|
|
|
|
|
- if(ImGui::TreeNode(&entt::type_id<Entity>(), "%d [%d/%d]", entt::to_integral(entt), entt::to_entity(entt), entt::to_version(entt))) {
|
|
|
+ if(ImGui::TreeNode(&type_id<Entity>(), "%d [%d/%d]", to_integral(entt), to_entity(entt), to_version(entt))) {
|
|
|
const auto range = registry.storage();
|
|
|
internal::present_entity(ctx, entt, range.begin(), range.end());
|
|
|
ImGui::TreePop();
|
|
|
@@ -298,7 +298,7 @@ void davey(const meta_ctx &ctx, const entt::basic_registry<Entity, Allocator> &r
|
|
|
|
|
|
if(ImGui::BeginTabItem("Storage")) {
|
|
|
for([[maybe_unused]] auto [id, storage]: registry.storage()) {
|
|
|
- if(const char *label = entt::resolve(ctx, storage.info()).name(); ImGui::TreeNode(&storage.info(), "%s (%zu)", LABEL_OR(storage), storage.size())) {
|
|
|
+ if(const char *label = resolve(ctx, storage.info()).name(); ImGui::TreeNode(&storage.info(), "%s (%zu)", LABEL_OR(storage), storage.size())) {
|
|
|
internal::present_storage(ctx, storage);
|
|
|
ImGui::TreePop();
|
|
|
}
|
|
|
@@ -317,7 +317,7 @@ void davey(const meta_ctx &ctx, const entt::basic_registry<Entity, Allocator> &r
|
|
|
* @param registry An instance of the registry type.
|
|
|
*/
|
|
|
template<typename Entity, typename Allocator>
|
|
|
-void davey(const entt::basic_registry<Entity, Allocator> ®istry) {
|
|
|
+void davey(const basic_registry<Entity, Allocator> ®istry) {
|
|
|
davey(locator<meta_ctx>::value_or(), registry);
|
|
|
}
|
|
|
|