Skip to content

Commit

Permalink
UObjectHook: Add object "Outer" and allow saving in this path
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Oct 26, 2024
1 parent ff4c8ff commit 1519726
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,7 @@ list(APPEND luavrlib_SOURCES
"lua-api/lib/src/datatypes/Vector.cpp"
"lua-api/lib/src/datatypes/XInput.cpp"
"lua-api/lib/include/ScriptContext.hpp"
"lua-api/lib/include/ScriptPrerequisites.hpp"
"lua-api/lib/include/ScriptState.hpp"
"lua-api/lib/include/ScriptUtility.hpp"
"lua-api/lib/include/datatypes/FFrame.hpp"
Expand Down
23 changes: 23 additions & 0 deletions src/mods/UObjectHook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1602,6 +1602,23 @@ UObjectHook::ResolvedObject UObjectHook::StatePath::resolve() const {
}

switch (utility::hash(*it)) {
case "Outer"_fnv:
{
static const auto object_t = sdk::UObject::static_class();

if (!previous_data_desc->is_a(object_t)) {
return nullptr;
}

previous_data = ((sdk::UObject*)previous_data)->get_outer();
if (previous_data != nullptr) {
previous_data_desc = ((sdk::UObject*)previous_data)->get_class();
} else {
previous_data_desc = nullptr;
}

break;
}
case "Components"_fnv:
{
// Make sure the base is an AActor
Expand Down Expand Up @@ -2393,6 +2410,12 @@ void UObjectHook::ui_handle_object(sdk::UObject* object) {

ImGui::Text("%s", utility::narrow(object->get_full_name()).data());

if (ImGui::TreeNode("Outer")) {
auto outer_scope = m_path.enter("Outer");
ui_handle_object(object->get_outer());
ImGui::TreePop();
}

static const auto material_t = sdk::find_uobject<sdk::UClass>(L"Class /Script/Engine.MaterialInterface");

if (uclass->is_a(material_t)) {
Expand Down

0 comments on commit 1519726

Please sign in to comment.