Skip to content

Commit

Permalink
UObjectHook: Fix materials getting applied to default actors
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Oct 29, 2023
1 parent 10f6dea commit b5236b8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
5 changes: 5 additions & 0 deletions shared/sdk/FArrayProperty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ void FArrayProperty::update_offsets() {
continue;
}

if (s_inner_offset == 0) {
SPDLOG_ERROR("[FArrayProperty::update_offsets] Failed to find property inner offset");
return;
}

SPDLOG_INFO("[FArrayProperty::update_offsets] Done");
}
}
5 changes: 5 additions & 0 deletions shared/sdk/FObjectProperty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ void FObjectProperty::update_offsets() {
continue;
}

if (s_property_class_offset == 0) {
SPDLOG_ERROR("[FObjectProperty::update_offsets] Failed to find property class offset");
return;
}

SPDLOG_INFO("[FObjectProperty::update_offsets] Done");
}
}
8 changes: 7 additions & 1 deletion src/mods/UObjectHook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1164,12 +1164,18 @@ void UObjectHook::ui_handle_material_interface(sdk::UObject* object) {
//auto components = actor->get_all_components();

for (auto comp_obj : components) {
auto comp = (sdk::UObject*)comp_obj;
auto comp = (sdk::UActorComponent*)comp_obj;
if (comp->is_a(mesh_component_t)) {
if (comp == comp->get_class()->get_class_default_object()) {
continue;
}

auto owner = comp->get_owner();

if (owner == nullptr || owner->get_class()->get_class_default_object() == owner) {
continue;
}

struct {
int32_t num{};
} get_num_materials_params{};
Expand Down

0 comments on commit b5236b8

Please sign in to comment.