Skip to content

Commit

Permalink
added headless mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor committed Nov 30, 2023
1 parent 442c1ca commit 6282e98
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
7 changes: 6 additions & 1 deletion src/core/gui/VRGuiManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,12 @@ string VRGuiManager::genUUID() {
void VRGuiManager::init() {
cout << "Init VRGuiManager.." << endl;
mtx = new VRMutex();
standalone = VROptions::get()->getOption<bool>("standalone") || nogtk;
standalone = VROptions::get()->getOption<bool>("standalone");
headless = VROptions::get()->getOption<bool>("headless");

if (headless) {
return;
}

//VRGuiBuilder::get(standalone);
if (standalone) {
Expand Down
2 changes: 1 addition & 1 deletion src/core/gui/VRGuiManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void saveScene(string path = "", bool saveas = false, string encryptionKey = "")

class VRGuiManager {
private:
bool nogtk = false;
bool headless = false;
bool standalone = false;
VRUpdateCbPtr updatePtr;
VRThreadCbPtr gtkUpdateCb;
Expand Down
2 changes: 1 addition & 1 deletion src/core/scripting/VRScriptManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ void VRScriptManager::initPyModules() {
sceneModules.setup(this, pModVR);
cout << " Added scene modules" << endl;

if (!VROptions::get()->getOption<bool>("standalone") && !VROptions::get()->getOption<bool>("nogtk")) {
if (!VROptions::get()->getOption<bool>("standalone") && !VROptions::get()->getOption<bool>("headless")) {
redirectPyOutput("stdout", "Console");
redirectPyOutput("stderr", "Errors");
}
Expand Down
5 changes: 3 additions & 2 deletions src/core/utils/VROptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ VROptions::VROptions() : desc("Configuration ") {
addOption<bool>(false, "fullscreen", "start with fullscreen GL window");
addOption<bool>(false, "ignoreHMD", "ignore HMD if present");
addOption<bool>(false, "active_stereo", "use active_stereo or not");
addOption<bool>(false, "nogtk", "start without UI, even without GL canvas, you should add a glut window in the setup file");
addOption<bool>(false, "headless", "start without UI, even without a window, run application with --application=\"path/to/app\"");
addOption<string>("", "application", "specify an application file to load at startup");
addOption<string>("", "decryption", "pass information to decrypt a secured application, \"key:YOURKEY\"");
addOption<string>("", "setup", "specify the hardware setup file to load, ommiting this will load the last setup");
Expand Down Expand Up @@ -59,8 +59,9 @@ void VROptions::parse(int _argc, char** _argv) {
cout << desc << endl;
}

// for testing
//setOption<bool>("headless", true);
//setOption<bool>("maximized", true);
//setOption<string>("application", "C:\\Users\\victo\\Projects\\lernfabrik\\factory.pvr");

cout << endl;
}

0 comments on commit 6282e98

Please sign in to comment.