Skip to content

Commit 8ec85c0

Browse files
committed
fixed some issues with disableOpenVrApi
1 parent 88dc95d commit 8ec85c0

File tree

2 files changed

+50
-48
lines changed

2 files changed

+50
-48
lines changed

AprilTagTrackers/Connection.cpp

Lines changed: 46 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -110,68 +110,66 @@ void Connection::Connect()
110110
}
111111
}
112112

113-
if (user_config.disableOpenVrApi)
113+
if (!user_config.disableOpenVrApi)
114114
{
115-
status = CONNECTED;
116-
return;
117-
}
118115

119-
// connect to steamvr as a client in order to get buttons.
120-
vr::EVRInitError error;
121-
openvr_handle = VR_Init(&error, vr::VRApplication_Overlay);
116+
// connect to steamvr as a client in order to get buttons.
117+
vr::EVRInitError error;
118+
openvr_handle = VR_Init(&error, vr::VRApplication_Overlay);
122119

123-
if (error != vr::VRInitError_None)
124-
{
125-
std::string ovrErr = vr::VR_GetVRInitErrorAsEnglishDescription(error);
126-
SetError(ErrorCode::CLIENT_ERROR, std::move(ovrErr));
127-
return;
128-
}
120+
if (error != vr::VRInitError_None)
121+
{
122+
std::string ovrErr = vr::VR_GetVRInitErrorAsEnglishDescription(error);
123+
SetError(ErrorCode::CLIENT_ERROR, std::move(ovrErr));
124+
return;
125+
}
129126

130-
/*
131-
vr::HmdMatrix34_t testZeroToStanding = openvr_handle->GetRawZeroPoseToStandingAbsoluteTrackingPose();
127+
/*
128+
vr::HmdMatrix34_t testZeroToStanding = openvr_handle->GetRawZeroPoseToStandingAbsoluteTrackingPose();
132129
133-
std::string e = "Zero pose to standing: \n ";
134-
for (int i = 0; i < 3; i++)
135-
{
136-
for (int j = 0; j < 4; j++)
130+
std::string e = "Zero pose to standing: \n ";
131+
for (int i = 0; i < 3; i++)
137132
{
138-
e += std::to_string(testZeroToStanding.m[i][j]) + ", ";
133+
for (int j = 0; j < 4; j++)
134+
{
135+
e += std::to_string(testZeroToStanding.m[i][j]) + ", ";
136+
}
137+
e += "\n";
139138
}
140-
e += "\n";
141-
}
142-
wxMessageDialog dial(NULL,
143-
e, wxT("Error"), wxOK | wxICON_ERROR);
144-
dial.ShowModal();
139+
wxMessageDialog dial(NULL,
140+
e, wxT("Error"), wxOK | wxICON_ERROR);
141+
dial.ShowModal();
145142
146-
vr::HmdMatrix34_t testStandingToSeated = openvr_handle->GetSeatedZeroPoseToStandingAbsoluteTrackingPose();
143+
vr::HmdMatrix34_t testStandingToSeated = openvr_handle->GetSeatedZeroPoseToStandingAbsoluteTrackingPose();
147144
148-
e = "Seated pose to standing: \n ";
149-
for (int i = 0; i < 3; i++)
150-
{
151-
for (int j = 0; j < 4; j++)
145+
e = "Seated pose to standing: \n ";
146+
for (int i = 0; i < 3; i++)
152147
{
153-
e += std::to_string(testStandingToSeated.m[i][j]) + ", ";
148+
for (int j = 0; j < 4; j++)
149+
{
150+
e += std::to_string(testStandingToSeated.m[i][j]) + ", ";
151+
}
152+
e += "\n";
154153
}
155-
e += "\n";
156-
}
157-
wxMessageDialog dial2(NULL,
158-
e, wxT("Error"), wxOK | wxICON_ERROR);
159-
dial2.ShowModal();
154+
wxMessageDialog dial2(NULL,
155+
e, wxT("Error"), wxOK | wxICON_ERROR);
156+
dial2.ShowModal();
160157
161-
*/
162-
const auto bindingsPath = std::filesystem::absolute("bindings/att_actions.json");
163-
if (!std::filesystem::exists(bindingsPath))
164-
{
165-
SetError(ErrorCode::BINDINGS_MISSING);
166-
return;
167-
}
168-
vr::VRInput()->SetActionManifestPath(bindingsPath.generic_u8string().c_str());
158+
*/
159+
const auto bindingsPath = std::filesystem::absolute("bindings/att_actions.json");
160+
if (!std::filesystem::exists(bindingsPath))
161+
{
162+
SetError(ErrorCode::BINDINGS_MISSING);
163+
return;
164+
}
165+
vr::VRInput()->SetActionManifestPath(bindingsPath.generic_u8string().c_str());
169166

170-
vr::VRInput()->GetActionHandle("/actions/demo/in/grab_camera", &m_actionCamera);
171-
vr::VRInput()->GetActionHandle("/actions/demo/in/grab_trackers", &m_actionTrackers);
172-
vr::VRInput()->GetActionHandle("/actions/demo/in/Hand_Left", &m_actionHand);
167+
vr::VRInput()->GetActionHandle("/actions/demo/in/grab_camera", &m_actionCamera);
168+
vr::VRInput()->GetActionHandle("/actions/demo/in/grab_trackers", &m_actionTrackers);
169+
vr::VRInput()->GetActionHandle("/actions/demo/in/Hand_Left", &m_actionHand);
173170

174-
vr::VRInput()->GetActionSetHandle("/actions/demo", &m_actionsetDemo);
171+
vr::VRInput()->GetActionSetHandle("/actions/demo", &m_actionsetDemo);
172+
}
175173

176174
std::istringstream ret;
177175
std::string word;

AprilTagTrackers/MyApp.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ int MyApp::OnExit()
2323
bool MyApp::OnInit()
2424
{
2525
userConfig.Load();
26+
27+
//The next two lines were added as a quick fix. The two options should be handeled differently from other parameters, so as a quick fix, they are reset on every launch of ATT.
2628
userConfig.driver_version = SemVer::Parse(REFLECTABLE_STRINGIZE(ATT_DRIVER_VERSION)); //a quick patch to prevent parameters from having an outdated version number
29+
userConfig.disableOpenVrApi = false; //since disable openvr api isnt part of the parameters, it isnt loaded properly. This ensures it is globaly disabled on every launch.
30+
2731
calibConfig.Load();
2832
arucoConfig.Load();
2933
lc.LoadLang(userConfig.langCode);

0 commit comments

Comments
 (0)