From fc9b2ab091df0226ac6f1d63de51b0a65d3120c0 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Fri, 14 Mar 2025 11:22:40 +0100 Subject: [PATCH 001/277] Increase the compilation speed (#3545) - Remove toStringConversion function and move json_helper include out of numericalproperty.inl - Optimizing some header files - Remove duplicate Lua functions from properties. - Move List,Option,Selection,String, and TriggerProperty into misc folder - Move lua_helper include out of inline file - Add lua_helper to the precompiled header - Declare property functions as final. No longer have OptionProperty derive from IntProperty - Remove Dictionary header from properties --- apps/OpenSpace/main.cpp | 1 + include/openspace/documentation/verifier.h | 2 - include/openspace/documentation/verifier.inl | 7 +- include/openspace/engine/globals.h | 1 - include/openspace/engine/openspaceengine.h | 4 +- include/openspace/engine/windowdelegate.h | 1 - .../openspace/navigation/navigationhandler.h | 14 +- .../openspace/navigation/orbitalnavigator.h | 6 +- include/openspace/navigation/pathnavigator.h | 2 +- include/openspace/network/parallelpeer.h | 2 +- .../properties/list/doublelistproperty.h | 13 +- .../properties/list/intlistproperty.h | 13 +- .../properties/list/stringlistproperty.h | 13 +- .../properties/matrix/dmat2property.h | 10 +- .../properties/matrix/dmat3property.h | 10 +- .../properties/matrix/dmat4property.h | 10 +- .../properties/matrix/mat2property.h | 10 +- .../properties/matrix/mat3property.h | 10 +- .../properties/matrix/mat4property.h | 10 +- .../properties/{ => misc}/listproperty.h | 6 +- .../properties/{ => misc}/listproperty.inl | 10 - .../properties/{ => misc}/optionproperty.h | 16 +- .../properties/{ => misc}/selectionproperty.h | 22 +- .../properties/{ => misc}/stringproperty.h | 14 +- .../properties/{ => misc}/triggerproperty.h | 10 +- .../openspace/properties/numericalproperty.h | 20 +- .../properties/numericalproperty.inl | 130 +++---- include/openspace/properties/property.h | 48 ++- .../properties/scalar/boolproperty.h | 13 +- .../properties/scalar/doubleproperty.h | 10 +- .../properties/scalar/floatproperty.h | 10 +- .../openspace/properties/scalar/intproperty.h | 11 +- .../properties/scalar/longproperty.h | 10 +- .../properties/scalar/shortproperty.h | 10 +- .../properties/scalar/uintproperty.h | 9 +- .../properties/scalar/ulongproperty.h | 10 +- .../properties/scalar/ushortproperty.h | 10 +- .../openspace/properties/templateproperty.h | 54 +-- .../openspace/properties/templateproperty.inl | 31 +- .../properties/vector/dvec2property.h | 10 +- .../properties/vector/dvec3property.h | 10 +- .../properties/vector/dvec4property.h | 10 +- .../properties/vector/ivec2property.h | 10 +- .../properties/vector/ivec3property.h | 10 +- .../properties/vector/ivec4property.h | 10 +- .../properties/vector/uvec2property.h | 10 +- .../properties/vector/uvec3property.h | 10 +- .../properties/vector/uvec4property.h | 10 +- .../properties/vector/vec2property.h | 10 +- .../properties/vector/vec3property.h | 10 +- .../properties/vector/vec4property.h | 11 +- .../rendering/colormappingcomponent.h | 6 +- .../openspace/rendering/dashboardtextitem.h | 2 +- include/openspace/rendering/renderable.h | 2 +- include/openspace/rendering/renderengine.h | 4 +- .../rendering/screenspacerenderable.h | 2 +- include/openspace/scene/scene.h | 68 +--- include/openspace/scene/scenegraphnode.h | 2 +- include/openspace/scripting/lualibrary.h | 5 +- include/openspace/util/spicemanager.h | 4 +- include/openspace/util/timemanager.h | 6 +- .../rendering/renderableatmosphere.h | 2 +- modules/audio/audiomodule_lua.inl | 1 + modules/base/dashboard/dashboarditemangle.h | 4 +- modules/base/dashboard/dashboarditemdate.h | 2 +- .../base/dashboard/dashboarditemdistance.h | 4 +- .../base/dashboard/dashboarditemelapsedtime.h | 4 +- .../base/dashboard/dashboarditemframerate.h | 4 +- .../dashboard/dashboarditempropertyvalue.h | 2 +- .../dashboarditemsimulationincrement.h | 4 +- modules/base/dashboard/dashboarditemtext.h | 2 +- .../base/dashboard/dashboarditemvelocity.h | 2 +- .../base/lightsource/scenegraphlightsource.h | 2 +- modules/base/rendering/grids/renderablegrid.h | 4 +- .../pointcloud/renderableinterpolatedpoints.h | 2 +- .../pointcloud/renderablepointcloud.h | 6 +- .../pointcloud/sizemappingcomponent.h | 2 +- .../base/rendering/renderablecartesianaxes.h | 2 +- modules/base/rendering/renderabledisc.h | 5 +- .../base/rendering/renderabledistancelabel.h | 4 +- modules/base/rendering/renderablelabel.h | 4 +- modules/base/rendering/renderablemodel.h | 4 +- modules/base/rendering/renderableplane.h | 2 +- modules/base/rendering/renderablesphere.h | 2 +- .../rendering/renderablesphereimageonline.cpp | 1 + modules/base/rendering/renderabletrail.h | 4 +- .../rendering/renderabletrailtrajectory.h | 2 +- .../rendering/screenspacedashboard_lua.inl | 2 + .../base/rendering/screenspaceimagelocal.h | 2 +- .../base/rendering/screenspaceimageonline.h | 2 +- modules/base/rotation/fixedrotation.h | 4 +- modules/base/rotation/luarotation.h | 2 +- modules/base/scale/luascale.h | 2 +- modules/base/scale/timedependentscale.h | 2 +- modules/base/translation/luatranslation.h | 2 +- modules/cefwebgui/cefwebguimodule.h | 5 +- modules/debugging/debuggingmodule_lua.inl | 1 + .../rendering/renderabledumeshes.h | 4 +- modules/exoplanets/exoplanetsmodule.h | 2 +- modules/exoplanets/exoplanetsmodule_lua.inl | 1 + .../rendering/renderableorbitdisc.h | 2 +- .../rendering/renderablefieldlines.h | 4 +- .../rendering/renderablefieldlinessequence.h | 6 +- modules/gaia/rendering/renderablegaiastars.h | 4 +- modules/galaxy/rendering/renderablegalaxy.h | 2 +- modules/globebrowsing/globebrowsingmodule.h | 5 +- .../globebrowsing/globebrowsingmodule_lua.inl | 1 + .../src/dashboarditemglobelocation.h | 4 +- .../src/geojson/geojsoncomponent.h | 8 +- .../src/geojson/geojsonproperties.h | 4 +- .../globebrowsing/src/globelabelscomponent.h | 2 +- modules/globebrowsing/src/globerotation.h | 2 +- modules/globebrowsing/src/globetranslation.h | 2 +- modules/globebrowsing/src/layer.h | 2 +- modules/globebrowsing/src/layeradjustment.h | 2 +- .../globebrowsing/src/layerrendersettings.h | 2 +- .../globebrowsing/src/memoryawaretilecache.h | 2 +- modules/globebrowsing/src/renderableglobe.h | 2 +- modules/globebrowsing/src/ringscomponent.h | 2 +- modules/globebrowsing/src/shadowcomponent.h | 4 +- .../src/tileprovider/temporaltileprovider.cpp | 1 + .../src/tileprovider/tileprovider.h | 2 +- .../imgui/src/guiglobebrowsingcomponent.cpp | 4 - modules/imgui/src/renderproperties.cpp | 11 +- modules/iswa/rendering/datacygnet.h | 4 +- modules/iswa/rendering/iswabasegroup.h | 2 +- modules/iswa/rendering/iswacygnet.h | 2 +- modules/iswa/rendering/iswadatagroup.h | 4 +- modules/iswa/rendering/kameleonplane.h | 2 +- modules/iswa/util/dataprocessorjson.cpp | 2 +- modules/iswa/util/dataprocessorkameleon.cpp | 2 +- modules/iswa/util/dataprocessortext.cpp | 2 +- modules/iswa/util/iswamanager_lua.inl | 2 + .../rendering/renderablekameleonvolume.h | 4 +- .../rendering/renderablemultiresvolume.h | 2 +- modules/server/include/serverinterface.h | 4 +- modules/server/src/topics/luascripttopic.cpp | 1 + modules/server/src/topics/skybrowsertopic.cpp | 1 + modules/skybrowser/include/browser.h | 4 +- modules/skybrowser/skybrowsermodule.h | 2 +- modules/skybrowser/skybrowsermodule_lua.inl | 1 + .../renderableconstellationsbase.cpp | 1 + .../rendering/renderableconstellationsbase.h | 4 +- .../space/rendering/renderableeclipsecone.h | 4 +- modules/space/rendering/renderablefluxnodes.h | 6 +- .../space/rendering/renderableorbitalkepler.h | 2 +- modules/space/rendering/renderablerings.h | 2 +- modules/space/rendering/renderablestars.h | 6 +- modules/space/rotation/spicerotation.h | 2 +- modules/space/spacemodule_lua.inl | 3 +- modules/space/translation/spicetranslation.h | 2 +- .../dashboard/dashboarditeminstruments.h | 2 +- .../rendering/renderablemodelprojection.h | 2 +- .../rendering/renderableplanetprojection.h | 6 +- .../rendering/renderableshadowcylinder.h | 4 +- .../util/projectioncomponent.h | 2 +- modules/spout/spoutwrapper.h | 6 +- modules/sync/syncmodule.cpp | 1 + modules/touch/include/touchinteraction.h | 4 +- modules/touch/include/touchmarker.h | 3 +- modules/touch/src/touchinteraction.cpp | 16 +- modules/touch/touchmodule.cpp | 3 +- modules/touch/touchmodule.h | 3 +- modules/video/include/screenspacevideo.h | 2 +- modules/video/include/videoplayer.h | 2 +- modules/video/include/videotileprovider.h | 2 +- modules/video/src/videotileprovider.cpp | 1 + .../rendering/renderabletimevaryingvolume.cpp | 1 + .../rendering/renderabletimevaryingvolume.h | 6 +- modules/volume/transferfunctionhandler.h | 4 +- modules/volume/transferfunctionproperty.cpp | 13 +- modules/volume/transferfunctionproperty.h | 9 +- .../webbrowser/include/screenspacebrowser.h | 4 +- modules/webgui/webguimodule.h | 2 +- src/CMakeLists.txt | 21 +- src/data/datamapping.cpp | 1 + src/documentation/documentation.cpp | 1 + src/documentation/documentationengine.cpp | 1 - src/documentation/verifier.cpp | 4 - src/engine/globals.cpp | 2 + src/engine/moduleengine.cpp | 1 + src/engine/openspaceengine_lua.inl | 2 + src/events/eventengine.cpp | 1 + src/events/eventengine_lua.inl | 2 + src/interaction/actionmanager_lua.inl | 1 + src/interaction/keybindingmanager_lua.inl | 2 + .../keyframerecordinghandler_lua.inl | 1 + src/interaction/sessionrecordinghandler.cpp | 1 + .../sessionrecordinghandler_lua.inl | 2 + src/mission/missionmanager_lua.inl | 1 + src/navigation/navigationhandler_lua.inl | 2 + src/navigation/orbitalnavigator.cpp | 1 + src/navigation/pathnavigator_lua.inl | 2 + src/network/parallelpeer_lua.inl | 2 + src/properties/list/doublelistproperty.cpp | 10 +- src/properties/list/intlistproperty.cpp | 10 +- src/properties/list/stringlistproperty.cpp | 10 +- src/properties/matrix/dmat2property.cpp | 13 + src/properties/matrix/dmat3property.cpp | 13 + src/properties/matrix/dmat4property.cpp | 13 + src/properties/matrix/mat2property.cpp | 13 + src/properties/matrix/mat3property.cpp | 13 + src/properties/matrix/mat4property.cpp | 13 + src/properties/{ => misc}/optionproperty.cpp | 52 ++- .../{ => misc}/selectionproperty.cpp | 16 +- src/properties/{ => misc}/stringproperty.cpp | 14 +- src/properties/{ => misc}/triggerproperty.cpp | 4 +- src/properties/property.cpp | 133 +++---- src/properties/scalar/boolproperty.cpp | 12 +- src/properties/scalar/doubleproperty.cpp | 13 + src/properties/scalar/floatproperty.cpp | 13 + src/properties/scalar/intproperty.cpp | 11 +- src/properties/scalar/longproperty.cpp | 13 + src/properties/scalar/shortproperty.cpp | 13 + src/properties/scalar/uintproperty.cpp | 13 +- src/properties/scalar/ulongproperty.cpp | 13 + src/properties/scalar/ushortproperty.cpp | 14 + src/properties/vector/dvec2property.cpp | 13 + src/properties/vector/dvec3property.cpp | 13 + src/properties/vector/dvec4property.cpp | 13 + src/properties/vector/ivec2property.cpp | 13 + src/properties/vector/ivec3property.cpp | 13 + src/properties/vector/ivec4property.cpp | 13 + src/properties/vector/uvec2property.cpp | 13 + src/properties/vector/uvec3property.cpp | 13 + src/properties/vector/uvec4property.cpp | 13 + src/properties/vector/vec2property.cpp | 13 + src/properties/vector/vec3property.cpp | 13 + src/properties/vector/vec4property.cpp | 13 + src/rendering/dashboard.cpp | 1 + src/rendering/dashboard_lua.inl | 1 + src/rendering/labelscomponent.cpp | 1 + src/rendering/renderengine_lua.inl | 2 + src/scene/profile_lua.inl | 2 + src/scene/scene.cpp | 363 ++++++++++-------- src/scene/scene_lua.inl | 17 +- src/scene/scenegraphnode.cpp | 1 + src/scripting/scriptscheduler_lua.inl | 2 + .../systemcapabilitiesbinding_lua.inl | 2 + src/util/spicemanager.cpp | 1 + src/util/time_lua.inl | 2 + support/cmake/module_definition.cmake | 1 + 242 files changed, 1306 insertions(+), 913 deletions(-) rename include/openspace/properties/{ => misc}/listproperty.h (93%) rename include/openspace/properties/{ => misc}/listproperty.inl (88%) rename include/openspace/properties/{ => misc}/optionproperty.h (93%) rename include/openspace/properties/{ => misc}/selectionproperty.h (93%) rename include/openspace/properties/{ => misc}/stringproperty.h (88%) rename include/openspace/properties/{ => misc}/triggerproperty.h (92%) rename src/properties/{ => misc}/optionproperty.cpp (86%) rename src/properties/{ => misc}/selectionproperty.cpp (95%) rename src/properties/{ => misc}/stringproperty.cpp (92%) rename src/properties/{ => misc}/triggerproperty.cpp (95%) diff --git a/apps/OpenSpace/main.cpp b/apps/OpenSpace/main.cpp index c03c43f681..d403c4fe6a 100644 --- a/apps/OpenSpace/main.cpp +++ b/apps/OpenSpace/main.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #ifdef WIN32 diff --git a/include/openspace/documentation/verifier.h b/include/openspace/documentation/verifier.h index 70d69a5c7a..16956c7f10 100644 --- a/include/openspace/documentation/verifier.h +++ b/include/openspace/documentation/verifier.h @@ -27,8 +27,6 @@ #include #include -#include -#include #include namespace openspace::documentation { diff --git a/include/openspace/documentation/verifier.inl b/include/openspace/documentation/verifier.inl index 7ba00334f6..9e32fdd4f7 100644 --- a/include/openspace/documentation/verifier.inl +++ b/include/openspace/documentation/verifier.inl @@ -23,12 +23,8 @@ ****************************************************************************************/ #include - -#include -#include -#include +#include #include -#include namespace openspace::documentation { @@ -682,7 +678,6 @@ std::string NotInRangeVerifier::documentation() const { ghoul::to_string(upper) + " )"; } - template AnnotationVerifier::AnnotationVerifier(std::string a) : annotation(std::move(a)) diff --git a/include/openspace/engine/globals.h b/include/openspace/engine/globals.h index 6eca1b720e..c85039cf88 100644 --- a/include/openspace/engine/globals.h +++ b/include/openspace/engine/globals.h @@ -25,7 +25,6 @@ #ifndef __OPENSPACE_CORE___GLOBALS___H__ #define __OPENSPACE_CORE___GLOBALS___H__ -#include #include #include diff --git a/include/openspace/engine/openspaceengine.h b/include/openspace/engine/openspaceengine.h index edeb821dac..b86d953cd4 100644 --- a/include/openspace/engine/openspaceengine.h +++ b/include/openspace/engine/openspaceengine.h @@ -26,12 +26,12 @@ #define __OPENSPACE_CORE___OPENSPACEENGINE___H__ #include -#include +#include +#include #include #include #include #include -#include #include #include #include diff --git a/include/openspace/engine/windowdelegate.h b/include/openspace/engine/windowdelegate.h index 73c6fa27fd..c159289fb5 100644 --- a/include/openspace/engine/windowdelegate.h +++ b/include/openspace/engine/windowdelegate.h @@ -26,7 +26,6 @@ #define __OPENSPACE_CORE__WINDOWDELEGATE___H__ #include -#include #include namespace openspace { diff --git a/include/openspace/navigation/navigationhandler.h b/include/openspace/navigation/navigationhandler.h index d9e37bcae9..c61021b7fa 100644 --- a/include/openspace/navigation/navigationhandler.h +++ b/include/openspace/navigation/navigationhandler.h @@ -25,7 +25,8 @@ #ifndef __OPENSPACE_CORE___NAVIGATIONHANDLER___H__ #define __OPENSPACE_CORE___NAVIGATIONHANDLER___H__ -#include +#include + #include #include #include @@ -34,13 +35,10 @@ #include #include #include -#include -#include #include -#include +#include #include #include -#include namespace openspace { class Camera; @@ -52,12 +50,12 @@ namespace openspace::scripting { struct LuaLibrary; } namespace openspace::interaction { struct JoystickInputStates; -struct NavigationState; -struct NodeCameraStateSpec; -struct WebsocketInputStates; class KeyframeNavigator; +struct NavigationState; class OrbitalNavigator; class PathNavigator; +struct NodeCameraStateSpec; +struct WebsocketInputStates; class NavigationHandler : public properties::PropertyOwner { public: diff --git a/include/openspace/navigation/orbitalnavigator.h b/include/openspace/navigation/orbitalnavigator.h index c75c51caa0..6a3d3283c5 100644 --- a/include/openspace/navigation/orbitalnavigator.h +++ b/include/openspace/navigation/orbitalnavigator.h @@ -33,11 +33,11 @@ #include #include #include -#include -#include +#include +#include +#include #include #include -#include #include #include #include diff --git a/include/openspace/navigation/pathnavigator.h b/include/openspace/navigation/pathnavigator.h index 97e95f1053..1cc0633d19 100644 --- a/include/openspace/navigation/pathnavigator.h +++ b/include/openspace/navigation/pathnavigator.h @@ -29,7 +29,7 @@ #include #include -#include +#include #include #include #include diff --git a/include/openspace/network/parallelpeer.h b/include/openspace/network/parallelpeer.h index 6882550974..a5cbbeab39 100644 --- a/include/openspace/network/parallelpeer.h +++ b/include/openspace/network/parallelpeer.h @@ -29,8 +29,8 @@ #include #include +#include #include -#include #include #include #include diff --git a/include/openspace/properties/list/doublelistproperty.h b/include/openspace/properties/list/doublelistproperty.h index 5cdbe76628..060c2a2142 100644 --- a/include/openspace/properties/list/doublelistproperty.h +++ b/include/openspace/properties/list/doublelistproperty.h @@ -25,7 +25,7 @@ #ifndef __OPENSPACE_CORE___DOUBLELISTPROPERTY___H__ #define __OPENSPACE_CORE___DOUBLELISTPROPERTY___H__ -#include +#include namespace openspace::properties { @@ -34,14 +34,17 @@ public: DoubleListProperty(Property::PropertyInfo info, std::vector values = std::vector()); - std::string_view className() const override; - ghoul::lua::LuaTypes typeLua() const override; + std::string_view className() const override final; + ghoul::lua::LuaTypes typeLua() const override final; + void getLuaValue(lua_State* state) const override final; + + std::string stringValue() const override final; using TemplateProperty>::operator std::vector; using TemplateProperty>::operator=; -protected: - std::string toStringConversion() const override; +private: + std::vector toValue(lua_State* state) const override final; }; } // namespace openspace::properties diff --git a/include/openspace/properties/list/intlistproperty.h b/include/openspace/properties/list/intlistproperty.h index 7dbde9f2e9..eb13bceba8 100644 --- a/include/openspace/properties/list/intlistproperty.h +++ b/include/openspace/properties/list/intlistproperty.h @@ -25,7 +25,7 @@ #ifndef __OPENSPACE_CORE___INTLISTPROPERTY___H__ #define __OPENSPACE_CORE___INTLISTPROPERTY___H__ -#include +#include namespace openspace::properties { @@ -34,14 +34,17 @@ public: IntListProperty(Property::PropertyInfo info, std::vector values = std::vector()); - std::string_view className() const override; - ghoul::lua::LuaTypes typeLua() const override; + std::string_view className() const override final; + ghoul::lua::LuaTypes typeLua() const override final; + void getLuaValue(lua_State* state) const override final; + + std::string stringValue() const override final; using TemplateProperty>::operator std::vector; using TemplateProperty>::operator=; -protected: - std::string toStringConversion() const override; +private: + std::vector toValue(lua_State* state) const override final; }; } // namespace openspace::properties diff --git a/include/openspace/properties/list/stringlistproperty.h b/include/openspace/properties/list/stringlistproperty.h index f6c21cfdce..ca56b50aea 100644 --- a/include/openspace/properties/list/stringlistproperty.h +++ b/include/openspace/properties/list/stringlistproperty.h @@ -25,7 +25,7 @@ #ifndef __OPENSPACE_CORE___STRINGLISTPROPERTY___H__ #define __OPENSPACE_CORE___STRINGLISTPROPERTY___H__ -#include +#include #include namespace openspace::properties { @@ -35,14 +35,17 @@ public: StringListProperty(Property::PropertyInfo info, std::vector values = std::vector()); - std::string_view className() const override; - ghoul::lua::LuaTypes typeLua() const override; + std::string_view className() const override final; + ghoul::lua::LuaTypes typeLua() const override final; + void getLuaValue(lua_State* state) const override final; + + std::string stringValue() const override final; using TemplateProperty>::operator std::vector; using TemplateProperty>::operator=; -protected: - std::string toStringConversion() const override; +private: + std::vector< std::string> toValue(lua_State* state) const override final; }; } // namespace openspace::properties diff --git a/include/openspace/properties/matrix/dmat2property.h b/include/openspace/properties/matrix/dmat2property.h index 89854b8f35..8c25086ef4 100644 --- a/include/openspace/properties/matrix/dmat2property.h +++ b/include/openspace/properties/matrix/dmat2property.h @@ -41,10 +41,16 @@ public: ghoul::createFillMat2x2(std::numeric_limits::max()), glm::dmat2x2 stepValue = ghoul::createFillMat2x2(0.01)); - std::string_view className() const override; - ghoul::lua::LuaTypes typeLua() const override; + std::string_view className() const override final; + ghoul::lua::LuaTypes typeLua() const override final; + void getLuaValue(lua_State* state) const override final; + + std::string stringValue() const override final; using TemplateProperty::operator=; + +private: + glm::dmat2x2 toValue(lua_State* state) const override final; }; } // namespace openspace::properties diff --git a/include/openspace/properties/matrix/dmat3property.h b/include/openspace/properties/matrix/dmat3property.h index 5de7441cdb..954e56e12a 100644 --- a/include/openspace/properties/matrix/dmat3property.h +++ b/include/openspace/properties/matrix/dmat3property.h @@ -41,10 +41,16 @@ public: ghoul::createFillMat3x3(std::numeric_limits::max()), glm::dmat3x3 stepValue = ghoul::createFillMat3x3(0.01)); - std::string_view className() const override; - ghoul::lua::LuaTypes typeLua() const override; + std::string_view className() const override final; + ghoul::lua::LuaTypes typeLua() const override final; + void getLuaValue(lua_State* state) const override final; + + std::string stringValue() const override final; using TemplateProperty::operator=; + +private: + glm::dmat3x3 toValue(lua_State* state) const override final; }; } // namespace openspace::properties diff --git a/include/openspace/properties/matrix/dmat4property.h b/include/openspace/properties/matrix/dmat4property.h index 4f43fd5745..3a21e502c9 100644 --- a/include/openspace/properties/matrix/dmat4property.h +++ b/include/openspace/properties/matrix/dmat4property.h @@ -41,10 +41,16 @@ public: ghoul::createFillMat4x4(std::numeric_limits::max()), glm::dmat4x4 stepValue = ghoul::createFillMat4x4(0.01)); - std::string_view className() const override; - ghoul::lua::LuaTypes typeLua() const override; + std::string_view className() const override final; + ghoul::lua::LuaTypes typeLua() const override final; + void getLuaValue(lua_State* state) const override final; + + std::string stringValue() const override final; using TemplateProperty::operator=; + +private: + glm::dmat4x4 toValue(lua_State* state) const override final; }; } // namespace openspace::properties diff --git a/include/openspace/properties/matrix/mat2property.h b/include/openspace/properties/matrix/mat2property.h index b818a9be2c..68513c377d 100644 --- a/include/openspace/properties/matrix/mat2property.h +++ b/include/openspace/properties/matrix/mat2property.h @@ -41,10 +41,16 @@ public: ghoul::createFillMat2x2(std::numeric_limits::max()), glm::mat2x2 stepValue = ghoul::createFillMat2x2(0.01f)); - std::string_view className() const override; - ghoul::lua::LuaTypes typeLua() const override; + std::string_view className() const override final; + ghoul::lua::LuaTypes typeLua() const override final; + void getLuaValue(lua_State* state) const override final; + + std::string stringValue() const override final; using TemplateProperty::operator=; + +private: + glm::mat2x2 toValue(lua_State* state) const override final; }; } // namespace openspace::properties diff --git a/include/openspace/properties/matrix/mat3property.h b/include/openspace/properties/matrix/mat3property.h index d857fbfe42..17cc04876e 100644 --- a/include/openspace/properties/matrix/mat3property.h +++ b/include/openspace/properties/matrix/mat3property.h @@ -41,10 +41,16 @@ public: ghoul::createFillMat3x3(std::numeric_limits::max()), glm::mat3x3 stepValue = ghoul::createFillMat3x3(0.01f)); - std::string_view className() const override; - ghoul::lua::LuaTypes typeLua() const override; + std::string_view className() const override final; + ghoul::lua::LuaTypes typeLua() const override final; + void getLuaValue(lua_State* state) const override final; + + std::string stringValue() const override final; using TemplateProperty::operator=; + +private: + glm::mat3x3 toValue(lua_State* state) const override final; }; } // namespace openspace::properties diff --git a/include/openspace/properties/matrix/mat4property.h b/include/openspace/properties/matrix/mat4property.h index 93d0eb83f4..790f48dc4c 100644 --- a/include/openspace/properties/matrix/mat4property.h +++ b/include/openspace/properties/matrix/mat4property.h @@ -41,10 +41,16 @@ public: ghoul::createFillMat4x4(std::numeric_limits::max()), glm::mat4x4 stepValue = ghoul::createFillMat4x4(0.01f)); - std::string_view className() const override; - ghoul::lua::LuaTypes typeLua() const override; + std::string_view className() const override final; + ghoul::lua::LuaTypes typeLua() const override final; + void getLuaValue(lua_State* state) const override final; + + std::string stringValue() const override final; using TemplateProperty::operator=; + +private: + glm::mat4x4 toValue(lua_State* state) const override final; }; } // namespace openspace::properties diff --git a/include/openspace/properties/listproperty.h b/include/openspace/properties/misc/listproperty.h similarity index 93% rename from include/openspace/properties/listproperty.h rename to include/openspace/properties/misc/listproperty.h index dc10f3fc25..aa70fb3d21 100644 --- a/include/openspace/properties/listproperty.h +++ b/include/openspace/properties/misc/listproperty.h @@ -36,14 +36,10 @@ public: ListProperty(Property::PropertyInfo info, std::vector values); virtual ~ListProperty() override = 0; - -protected: - std::vector fromLuaConversion(lua_State* state) const override; - void toLuaConversion(lua_State* state) const override; }; } // namespace openspace::properties -#include "openspace/properties/listproperty.inl" +#include "openspace/properties/misc/listproperty.inl" #endif // __OPENSPACE_CORE___LISTPROPERTY___H__ diff --git a/include/openspace/properties/listproperty.inl b/include/openspace/properties/misc/listproperty.inl similarity index 88% rename from include/openspace/properties/listproperty.inl rename to include/openspace/properties/misc/listproperty.inl index 6d17be9a39..5f26c193f2 100644 --- a/include/openspace/properties/listproperty.inl +++ b/include/openspace/properties/misc/listproperty.inl @@ -32,15 +32,5 @@ ListProperty::ListProperty(Property::PropertyInfo info, std::vector values template ListProperty::~ListProperty() {} -template -std::vector ListProperty::fromLuaConversion(lua_State* state) const { - return ghoul::lua::value>(state); -} - -template -void ListProperty::toLuaConversion(lua_State* state) const { - ghoul::lua::push(state, TemplateProperty>::_value); -} - } // namespace openspace::properties diff --git a/include/openspace/properties/optionproperty.h b/include/openspace/properties/misc/optionproperty.h similarity index 93% rename from include/openspace/properties/optionproperty.h rename to include/openspace/properties/misc/optionproperty.h index 8e09fb43a3..6507d43a45 100644 --- a/include/openspace/properties/optionproperty.h +++ b/include/openspace/properties/misc/optionproperty.h @@ -37,7 +37,7 @@ namespace openspace::properties { * options can be queried using the options method. Only values representing valid options * can be used to set this property, or an error will be logged. */ -class OptionProperty : public IntProperty { +class OptionProperty : public NumericalProperty { public: /** * The struct storing a single option consisting of an integer `value` and a `string` @@ -81,10 +81,10 @@ public: * * \return The name of this class for reflection purposes */ - std::string_view className() const override; - ghoul::lua::LuaTypes typeLua() const override; + std::string_view className() const override final; + ghoul::lua::LuaTypes typeLua() const override final; - using IntProperty::operator=; + using TemplateProperty::operator=; /** * Returns the type for GUI display. @@ -160,10 +160,14 @@ public: */ std::string getDescriptionByValue(int value); + void getLuaValue(lua_State* state) const override final; + void setLuaValue(lua_State* state) override final; + std::string stringValue() const override final; + private: static const std::string OptionsKey; - int fromLuaConversion(lua_State* state) const override; - std::string generateAdditionalJsonDescription() const override; + std::string generateAdditionalJsonDescription() const override final; + int toValue(lua_State* state) const override final; /// The list of options which have been registered with this OptionProperty std::vector