From 606a5b82991c55d70eced5b6397ebac72ceab666 Mon Sep 17 00:00:00 2001 From: UE4SS Date: Mon, 16 Oct 2023 06:03:53 +0200 Subject: [PATCH 1/2] Made enum values use their display name when appropriate in the live view tab --- UE4SS/src/GUI/LiveView.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/UE4SS/src/GUI/LiveView.cpp b/UE4SS/src/GUI/LiveView.cpp index e5952f466..ab80ba686 100644 --- a/UE4SS/src/GUI/LiveView.cpp +++ b/UE4SS/src/GUI/LiveView.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -1385,6 +1386,13 @@ namespace RC::GUI } render_property_value_context_menu(tree_node_id); } + else if (auto enum_property = CastField(property); enum_property) + { + auto value_raw = std::bit_cast(container_ptr); + auto value_as_string = Unreal::UKismetNodeHelperLibrary::GetEnumeratorUserFriendlyName(enum_property->GetEnum(), *value_raw); + ImGui::SameLine(); + ImGui::Text("%S", value_as_string.c_str()); + } else { ImGui::SameLine(); From 33e040984354d41534f7e1fa6a14d7e180f188db Mon Sep 17 00:00:00 2001 From: UE4SS Date: Mon, 16 Oct 2023 06:56:04 +0200 Subject: [PATCH 2/2] ByteProperties that are enums are now also using their display name when appropriate --- UE4SS/src/GUI/LiveView.cpp | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/UE4SS/src/GUI/LiveView.cpp b/UE4SS/src/GUI/LiveView.cpp index ab80ba686..4c294f971 100644 --- a/UE4SS/src/GUI/LiveView.cpp +++ b/UE4SS/src/GUI/LiveView.cpp @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -33,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -1386,12 +1388,31 @@ namespace RC::GUI } render_property_value_context_menu(tree_node_id); } - else if (auto enum_property = CastField(property); enum_property) + else if (property->IsA() || property->IsA()) { - auto value_raw = std::bit_cast(container_ptr); - auto value_as_string = Unreal::UKismetNodeHelperLibrary::GetEnumeratorUserFriendlyName(enum_property->GetEnum(), *value_raw); + UEnum* uenum{}; + if (property->IsA()) + { + uenum = static_cast(property)->GetEnum(); + } + else + { + uenum = static_cast(property)->GetEnum(); + } + auto value_raw = *std::bit_cast(container_ptr); + uint8 enum_index{}; + for (const auto& [key_value_pair, index] : uenum->ForEachName() | views::enumerate) + { + if (key_value_pair.Value == value_raw) + { + enum_index = index; + break; + } + } + auto value_as_string = Unreal::UKismetNodeHelperLibrary::GetEnumeratorUserFriendlyName(uenum, enum_index); ImGui::SameLine(); ImGui::Text("%S", value_as_string.c_str()); + render_property_value_context_menu(); } else {