mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 11:39:49 -06:00
Only display commit hash text overlay if there is information available
Add version and commit information into a global property
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#ifndef __OPENSPACE_CORE___OPENSPACEENGINE___H__
|
||||
#define __OPENSPACE_CORE___OPENSPACEENGINE___H__
|
||||
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
#include <openspace/util/keys.h>
|
||||
#include <openspace/util/mouse.h>
|
||||
|
||||
@@ -204,6 +205,11 @@ private:
|
||||
|
||||
// Others
|
||||
std::unique_ptr<properties::PropertyOwner> _globalPropertyNamespace;
|
||||
|
||||
struct {
|
||||
properties::StringProperty versionString;
|
||||
properties::StringProperty sourceControlInformation;
|
||||
} _versionInformation;
|
||||
|
||||
bool _scheduledSceneSwitch;
|
||||
std::string _scenePath;
|
||||
|
||||
@@ -112,6 +112,19 @@ namespace {
|
||||
std::string sceneName;
|
||||
std::string cacheFolder;
|
||||
} commandlineArgumentPlaceholders;
|
||||
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo VersionInfo = {
|
||||
"VersionInfo",
|
||||
"Version Information",
|
||||
"This value contains the full string identifying this OpenSpace Version"
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo SourceControlInfo = {
|
||||
"SCMInfo",
|
||||
"Source Control Management Information",
|
||||
"This value contains information from the SCM, such as commit hash and branch"
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
@@ -145,6 +158,10 @@ OpenSpaceEngine::OpenSpaceEngine(std::string programName,
|
||||
, _scriptScheduler(new scripting::ScriptScheduler)
|
||||
, _virtualPropertyManager(new VirtualPropertyManager)
|
||||
, _globalPropertyNamespace(new properties::PropertyOwner({ "" }))
|
||||
, _versionInformation{
|
||||
properties::StringProperty(VersionInfo, OPENSPACE_VERSION_STRING_FULL),
|
||||
properties::StringProperty(SourceControlInfo, OPENSPACE_GIT_FULL)
|
||||
}
|
||||
, _scheduledSceneSwitch(false)
|
||||
, _scenePath("")
|
||||
, _runTime(0.0)
|
||||
@@ -161,6 +178,12 @@ OpenSpaceEngine::OpenSpaceEngine(std::string programName,
|
||||
_globalPropertyNamespace->addPropertySubOwner(_parallelConnection.get());
|
||||
_globalPropertyNamespace->addPropertySubOwner(_console.get());
|
||||
|
||||
|
||||
_versionInformation.versionString.setReadOnly(true);
|
||||
_globalPropertyNamespace->addProperty(_versionInformation.versionString);
|
||||
_versionInformation.sourceControlInformation.setReadOnly(true);
|
||||
_globalPropertyNamespace->addProperty(_versionInformation.sourceControlInformation);
|
||||
|
||||
FactoryManager::initialize();
|
||||
FactoryManager::ref().addFactory(
|
||||
std::make_unique<ghoul::TemplateFactory<Renderable>>(),
|
||||
|
||||
@@ -1331,17 +1331,23 @@ void RenderEngine::renderVersionInformation() {
|
||||
OPENSPACE_VERSION_STRING_FULL
|
||||
);
|
||||
|
||||
FR::defaultRenderer().render(
|
||||
*_fontInfo,
|
||||
glm::vec2(
|
||||
fontResolution().x - commitBox.boundingBox.x - 10.f,
|
||||
versionBox.boundingBox.y + 5.f
|
||||
),
|
||||
glm::vec4(0.5, 0.5, 0.5, 1.f),
|
||||
"%s@%s",
|
||||
OPENSPACE_GIT_BRANCH,
|
||||
OPENSPACE_GIT_COMMIT
|
||||
);
|
||||
// If a developer hasn't placed the Git command in the path, this variable will be
|
||||
// empty
|
||||
if (!std::string(OPENSPACE_GIT_COMMIT).empty()) {
|
||||
// We check OPENSPACE_GIT_COMMIT but puse OPENSPACE_GIT_FULL on purpose since
|
||||
// OPENSPACE_GIT_FULL will never be empty (always will contain at least @, but
|
||||
// checking for that is a bit brittle)
|
||||
FR::defaultRenderer().render(
|
||||
*_fontInfo,
|
||||
glm::vec2(
|
||||
fontResolution().x - commitBox.boundingBox.x - 10.f,
|
||||
versionBox.boundingBox.y + 5.f
|
||||
),
|
||||
glm::vec4(0.5, 0.5, 0.5, 1.f),
|
||||
"%s",
|
||||
OPENSPACE_GIT_FULL
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void RenderEngine::renderScreenLog() {
|
||||
|
||||
@@ -41,6 +41,7 @@ constexpr const char* OPENSPACE_VERSION_STRING_FULL = "@OPENSPACE_VERSION_MAJOR@
|
||||
|
||||
constexpr const char* OPENSPACE_GIT_BRANCH = "@OPENSPACE_GIT_BRANCH@";
|
||||
constexpr const char* OPENSPACE_GIT_COMMIT = "@OPENSPACE_GIT_COMMIT@";
|
||||
constexpr const char* OPENSPACE_GIT_FULL = "@OPENSPACE_GIT_BRANCH@@@OPENSPACE_GIT_COMMIT@";
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
|
||||
Reference in New Issue
Block a user