Skip to content

Commit

Permalink
Blueprint: Add checkbox to load BP code
Browse files Browse the repository at this point in the history
dfggf
  • Loading branch information
praydog committed Apr 26, 2023
1 parent fcb7ad8 commit b6e6d31
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/mods/VR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1819,6 +1819,7 @@ void VR::on_draw_ui() {
m_enable_gui->draw("Enable GUI");
m_enable_depth->draw("Enable Depth");
m_thumbrest_shifting->draw("Thumbrest DPad Shifting");
m_load_blueprint_code->draw("Load Blueprint Code");
ImGui::EndGroup();

ImGui::NextColumn();
Expand Down
6 changes: 6 additions & 0 deletions src/mods/VR.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,10 @@ class VR : public Mod {
return value == AimMethod::LEFT_CONTROLLER || value == AimMethod::RIGHT_CONTROLLER || value == AimMethod::TWO_HANDED_LEFT || value == AimMethod::TWO_HANDED_RIGHT;
}

bool wants_blueprint_load() const {
return m_load_blueprint_code->value();
}

auto& get_fake_stereo_hook() {
return m_fake_stereo_hook;
}
Expand Down Expand Up @@ -613,6 +617,7 @@ class VR : public Mod {
const ModToggle::Ptr m_enable_depth{ ModToggle::create(generate_name("EnableDepth"), false) };
const ModToggle::Ptr m_decoupled_pitch{ ModToggle::create(generate_name("DecoupledPitch"), false) };
const ModToggle::Ptr m_decoupled_pitch_ui_adjust{ ModToggle::create(generate_name("DecoupledPitchUIAdjust"), true) };
const ModToggle::Ptr m_load_blueprint_code{ ModToggle::create(generate_name("LoadBlueprintCode"), false) };

// Aim method and movement orientation are not the same thing, but they can both have the same options
const ModCombo::Ptr m_aim_method{ ModCombo::create(generate_name("AimMethod"), s_aim_method_names, AimMethod::GAME) };
Expand Down Expand Up @@ -667,6 +672,7 @@ class VR : public Mod {
*m_enable_depth,
*m_decoupled_pitch,
*m_decoupled_pitch_ui_adjust,
*m_load_blueprint_code,
*m_aim_method,
*m_movement_orientation,
*m_aim_speed,
Expand Down
4 changes: 3 additions & 1 deletion src/mods/vr/IXRTrackingSystemHook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,11 +359,13 @@ void IXRTrackingSystemHook::on_draw_ui() {
void IXRTrackingSystemHook::on_pre_engine_tick(sdk::UGameEngine* engine, float delta) {
auto& vr = VR::get();

if (vr->is_any_aim_method_active()) {
if (!m_initialized && (vr->is_any_aim_method_active() || vr->wants_blueprint_load())) {
if (!m_initialized) {
initialize();
}
}

if (vr->is_any_aim_method_active()) {
auto& data = m_process_view_rotation_data;

// This can happen if player logic stops running (e.g. player has died or entered a loading screen)
Expand Down

0 comments on commit b6e6d31

Please sign in to comment.