Skip to content

Commit

Permalink
UObjectHook: Add "Detach all" button
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Oct 26, 2023
1 parent b29cb67 commit 46b0861
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/mods/UObjectHook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,30 @@ void UObjectHook::on_draw_ui() {

std::shared_lock _{m_mutex};

if (!m_motion_controller_attached_components.empty()) {
if (ImGui::Button("Detach all")) {
for (auto it : m_motion_controller_attached_components) {
auto comp = it.first;
auto& state = it.second;

if (state.adjustment_visualizer != nullptr) {
auto vis = state.adjustment_visualizer;
GameThreadWorker::get().enqueue([this, vis]() {
if (!this->exists(vis)) {
return;
}

vis->destroy_actor();
});

state.adjustment_visualizer = nullptr;
}
}

m_motion_controller_attached_components.clear();
}
}

ImGui::Text("Objects: %zu (%zu actual)", m_objects.size(), sdk::FUObjectArray::get()->get_object_count());

if (ImGui::TreeNode("Recent Objects")) {
Expand Down

0 comments on commit 46b0861

Please sign in to comment.