One Property Tree (#500)

* Organize properties in one single property tree
* Update scenes to work with one property tree. Fix documentation issues.
This commit is contained in:
Emil Axelsson
2018-03-06 16:59:06 +01:00
committed by GitHub
parent ebd69d1333
commit 4675554471
53 changed files with 527 additions and 603 deletions
+14 -7
View File
@@ -27,9 +27,9 @@
#include <modules/imgui/include/gui.h>
#include <openspace/engine/openspaceengine.h>
#include <openspace/engine/settingsengine.h>
#include <openspace/engine/virtualpropertymanager.h>
#include <openspace/engine/wrapper/windowwrapper.h>
#include <openspace/engine/moduleengine.h>
#include <openspace/interaction/navigationhandler.h>
#include <openspace/interaction/luaconsole.h>
#include <openspace/network/parallelconnection.h>
@@ -67,7 +67,6 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
[]() {
std::vector<properties::PropertyOwner*> res = {
&(OsEng.windowWrapper()),
&(OsEng.settingsEngine()),
&(OsEng.navigationHandler()),
&(OsEng.renderEngine()),
&(OsEng.parallelConnection()),
@@ -86,7 +85,15 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
}
);
gui._property.setSource(
gui._moduleProperty.setSource(
[]() {
std::vector<properties::PropertyOwner*> v;
v.push_back(&(OsEng.moduleEngine()));
return v;
}
);
gui._sceneProperty.setSource(
[]() {
const Scene* scene = OsEng.renderEngine().scene();
const std::vector<SceneGraphNode*>& nodes = scene ?
@@ -197,7 +204,7 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
[&](Key key, KeyModifier mod, KeyAction action) -> bool {
// A list of all the windows that can show up by themselves
if (gui.isEnabled() || gui._performance.isEnabled() ||
gui._property.isEnabled())
gui._sceneProperty.isEnabled())
{
return gui.keyCallback(key, mod, action);
}
@@ -211,7 +218,7 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
[&](unsigned int codepoint, KeyModifier modifier) -> bool {
// A list of all the windows that can show up by themselves
if (gui.isEnabled() || gui._performance.isEnabled() ||
gui._property.isEnabled())
gui._sceneProperty.isEnabled())
{
return gui.charCallback(codepoint, modifier);
}
@@ -225,7 +232,7 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
[&](MouseButton button, MouseAction action) -> bool {
// A list of all the windows that can show up by themselves
if (gui.isEnabled() || gui._performance.isEnabled() ||
gui._property.isEnabled())
gui._sceneProperty.isEnabled())
{
return gui.mouseButtonCallback(button, action);
}
@@ -239,7 +246,7 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
[&](double, double posY) -> bool {
// A list of all the windows that can show up by themselves
if (gui.isEnabled() || gui._performance.isEnabled() ||
gui._property.isEnabled())
gui._sceneProperty.isEnabled())
{
return gui.mouseWheelCallback(posY);
}
+4 -1
View File
@@ -75,9 +75,12 @@ public:
GuiGlobeBrowsingComponent _globeBrowsing;
#endif // GLOBEBROWSING_USE_GDAL
GuiPerformanceComponent _performance;
GuiPropertyComponent _globalProperty;
GuiPropertyComponent _property;
GuiPropertyComponent _sceneProperty;
GuiPropertyComponent _screenSpaceProperty;
GuiPropertyComponent _moduleProperty;
GuiPropertyComponent _virtualProperty;
GuiSpaceTimeComponent _spaceTime;
GuiMissionComponent _mission;
+34 -17
View File
@@ -280,9 +280,10 @@ void CaptionText(const char* text) {
GUI::GUI()
: GuiComponent("Main")
, _globalProperty("Global")
, _property(
"Properties",
, _globalProperty("Global Properties")
, _moduleProperty("Module Properties")
, _sceneProperty(
"Scene Properties",
GuiPropertyComponent::UseTreeLayout::Yes
)
, _screenSpaceProperty("ScreenSpace Properties")
@@ -297,7 +298,8 @@ GUI::GUI()
addPropertySubOwner(_help);
addPropertySubOwner(_performance);
addPropertySubOwner(_globalProperty);
addPropertySubOwner(_property);
addPropertySubOwner(_moduleProperty);
addPropertySubOwner(_sceneProperty);
addPropertySubOwner(_screenSpaceProperty);
_featuredProperties.setEnabled(true);
addPropertySubOwner(_featuredProperties);
@@ -323,7 +325,8 @@ GUI::GUI()
#endif // GLOBEBROWSING_USE_GDAL
_performance.setShowHelpTooltip(_showHelpText);
_globalProperty.setShowHelpTooltip(_showHelpText);
_property.setShowHelpTooltip(_showHelpText);
_moduleProperty.setShowHelpTooltip(_showHelpText);
_sceneProperty.setShowHelpTooltip(_showHelpText);
_screenSpaceProperty.setShowHelpTooltip(_showHelpText);
_virtualProperty.setShowHelpTooltip(_showHelpText);
_spaceTime.setShowHelpTooltip(_showHelpText);
@@ -348,7 +351,8 @@ GUI::GUI()
#endif // GLOBEBROWSING_USE_GDAL
_performance.setShowHelpTooltipDelay(_helpTextDelay);
_globalProperty.setShowHelpTooltipDelay(_helpTextDelay);
_property.setShowHelpTooltipDelay(_helpTextDelay);
_moduleProperty.setShowHelpTooltipDelay(_helpTextDelay);
_sceneProperty.setShowHelpTooltipDelay(_helpTextDelay);
_screenSpaceProperty.setShowHelpTooltipDelay(_helpTextDelay);
_virtualProperty.setShowHelpTooltipDelay(_helpTextDelay);
_spaceTime.setShowHelpTooltipDelay(_helpTextDelay);
@@ -479,12 +483,14 @@ void GUI::initialize() {
style.Colors[ImGuiCol_TextSelectedBg] = ImVec4(0.44f, 0.63f, 1.00f, 0.35f);
style.Colors[ImGuiCol_ModalWindowDarkening] = ImVec4(0.20f, 0.20f, 0.20f, 0.35f);
}
_property.initialize();
_property.setHasRegularProperties(true);
_sceneProperty.initialize();
_sceneProperty.setHasRegularProperties(true);
_screenSpaceProperty.initialize();
_screenSpaceProperty.setHasRegularProperties(true);
_globalProperty.initialize();
_globalProperty.setHasRegularProperties(true);
_moduleProperty.initialize();
_moduleProperty.setHasRegularProperties(true);
_featuredProperties.initialize();
_featuredProperties.setHasRegularProperties(true);
_virtualProperty.initialize();
@@ -518,6 +524,7 @@ void GUI::deinitialize() {
_help.deinitialize();
_performance.deinitialize();
_globalProperty.deinitialize();
_moduleProperty.deinitialize();
_featuredProperties.deinitialize();
_screenSpaceProperty.deinitialize();
_virtualProperty.deinitialize();
@@ -526,7 +533,7 @@ void GUI::deinitialize() {
#ifdef GLOBEBROWSING_USE_GDAL
_globeBrowsing.deinitialize();
#endif // GLOBEBROWSING_USE_GDAL
_property.deinitialize();
_sceneProperty.deinitialize();
delete iniFileBuffer;
}
@@ -614,9 +621,10 @@ void GUI::initializeGL() {
glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
_property.initializeGL();
_sceneProperty.initializeGL();
_screenSpaceProperty.initializeGL();
_globalProperty.initializeGL();
_moduleProperty.initializeGL();
_featuredProperties.initializeGL();
_performance.initializeGL();
_help.initializeGL();
@@ -656,13 +664,14 @@ void GUI::deinitializeGL() {
_performance.deinitializeGL();
_featuredProperties.deinitializeGL();
_globalProperty.deinitializeGL();
_moduleProperty.deinitializeGL();
_screenSpaceProperty.deinitializeGL();
#ifdef GLOBEBROWSING_USE_GDAL
_globeBrowsing.deinitializeGL();
#endif // GLOBEBROWSING_USE_GDAL
_filePath.deinitializeGL();
_asset.deinitializeGL();
_property.deinitializeGL();
_sceneProperty.deinitializeGL();
}
void GUI::startFrame(float deltaTime, const glm::vec2& windowSize,
@@ -709,8 +718,11 @@ void GUI::endFrame() {
if (_globalProperty.isEnabled()) {
_globalProperty.render();
}
if (_property.isEnabled()) {
_property.render();
if (_moduleProperty.isEnabled()) {
_moduleProperty.render();
}
if (_sceneProperty.isEnabled()) {
_sceneProperty.render();
}
if (_screenSpaceProperty.isEnabled()) {
_screenSpaceProperty.render();
@@ -832,9 +844,9 @@ void GUI::render() {
_isCollapsed = ImGui::IsWindowCollapsed();
bool property = _property.isEnabled();
ImGui::Checkbox("Scene Graph Properties", &property);
_property.setEnabled(property);
bool sceneProperty = _sceneProperty.isEnabled();
ImGui::Checkbox("Scene Graph Properties", &sceneProperty);
_sceneProperty.setEnabled(sceneProperty);
bool screenSpaceProperty = _screenSpaceProperty.isEnabled();
ImGui::Checkbox("ScreenSpace Properties", &screenSpaceProperty);
@@ -848,6 +860,10 @@ void GUI::render() {
ImGui::Checkbox("Global Properties", &globalProperty);
_globalProperty.setEnabled(globalProperty);
bool moduleProperty = _moduleProperty.isEnabled();
ImGui::Checkbox("Module Properties", &moduleProperty);
_moduleProperty.setEnabled(moduleProperty);
bool spacetime = _spaceTime.isEnabled();
ImGui::Checkbox("Space/Time", &spacetime);
_spaceTime.setEnabled(spacetime);
@@ -961,7 +977,8 @@ void GUI::renderAndUpdatePropertyVisibility() {
_currentVisibility = static_cast<V>(t);
_globalProperty.setVisibility(_currentVisibility);
_property.setVisibility(_currentVisibility);
_moduleProperty.setVisibility(_currentVisibility);
_sceneProperty.setVisibility(_currentVisibility);
_screenSpaceProperty.setVisibility(_currentVisibility);
_virtualProperty.setVisibility(_currentVisibility);
_featuredProperties.setVisibility(_currentVisibility);