diff --git a/ext/ghoul b/ext/ghoul index 58abe3e023..02a2072564 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit 58abe3e023a3ebe6286a63bd9109ff6160ff5969 +Subproject commit 02a2072564a7efeb347fa978ca73dae10f920d23 diff --git a/include/openspace/engine/openspaceengine.h b/include/openspace/engine/openspaceengine.h index a0b38eb422..0f7d9e5c29 100644 --- a/include/openspace/engine/openspaceengine.h +++ b/include/openspace/engine/openspaceengine.h @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include namespace openspace { diff --git a/include/openspace/engine/gui.h b/include/openspace/gui/gui.h similarity index 98% rename from include/openspace/engine/gui.h rename to include/openspace/gui/gui.h index 36363c42a3..88861d1d6b 100644 --- a/include/openspace/engine/gui.h +++ b/include/openspace/gui/gui.h @@ -91,6 +91,7 @@ private: std::set _floatProperties; std::set _vec2Properties; std::set _vec3Properties; + std::set _vec4Properties; std::set _stringProperties; std::set _optionProperty; std::set _selectionProperty; diff --git a/include/openspace/properties/numericalproperty.h b/include/openspace/properties/numericalproperty.h index 5f97c23fcb..1fa4d6d6a9 100644 --- a/include/openspace/properties/numericalproperty.h +++ b/include/openspace/properties/numericalproperty.h @@ -35,8 +35,10 @@ class NumericalProperty : public TemplateProperty { public: NumericalProperty(std::string identifier, std::string guiName); NumericalProperty(std::string identifier, std::string guiName, T value); + NumericalProperty(std::string identifier, std::string guiName, T value, + T minimumValue, T maximumValue); NumericalProperty(std::string identifier, std::string guiName, T value, - T minimumValue, T maximumValue); + T minimumValue, T maximumValue, T steppingValue); bool getLua(lua_State* state) const override; bool setLua(lua_State* state) override; @@ -50,8 +52,15 @@ public: using TemplateProperty::operator=; protected: + static const std::string MinimumValueKey; + static const std::string MaximumValueKey; + static const std::string SteppingValueKey; + + std::string generateAdditionalDescription() const; + T _minimumValue; T _maximumValue; + T _stepping; }; } // namespace properties diff --git a/include/openspace/properties/numericalproperty.inl b/include/openspace/properties/numericalproperty.inl index be04323787..b6d25fde64 100644 --- a/include/openspace/properties/numericalproperty.inl +++ b/include/openspace/properties/numericalproperty.inl @@ -42,6 +42,9 @@ namespace properties { template <> \ template <> \ TYPE PropertyDelegate>::defaultMaximumValue(); \ + template <> \ + template <> \ + TYPE PropertyDelegate>::defaultSteppingValue(); \ template <> \ template <> \ TYPE PropertyDelegate>::fromLuaValue(lua_State* state, \ @@ -71,43 +74,43 @@ namespace properties { std::string PropertyDelegate>::className() \ { \ return #CLASS_NAME; \ - \ -} \ + } \ template <> \ std::string PropertyDelegate>::className() \ { \ return PropertyDelegate>::className(); \ - \ -} \ + } \ template <> \ template <> \ TYPE PropertyDelegate>::defaultValue() \ { \ return DEFAULT_VALUE; \ - \ -} \ + } \ template <> \ template <> \ TYPE PropertyDelegate>::defaultMinimumValue() \ { \ return DEFAULT_MIN_VALUE; \ - \ -} \ + } \ template <> \ template <> \ TYPE PropertyDelegate>::defaultMaximumValue() \ { \ return DEFAULT_MAX_VALUE; \ - \ -} \ + } \ + template <> \ + template <> \ + TYPE PropertyDelegate>::defaultSteppingValue() \ + { \ + return DEFAULT_STEPPING; \ + } \ template <> \ template <> \ TYPE PropertyDelegate>::fromLuaValue(lua_State * state, \ bool& success) \ { \ return FROM_LUA_LAMBDA_EXPRESSION(state, success); \ - \ -} \ + } \ template <> \ template <> \ TYPE PropertyDelegate>::fromLuaValue( \ @@ -115,8 +118,7 @@ namespace properties { { \ return PropertyDelegate>::fromLuaValue(state, \ success); \ - \ -} \ + } \ template <> \ template <> \ bool PropertyDelegate>::toLuaValue(lua_State * state, \ @@ -142,36 +144,62 @@ namespace properties { return PropertyDelegate>::typeLua(); \ } + +template +const std::string NumericalProperty::MinimumValueKey = "MinimumValue"; + +template +const std::string NumericalProperty::MaximumValueKey = "MaximumValue"; + +template +const std::string NumericalProperty::SteppingValueKey = "SteppingValue"; + // Delegating constructors are necessary; automatic template deduction cannot // deduce template argument for 'U' if 'default' methods are used as default values in // a single constructor template NumericalProperty::NumericalProperty(std::string identifier, std::string guiName) - : NumericalProperty(std::move(identifier), std::move(guiName), - PropertyDelegate>::template defaultValue(), - PropertyDelegate>::template defaultMinimumValue(), - PropertyDelegate>::template defaultMaximumValue()) + : NumericalProperty( + std::move(identifier), std::move(guiName), + PropertyDelegate>::template defaultValue(), + PropertyDelegate>::template defaultMinimumValue(), + PropertyDelegate>::template defaultMaximumValue(), + PropertyDelegate>::template defaultSteppingValue() + ) {} template NumericalProperty::NumericalProperty(std::string identifier, std::string guiName, T value) - : NumericalProperty(std::move(identifier), std::move(guiName), std::move(value), - PropertyDelegate>::template defaultMinimumValue(), - PropertyDelegate>::template defaultMaximumValue()) + : NumericalProperty( + std::move(identifier), std::move(guiName), std::move(value), + PropertyDelegate>::template defaultMinimumValue(), + PropertyDelegate>::template defaultMaximumValue(), + PropertyDelegate>::template defaultSteppingValue() + ) +{} + +template +NumericalProperty::NumericalProperty(std::string identifier, std::string guiName, + T value, T minimumValue, T maximumValue) + : NumericalProperty( + std::move(identifier) , std::move(guiName), std::move(value), + std::move(minimumValue), std::move(maximumValue), + PropertyDelegate>::template defaultSteppingValue() + ) {} template NumericalProperty::NumericalProperty(std::string identifier, std::string guiName, T value, - T minimumValue, T maximumValue) + T minimumValue, T maximumValue, T steppingValue) : TemplateProperty(std::move(identifier), std::move(guiName), std::move(value)) , _minimumValue(std::move(minimumValue)) , _maximumValue(std::move(maximumValue)) + , _stepping(std::move(steppingValue)) {} - template std::string NumericalProperty::className() const { return PropertyDelegate>::className(); @@ -199,7 +227,6 @@ int NumericalProperty::typeLua() const { return PropertyDelegate>::typeLua(); } - template T NumericalProperty::minValue() const { return _minimumValue; @@ -210,5 +237,14 @@ T NumericalProperty::maxValue() const { return _maximumValue; } +template +std::string NumericalProperty::generateAdditionalDescription() const { + std::string result; + result += MinimumValueKey + " = " + std::to_string(_minimumValue) + ","; + result += MaximumValueKey + " = " + std::to_string(_maximumValue) + ","; + result += SteppingValueKey + " = " + std::to_string(_stepping); + return result; +} + } // namespace properties } // namespace openspace diff --git a/include/openspace/properties/optionproperty.h b/include/openspace/properties/optionproperty.h index aef08326f2..fa169a03df 100644 --- a/include/openspace/properties/optionproperty.h +++ b/include/openspace/properties/optionproperty.h @@ -87,6 +87,9 @@ public: void setValue(int value) override; private: + static const std::string OptionsKey; + std::string generateAdditionalDescription() const; + /// The list of options which have been registered with this OptionProperty std::vector