Skip to content

Commit

Permalink
Added enum names & values to the live view
Browse files Browse the repository at this point in the history
  • Loading branch information
UE4SS committed Jun 19, 2023
1 parent 97ac2ea commit 8e6d69b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 2 additions & 0 deletions include/GUI/LiveView.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ namespace RC::GUI
auto render_info_panel() -> void;
auto render_info_panel_as_object(const FUObjectItem*, UObject*) -> void;
auto render_info_panel_as_property(FProperty*) -> void;
auto render_bottom_panel() -> void;
auto render_enum() -> void;
auto render_properties() -> void;
auto render_object_sub_tree_hierarchy(UObject* object) -> void;
auto render_struct_sub_tree_hierarchy(UStruct* ustruct) -> void;
Expand Down
30 changes: 29 additions & 1 deletion src/GUI/LiveView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <Unreal/AActor.hpp>
#include <Unreal/UFunction.hpp>
#include <Unreal/FOutputDevice.hpp>
#include <Unreal/UEnum.hpp>
#include <Unreal/Property/FObjectProperty.hpp>
#include <Unreal/Property/FBoolProperty.hpp>
#include <Unreal/Property/FArrayProperty.hpp>
Expand Down Expand Up @@ -1036,6 +1037,33 @@ namespace RC::GUI
return next_item_to_render;
}

auto LiveView::render_enum() -> void
{
const auto currently_selected_object = get_selected_object();
if (!currently_selected_object.first || !currently_selected_object.second) { return; }

auto uenum = static_cast<UEnum*>(currently_selected_object.second);
for (const auto& name : uenum->ForEachName())
{
ImGui::Text("%S <=> %i", name.Key.ToString().c_str(), name.Value);
}
}

auto LiveView::render_bottom_panel() -> void
{
const auto currently_selected_object = get_selected_object();
if (!currently_selected_object.first || !currently_selected_object.second) { return; }

if (currently_selected_object.second->IsA<UEnum>())
{
render_enum();
}
else
{
render_properties();
}
}

auto LiveView::render_properties() -> void
{
const auto currently_selected_object = get_selected_object();
Expand Down Expand Up @@ -1280,7 +1308,7 @@ namespace RC::GUI
ImGui::Unindent();
}

render_properties();
render_bottom_panel();
}

static auto render_fname(FName name) -> void
Expand Down

0 comments on commit 8e6d69b

Please sign in to comment.