Commit 3ce9f523 authored by Alexander Bock's avatar Alexander Bock
Browse files

Add new dedicated directory for screenshots

 * Add ability to have current date in file name path
 * Remove SGCT_ prefix for screenshots (closes #449)
parent 9f90c6c3
No related merge requests found
Showing with 55 additions and 7 deletions
+55 -7
......@@ -10,28 +10,23 @@
/sync/
tmp/
Thumbs.db
*~
*.swp
*.gglsl
*.GhoulGenerated.glsl
*.OpenSpaceGenerated.glsl
shaders/generated/*
# CMake stuff
CMakeCache.txt
CMakeFiles
Makefile
cmake_install.cmake
install_manifest.txt
# Eclipse stuff
.cproject
.project
shaders/ABuffer/constants.hglsl
ScriptLog.txt
customization.lua
COMMIT.md
screenshots
\ No newline at end of file
......@@ -22,6 +22,7 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#include <openspace/engine/configurationmanager.h>
#include <openspace/engine/openspaceengine.h>
#include <openspace/engine/wrapper/sgctwindowwrapper.h>
#include <openspace/util/keys.h>
......@@ -31,6 +32,8 @@
#include <ghoul/misc/boolean.h>
#include <sgct.h>
#include <chrono>
#include <ctime>
#ifdef WIN32
......@@ -306,6 +309,41 @@ void mainInitFunc() {
#endif // OPENSPACE_HAS_SPOUT
}
std::string k = openspace::ConfigurationManager::KeyScreenshotUseDate;
std::string screenshotPath = "${SCREENSHOTS}";
std::string screenshotNames = "OpenSpace";
if (OsEng.configurationManager().hasKey(k)) {
std::time_t now = std::time(nullptr);
std::tm* nowTime = std::localtime(&now);
char mbstr[100];
strftime(mbstr, sizeof(mbstr), "%Y-%m-%d-%H-%M", nowTime);
screenshotPath += "/" + std::string(mbstr);
FileSys.createDirectory(absPath(screenshotPath));
}
for (size_t i = 0; i < nWindows; ++i) {
sgct_core::ScreenCapture* cpt0 =
SgctEngine->getWindowPtr(i)->getScreenCapturePointer(0);
sgct_core::ScreenCapture* cpt1 =
SgctEngine->getWindowPtr(i)->getScreenCapturePointer(1);
if (cpt0) {
cpt0->setPathAndFileName(
absPath(screenshotPath),
screenshotNames
);
}
if (cpt1) {
cpt1->setPathAndFileName(
screenshotPath,
screenshotNames
);
}
}
LTRACE("main::mainInitFunc(end)");
}
......
......@@ -169,6 +169,8 @@ public:
static const std::string PartShowProgressbar;
/// The key used to specify module specific configurations
static const std::string KeyModuleConfigurations;
/// The key used to specify whether screenshots should contain the current date
static const std::string KeyScreenshotUseDate;
/**
......
......@@ -51,6 +51,8 @@ return {
ASSETS = "${DATA}/assets",
FONTS = "${DATA}/fonts",
TASKS = "${DATA}/tasks",
SYNC = "${BASE}/sync",
SCREENSHOTS = "${BASE}/screenshots",
WEB = "${DATA}/web",
CACHE = "${BASE}/cache",
......@@ -60,7 +62,6 @@ return {
MODULES = "${BASE}/modules",
SCRIPTS = "${BASE}/scripts",
SHADERS = "${BASE}/shaders",
SYNC = "${BASE}/sync",
TESTDIR = "${BASE}/tests"
},
Fonts = {
......@@ -102,6 +103,7 @@ return {
LogEachOpenGLCall = false,
ShutdownCountdown = 3,
ScreenshotUseDate = true,
-- OnScreenTextScaling = "framebuffer",
-- PerSceneCache = true,
-- DisableRenderingOnMaster = true,
......
......@@ -114,6 +114,8 @@ const string ConfigurationManager::PartShowMessage = "ShowMessage";
const string ConfigurationManager::PartShowNodeNames = "ShowNodeNames";
const string ConfigurationManager::PartShowProgressbar = "ShowProgressbar";
const string ConfigurationManager::KeyScreenshotUseDate = "ScreenshotUseDate";
const string ConfigurationManager::KeyModuleConfigurations = "ModuleConfigurations";
string ConfigurationManager::findConfiguration(const string& filename) {
......
......@@ -284,6 +284,15 @@ documentation::Documentation ConfigurationManager::Documentation() {
"interaction and it is thus desired to disable the transformation. The "
"default is false."
},
{
ConfigurationManager::KeyScreenshotUseDate,
new BoolVerifier,
Optional::Yes,
"Toggles whether screenshots generated by OpenSpace contain the date when "
"the concrete OpenSpace instance was started. This value is enabled by "
"default, but it is advised to disable this value if rendering sessions of "
"individual frames pass beyond local midnight."
},
{
ConfigurationManager::KeyHttpProxy,
new TableVerifier({
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment