diff --git a/Jenkinsfile b/Jenkinsfile index 730909116e..7405ada9a9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -68,7 +68,7 @@ parallel tools: { }, linux_gcc_make: { if (env.USE_BUILD_OS_LINUX == 'true') { - node('linux' && 'gcc') { + node('linux-gcc') { stage('linux-gcc-make/scm') { deleteDir(); gitHelper.checkoutGit(url, branch); @@ -114,7 +114,7 @@ linux_gcc_make: { }, linux_gcc_ninja: { if (env.USE_BUILD_OS_LINUX == 'true') { - node('linux' && 'gcc') { + node('linux-gcc') { stage('linux-gcc-ninja/scm') { deleteDir(); gitHelper.checkoutGit(url, branch); @@ -158,7 +158,7 @@ linux_gcc_ninja: { }, linux_clang_make: { if (env.USE_BUILD_OS_LINUX == 'true') { - node('linux' && 'clang') { + node('linux-clang') { stage('linux-clang-make/scm') { deleteDir() gitHelper.checkoutGit(url, branch); @@ -203,7 +203,7 @@ linux_clang_make: { }, linux_clang_ninja: { if (env.USE_BUILD_OS_LINUX == 'true') { - node('linux' && 'clang') { + node('linux-clang') { stage('linux-clang-ninja/scm') { deleteDir() gitHelper.checkoutGit(url, branch); diff --git a/apps/OpenSpace/ext/sgct b/apps/OpenSpace/ext/sgct index e40111d616..f48a48307f 160000 --- a/apps/OpenSpace/ext/sgct +++ b/apps/OpenSpace/ext/sgct @@ -1 +1 @@ -Subproject commit e40111d616e85b61632b74a6b900fe6b88d2b74b +Subproject commit f48a48307fa76c0ec9a9db0423ae417cf301f76f diff --git a/ext/ghoul b/ext/ghoul index b676d66bc0..df84293686 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit b676d66bc028e26dbf2fa0a39c67e35667df13f9 +Subproject commit df84293686f270d40be22725e6b11a4e020b8bf3 diff --git a/include/openspace/camera/camera.h b/include/openspace/camera/camera.h index a9f398e25d..5e66fb54b7 100644 --- a/include/openspace/camera/camera.h +++ b/include/openspace/camera/camera.h @@ -145,7 +145,7 @@ public: // [[deprecated("Replaced by Camera::SgctInternal::viewProjectionMatrix()")]] const glm::mat4& viewProjectionMatrix() const; - std::vector getSyncables(); + std::vector syncables(); // Static constants // (2021-07-16, emmbr) Note that this hard coded vector for the view direction is also diff --git a/include/openspace/engine/openspaceengine.h b/include/openspace/engine/openspaceengine.h index 7f715b4629..adef08025d 100644 --- a/include/openspace/engine/openspaceengine.h +++ b/include/openspace/engine/openspaceengine.h @@ -104,7 +104,7 @@ public: void touchDetectionCallback(TouchInput input); void touchUpdateCallback(TouchInput input); void touchExitCallback(TouchInput input); - void handleDragDrop(const std::string& file); + void handleDragDrop(std::filesystem::path file); std::vector encode(); void decode(std::vector data); @@ -126,8 +126,7 @@ public: AssetManager& assetManager(); LoadingScreen* loadingScreen(); - void writeSceneDocumentation(); - void writeStaticDocumentation(); + void writeDocumentation(); void createUserDirectoriesIfNecessary(); /** @@ -141,7 +140,6 @@ private: void loadFonts(); void runGlobalCustomizationScripts(); - std::string generateFilePath(std::string openspaceRelativePath); void resetPropertyChangeFlagsOfSubowners(openspace::properties::PropertyOwner* po); properties::BoolProperty _printEvents; @@ -156,9 +154,6 @@ private: glm::vec2 _mousePosition = glm::vec2(0.f); - //grabs json from each module to pass to the documentation engine. - std::string _documentationJson; - std::future _writeDocumentationTask; ShutdownInformation _shutdown; diff --git a/include/openspace/properties/list/doublelistproperty.h b/include/openspace/properties/list/doublelistproperty.h index d3fb84b990..ca4f1d8b24 100644 --- a/include/openspace/properties/list/doublelistproperty.h +++ b/include/openspace/properties/list/doublelistproperty.h @@ -34,7 +34,7 @@ public: DoubleListProperty(Property::PropertyInfo info, std::vector values = std::vector()); - std::string className() const override; + std::string_view className() const override; int typeLua() const override; using TemplateProperty>::operator std::vector; diff --git a/include/openspace/properties/list/intlistproperty.h b/include/openspace/properties/list/intlistproperty.h index d0a432815e..2e13e0a4ac 100644 --- a/include/openspace/properties/list/intlistproperty.h +++ b/include/openspace/properties/list/intlistproperty.h @@ -34,7 +34,7 @@ public: IntListProperty(Property::PropertyInfo info, std::vector values = std::vector()); - std::string className() const override; + std::string_view className() const override; int typeLua() const override; using TemplateProperty>::operator std::vector; diff --git a/include/openspace/properties/list/stringlistproperty.h b/include/openspace/properties/list/stringlistproperty.h index 3a3a70ac9e..1b1cfca68d 100644 --- a/include/openspace/properties/list/stringlistproperty.h +++ b/include/openspace/properties/list/stringlistproperty.h @@ -35,7 +35,7 @@ public: StringListProperty(Property::PropertyInfo info, std::vector values = std::vector()); - std::string className() const override; + std::string_view className() const override; int typeLua() const override; using TemplateProperty>::operator std::vector; diff --git a/include/openspace/properties/matrix/dmat2property.h b/include/openspace/properties/matrix/dmat2property.h index 953a5396db..8b3293b1aa 100644 --- a/include/openspace/properties/matrix/dmat2property.h +++ b/include/openspace/properties/matrix/dmat2property.h @@ -41,7 +41,7 @@ public: ghoul::createFillMat2x2(std::numeric_limits::max()), glm::dmat2x2 stepValue = ghoul::createFillMat2x2(0.01)); - std::string className() const override; + std::string_view className() const override; int typeLua() const override; using TemplateProperty::operator=; diff --git a/include/openspace/properties/matrix/dmat3property.h b/include/openspace/properties/matrix/dmat3property.h index ec36ca48d7..58c5610c4a 100644 --- a/include/openspace/properties/matrix/dmat3property.h +++ b/include/openspace/properties/matrix/dmat3property.h @@ -41,7 +41,7 @@ public: ghoul::createFillMat3x3(std::numeric_limits::max()), glm::dmat3x3 stepValue = ghoul::createFillMat3x3(0.01)); - std::string className() const override; + std::string_view className() const override; int typeLua() const override; using TemplateProperty::operator=; diff --git a/include/openspace/properties/matrix/dmat4property.h b/include/openspace/properties/matrix/dmat4property.h index 3b2e8928f9..f05988cad8 100644 --- a/include/openspace/properties/matrix/dmat4property.h +++ b/include/openspace/properties/matrix/dmat4property.h @@ -41,7 +41,7 @@ public: ghoul::createFillMat4x4(std::numeric_limits::max()), glm::dmat4x4 stepValue = ghoul::createFillMat4x4(0.01)); - std::string className() const override; + std::string_view className() const override; int typeLua() const override; using TemplateProperty::operator=; diff --git a/include/openspace/properties/matrix/mat2property.h b/include/openspace/properties/matrix/mat2property.h index 458338e1ef..203f25ad2e 100644 --- a/include/openspace/properties/matrix/mat2property.h +++ b/include/openspace/properties/matrix/mat2property.h @@ -41,7 +41,7 @@ public: ghoul::createFillMat2x2(std::numeric_limits::max()), glm::mat2x2 stepValue = ghoul::createFillMat2x2(0.01f)); - std::string className() const override; + std::string_view className() const override; int typeLua() const override; using TemplateProperty::operator=; diff --git a/include/openspace/properties/matrix/mat3property.h b/include/openspace/properties/matrix/mat3property.h index 457ed99465..01c74a913d 100644 --- a/include/openspace/properties/matrix/mat3property.h +++ b/include/openspace/properties/matrix/mat3property.h @@ -41,7 +41,7 @@ public: ghoul::createFillMat3x3(std::numeric_limits::max()), glm::mat3x3 stepValue = ghoul::createFillMat3x3(0.01f)); - std::string className() const override; + std::string_view className() const override; int typeLua() const override; using TemplateProperty::operator=; diff --git a/include/openspace/properties/matrix/mat4property.h b/include/openspace/properties/matrix/mat4property.h index e5a97df2c7..6a82647161 100644 --- a/include/openspace/properties/matrix/mat4property.h +++ b/include/openspace/properties/matrix/mat4property.h @@ -41,7 +41,7 @@ public: ghoul::createFillMat4x4(std::numeric_limits::max()), glm::mat4x4 stepValue = ghoul::createFillMat4x4(0.01f)); - std::string className() const override; + std::string_view className() const override; int typeLua() const override; using TemplateProperty::operator=; diff --git a/include/openspace/properties/numericalproperty.h b/include/openspace/properties/numericalproperty.h index 8e40185467..06f2f5d68c 100644 --- a/include/openspace/properties/numericalproperty.h +++ b/include/openspace/properties/numericalproperty.h @@ -35,7 +35,7 @@ public: NumericalProperty(Property::PropertyInfo info, T value, T minimumValue, T maximumValue, T steppingValue, float exponent = 1.f); - virtual std::string className() const override = 0; + virtual std::string_view className() const override = 0; virtual int typeLua() const override = 0; T minValue() const; diff --git a/include/openspace/properties/optionproperty.h b/include/openspace/properties/optionproperty.h index b07efec1ec..a618bce27a 100644 --- a/include/openspace/properties/optionproperty.h +++ b/include/openspace/properties/optionproperty.h @@ -82,7 +82,7 @@ public: * * \return The name of this class for reflection purposes */ - std::string className() const override; + std::string_view className() const override; using IntProperty::operator=; /** diff --git a/include/openspace/properties/property.h b/include/openspace/properties/property.h index 6e9303a271..f17c3c85aa 100644 --- a/include/openspace/properties/property.h +++ b/include/openspace/properties/property.h @@ -30,6 +30,7 @@ #include #include #include +#include struct lua_State; @@ -114,7 +115,8 @@ public: /// This OnChangeHandle can be used to remove all onChange callbacks from this /// Property - static OnChangeHandle OnChangeHandleAll; + constexpr static OnChangeHandle OnChangeHandleAll = + std::numeric_limits::max(); /** * The constructor for the property. The \p info (see #PropertyInfo) contains @@ -145,7 +147,7 @@ public: * * \return The class name of the Property */ - virtual std::string className() const = 0; + virtual std::string_view className() const = 0; /** * This method returns the encapsulated value of the Property to the caller. The type @@ -223,17 +225,7 @@ public: * \param value The value to which the Property will be encoded * \return \p true if the encoding succeeded, \p false otherwise */ - virtual bool getStringValue(std::string& value) const; - - /** - * This method encodes the encapsulated value of this Property as a - * std::string. - * - * \return the string value - * - * \throw ghoul::RuntimeError If value could not be fetched - */ - std::string getStringValue() const; + virtual std::string stringValue() const; /** * This method registers a \p callback function that will be called every time if @@ -382,11 +374,11 @@ public: void setReadOnly(bool state); /** - * Default view options that can be used in the Property::setViewOption method. The - * values are: - * - Property::ViewOptions::Color = \c Color (Intended for Vec3 and Vec4), - * - Property::ViewOptions::MinMaxRange = \c MinMaxRange (Intended for Vec2) - */ + * Default view options that can be used in the Property::setViewOption method. The + * values are: + * - Property::ViewOptions::Color = \c Color (Intended for Vec3 and Vec4), + * - Property::ViewOptions::MinMaxRange = \c MinMaxRange (Intended for Vec2) + */ struct ViewOptions { static const char* Color; static const char* MinMaxRange; @@ -426,14 +418,6 @@ public: */ const ghoul::Dictionary& metaData() const; - /** - * Convert the Property into a string containing a JSON representation of the - * Property. Includes description of the object. - * - * \return The JSON string - */ - virtual std::string toJson() const; - /** * Get a valid JSON formatted representation of the Property's value. * @@ -457,7 +441,7 @@ public: * * \return The base description common to all Property classes */ - std::string generateBaseJsonDescription() const; + std::string generateJsonDescription() const; /** * Creates the information for the \c MetaData key-part of the JSON description for @@ -496,14 +480,6 @@ public: void resetToUnchanged(); protected: - static const char* IdentifierKey; - static const char* NameKey; - static const char* TypeKey; - static const char* DescriptionKey; - static const char* JsonValueKey; - static const char* MetaDataKey; - static const char* AdditionalDataKey; - /** * This method must be called by all subclasses whenever the encapsulated value has * changed and potential listeners need to be informed. @@ -547,9 +523,6 @@ private: #endif }; -/// This function sanitizes an incoming string for JSON control characters -std::string sanitizeString(const std::string& str); - } // namespace openspace::properties #endif // __OPENSPACE_CORE___PROPERTY___H__ diff --git a/include/openspace/properties/scalar/boolproperty.h b/include/openspace/properties/scalar/boolproperty.h index 05a92c864a..c100171f3b 100644 --- a/include/openspace/properties/scalar/boolproperty.h +++ b/include/openspace/properties/scalar/boolproperty.h @@ -48,7 +48,7 @@ class BoolProperty : public TemplateProperty { public: BoolProperty(Property::PropertyInfo info, bool value = false); - std::string className() const override; + std::string_view className() const override; int typeLua() const override; using TemplateProperty::operator=; diff --git a/include/openspace/properties/scalar/doubleproperty.h b/include/openspace/properties/scalar/doubleproperty.h index 095b0e659c..65b3c8f549 100644 --- a/include/openspace/properties/scalar/doubleproperty.h +++ b/include/openspace/properties/scalar/doubleproperty.h @@ -51,7 +51,7 @@ public: double minValue = std::numeric_limits::lowest(), double maxValue = std::numeric_limits::max(), double stepValue = 0.01); - std::string className() const override; + std::string_view className() const override; int typeLua() const override; using TemplateProperty::operator=; diff --git a/include/openspace/properties/scalar/floatproperty.h b/include/openspace/properties/scalar/floatproperty.h index b1d60b80b7..b52f9d7754 100644 --- a/include/openspace/properties/scalar/floatproperty.h +++ b/include/openspace/properties/scalar/floatproperty.h @@ -51,7 +51,7 @@ public: float minValue = std::numeric_limits::lowest(), float maxValue = std::numeric_limits::max(), float stepValue = 0.01f); - std::string className() const override; + std::string_view className() const override; int typeLua() const override; using TemplateProperty::operator=; diff --git a/include/openspace/properties/scalar/intproperty.h b/include/openspace/properties/scalar/intproperty.h index 51f4ea5fef..906dbddaf5 100644 --- a/include/openspace/properties/scalar/intproperty.h +++ b/include/openspace/properties/scalar/intproperty.h @@ -51,7 +51,7 @@ public: int minValue = std::numeric_limits::lowest(), int maxValue = std::numeric_limits::max(), int stepValue = 1); - std::string className() const override; + std::string_view className() const override; int typeLua() const override; using TemplateProperty::operator=; diff --git a/include/openspace/properties/scalar/longproperty.h b/include/openspace/properties/scalar/longproperty.h index 6abd2d0932..f8b7586347 100644 --- a/include/openspace/properties/scalar/longproperty.h +++ b/include/openspace/properties/scalar/longproperty.h @@ -52,7 +52,7 @@ public: long maxValue = std::numeric_limits::max(), long stepValue = long(1)); - std::string className() const override; + std::string_view className() const override; int typeLua() const override; using TemplateProperty::operator=; diff --git a/include/openspace/properties/scalar/shortproperty.h b/include/openspace/properties/scalar/shortproperty.h index 012402dda0..b60cd2c721 100644 --- a/include/openspace/properties/scalar/shortproperty.h +++ b/include/openspace/properties/scalar/shortproperty.h @@ -52,7 +52,7 @@ public: short maxValue = std::numeric_limits::max(), short stepValue = short(1)); - std::string className() const override; + std::string_view className() const override; int typeLua() const override; using TemplateProperty::operator=; diff --git a/include/openspace/properties/scalar/uintproperty.h b/include/openspace/properties/scalar/uintproperty.h index 20e5d3c35b..9064f1a386 100644 --- a/include/openspace/properties/scalar/uintproperty.h +++ b/include/openspace/properties/scalar/uintproperty.h @@ -52,7 +52,7 @@ public: unsigned int maxValue = std::numeric_limits::max(), unsigned int stepValue = 1); - std::string className() const override; + std::string_view className() const override; int typeLua() const override; using TemplateProperty::operator=; diff --git a/include/openspace/properties/scalar/ulongproperty.h b/include/openspace/properties/scalar/ulongproperty.h index 36d49dedf1..f5c7e3a31f 100644 --- a/include/openspace/properties/scalar/ulongproperty.h +++ b/include/openspace/properties/scalar/ulongproperty.h @@ -52,7 +52,7 @@ public: unsigned long maxValue = std::numeric_limits::max(), unsigned long stepValue = 1ul); - std::string className() const override; + std::string_view className() const override; int typeLua() const override; using TemplateProperty::operator=; diff --git a/include/openspace/properties/scalar/ushortproperty.h b/include/openspace/properties/scalar/ushortproperty.h index 4a8a7ae536..12b69295e6 100644 --- a/include/openspace/properties/scalar/ushortproperty.h +++ b/include/openspace/properties/scalar/ushortproperty.h @@ -52,7 +52,7 @@ public: unsigned short maxValue = std::numeric_limits::max(), unsigned short stepValue = 1); - std::string className() const override; + std::string_view className() const override; int typeLua() const override; using TemplateProperty::operator=; diff --git a/include/openspace/properties/selectionproperty.h b/include/openspace/properties/selectionproperty.h index 447b403a38..21c44985a0 100644 --- a/include/openspace/properties/selectionproperty.h +++ b/include/openspace/properties/selectionproperty.h @@ -37,7 +37,7 @@ class SelectionProperty : public TemplateProperty> { public: SelectionProperty(Property::PropertyInfo info); - std::string className() const override; + std::string_view className() const override; int typeLua() const override; /** diff --git a/include/openspace/properties/stringproperty.h b/include/openspace/properties/stringproperty.h index 8a82e79835..b803285993 100644 --- a/include/openspace/properties/stringproperty.h +++ b/include/openspace/properties/stringproperty.h @@ -33,7 +33,7 @@ class StringProperty : public TemplateProperty { public: StringProperty(Property::PropertyInfo info, std::string value = ""); - std::string className() const override; + std::string_view className() const override; int typeLua() const override; using TemplateProperty::operator=; diff --git a/include/openspace/properties/templateproperty.h b/include/openspace/properties/templateproperty.h index 6e5121a329..4bbb48e423 100644 --- a/include/openspace/properties/templateproperty.h +++ b/include/openspace/properties/templateproperty.h @@ -71,7 +71,7 @@ public: * * \return The class name for the TemplateProperty */ - virtual std::string className() const override = 0; + virtual std::string_view className() const override = 0; /** * Returns the stored value packed into a ghoul::any object. @@ -127,7 +127,7 @@ public: * \param value The string object in which to store the resulting encoding * \return \c true if the encoding succeeded; \c false otherwise */ - virtual bool getStringValue(std::string& value) const override; + virtual std::string stringValue() const override; /** * Returns the description for this TemplateProperty as a Lua script that returns a diff --git a/include/openspace/properties/templateproperty.inl b/include/openspace/properties/templateproperty.inl index 7b0d76389b..014e690192 100644 --- a/include/openspace/properties/templateproperty.inl +++ b/include/openspace/properties/templateproperty.inl @@ -60,12 +60,6 @@ void openspace::properties::TemplateProperty::setValue(T val) { } } -template -std::ostream& operator<<(std::ostream& os, const TemplateProperty& obj) { - os << obj.value(); - return os; -} - template std::any TemplateProperty::get() const { return std::any(_value); @@ -99,9 +93,8 @@ bool TemplateProperty::setLuaValue(lua_State* state) { } template -bool TemplateProperty::getStringValue(std::string& outValue) const { - outValue = toStringConversion(); - return true; +std::string TemplateProperty::stringValue() const { + return toStringConversion(); } } // namespace openspace::properties diff --git a/include/openspace/properties/triggerproperty.h b/include/openspace/properties/triggerproperty.h index 09c5a75e40..f3ec305720 100644 --- a/include/openspace/properties/triggerproperty.h +++ b/include/openspace/properties/triggerproperty.h @@ -49,7 +49,7 @@ public: * Returns the class name TriggerProperty. * \return The class name TriggerProperty */ - std::string className() const override; + std::string_view className() const override; /** * Accepts only the LUA_TNIL type and will notify all the listeners @@ -66,8 +66,6 @@ public: */ void set(std::any value) override; - std::string toJson() const override; - std::string jsonValue() const override; }; diff --git a/include/openspace/properties/vector/dvec2property.h b/include/openspace/properties/vector/dvec2property.h index 7519edf158..1b634c18f1 100644 --- a/include/openspace/properties/vector/dvec2property.h +++ b/include/openspace/properties/vector/dvec2property.h @@ -39,7 +39,7 @@ public: glm::dvec2 maxValue = glm::dvec2(std::numeric_limits::max()), glm::dvec2 stepValue = glm::dvec2(0.01)); - std::string className() const override; + std::string_view className() const override; int typeLua() const override; using TemplateProperty::operator=; diff --git a/include/openspace/properties/vector/dvec3property.h b/include/openspace/properties/vector/dvec3property.h index 8a52d85b54..cd8d4cead6 100644 --- a/include/openspace/properties/vector/dvec3property.h +++ b/include/openspace/properties/vector/dvec3property.h @@ -39,7 +39,7 @@ public: glm::dvec3 maxValue = glm::dvec3(std::numeric_limits::max()), glm::dvec3 stepValue = glm::dvec3(0.01)); - std::string className() const override; + std::string_view className() const override; int typeLua() const override; using TemplateProperty::operator=; diff --git a/include/openspace/properties/vector/dvec4property.h b/include/openspace/properties/vector/dvec4property.h index 54e0742b9e..43f1259f36 100644 --- a/include/openspace/properties/vector/dvec4property.h +++ b/include/openspace/properties/vector/dvec4property.h @@ -39,7 +39,7 @@ public: glm::dvec4 maxValue = glm::dvec4(std::numeric_limits::max()), glm::dvec4 stepValue = glm::dvec4(0.01)); - std::string className() const override; + std::string_view className() const override; int typeLua() const override; using TemplateProperty::operator=; diff --git a/include/openspace/properties/vector/ivec2property.h b/include/openspace/properties/vector/ivec2property.h index e40d59ad4b..d8b20fa684 100644 --- a/include/openspace/properties/vector/ivec2property.h +++ b/include/openspace/properties/vector/ivec2property.h @@ -39,7 +39,7 @@ public: glm::ivec2 maxValue = glm::ivec2(std::numeric_limits::max()), glm::ivec2 stepValue = glm::ivec2(1)); - std::string className() const override; + std::string_view className() const override; int typeLua() const override; using TemplateProperty::operator=; diff --git a/include/openspace/properties/vector/ivec3property.h b/include/openspace/properties/vector/ivec3property.h index efb7527eb3..573d8b80e7 100644 --- a/include/openspace/properties/vector/ivec3property.h +++ b/include/openspace/properties/vector/ivec3property.h @@ -39,7 +39,7 @@ public: glm::ivec3 maxValue = glm::ivec3(std::numeric_limits::max()), glm::ivec3 stepValue = glm::ivec3(1)); - std::string className() const override; + std::string_view className() const override; int typeLua() const override; using TemplateProperty::operator=; diff --git a/include/openspace/properties/vector/ivec4property.h b/include/openspace/properties/vector/ivec4property.h index c5bbea993b..841bb0404b 100644 --- a/include/openspace/properties/vector/ivec4property.h +++ b/include/openspace/properties/vector/ivec4property.h @@ -39,7 +39,7 @@ public: glm::ivec4 maxValue = glm::ivec4(std::numeric_limits::max()), glm::ivec4 stepValue = glm::ivec4(1)); - std::string className() const override; + std::string_view className() const override; int typeLua() const override; using TemplateProperty::operator=; diff --git a/include/openspace/properties/vector/uvec2property.h b/include/openspace/properties/vector/uvec2property.h index 1e7fc2aa93..5ca0850741 100644 --- a/include/openspace/properties/vector/uvec2property.h +++ b/include/openspace/properties/vector/uvec2property.h @@ -39,7 +39,7 @@ public: glm::uvec2 maxValue = glm::uvec2(std::numeric_limits::max()), glm::uvec2 stepValue = glm::uvec2(1)); - std::string className() const override; + std::string_view className() const override; int typeLua() const override; using TemplateProperty::operator=; diff --git a/include/openspace/properties/vector/uvec3property.h b/include/openspace/properties/vector/uvec3property.h index 293a74e826..1f24f3411b 100644 --- a/include/openspace/properties/vector/uvec3property.h +++ b/include/openspace/properties/vector/uvec3property.h @@ -39,7 +39,7 @@ public: glm::uvec3 maxValue = glm::uvec3(std::numeric_limits::max()), glm::uvec3 stepValue = glm::uvec3(1)); - std::string className() const override; + std::string_view className() const override; int typeLua() const override; using TemplateProperty::operator=; diff --git a/include/openspace/properties/vector/uvec4property.h b/include/openspace/properties/vector/uvec4property.h index 253e4a187a..5391febdec 100644 --- a/include/openspace/properties/vector/uvec4property.h +++ b/include/openspace/properties/vector/uvec4property.h @@ -39,7 +39,7 @@ public: glm::uvec4 maxValue = glm::uvec4(std::numeric_limits::max()), glm::uvec4 stepValue = glm::uvec4(1)); - std::string className() const override; + std::string_view className() const override; int typeLua() const override; using TemplateProperty::operator=; diff --git a/include/openspace/properties/vector/vec2property.h b/include/openspace/properties/vector/vec2property.h index dd655e1f16..0af248451e 100644 --- a/include/openspace/properties/vector/vec2property.h +++ b/include/openspace/properties/vector/vec2property.h @@ -39,7 +39,7 @@ public: glm::vec2 maxValue = glm::vec2(std::numeric_limits::max()), glm::vec2 stepValue = glm::vec2(0.01f)); - std::string className() const override; + std::string_view className() const override; int typeLua() const override; using TemplateProperty::operator=; diff --git a/include/openspace/properties/vector/vec3property.h b/include/openspace/properties/vector/vec3property.h index 4b7dee52f0..1f6392bf26 100644 --- a/include/openspace/properties/vector/vec3property.h +++ b/include/openspace/properties/vector/vec3property.h @@ -39,7 +39,7 @@ public: glm::vec3 maxValue = glm::vec3(std::numeric_limits::max()), glm::vec3 stepValue = glm::vec3(0.01f)); - std::string className() const override; + std::string_view className() const override; int typeLua() const override; using TemplateProperty::operator=; diff --git a/include/openspace/properties/vector/vec4property.h b/include/openspace/properties/vector/vec4property.h index 7550b0734e..a29fc2280b 100644 --- a/include/openspace/properties/vector/vec4property.h +++ b/include/openspace/properties/vector/vec4property.h @@ -39,7 +39,7 @@ public: glm::vec4 maxValue = glm::vec4(std::numeric_limits::max()), glm::vec4 stepValue = glm::vec4(0.01f)); - std::string className() const override; + std::string_view className() const override; int typeLua() const override; using TemplateProperty::operator=; diff --git a/include/openspace/rendering/renderengine.h b/include/openspace/rendering/renderengine.h index dfc751a3f3..0b5809eec4 100644 --- a/include/openspace/rendering/renderengine.h +++ b/include/openspace/rendering/renderengine.h @@ -90,7 +90,7 @@ public: void renderEndscreen(); void postDraw(); - float globalBlackOutFactor(); + float globalBlackOutFactor() const; void setGlobalBlackOutFactor(float opacity); float hdrExposure() const; diff --git a/include/openspace/scene/scene.h b/include/openspace/scene/scene.h index 6ec1097326..cbd3368a25 100644 --- a/include/openspace/scene/scene.h +++ b/include/openspace/scene/scene.h @@ -69,7 +69,7 @@ public: * \param message The reason that caused this exception to be thrown * \param component The optional compoment that caused this exception to be thrown * \pre message may not be empty - */ + */ explicit InvalidSceneError(std::string msg, std::string comp = ""); }; @@ -100,11 +100,6 @@ public: */ ghoul::mm_unique_ptr detachNode(SceneGraphNode& node); - /** - * Set the camera of the scene - */ - void setCamera(std::unique_ptr camera); - /** * Return the camera */ @@ -147,8 +142,8 @@ public: void unregisterNode(SceneGraphNode* node); /** - * Mark the node registry as dirty - */ + * Mark the node registry as dirty + */ void markNodeRegistryDirty(); /** diff --git a/include/openspace/scene/scenegraphnode.h b/include/openspace/scene/scenegraphnode.h index b2046ae194..31c4f97018 100644 --- a/include/openspace/scene/scenegraphnode.h +++ b/include/openspace/scene/scenegraphnode.h @@ -178,7 +178,7 @@ private: properties::StringProperty _guiDisplayName; properties::StringProperty _guiDescription; - // Transformation defined by ephemeris, rotation and scale + // Transformation defined by translation, rotation and scale struct { ghoul::mm_unique_ptr translation; ghoul::mm_unique_ptr rotation; diff --git a/include/openspace/scripting/scriptengine.h b/include/openspace/scripting/scriptengine.h index 14d62325e9..9267963c47 100644 --- a/include/openspace/scripting/scriptengine.h +++ b/include/openspace/scripting/scriptengine.h @@ -85,8 +85,6 @@ public: bool runScript(const std::string& script, ScriptCallback callback = ScriptCallback()); bool runScriptFile(const std::filesystem::path& filename); - bool writeLog(const std::string& script); - virtual void preSync(bool isMaster) override; virtual void encode(SyncBuffer* syncBuffer) override; virtual void decode(SyncBuffer* syncBuffer) override; @@ -102,13 +100,14 @@ public: private: BooleanType(Replace); + void writeLog(const std::string& script); + bool registerLuaLibrary(lua_State* state, LuaLibrary& library); void addLibraryFunctions(lua_State* state, LuaLibrary& library, Replace replace); bool isLibraryNameAllowed(lua_State* state, const std::string& name); void addBaseLibrary(); - void remapPrintFunction(); ghoul::lua::LuaState _state; std::vector _registeredLibraries; diff --git a/include/openspace/util/timemanager.h b/include/openspace/util/timemanager.h index 4bca989b82..a61d2d891d 100644 --- a/include/openspace/util/timemanager.h +++ b/include/openspace/util/timemanager.h @@ -59,7 +59,7 @@ public: const Time& integrateFromTime() const; const Timeline& timeline() const; - std::vector getSyncables(); + std::vector syncables(); void preSynchronization(double dt); TimeKeyframeData interpolate(double applicationTime); diff --git a/modules/base/dashboard/dashboarditempropertyvalue.cpp b/modules/base/dashboard/dashboarditempropertyvalue.cpp index 281b700eee..69d781d0eb 100644 --- a/modules/base/dashboard/dashboarditempropertyvalue.cpp +++ b/modules/base/dashboard/dashboarditempropertyvalue.cpp @@ -93,9 +93,7 @@ void DashboardItemPropertyValue::render(glm::vec2& penPosition) { } if (_property) { - std::string value; - _property->getStringValue(value); - + std::string value = _property->stringValue(); RenderFont( *_font, penPosition, diff --git a/modules/base/lightsource/scenegraphlightsource.cpp b/modules/base/lightsource/scenegraphlightsource.cpp index a4f41729b3..3365c2a4ee 100644 --- a/modules/base/lightsource/scenegraphlightsource.cpp +++ b/modules/base/lightsource/scenegraphlightsource.cpp @@ -67,20 +67,6 @@ SceneGraphLightSource::SceneGraphLightSource() , _sceneGraphNodeReference(NodeInfo, "") { addProperty(_intensity); - addProperty(_sceneGraphNodeReference); -} - -SceneGraphLightSource::SceneGraphLightSource(const ghoul::Dictionary& dictionary) - : LightSource(dictionary) - , _intensity(IntensityInfo, 1.f, 0.f, 1.f) - , _sceneGraphNodeReference(NodeInfo, "") -{ - const Parameters p = codegen::bake(dictionary); - - _intensity = p.intensity.value_or(_intensity); - addProperty(_intensity); - - _sceneGraphNodeReference = p.node; _sceneGraphNodeReference.onChange([this]() { _sceneGraphNode = global::renderEngine->scene()->sceneGraphNode(_sceneGraphNodeReference); @@ -88,6 +74,14 @@ SceneGraphLightSource::SceneGraphLightSource(const ghoul::Dictionary& dictionary addProperty(_sceneGraphNodeReference); } +SceneGraphLightSource::SceneGraphLightSource(const ghoul::Dictionary& dictionary) + : SceneGraphLightSource() +{ + const Parameters p = codegen::bake(dictionary); + _intensity = p.intensity.value_or(_intensity); + _sceneGraphNodeReference = p.node; +} + bool SceneGraphLightSource::initialize() { ZoneScoped diff --git a/modules/base/rendering/screenspaceframebuffer.cpp b/modules/base/rendering/screenspaceframebuffer.cpp index 17b7f0d869..f371e4cfa5 100644 --- a/modules/base/rendering/screenspaceframebuffer.cpp +++ b/modules/base/rendering/screenspaceframebuffer.cpp @@ -83,7 +83,7 @@ ScreenSpaceFramebuffer::ScreenSpaceFramebuffer(const ghoul::Dictionary& dictiona _size.set(glm::vec4(0.f, 0.f, resolution.x, resolution.y)); } -ScreenSpaceFramebuffer::~ScreenSpaceFramebuffer() {} // NOLINT +ScreenSpaceFramebuffer::~ScreenSpaceFramebuffer() {} bool ScreenSpaceFramebuffer::initializeGL() { ScreenSpaceRenderable::initializeGL(); diff --git a/modules/base/rendering/screenspaceimageonline.cpp b/modules/base/rendering/screenspaceimageonline.cpp index afc25f1ba3..b4ee5cc725 100644 --- a/modules/base/rendering/screenspaceimageonline.cpp +++ b/modules/base/rendering/screenspaceimageonline.cpp @@ -83,7 +83,7 @@ ScreenSpaceImageOnline::ScreenSpaceImageOnline(const ghoul::Dictionary& dictiona addProperty(_texturePath); } -ScreenSpaceImageOnline::~ScreenSpaceImageOnline() {} // NOLINT +ScreenSpaceImageOnline::~ScreenSpaceImageOnline() {} bool ScreenSpaceImageOnline::deinitializeGL() { _texture = nullptr; diff --git a/modules/globebrowsing/src/ringscomponent.cpp b/modules/globebrowsing/src/ringscomponent.cpp index 1093d89cb4..8953889000 100644 --- a/modules/globebrowsing/src/ringscomponent.cpp +++ b/modules/globebrowsing/src/ringscomponent.cpp @@ -814,7 +814,7 @@ void RingsComponent::createPlane() { GL_FLOAT, GL_FALSE, sizeof(VertexData), - reinterpret_cast(offsetof(VertexData, s)) // NOLINT + reinterpret_cast(offsetof(VertexData, s)) ); } diff --git a/modules/globebrowsing/src/tileprovider/imagesequencetileprovider.cpp b/modules/globebrowsing/src/tileprovider/imagesequencetileprovider.cpp index b0b1423be5..d227f2a31c 100644 --- a/modules/globebrowsing/src/tileprovider/imagesequencetileprovider.cpp +++ b/modules/globebrowsing/src/tileprovider/imagesequencetileprovider.cpp @@ -140,6 +140,7 @@ void ImageSequenceTileProvider::reset() { _imagePaths.push_back(p.path()); } } + std::sort(_imagePaths.begin(), _imagePaths.end()); _index = 0; _index.setMaxValue(static_cast(_imagePaths.size() - 1)); diff --git a/modules/imgui/src/guipropertycomponent.cpp b/modules/imgui/src/guipropertycomponent.cpp index c4454cb2f9..f3fe2cffef 100644 --- a/modules/imgui/src/guipropertycomponent.cpp +++ b/modules/imgui/src/guipropertycomponent.cpp @@ -497,7 +497,7 @@ void GuiPropertyComponent::renderProperty(properties::Property* prop, const auto v = static_cast>(visibilityFilter); const auto propV = static_cast>(prop->visibility()); if (v >= propV) { - auto it = FunctionMapping.find(prop->className()); + auto it = FunctionMapping.find(std::string(prop->className())); if (it != FunctionMapping.end()) { if (owner) { it->second( diff --git a/modules/imgui/src/renderproperties.cpp b/modules/imgui/src/renderproperties.cpp index 53193a5764..d17af16953 100644 --- a/modules/imgui/src/renderproperties.cpp +++ b/modules/imgui/src/renderproperties.cpp @@ -282,9 +282,7 @@ void renderDoubleListProperty(Property* prop, const std::string& ownerName, const std::string& name = p->guiName(); ImGui::PushID((ownerName + '.' + name).c_str()); - std::string value; - p->getStringValue(value); - + std::string value = p->stringValue(); renderListProperty(name, p->fullyQualifiedIdentifier(), value); if (showTooltip) { @@ -302,9 +300,7 @@ void renderIntListProperty(Property* prop, const std::string& ownerName, const std::string& name = p->guiName(); ImGui::PushID((ownerName + '.' + name).c_str()); - std::string value; - p->getStringValue(value); - + std::string value = p->stringValue(); renderListProperty(name, p->fullyQualifiedIdentifier(), value); if (showTooltip) { @@ -322,9 +318,7 @@ void renderStringListProperty(Property* prop, const std::string& ownerName, const std::string& name = p->guiName(); ImGui::PushID((ownerName + '.' + name).c_str()); - std::string value; - p->getStringValue(value); - + std::string value = p->stringValue(); renderListProperty(name, p->fullyQualifiedIdentifier(), value); if (showTooltip) { diff --git a/modules/server/src/jsonconverters.cpp b/modules/server/src/jsonconverters.cpp index 248968d834..17427313c6 100644 --- a/modules/server/src/jsonconverters.cpp +++ b/modules/server/src/jsonconverters.cpp @@ -34,7 +34,7 @@ using json = nlohmann::json; namespace openspace::properties { void to_json(json& j, const Property& p) { - std::string description = p.generateBaseJsonDescription(); + std::string description = p.generateJsonDescription(); json desc = json::parse(description); std::string value = p.jsonValue(); diff --git a/modules/space/rendering/renderablerings.cpp b/modules/space/rendering/renderablerings.cpp index db847fc948..bdf2ad1db9 100644 --- a/modules/space/rendering/renderablerings.cpp +++ b/modules/space/rendering/renderablerings.cpp @@ -301,7 +301,7 @@ void RenderableRings::createPlane() { GL_FLOAT, GL_FALSE, sizeof(VertexData), - reinterpret_cast(offsetof(VertexData, s)) // NOLINT + reinterpret_cast(offsetof(VertexData, s)) ); } diff --git a/modules/space/rendering/renderablestars.cpp b/modules/space/rendering/renderablestars.cpp index 48a0bc7602..60fb29ead1 100644 --- a/modules/space/rendering/renderablestars.cpp +++ b/modules/space/rendering/renderablestars.cpp @@ -1203,7 +1203,7 @@ void RenderableStars::update(const UpdateData&) { GL_FLOAT, GL_TRUE, stride, - reinterpret_cast(offsetof(VelocityVBOLayout, vx)) // NOLINT + reinterpret_cast(offsetof(VelocityVBOLayout, vx)) ); break; @@ -1255,7 +1255,7 @@ void RenderableStars::update(const UpdateData&) { GL_FLOAT, GL_FALSE, stride, - reinterpret_cast(offsetof(OtherDataLayout, value)) // NOLINT + reinterpret_cast(offsetof(OtherDataLayout, value)) ); } } diff --git a/modules/spacecraftinstruments/rendering/renderablemodelprojection.cpp b/modules/spacecraftinstruments/rendering/renderablemodelprojection.cpp index 7b98035fa2..132d3d491b 100644 --- a/modules/spacecraftinstruments/rendering/renderablemodelprojection.cpp +++ b/modules/spacecraftinstruments/rendering/renderablemodelprojection.cpp @@ -112,7 +112,7 @@ RenderableModelProjection::RenderableModelProjection(const ghoul::Dictionary& di addProperty(_performShading); } -RenderableModelProjection::~RenderableModelProjection() {} // NOLINT +RenderableModelProjection::~RenderableModelProjection() {} bool RenderableModelProjection::isReady() const { return (_programObject != nullptr) && _projectionComponent.isReady(); diff --git a/modules/spacecraftinstruments/rendering/renderableplaneprojection.cpp b/modules/spacecraftinstruments/rendering/renderableplaneprojection.cpp index 0a216914d2..b585b70fbf 100644 --- a/modules/spacecraftinstruments/rendering/renderableplaneprojection.cpp +++ b/modules/spacecraftinstruments/rendering/renderableplaneprojection.cpp @@ -82,7 +82,7 @@ RenderablePlaneProjection::RenderablePlaneProjection(const ghoul::Dictionary& di } } -RenderablePlaneProjection::~RenderablePlaneProjection() {} // NOLINT +RenderablePlaneProjection::~RenderablePlaneProjection() {} bool RenderablePlaneProjection::isReady() const { return _shader && _texture; diff --git a/modules/spacecraftinstruments/rendering/renderableplanetprojection.cpp b/modules/spacecraftinstruments/rendering/renderableplanetprojection.cpp index 6431461397..c2e725a3f2 100644 --- a/modules/spacecraftinstruments/rendering/renderableplanetprojection.cpp +++ b/modules/spacecraftinstruments/rendering/renderableplanetprojection.cpp @@ -299,7 +299,7 @@ RenderablePlanetProjection::RenderablePlanetProjection(const ghoul::Dictionary& addProperty(_segments); } -RenderablePlanetProjection::~RenderablePlanetProjection() {} // NOLINT +RenderablePlanetProjection::~RenderablePlanetProjection() {} void RenderablePlanetProjection::initializeGL() { _programObject = SpacecraftInstrumentsModule::ProgramObjectManager.request( diff --git a/modules/touch/src/touchmarker.cpp b/modules/touch/src/touchmarker.cpp index 7348129b7f..22fe8ff506 100644 --- a/modules/touch/src/touchmarker.cpp +++ b/modules/touch/src/touchmarker.cpp @@ -83,7 +83,7 @@ TouchMarker::TouchMarker() addProperty(_color); } -TouchMarker::~TouchMarker() {} // NOLINT +TouchMarker::~TouchMarker() {} void TouchMarker::initialize() { glGenVertexArrays(1, &_quad); // generate array diff --git a/modules/volume/transferfunctionproperty.cpp b/modules/volume/transferfunctionproperty.cpp index ac7c17ae13..ee54b0ab64 100644 --- a/modules/volume/transferfunctionproperty.cpp +++ b/modules/volume/transferfunctionproperty.cpp @@ -32,7 +32,7 @@ TransferFunctionProperty::TransferFunctionProperty(Property::PropertyInfo info, : TemplateProperty(std::move(info), value) {} -std::string TransferFunctionProperty::className() const { +std::string_view TransferFunctionProperty::className() const { return "TransferFunctionProperty"; } diff --git a/modules/volume/transferfunctionproperty.h b/modules/volume/transferfunctionproperty.h index 03d39f4365..642e2cf7e3 100644 --- a/modules/volume/transferfunctionproperty.h +++ b/modules/volume/transferfunctionproperty.h @@ -35,7 +35,7 @@ public: TransferFunctionProperty(Property::PropertyInfo info, volume::TransferFunction value = volume::TransferFunction()); - std::string className() const override; + std::string_view className() const override; int typeLua() const override; using TemplateProperty::operator=; diff --git a/src/camera/camera.cpp b/src/camera/camera.cpp index 8f3f944263..d9120431e4 100644 --- a/src/camera/camera.cpp +++ b/src/camera/camera.cpp @@ -288,7 +288,7 @@ const glm::mat4& Camera::viewProjectionMatrix() const { return sgctInternal.viewProjectionMatrix(); } -std::vector Camera::getSyncables() { +std::vector Camera::syncables() { return { &_position, &_rotation, &_scaling }; } diff --git a/src/engine/downloadmanager.cpp b/src/engine/downloadmanager.cpp index 7b57907d13..c37e260277 100644 --- a/src/engine/downloadmanager.cpp +++ b/src/engine/downloadmanager.cpp @@ -159,16 +159,16 @@ std::shared_ptr DownloadManager::downloadFile( { CURL* curl = curl_easy_init(); if (curl) { - curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); // NOLINT - curl_easy_setopt(curl, CURLOPT_USERAGENT, "OpenSpace"); // NOLINT - curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); // NOLINT - curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp); // NOLINT - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &writeData); // NOLINT + curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); + curl_easy_setopt(curl, CURLOPT_USERAGENT, "OpenSpace"); + curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &writeData); if (timeout_secs) { - curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout_secs); // NOLINT + curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout_secs); } if (failOnError) { - curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L); // NOLINT + curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L); } ProgressInformation p = { @@ -179,10 +179,10 @@ std::shared_ptr DownloadManager::downloadFile( #if LIBCURL_VERSION_NUM >= 0x072000 // xferinfo was introduced in 7.32.0, if a lower curl version is used the // progress will not be shown for downloads on the splash screen - curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, xferinfo); // NOLINT - curl_easy_setopt(curl, CURLOPT_XFERINFODATA, &p); // NOLINT + curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, xferinfo); + curl_easy_setopt(curl, CURLOPT_XFERINFODATA, &p); #endif - curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L); // NOLINT + curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L); CURLcode res = curl_easy_perform(curl); curl_easy_cleanup(curl); @@ -242,22 +242,22 @@ std::future DownloadManager::fetchFile( throw ghoul::RuntimeError("Error initializing cURL"); } - curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); // NOLINT - curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); // NOLINT - curl_easy_setopt(curl, CURLOPT_USERAGENT, "OpenSpace"); // NOLINT + curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); + curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); + curl_easy_setopt(curl, CURLOPT_USERAGENT, "OpenSpace"); curl_easy_setopt(curl, CURLOPT_WRITEDATA, reinterpret_cast(&file)); - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writeMemoryCallback); // NOLINT - curl_easy_setopt(curl, CURLOPT_TIMEOUT, 5L); // NOLINT - curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false); // NOLINT + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writeMemoryCallback); + curl_easy_setopt(curl, CURLOPT_TIMEOUT, 5L); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false); // Will fail when response status is 400 or above - curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L); // NOLINT + curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L); CURLcode res = curl_easy_perform(curl); if (res == CURLE_OK) { // ask for the content-type char* ct; - res = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct); // NOLINT + res = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct); if (res == CURLE_OK) { std::string extension = std::string(ct); std::stringstream ss(extension); @@ -299,14 +299,14 @@ void DownloadManager::getFileExtension(const std::string& url, auto requestFunction = [url, finishedCb = std::move(finishedCallback)]() { CURL* curl = curl_easy_init(); if (curl) { - curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); // NOLINT + curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); //USING CURLOPT NOBODY - curl_easy_setopt(curl, CURLOPT_NOBODY, 1); // NOLINT + curl_easy_setopt(curl, CURLOPT_NOBODY, 1); CURLcode res = curl_easy_perform(curl); if (CURLE_OK == res) { char* ct; // ask for the content-type - res = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct); // NOLINT + res = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct); if ((res == CURLE_OK) && ct && finishedCb) { finishedCb(std::string(ct)); } diff --git a/src/engine/globals.cpp b/src/engine/globals.cpp index ddd1b0777f..8f897cafe6 100644 --- a/src/engine/globals.cpp +++ b/src/engine/globals.cpp @@ -637,7 +637,7 @@ void deinitialize() { ssr->deinitialize(); } - syncEngine->removeSyncables(timeManager->getSyncables()); + syncEngine->removeSyncables(timeManager->syncables()); moduleEngine->deinitialize(); luaConsole->deinitialize(); diff --git a/src/engine/moduleengine.cpp b/src/engine/moduleengine.cpp index 47f733b0a1..4c9da424d5 100644 --- a/src/engine/moduleengine.cpp +++ b/src/engine/moduleengine.cpp @@ -92,7 +92,6 @@ void ModuleEngine::initialize( } addPropertySubOwner(m); - } } @@ -153,12 +152,11 @@ void ModuleEngine::registerModule(std::unique_ptr mod) { ); if (it != _modules.end()) { throw ghoul::RuntimeError( - "Module name '" + mod->identifier() + "' was registered before", + fmt::format("Module name '{}' was registered before", mod->identifier()), "ModuleEngine" ); } - LDEBUG(fmt::format("Registering module '{}'", mod->identifier())); LDEBUG(fmt::format("Registered module '{}'", mod->identifier())); _modules.push_back(std::move(mod)); } diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index 5ebce6a3cf..9a12a4d31e 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -45,30 +45,22 @@ #include #include #include -#include #include #include #include -#include #include #include #include #include #include #include -#include -#include -#include -#include #include -#include #include #include #include #include #include #include -#include #include #include #include @@ -154,16 +146,6 @@ OpenSpaceEngine::OpenSpaceEngine() , _showHiddenSceneGraphNodes(ShowHiddenSceneInfo, false) { FactoryManager::initialize(); - FactoryManager::ref().addFactory("Renderable"); - FactoryManager::ref().addFactory("Translation"); - FactoryManager::ref().addFactory("Rotation"); - FactoryManager::ref().addFactory("Scale"); - FactoryManager::ref().addFactory("TimeFrame"); - FactoryManager::ref().addFactory("LightSource"); - FactoryManager::ref().addFactory("Task"); - FactoryManager::ref().addFactory("ResourceSynchronization"); - FactoryManager::ref().addFactory("DashboardItem"); - SpiceManager::initialize(); TransformationManager::initialize(); @@ -181,7 +163,7 @@ OpenSpaceEngine::OpenSpaceEngine() }); } -OpenSpaceEngine::~OpenSpaceEngine() {} // NOLINT +OpenSpaceEngine::~OpenSpaceEngine() {} void OpenSpaceEngine::registerPathTokens() { LTRACE("OpenSpaceEngine::initialize(begin)"); @@ -225,13 +207,7 @@ void OpenSpaceEngine::initialize() { std::string cacheFolder = absPath("${CACHE}").string(); if (global::configuration->usePerProfileCache) { - std::string profile = global::configuration->profile; - if (profile.empty()) { - throw ghoul::RuntimeError( - "Unexpected error: Configuration file profile was empty" - ); - } - cacheFolder = cacheFolder + "-" + profile; + cacheFolder = cacheFolder + "-" + global::configuration->profile; LINFO(fmt::format("Old cache: {}", absPath("${CACHE}"))); LINFO(fmt::format("New cache: {}", cacheFolder)); @@ -244,7 +220,7 @@ void OpenSpaceEngine::initialize() { // Create directories that doesn't exist for (const std::string& token : FileSys.tokens()) { - if (!std::filesystem::is_directory(token)) { + if (!std::filesystem::is_directory(absPath(token))) { std::filesystem::create_directories(absPath(token)); } } @@ -329,63 +305,58 @@ void OpenSpaceEngine::initialize() { LDEBUG("Registering Lua libraries"); registerCoreClasses(*global::scriptEngine); - // Process profile file (must be provided in configuration file) - if (!global::configuration->profile.empty()) { - std::filesystem::path profile; - if (!std::filesystem::is_regular_file(global::configuration->profile)) { - std::filesystem::path userCandidate = absPath(fmt::format( - "${{USER_PROFILES}}/{}.profile", global::configuration->profile - )); - std::filesystem::path profileCandidate = absPath(fmt::format( - "${{PROFILES}}/{}.profile", global::configuration->profile - )); + // Process profile file + std::filesystem::path profile; + if (!std::filesystem::is_regular_file(global::configuration->profile)) { + std::filesystem::path userCandidate = absPath(fmt::format( + "${{USER_PROFILES}}/{}.profile", global::configuration->profile + )); + std::filesystem::path profileCandidate = absPath(fmt::format( + "${{PROFILES}}/{}.profile", global::configuration->profile + )); - // Give the user profile priority if there are both - if (std::filesystem::is_regular_file(userCandidate)) { - profile = userCandidate; - } - else if (std::filesystem::is_regular_file(profileCandidate)) { - profile = profileCandidate; - } - else { - throw ghoul::RuntimeError(fmt::format( - "Could not load profile '{}': File does not exist", - global::configuration->profile - )); - } + // Give the user profile priority if there are both + if (std::filesystem::is_regular_file(userCandidate)) { + profile = userCandidate; + } + else if (std::filesystem::is_regular_file(profileCandidate)) { + profile = profileCandidate; } else { - profile = global::configuration->profile; - } - - // Load the profile - std::ifstream inFile; - try { - inFile.open(profile, std::ifstream::in); - } - catch (const std::ifstream::failure& e) { throw ghoul::RuntimeError(fmt::format( - "Exception opening profile file for read: {} ({})", - profile, e.what()) - ); + "Could not load profile '{}': File does not exist", + global::configuration->profile + )); } - - std::string content( - (std::istreambuf_iterator(inFile)), - std::istreambuf_iterator() - ); - *global::profile = Profile(content); + } + else { + profile = global::configuration->profile; } + // Load the profile + std::ifstream inFile; + try { + inFile.open(profile, std::ifstream::in); + } + catch (const std::ifstream::failure& e) { + throw ghoul::RuntimeError(fmt::format( + "Exception opening profile file for read: {} ({})", profile, e.what() + )); + } + + std::string content( + (std::istreambuf_iterator(inFile)), + std::istreambuf_iterator() + ); + *global::profile = Profile(content); + // Set up asset loader - global::openSpaceEngine->_assetManager = std::make_unique( + _assetManager = std::make_unique( global::scriptEngine->luaState(), - absPath("${ASSETS}").string() + absPath("${ASSETS}") ); - global::scriptEngine->addLibrary( - global::openSpaceEngine->_assetManager->luaLibrary() - ); + global::scriptEngine->addLibrary(_assetManager->luaLibrary()); for (OpenSpaceModule* module : global::moduleEngine->modules()) { global::scriptEngine->addLibrary(module->luaLibrary()); @@ -397,12 +368,6 @@ void OpenSpaceEngine::initialize() { global::scriptEngine->initialize(); - // To be concluded - _documentationJson.clear(); - _documentationJson += "{\"documentation\":["; - - writeStaticDocumentation(); - _shutdown.waitTime = global::configuration->shutdownCountdown; global::navigationHandler->initialize(); @@ -418,27 +383,6 @@ void OpenSpaceEngine::initialize() { LTRACE("OpenSpaceEngine::initialize(end)"); } -std::string OpenSpaceEngine::generateFilePath(std::string openspaceRelativePath) { - // @TODO (abock, 2021-05-16) This whole function can die, I think - std::string path = absPath(openspaceRelativePath).string(); - // Needs to handle either windows (which seems to require double back-slashes) - // or unix path slashes. - const std::string search = "\\"; - const std::string replace = "\\\\"; - if (path.find(search) != std::string::npos) { - size_t start_pos = 0; - while ((start_pos = path.find(search, start_pos)) != std::string::npos) { - path.replace(start_pos, search.length(), replace); - start_pos += replace.length(); - } - path.append(replace); - } - else { - path.append("/"); - } - return path.append(global::configuration->profile); -} - void OpenSpaceEngine::initializeGL() { ZoneScoped @@ -545,7 +489,7 @@ void OpenSpaceEngine::initializeGL() { bool synchronous = global::configuration->openGLDebugContext.isSynchronous; setDebugOutput(DebugOutput(debugActive), SynchronousOutput(synchronous)); - for (const configuration::Configuration::OpenGLDebugContext::IdentifierFilter&f : + for (const configuration::Configuration::OpenGLDebugContext::IdentifierFilter& f : global::configuration->openGLDebugContext.identifierFilters) { setDebugMessageControl( @@ -569,13 +513,12 @@ void OpenSpaceEngine::initializeGL() { } auto callback = [](Source source, Type type, Severity severity, - unsigned int id, std::string message) -> void + unsigned int id, std::string message) -> void { const std::string s = ghoul::to_string(source); const std::string t = ghoul::to_string(type); - const std::string category = - "OpenGL (" + s + ") [" + t + "] {" + std::to_string(id) + "}"; + const std::string category = fmt::format("OpenGL ({}) [{}] {{{}}}", s, t, id); switch (severity) { case Severity::High: LERRORC(category, message); @@ -669,7 +612,8 @@ void OpenSpaceEngine::initializeGL() { if (lvl > LogLevel::Trace) { LWARNING( "Logging OpenGL calls is enabled, but the selected log level does " - "not include TRACE, so no OpenGL logs will be printed"); + "not include TRACE, so no OpenGL logs will be printed" + ); } else { using namespace glbinding; @@ -735,9 +679,9 @@ void OpenSpaceEngine::loadAssets() { if (_scene) { ZoneScopedN("Reset scene") - global::syncEngine->removeSyncables(global::timeManager->getSyncables()); + global::syncEngine->removeSyncables(global::timeManager->syncables()); if (_scene && _scene->camera()) { - global::syncEngine->removeSyncables(_scene->camera()->getSyncables()); + global::syncEngine->removeSyncables(_scene->camera()->syncables()); } global::renderEngine->setScene(nullptr); global::renderEngine->setCamera(nullptr); @@ -761,12 +705,9 @@ void OpenSpaceEngine::loadAssets() { _scene = std::make_unique(std::move(sceneInitializer)); global::renderEngine->setScene(_scene.get()); - global::rootPropertyOwner->addPropertySubOwner(_scene.get()); - _scene->setCamera(std::make_unique()); - Camera* camera = _scene->camera(); - camera->setParent(_scene->root()); + Camera* camera = _scene->camera(); global::renderEngine->setCamera(camera); global::navigationHandler->setCamera(camera); const SceneGraphNode* parent = camera->parent(); @@ -917,9 +858,9 @@ void OpenSpaceEngine::loadAssets() { global::renderEngine->updateScene(); - global::syncEngine->addSyncables(global::timeManager->getSyncables()); + global::syncEngine->addSyncables(global::timeManager->syncables()); if (_scene && _scene->camera()) { - global::syncEngine->addSyncables(_scene->camera()->getSyncables()); + global::syncEngine->addSyncables(_scene->camera()->syncables()); } #ifdef __APPLE__ @@ -928,7 +869,7 @@ void OpenSpaceEngine::loadAssets() { runGlobalCustomizationScripts(); - _writeDocumentationTask = std::async(&OpenSpaceEngine::writeSceneDocumentation, this); + _writeDocumentationTask = std::async(&OpenSpaceEngine::writeDocumentation, this); LTRACE("OpenSpaceEngine::loadAsset(end)"); } @@ -950,7 +891,7 @@ void OpenSpaceEngine::deinitialize() { } if (global::renderEngine->scene() && global::renderEngine->scene()->camera()) { global::syncEngine->removeSyncables( - global::renderEngine->scene()->camera()->getSyncables() + global::renderEngine->scene()->camera()->syncables() ); } global::sessionRecording->deinitialize(); @@ -1003,31 +944,6 @@ void OpenSpaceEngine::deinitializeGL() { LTRACE("OpenSpaceEngine::deinitializeGL(end)"); } -void OpenSpaceEngine::writeStaticDocumentation() { - std::string path = global::configuration->documentation.path; - if (!path.empty()) { - - DocEng.addHandlebarTemplates(global::scriptEngine->templatesToRegister()); - DocEng.addHandlebarTemplates(FactoryManager::ref().templatesToRegister()); - DocEng.addHandlebarTemplates(DocEng.templatesToRegister()); - - _documentationJson += "{\"name\":\"Scripting\","; - _documentationJson += "\"identifier\":\"" + global::scriptEngine->jsonName(); - _documentationJson += "\",\"data\":" + global::scriptEngine->generateJson(); - _documentationJson += "},"; - - _documentationJson += "{\"name\":\"Top Level\","; - _documentationJson += "\"identifier\":\"" + DocEng.jsonName(); - _documentationJson += "\",\"data\":" + DocEng.generateJson(); - _documentationJson += "},"; - - _documentationJson += "{\"name\":\"Factory\","; - _documentationJson += "\"identifier\":\"" + FactoryManager::ref().jsonName(); - _documentationJson += "\",\"data\":" + FactoryManager::ref().generateJson(); - _documentationJson += "},"; - } -} - void OpenSpaceEngine::createUserDirectoriesIfNecessary() { LTRACE(absPath("${USER}").string()); @@ -1083,9 +999,7 @@ void OpenSpaceEngine::loadFonts() { bool success = global::fontManager->registerFontPath(key, fontName); if (!success) { - LERROR(fmt::format( - "Error registering font {} with key '{}'", fontName, key - )); + LERROR(fmt::format("Error registering font {} with key '{}'", fontName, key)); } } @@ -1097,61 +1011,83 @@ void OpenSpaceEngine::loadFonts() { } } -void OpenSpaceEngine::writeSceneDocumentation() { +void OpenSpaceEngine::writeDocumentation() { ZoneScoped // Write documentation to json files if config file supplies path for doc files - std::string path = global::configuration->documentation.path; - if (!path.empty()) { - std::future root = std::async( - &properties::PropertyOwner::generateJson, - global::rootPropertyOwner - ); - - std::future scene = std::async( - &properties::PropertyOwner::generateJson, - _scene.get() - ); - - - - path = absPath(path).string() + '/'; - _documentationJson += "{\"name\":\"Keybindings\",\"identifier\":\""; - _documentationJson += global::keybindingManager->jsonName() + "\","; - _documentationJson += "\"data\":"; - _documentationJson += global::keybindingManager->generateJson(); - _documentationJson += "},"; - _documentationJson += "{\"name\":\"Scene License Information\","; - _documentationJson += "\"identifier\":\"sceneLicense"; - _documentationJson += "\",\"data\":"; - _documentationJson += SceneLicenseWriter().generateJson(); - _documentationJson += "},"; - _documentationJson += "{\"name\":\"Scene Properties\","; - _documentationJson += "\"identifier\":\"propertylist";// + _scene->jsonName(); - _documentationJson += "\",\"data\":" + root.get(); - _documentationJson += "},"; - _documentationJson += "{\"name\":\"Scene Graph Information\","; - _documentationJson += "\"identifier\":\"propertylist"; - _documentationJson += "\",\"data\":" + scene.get(); - _documentationJson += "}"; - - //add templates for the jsons we just registered - DocEng.addHandlebarTemplates(global::keybindingManager->templatesToRegister()); - //TODO this is in efficaiant, here i am just instaning the class to get - //at a member variable which is staticly defined. How do i just get that - SceneLicenseWriter writer; - DocEng.addHandlebarTemplates(writer.templatesToRegister()); - DocEng.addHandlebarTemplates(global::rootPropertyOwner->templatesToRegister()); - - //the static documentation shoudl be finished already - //so now that we wrote the static and secene json files - //we should write the html file that uses them. - _documentationJson += "]}"; - - DocEng.writeDocumentationHtml(path, _documentationJson); + if (path.empty()) { + // if path was empty, that means that no documentation is requested + return; } - //no else, if path was empty, that means that no documentation is requested + path = absPath(path).string() + '/'; + + // Start the async requests as soon as possible so they are finished when we need them + std::future root = std::async( + &properties::PropertyOwner::generateJson, + global::rootPropertyOwner + ); + + std::future scene = std::async( + &properties::PropertyOwner::generateJson, + _scene.get() + ); + + + DocEng.addHandlebarTemplates(global::scriptEngine->templatesToRegister()); + DocEng.addHandlebarTemplates(FactoryManager::ref().templatesToRegister()); + DocEng.addHandlebarTemplates(DocEng.templatesToRegister()); + + std::string json = "{\"documentation\":["; + + json += fmt::format( + R"({{"name":"{}","identifier":"{}","data":{}}},)", + "Scripting", + global::scriptEngine->jsonName(), + global::scriptEngine->generateJson() + ); + + json += fmt::format( + R"({{"name":"{}","identifier":"{}","data":{}}},)", + "Top Level", DocEng.jsonName(), DocEng.generateJson() + ); + + json += fmt::format( + R"({{"name":"{}","identifier":"{}","data":{}}},)", + "Factory", FactoryManager::ref().jsonName(), FactoryManager::ref().generateJson() + ); + + json += fmt::format( + R"({{"name":"{}","identifier":"{}","data":{}}},)", + "Keybindings", + global::keybindingManager->jsonName(), + global::keybindingManager->generateJson() + ); + + SceneLicenseWriter writer; + json += fmt::format( + R"({{"name":"{}","identifier":"{}","data":{}}},)", + "Scene License Information", writer.jsonName(), writer.generateJson() + ); + + json += fmt::format( + R"({{"name":"{}","identifier":"{}","data":{}}},)", + "Scene Properties", "propertylist", root.get() + ); + + json += fmt::format( + R"({{"name":"{}","identifier":"{}","data":{}}})", + "Scene Graph Information", "propertylist", scene.get() + ); + + json += "]}"; + + // Add templates for the JSONs we just registered + DocEng.addHandlebarTemplates(global::keybindingManager->templatesToRegister()); + DocEng.addHandlebarTemplates(writer.templatesToRegister()); + DocEng.addHandlebarTemplates(global::rootPropertyOwner->templatesToRegister()); + + DocEng.writeDocumentationHtml(path, json); } void OpenSpaceEngine::preSynchronization() { @@ -1479,9 +1415,9 @@ void OpenSpaceEngine::mouseButtonCallback(MouseButton button, MouseAction action if (isConsumed) { // If the mouse was released, we still want to forward it to the navigation // handler in order to reliably terminate a rotation or zoom, or to the other - // callbacks to for example release a drag and drop of a UI window. Accidentally - // moving the cursor over a UI window is easy to miss and leads to weird - // continuing movement + // callbacks to for example release a drag and drop of a UI window. + // Accidentally moving the cursor over a UI window is easy to miss and leads + // to weird continuing movement if (action == MouseAction::Release) { continue; } @@ -1504,9 +1440,7 @@ void OpenSpaceEngine::mouseButtonCallback(MouseButton button, MouseAction action global::interactionMonitor->markInteraction(); } -void OpenSpaceEngine::mousePositionCallback(double x, double y, - IsGuiWindow isGuiWindow) -{ +void OpenSpaceEngine::mousePositionCallback(double x, double y, IsGuiWindow isGuiWindow) { ZoneScoped using F = global::callback::MousePositionCallback; @@ -1570,9 +1504,7 @@ void OpenSpaceEngine::touchExitCallback(TouchInput input) { } } -void OpenSpaceEngine::handleDragDrop(const std::string& file) { - std::filesystem::path f(file); - +void OpenSpaceEngine::handleDragDrop(std::filesystem::path file) { ghoul::lua::LuaState s(ghoul::lua::LuaState::IncludeStandardLibrary::Yes); std::filesystem::path absolutePath = absPath("${SCRIPTS}/drag_drop_handler.lua"); int status = luaL_loadfile(s, absolutePath.string().c_str()); @@ -1585,11 +1517,11 @@ void OpenSpaceEngine::handleDragDrop(const std::string& file) { ghoul::lua::push(s, file); lua_setglobal(s, "filename"); - std::string basename = f.filename().string(); + std::string basename = file.filename().string(); ghoul::lua::push(s, basename); lua_setglobal(s, "basename"); - std::string extension = f.extension().string(); + std::string extension = file.extension().string(); std::transform( extension.begin(), extension.end(), extension.begin(), @@ -1620,8 +1552,7 @@ void OpenSpaceEngine::handleDragDrop(const std::string& file) { std::vector OpenSpaceEngine::encode() { ZoneScoped - std::vector buffer = global::syncEngine->encodeSyncables(); - return buffer; + return global::syncEngine->encodeSyncables(); } void OpenSpaceEngine::decode(std::vector data) { @@ -1714,6 +1645,35 @@ void OpenSpaceEngine::removeModeChangeCallback(CallbackHandle handle) { _modeChangeCallbacks.erase(it); } +scripting::LuaLibrary OpenSpaceEngine::luaLibrary() { + return { + "", + { + codegen::lua::ToggleShutdown, + codegen::lua::WriteDocumentation, + codegen::lua::SetScreenshotFolder, + codegen::lua::AddTag, + codegen::lua::RemoveTag, + codegen::lua::DownloadFile, + codegen::lua::CreateSingleColorImage, + codegen::lua::IsMaster, + codegen::lua::Version + }, + { + absPath("${SCRIPTS}/core_scripts.lua") + } + }; +} + +LoadingScreen* OpenSpaceEngine::loadingScreen() { + return _loadingScreen.get(); +} + +AssetManager& OpenSpaceEngine::assetManager() { + ghoul_assert(_assetManager, "Asset Manager must not be nullptr"); + return *_assetManager; +} + void setCameraFromProfile(const Profile& p) { if (!p.camera.has_value()) { // If the camera is not specified, we want to set it to a sensible default value @@ -1751,10 +1711,10 @@ void setCameraFromProfile(const Profile& p) { global::navigationHandler->setNavigationStateNextFrame(nav); }, [](const Profile::CameraGoToGeo& geo) { - //Instead of direct calls to navigation state code, lua commands with - //globebrowsing goToGeo are used because this prevents a module - //dependency in this core code. Eventually, goToGeo will be incorporated - //in the OpenSpace core and this code will change. + // Instead of direct calls to navigation state code, lua commands with + // globebrowsing goToGeo are used because this prevents a module + // dependency in this core code. Eventually, goToGeo will be incorporated + // in the OpenSpace core and this code will change. std::string geoScript = fmt::format("openspace.globebrowsing.goToGeo" "([[{}]], {}, {}", geo.anchor, geo.latitude, geo.longitude); if (geo.altitude.has_value()) { @@ -1803,16 +1763,14 @@ void setActionsFromProfile(const Profile& p) { LERROR("Identifier must to provided to register action"); } if (global::actionManager->hasAction(a.identifier)) { - LERROR( - fmt::format("Action for identifier '{}' already existed & registered", - a.identifier) - ); + LERROR(fmt::format( + "Action for identifier '{}' already existed & registered", a.identifier + )); } if (a.script.empty()) { - LERROR( - fmt::format("Identifier '{}' doesn't provide a Lua command to execute", - a.identifier) - ); + LERROR(fmt::format( + "Identifier '{}' doesn't provide a Lua command to execute", a.identifier + )); } interaction::Action action; action.identifier = a.identifier; @@ -1834,12 +1792,10 @@ void setKeybindingsFromProfile(const Profile& p) { LERROR(fmt::format("Action '{}' does not exist", k.action)); } if (k.key.key == openspace::Key::Unknown) { - LERROR( - fmt::format( - "Could not find key '{}'", - std::to_string(static_cast(k.key.key)) - ) - ); + LERROR(fmt::format( + "Could not find key '{}'", + std::to_string(static_cast(k.key.key)) + )); } global::keybindingManager->bindKey(k.key.key, k.key.modifier, k.action); } @@ -1863,33 +1819,4 @@ void setAdditionalScriptsFromProfile(const Profile& p) { } } -scripting::LuaLibrary OpenSpaceEngine::luaLibrary() { - return { - "", - { - codegen::lua::ToggleShutdown, - codegen::lua::WriteDocumentation, - codegen::lua::SetScreenshotFolder, - codegen::lua::AddTag, - codegen::lua::RemoveTag, - codegen::lua::DownloadFile, - codegen::lua::CreateSingleColorImage, - codegen::lua::IsMaster, - codegen::lua::Version - }, - { - absPath("${SCRIPTS}/core_scripts.lua") - } - }; -} - -LoadingScreen* OpenSpaceEngine::loadingScreen() { - return _loadingScreen.get(); -} - -AssetManager& OpenSpaceEngine::assetManager() { - ghoul_assert(_assetManager, "Asset Manager must not be nullptr"); - return *_assetManager; -} - } // namespace openspace diff --git a/src/engine/openspaceengine_lua.inl b/src/engine/openspaceengine_lua.inl index d7f028ba22..008d9eded7 100644 --- a/src/engine/openspaceengine_lua.inl +++ b/src/engine/openspaceengine_lua.inl @@ -38,8 +38,7 @@ namespace { * Writes out documentation files */ [[codegen::luawrap]] void writeDocumentation() { - openspace::global::openSpaceEngine->writeStaticDocumentation(); - openspace::global::openSpaceEngine->writeSceneDocumentation(); + openspace::global::openSpaceEngine->writeDocumentation(); } // Sets the folder used for storing screenshots or session recording frames diff --git a/src/interaction/sessionrecording.cpp b/src/interaction/sessionrecording.cpp index 365fd801f4..e6a665b1eb 100644 --- a/src/interaction/sessionrecording.cpp +++ b/src/interaction/sessionrecording.cpp @@ -107,7 +107,7 @@ SessionRecording::SessionRecording(bool isGlobal) } } -SessionRecording::~SessionRecording() { // NOLINT +SessionRecording::~SessionRecording() { } void SessionRecording::deinitialize() { @@ -955,7 +955,7 @@ void SessionRecording::savePropertyBaseline(properties::Property& prop) { if (!isPropAlreadySaved) { std::string initialScriptCommand = fmt::format( "openspace.setPropertyValueSingle(\"{}\", {})", - propIdentifier, prop.getStringValue() + propIdentifier, prop.stringValue() ); saveScriptKeyframeToPropertiesBaseline(initialScriptCommand); _propertyBaselinesSaved.push_back(propIdentifier); diff --git a/src/navigation/navigationhandler.cpp b/src/navigation/navigationhandler.cpp index 27ca0633ce..adccd599a4 100644 --- a/src/navigation/navigationhandler.cpp +++ b/src/navigation/navigationhandler.cpp @@ -104,7 +104,7 @@ NavigationHandler::NavigationHandler() addProperty(_useKeyFrameInteraction); } -NavigationHandler::~NavigationHandler() {} // NOLINT +NavigationHandler::~NavigationHandler() {} void NavigationHandler::initialize() { ZoneScoped diff --git a/src/navigation/pathnavigator.cpp b/src/navigation/pathnavigator.cpp index 0caefdbfd4..eac2e4631b 100644 --- a/src/navigation/pathnavigator.cpp +++ b/src/navigation/pathnavigator.cpp @@ -157,7 +157,7 @@ PathNavigator::PathNavigator() addProperty(_relevantNodeTags); } -PathNavigator::~PathNavigator() {} // NOLINT +PathNavigator::~PathNavigator() {} Camera* PathNavigator::camera() const { return global::navigationHandler->camera(); diff --git a/src/properties/list/doublelistproperty.cpp b/src/properties/list/doublelistproperty.cpp index 58360f9317..9e3c69a704 100644 --- a/src/properties/list/doublelistproperty.cpp +++ b/src/properties/list/doublelistproperty.cpp @@ -37,7 +37,7 @@ DoubleListProperty::DoubleListProperty(Property::PropertyInfo info, : ListProperty(std::move(info), std::move(values)) {} -std::string DoubleListProperty::className() const { +std::string_view DoubleListProperty::className() const { return "DoubleListProperty"; } diff --git a/src/properties/list/intlistproperty.cpp b/src/properties/list/intlistproperty.cpp index 56b83a09f7..ff65d8ff5f 100644 --- a/src/properties/list/intlistproperty.cpp +++ b/src/properties/list/intlistproperty.cpp @@ -36,7 +36,7 @@ IntListProperty::IntListProperty(Property::PropertyInfo info, std::vector v : ListProperty(std::move(info), std::move(values)) {} -std::string IntListProperty::className() const { +std::string_view IntListProperty::className() const { return "IntListProperty"; } diff --git a/src/properties/list/stringlistproperty.cpp b/src/properties/list/stringlistproperty.cpp index 844760f90a..86ebb1b8ca 100644 --- a/src/properties/list/stringlistproperty.cpp +++ b/src/properties/list/stringlistproperty.cpp @@ -37,7 +37,7 @@ StringListProperty::StringListProperty(Property::PropertyInfo info, : ListProperty(std::move(info), std::move(values)) {} -std::string StringListProperty::className() const { +std::string_view StringListProperty::className() const { return "StringListProperty"; } diff --git a/src/properties/matrix/dmat2property.cpp b/src/properties/matrix/dmat2property.cpp index 0eb881aaf5..01d2596072 100644 --- a/src/properties/matrix/dmat2property.cpp +++ b/src/properties/matrix/dmat2property.cpp @@ -41,7 +41,7 @@ DMat2Property::DMat2Property(Property::PropertyInfo info, glm::dmat2x2 value, ) {} -std::string DMat2Property::className() const { +std::string_view DMat2Property::className() const { return "DMat2Property"; } diff --git a/src/properties/matrix/dmat3property.cpp b/src/properties/matrix/dmat3property.cpp index 6810a1a1a3..845a7bc8b9 100644 --- a/src/properties/matrix/dmat3property.cpp +++ b/src/properties/matrix/dmat3property.cpp @@ -41,7 +41,7 @@ DMat3Property::DMat3Property(Property::PropertyInfo info, glm::dmat3x3 value, ) {} -std::string DMat3Property::className() const { +std::string_view DMat3Property::className() const { return "DMat3Property"; } diff --git a/src/properties/matrix/dmat4property.cpp b/src/properties/matrix/dmat4property.cpp index b7a6de4f5e..ad4de4acdc 100644 --- a/src/properties/matrix/dmat4property.cpp +++ b/src/properties/matrix/dmat4property.cpp @@ -41,7 +41,7 @@ DMat4Property::DMat4Property(Property::PropertyInfo info, glm::dmat4x4 value, ) {} -std::string DMat4Property::className() const { +std::string_view DMat4Property::className() const { return "DMat4Property"; } diff --git a/src/properties/matrix/mat2property.cpp b/src/properties/matrix/mat2property.cpp index 8a1c2a3700..76b96d4a78 100644 --- a/src/properties/matrix/mat2property.cpp +++ b/src/properties/matrix/mat2property.cpp @@ -41,7 +41,7 @@ Mat2Property::Mat2Property(Property::PropertyInfo info, glm::mat2x2 value, ) {} -std::string Mat2Property::className() const { +std::string_view Mat2Property::className() const { return "Mat2Property"; } diff --git a/src/properties/matrix/mat3property.cpp b/src/properties/matrix/mat3property.cpp index b9b251dc77..178a3ec8fa 100644 --- a/src/properties/matrix/mat3property.cpp +++ b/src/properties/matrix/mat3property.cpp @@ -41,7 +41,7 @@ Mat3Property::Mat3Property(Property::PropertyInfo info, glm::mat3x3 value, ) {} -std::string Mat3Property::className() const { +std::string_view Mat3Property::className() const { return "Mat3Property"; } diff --git a/src/properties/matrix/mat4property.cpp b/src/properties/matrix/mat4property.cpp index 6348a5043e..ac4e8bbbc0 100644 --- a/src/properties/matrix/mat4property.cpp +++ b/src/properties/matrix/mat4property.cpp @@ -41,7 +41,7 @@ Mat4Property::Mat4Property(Property::PropertyInfo info, glm::mat4x4 value, ) {} -std::string Mat4Property::className() const { +std::string_view Mat4Property::className() const { return "Mat4Property"; } diff --git a/src/properties/optionproperty.cpp b/src/properties/optionproperty.cpp index 9fa5a78045..e4e539b653 100644 --- a/src/properties/optionproperty.cpp +++ b/src/properties/optionproperty.cpp @@ -25,6 +25,7 @@ #include +#include #include namespace { @@ -45,7 +46,7 @@ OptionProperty::OptionProperty(PropertyInfo info, DisplayType displayType) , _displayType(displayType) {} -std::string OptionProperty::className() const { +std::string_view OptionProperty::className() const { return "OptionProperty"; } @@ -158,9 +159,9 @@ std::string OptionProperty::generateAdditionalJsonDescription() const { for (size_t i = 0; i < _options.size(); ++i) { const Option& o = _options[i]; std::string v = std::to_string(o.value); - std::string vSan = sanitizeString(v); + std::string vSan = escapedJson(v); std::string d = o.description; - std::string dSan = sanitizeString(d); + std::string dSan = escapedJson(d); result += '{'; result += fmt::format(R"("{}": "{}")", vSan, dSan); diff --git a/src/properties/property.cpp b/src/properties/property.cpp index 5f72b7e005..f6012e4f4f 100644 --- a/src/properties/property.cpp +++ b/src/properties/property.cpp @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -35,60 +36,21 @@ namespace { constexpr std::string_view MetaDataKeyReadOnly = "isReadOnly"; constexpr std::string_view MetaDataKeyViewOptions = "ViewOptions"; constexpr std::string_view MetaDataKeyVisibility = "Visibility"; + + constexpr std::string_view IdentifierKey = "Identifier"; + constexpr std::string_view NameKey = "Name"; + constexpr std::string_view TypeKey = "Type"; + constexpr std::string_view DescriptionKey = "Description"; + constexpr std::string_view JsonValueKey = "Value"; + constexpr std::string_view MetaDataKey = "MetaData"; + constexpr std::string_view AdditionalDataKey = "AdditionalData"; } // namespace namespace openspace::properties { -Property::OnChangeHandle Property::OnChangeHandleAll = - std::numeric_limits::max(); - const char* Property::ViewOptions::Color = "Color"; const char* Property::ViewOptions::MinMaxRange = "MinMaxRange"; -const char* Property::IdentifierKey = "Identifier"; -const char* Property::NameKey = "Name"; -const char* Property::TypeKey = "Type"; -const char* Property::DescriptionKey = "Description"; -const char* Property::JsonValueKey = "Value"; -const char* Property::MetaDataKey = "MetaData"; -const char* Property::AdditionalDataKey = "AdditionalData"; - - -std::string sanitizeString(const std::string& s) { - std::string result; - - for (const char& c : s) { - switch (c) { - case '"': - result += "\\\""; - break; - case '\\': - result += "\\\\"; - break; - case '\b': - result += "\\b"; - break; - case '\f': - result += "\\f"; - break; - case '\n': - result += "\\n"; - break; - case '\r': - result += "\\r"; - break; - case '\t': - result += "\\t"; - break; - default: - result += c; - } - } - - return result; -} - - #ifdef _DEBUG uint64_t Property::Identifier = 0; #endif @@ -121,7 +83,7 @@ std::string Property::fullyQualifiedIdentifier() const { while (currentOwner) { std::string ownerId = currentOwner->identifier(); if (!ownerId.empty()) { - identifier = ownerId + "." + identifier; // NOLINT + identifier = ownerId + "." + identifier; } currentOwner = currentOwner->owner(); } @@ -136,7 +98,7 @@ bool Property::getLuaValue(lua_State*) const { return false; } -void Property::set(std::any) {} // NOLINT +void Property::set(std::any) {} bool Property::setLuaValue(lua_State*) { return false; @@ -150,17 +112,8 @@ int Property::typeLua() const { return LUA_TNIL; } -bool Property::getStringValue(std::string&) const { - return false; -} - -std::string Property::getStringValue() const { - std::string value; - bool status = getStringValue(value); - if (!status) { - throw ghoul::RuntimeError("Could not get string value", identifier()); - } - return value; +std::string Property::stringValue() const { + return ""; } const std::string& Property::guiName() const { @@ -224,16 +177,8 @@ const ghoul::Dictionary& Property::metaData() const { return _metaData; } -std::string Property::toJson() const { - std::string result = "{"; - result += "\"" + std::string(DescriptionKey) + "\": " + - generateBaseJsonDescription() + ", "; - result += "\"" + std::string(JsonValueKey) + "\": " + jsonValue() + '}'; - return result; -} - std::string Property::jsonValue() const { - return getStringValue(); + return stringValue(); } Property::OnChangeHandle Property::onChange(std::function callback) { @@ -319,22 +264,20 @@ void Property::resetToUnchanged() { _isValueDirty = false; } -std::string Property::generateBaseJsonDescription() const { - std::string cName = className(); - std::string cNameSan = sanitizeString(cName); +std::string Property::generateJsonDescription() const { + std::string cName = escapedJson(std::string(className())); std::string identifier = fullyQualifiedIdentifier(); - std::string identifierSan = sanitizeString(identifier); + std::string identifierSan = escapedJson(identifier); std::string gName = guiName(); - std::string gNameSan = sanitizeString(gName); + std::string gNameSan = escapedJson(gName); std::string metaData = generateMetaDataJsonDescription(); std::string description = generateAdditionalJsonDescription(); - return - "{ \"" + std::string(TypeKey) + "\": \"" + cNameSan + "\", " + - "\"" + std::string(IdentifierKey) + "\": \"" + identifierSan + "\", " + - "\"" + std::string(NameKey) + "\": \"" + gNameSan + "\", " + - "\"" + std::string(MetaDataKey) + "\": " + metaData + ", " + - "\"" + std::string(AdditionalDataKey) + "\": " + description + " }"; + return fmt::format( + R"({{"{}":"{}","{}":"{}","{}":"{}","{}":{},"{}":{}}})", + TypeKey, cName, IdentifierKey, identifierSan, NameKey, gNameSan, MetaDataKey, + metaData, AdditionalDataKey, description + ); } std::string Property::generateMetaDataJsonDescription() const { @@ -357,21 +300,22 @@ std::string Property::generateMetaDataJsonDescription() const { std::string isReadOnlyString = (isReadOnly ? "true" : "false"); std::string groupId = groupIdentifier(); - std::string sanitizedGroupId = sanitizeString(groupId); + std::string sanitizedGroupId = escapedJson(groupId); std::string viewOptions = "{}"; - if (_metaData.hasValue(MetaDataKeyViewOptions)) { - viewOptions = ghoul::formatJson( - _metaData.value(MetaDataKeyViewOptions) - ); - } + if (_metaData.hasValue(MetaDataKeyViewOptions)) { + viewOptions = ghoul::formatJson( + _metaData.value(MetaDataKeyViewOptions) + ); + } - std::string result = "{ "; - result += fmt::format("\"{}\": \"{}\",", MetaDataKeyGroup, sanitizedGroupId); - result += fmt::format("\"{}\": \"{}\",", MetaDataKeyVisibility, vis); - result += fmt::format("\"{}\": {},", MetaDataKeyReadOnly, isReadOnlyString); - result += fmt::format("\"{}\": {}", MetaDataKeyViewOptions, viewOptions); - result += " }"; + std::string result = fmt::format( + R"({{"{}":"{}","{}":"{}","{}":{},"{}":{}}})", + MetaDataKeyGroup, sanitizedGroupId, + MetaDataKeyVisibility, vis, + MetaDataKeyReadOnly, isReadOnlyString, + MetaDataKeyViewOptions, viewOptions + ); return result; } @@ -379,7 +323,7 @@ std::string Property::generateAdditionalJsonDescription() const { return "{}"; } -void Property::setInterpolationTarget(std::any) {} // NOLINT +void Property::setInterpolationTarget(std::any) {} void Property::setLuaInterpolationTarget(lua_State*) {} void Property::interpolateValue(float, ghoul::EasingFunc) {} diff --git a/src/properties/scalar/boolproperty.cpp b/src/properties/scalar/boolproperty.cpp index 08a2be4a76..9709498368 100644 --- a/src/properties/scalar/boolproperty.cpp +++ b/src/properties/scalar/boolproperty.cpp @@ -33,7 +33,7 @@ BoolProperty::BoolProperty(Property::PropertyInfo info, bool value) : TemplateProperty(std::move(info), value) {} -std::string BoolProperty::className() const { +std::string_view BoolProperty::className() const { return "BoolProperty"; } diff --git a/src/properties/scalar/doubleproperty.cpp b/src/properties/scalar/doubleproperty.cpp index d4bd6c7a10..96adca4909 100644 --- a/src/properties/scalar/doubleproperty.cpp +++ b/src/properties/scalar/doubleproperty.cpp @@ -33,7 +33,7 @@ DoubleProperty::DoubleProperty(Property::PropertyInfo info, double value, : NumericalProperty(std::move(info), value, minValue, maxValue, stepValue) {} -std::string DoubleProperty::className() const { +std::string_view DoubleProperty::className() const { return "DoubleProperty"; } diff --git a/src/properties/scalar/floatproperty.cpp b/src/properties/scalar/floatproperty.cpp index 9dfaa82636..8b6f05edc4 100644 --- a/src/properties/scalar/floatproperty.cpp +++ b/src/properties/scalar/floatproperty.cpp @@ -33,7 +33,7 @@ FloatProperty::FloatProperty(Property::PropertyInfo info, float value, : NumericalProperty(std::move(info), value, minValue, maxValue, stepValue) {} -std::string FloatProperty::className() const { +std::string_view FloatProperty::className() const { return "FloatProperty"; } diff --git a/src/properties/scalar/intproperty.cpp b/src/properties/scalar/intproperty.cpp index 60cd511f3d..758dff8f2f 100644 --- a/src/properties/scalar/intproperty.cpp +++ b/src/properties/scalar/intproperty.cpp @@ -33,7 +33,7 @@ IntProperty::IntProperty(Property::PropertyInfo info, int value, : NumericalProperty(std::move(info), value, minValue, maxValue, stepValue) {} -std::string IntProperty::className() const { +std::string_view IntProperty::className() const { return "IntProperty"; } diff --git a/src/properties/scalar/longproperty.cpp b/src/properties/scalar/longproperty.cpp index f7c0ad1fd0..4d7a8cc73d 100644 --- a/src/properties/scalar/longproperty.cpp +++ b/src/properties/scalar/longproperty.cpp @@ -33,7 +33,7 @@ LongProperty::LongProperty(Property::PropertyInfo info, long value, : NumericalProperty(std::move(info), value, minValue, maxValue, stepValue) {} -std::string LongProperty::className() const { +std::string_view LongProperty::className() const { return "LongProperty"; } diff --git a/src/properties/scalar/shortproperty.cpp b/src/properties/scalar/shortproperty.cpp index 11c0872282..88339a9c53 100644 --- a/src/properties/scalar/shortproperty.cpp +++ b/src/properties/scalar/shortproperty.cpp @@ -33,7 +33,7 @@ ShortProperty::ShortProperty(Property::PropertyInfo info, short value, short min : NumericalProperty(std::move(info), value, minValue, maxValue, stepValue) {} -std::string ShortProperty::className() const { +std::string_view ShortProperty::className() const { return "ShortProperty"; } diff --git a/src/properties/scalar/uintproperty.cpp b/src/properties/scalar/uintproperty.cpp index 71f3b4fad4..62ad26d27d 100644 --- a/src/properties/scalar/uintproperty.cpp +++ b/src/properties/scalar/uintproperty.cpp @@ -40,7 +40,7 @@ UIntProperty::UIntProperty(Property::PropertyInfo info, unsigned int value, ) {} -std::string UIntProperty::className() const { +std::string_view UIntProperty::className() const { return "UIntProperty"; } diff --git a/src/properties/scalar/ulongproperty.cpp b/src/properties/scalar/ulongproperty.cpp index b386922098..84fae8d7ff 100644 --- a/src/properties/scalar/ulongproperty.cpp +++ b/src/properties/scalar/ulongproperty.cpp @@ -40,7 +40,7 @@ ULongProperty::ULongProperty(Property::PropertyInfo info, unsigned long value, ) {} -std::string ULongProperty::className() const { +std::string_view ULongProperty::className() const { return "ULongProperty"; } diff --git a/src/properties/scalar/ushortproperty.cpp b/src/properties/scalar/ushortproperty.cpp index 4ec5b4f512..d6be61dad8 100644 --- a/src/properties/scalar/ushortproperty.cpp +++ b/src/properties/scalar/ushortproperty.cpp @@ -40,7 +40,7 @@ UShortProperty::UShortProperty(Property::PropertyInfo info, unsigned short value ) {} -std::string UShortProperty::className() const { +std::string_view UShortProperty::className() const { return "UShortProperty"; } diff --git a/src/properties/selectionproperty.cpp b/src/properties/selectionproperty.cpp index 4d0b5338d3..3d65d8d1ff 100644 --- a/src/properties/selectionproperty.cpp +++ b/src/properties/selectionproperty.cpp @@ -43,7 +43,7 @@ SelectionProperty::SelectionProperty(Property::PropertyInfo info) : TemplateProperty(std::move(info), std::set()) {} -std::string SelectionProperty::className() const { +std::string_view SelectionProperty::className() const { return "SelectionProperty"; } diff --git a/src/properties/stringproperty.cpp b/src/properties/stringproperty.cpp index 60840d4bdb..2302ef8e1e 100644 --- a/src/properties/stringproperty.cpp +++ b/src/properties/stringproperty.cpp @@ -34,7 +34,7 @@ StringProperty::StringProperty(Property::PropertyInfo info, std::string value) : TemplateProperty(info, value) {} -std::string StringProperty::className() const { +std::string_view StringProperty::className() const { return "StringProperty"; } diff --git a/src/properties/triggerproperty.cpp b/src/properties/triggerproperty.cpp index b7e58a6275..312f148fe1 100644 --- a/src/properties/triggerproperty.cpp +++ b/src/properties/triggerproperty.cpp @@ -30,7 +30,7 @@ TriggerProperty::TriggerProperty(PropertyInfo info) : Property(std::move(info)) {} -std::string TriggerProperty::className() const { +std::string_view TriggerProperty::className() const { return "TriggerProperty"; } @@ -43,13 +43,6 @@ void TriggerProperty::set(std::any) { notifyChangeListeners(); } -std::string TriggerProperty::toJson() const { - std::string result = "{"; - result += "\"" + std::string(DescriptionKey) + "\": " + generateBaseJsonDescription(); - result += "}"; - return result; -} - std::string TriggerProperty::jsonValue() const { return "true"; } diff --git a/src/properties/vector/dvec2property.cpp b/src/properties/vector/dvec2property.cpp index 715b6be6d9..88aefa1d78 100644 --- a/src/properties/vector/dvec2property.cpp +++ b/src/properties/vector/dvec2property.cpp @@ -41,7 +41,7 @@ DVec2Property::DVec2Property(Property::PropertyInfo info, glm::dvec2 value, ) {} -std::string DVec2Property::className() const { +std::string_view DVec2Property::className() const { return "DVec2Property"; } diff --git a/src/properties/vector/dvec3property.cpp b/src/properties/vector/dvec3property.cpp index d45b34068a..00667d8050 100644 --- a/src/properties/vector/dvec3property.cpp +++ b/src/properties/vector/dvec3property.cpp @@ -41,7 +41,7 @@ DVec3Property::DVec3Property(Property::PropertyInfo info, glm::dvec3 value, ) {} -std::string DVec3Property::className() const { +std::string_view DVec3Property::className() const { return "DVec3Property"; } diff --git a/src/properties/vector/dvec4property.cpp b/src/properties/vector/dvec4property.cpp index 49ebcf7205..5a07cb11e9 100644 --- a/src/properties/vector/dvec4property.cpp +++ b/src/properties/vector/dvec4property.cpp @@ -41,7 +41,7 @@ DVec4Property::DVec4Property(Property::PropertyInfo info, glm::dvec4 value, ) {} -std::string DVec4Property::className() const { +std::string_view DVec4Property::className() const { return "DVec4Property"; } diff --git a/src/properties/vector/ivec2property.cpp b/src/properties/vector/ivec2property.cpp index db617df509..4937ecdc3f 100644 --- a/src/properties/vector/ivec2property.cpp +++ b/src/properties/vector/ivec2property.cpp @@ -41,7 +41,7 @@ IVec2Property::IVec2Property(Property::PropertyInfo info, glm::ivec2 value, ) {} -std::string IVec2Property::className() const { +std::string_view IVec2Property::className() const { return "IVec2Property"; } diff --git a/src/properties/vector/ivec3property.cpp b/src/properties/vector/ivec3property.cpp index e2f7ceb241..341f6b510f 100644 --- a/src/properties/vector/ivec3property.cpp +++ b/src/properties/vector/ivec3property.cpp @@ -41,7 +41,7 @@ IVec3Property::IVec3Property(Property::PropertyInfo info, glm::ivec3 value, ) {} -std::string IVec3Property::className() const { +std::string_view IVec3Property::className() const { return "IVec3Property"; } diff --git a/src/properties/vector/ivec4property.cpp b/src/properties/vector/ivec4property.cpp index d00607aed0..aa105756a1 100644 --- a/src/properties/vector/ivec4property.cpp +++ b/src/properties/vector/ivec4property.cpp @@ -41,7 +41,7 @@ IVec4Property::IVec4Property(Property::PropertyInfo info, glm::ivec4 value, ) {} -std::string IVec4Property::className() const { +std::string_view IVec4Property::className() const { return "IVec4Property"; } diff --git a/src/properties/vector/uvec2property.cpp b/src/properties/vector/uvec2property.cpp index f6f6a9fd62..8c44a9855a 100644 --- a/src/properties/vector/uvec2property.cpp +++ b/src/properties/vector/uvec2property.cpp @@ -41,7 +41,7 @@ UVec2Property::UVec2Property(Property::PropertyInfo info, glm::uvec2 value, ) {} -std::string UVec2Property::className() const { +std::string_view UVec2Property::className() const { return "UVec2Property"; } diff --git a/src/properties/vector/uvec3property.cpp b/src/properties/vector/uvec3property.cpp index 07820176bb..194ec25279 100644 --- a/src/properties/vector/uvec3property.cpp +++ b/src/properties/vector/uvec3property.cpp @@ -41,7 +41,7 @@ UVec3Property::UVec3Property(Property::PropertyInfo info, glm::uvec3 value, ) {} -std::string UVec3Property::className() const { +std::string_view UVec3Property::className() const { return "UVec3Property"; } diff --git a/src/properties/vector/uvec4property.cpp b/src/properties/vector/uvec4property.cpp index bd802f0ad0..e07940fc24 100644 --- a/src/properties/vector/uvec4property.cpp +++ b/src/properties/vector/uvec4property.cpp @@ -41,7 +41,7 @@ UVec4Property::UVec4Property(Property::PropertyInfo info, glm::uvec4 value, ) {} -std::string UVec4Property::className() const { +std::string_view UVec4Property::className() const { return "UVec4Property"; } diff --git a/src/properties/vector/vec2property.cpp b/src/properties/vector/vec2property.cpp index b910b138ed..0c69336a1f 100644 --- a/src/properties/vector/vec2property.cpp +++ b/src/properties/vector/vec2property.cpp @@ -40,7 +40,7 @@ Vec2Property::Vec2Property(Property::PropertyInfo info, glm::vec2 value, ) {} -std::string Vec2Property::className() const { +std::string_view Vec2Property::className() const { return "Vec2Property"; } diff --git a/src/properties/vector/vec3property.cpp b/src/properties/vector/vec3property.cpp index 488dd97607..8ee408d3c0 100644 --- a/src/properties/vector/vec3property.cpp +++ b/src/properties/vector/vec3property.cpp @@ -40,7 +40,7 @@ Vec3Property::Vec3Property(Property::PropertyInfo info, glm::vec3 value, ) {} -std::string Vec3Property::className() const { +std::string_view Vec3Property::className() const { return "Vec3Property"; } diff --git a/src/properties/vector/vec4property.cpp b/src/properties/vector/vec4property.cpp index 8681a1e094..fce95037e3 100644 --- a/src/properties/vector/vec4property.cpp +++ b/src/properties/vector/vec4property.cpp @@ -40,7 +40,7 @@ Vec4Property::Vec4Property(Property::PropertyInfo info, glm::vec4 value, ) {} -std::string Vec4Property::className() const { +std::string_view Vec4Property::className() const { return "Vec4Property"; } diff --git a/src/rendering/luaconsole.cpp b/src/rendering/luaconsole.cpp index e4bcd43207..b31c0ea85c 100644 --- a/src/rendering/luaconsole.cpp +++ b/src/rendering/luaconsole.cpp @@ -166,7 +166,7 @@ LuaConsole::LuaConsole() addProperty(_historyTextColor); } -LuaConsole::~LuaConsole() {} // NOLINT +LuaConsole::~LuaConsole() {} void LuaConsole::initialize() { ZoneScoped diff --git a/src/rendering/renderengine.cpp b/src/rendering/renderengine.cpp index 19ab3b5ae9..ea8351917d 100644 --- a/src/rendering/renderengine.cpp +++ b/src/rendering/renderengine.cpp @@ -411,7 +411,7 @@ RenderEngine::RenderEngine() addProperty(_disabledFontColor); } -RenderEngine::~RenderEngine() {} // NOLINT +RenderEngine::~RenderEngine() {} void RenderEngine::initialize() { ZoneScoped @@ -632,9 +632,7 @@ void RenderEngine::render(const glm::mat4& sceneMatrix, const glm::mat4& viewMat glm::mat4 combinedGlobalRot = nodeRot * globalRot; if (_camera) { - _camera->sgctInternal.setViewMatrix( - viewMatrix * combinedGlobalRot * sceneMatrix - ); + _camera->sgctInternal.setViewMatrix(viewMatrix * combinedGlobalRot * sceneMatrix); _camera->sgctInternal.setSceneMatrix(combinedGlobalRot * sceneMatrix); _camera->sgctInternal.setProjectionMatrix(projectionMatrix); _camera->invalidateCache(); @@ -642,8 +640,7 @@ void RenderEngine::render(const glm::mat4& sceneMatrix, const glm::mat4& viewMat const int fpsLimit = _framerateLimit; if (fpsLimit > 0) { - // Using a sleep here is not optimal, but we are not looking for FPS-perfect - // limiting + // Using a sleep here is not optimal, but we are not looking for perfect timing std::this_thread::sleep_until(_lastFrameTime); const double delta = (1.0 / fpsLimit) * 1000.0 * 1000.0; auto now = std::chrono::high_resolution_clock::now(); @@ -652,11 +649,7 @@ void RenderEngine::render(const glm::mat4& sceneMatrix, const glm::mat4& viewMat const bool renderingEnabled = delegate.isMaster() ? !_disableMasterRendering : true; if (renderingEnabled && !delegate.isGuiWindow() && _globalBlackOutFactor > 0.f) { - _renderer.render( - _scene, - _camera, - _globalBlackOutFactor - ); + _renderer.render(_scene, _camera, _globalBlackOutFactor); } // The CEF webbrowser fix has to be called at least once per frame and we are doing @@ -896,7 +889,7 @@ ghoul::opengl::OpenGLStateCache& RenderEngine::openglStateCache() { return *_openglStateCache; } -float RenderEngine::globalBlackOutFactor() { +float RenderEngine::globalBlackOutFactor() const { return _globalBlackOutFactor; } @@ -982,12 +975,7 @@ void RenderEngine::removeRenderProgram(ghoul::opengl::ProgramObject* program) { return; } - auto it = std::find( - _programs.begin(), - _programs.end(), - program - ); - + auto it = std::find(_programs.begin(), _programs.end(), program); if (it != _programs.end()) { _programs.erase(it); } @@ -1056,19 +1044,18 @@ scripting::LuaLibrary RenderEngine::luaLibrary() { } void RenderEngine::addScreenSpaceRenderable(std::unique_ptr s) { - const std::string identifier = s->identifier(); - if (std::find_if( + auto it = std::find_if( global::screenSpaceRenderables->begin(), global::screenSpaceRenderables->end(), [&identifier](const std::unique_ptr& ssr) { return ssr->identifier() == identifier; - }) != global::screenSpaceRenderables->end() - ) { + } + ); + if (it != global::screenSpaceRenderables->end()) { LERROR(fmt::format( - "Cannot add scene space renderable. " - "An element with identifier '{}' already exists", + "Cannot add scene space renderable. Identifier '{}' already exists", identifier )); return; @@ -1142,7 +1129,7 @@ void RenderEngine::renderCameraInformation() { return; } - const glm::vec4 EnabledColor = _enabledFontColor.value(); + const glm::vec4 EnabledColor = _enabledFontColor.value(); const glm::vec4 DisabledColor = _disabledFontColor.value(); const glm::vec2 rotationBox = _fontCameraInfo->boundingBox("Rotation"); @@ -1216,10 +1203,7 @@ void RenderEngine::renderVersionInformation() { FR::defaultRenderer().render( *_fontVersionInfo, - glm::vec2( - fontResolution().x - versionBox.x - 10.f, - 5.f - ), + glm::vec2(fontResolution().x - versionBox.x - 10.f, 5.f), _versionString, glm::vec4(0.5f, 0.5f, 0.5f, 1.f) ); diff --git a/src/rendering/screenspacerenderable.cpp b/src/rendering/screenspacerenderable.cpp index 3969ea00cc..2b0650e919 100644 --- a/src/rendering/screenspacerenderable.cpp +++ b/src/rendering/screenspacerenderable.cpp @@ -387,7 +387,7 @@ ScreenSpaceRenderable::ScreenSpaceRenderable(const ghoul::Dictionary& dictionary addProperty(_delete); } -ScreenSpaceRenderable::~ScreenSpaceRenderable() {} // NOLINT +ScreenSpaceRenderable::~ScreenSpaceRenderable() {} bool ScreenSpaceRenderable::initialize() { return true; diff --git a/src/rendering/transferfunction.cpp b/src/rendering/transferfunction.cpp index 891c58c0a1..5f9f628448 100644 --- a/src/rendering/transferfunction.cpp +++ b/src/rendering/transferfunction.cpp @@ -50,7 +50,7 @@ TransferFunction::TransferFunction(const std::string& filepath, setCallback(std::move(tfChangedCallback)); } -TransferFunction::~TransferFunction() {} // NOLINT +TransferFunction::~TransferFunction() {} void TransferFunction::setPath(const std::string& filepath) { if (_file) { diff --git a/src/scene/lightsource.cpp b/src/scene/lightsource.cpp index 15fd41a0af..2920cfd62c 100644 --- a/src/scene/lightsource.cpp +++ b/src/scene/lightsource.cpp @@ -87,13 +87,10 @@ LightSource::LightSource() } LightSource::LightSource(const ghoul::Dictionary& dictionary) - : properties::PropertyOwner({ "LightSource" }) - , _enabled(EnabledInfo, true) + : LightSource() { const Parameters p = codegen::bake(dictionary); - _enabled = p.enabled.value_or(_enabled); - addProperty(_enabled); } bool LightSource::initialize() { diff --git a/src/scene/profile.cpp b/src/scene/profile.cpp index 5b6c5bcf5d..c09c9ecfb6 100644 --- a/src/scene/profile.cpp +++ b/src/scene/profile.cpp @@ -589,7 +589,7 @@ void Profile::saveCurrentSettingsToProfile(const properties::PropertyOwner& root Property p; p.setType = Property::SetType::SetPropertyValueSingle; p.name = prop->fullyQualifiedIdentifier(); - p.value = prop->getStringValue(); + p.value = prop->stringValue(); properties.push_back(std::move(p)); } diff --git a/src/scene/scene.cpp b/src/scene/scene.cpp index 6e4390e277..3ebe8edf34 100644 --- a/src/scene/scene.cpp +++ b/src/scene/scene.cpp @@ -98,10 +98,13 @@ Scene::InvalidSceneError::InvalidSceneError(std::string msg, std::string comp) Scene::Scene(std::unique_ptr initializer) : properties::PropertyOwner({"Scene", "Scene"}) + , _camera(std::make_unique()) , _initializer(std::move(initializer)) { _rootDummy.setIdentifier(SceneGraphNode::RootNodeIdentifier); _rootDummy.setScene(this); + + _camera->setParent(&_rootDummy); } Scene::~Scene() { @@ -117,10 +120,6 @@ ghoul::mm_unique_ptr Scene::detachNode(SceneGraphNode& node) { return _rootDummy.detachChild(node); } -void Scene::setCamera(std::unique_ptr camera) { - _camera = std::move(camera); -} - Camera* Scene::camera() const { return _camera.get(); } @@ -128,7 +127,7 @@ Camera* Scene::camera() const { void Scene::registerNode(SceneGraphNode* node) { if (_nodesByIdentifier.count(node->identifier())) { throw Scene::InvalidSceneError( - "Node with identifier " + node->identifier() + " already exits" + "Node with identifier " + node->identifier() + " already exists" ); } @@ -251,75 +250,6 @@ bool Scene::isInitializing() const { return _initializer->isInitializing(); } -/* -void Scene::initialize() { - bool useMultipleThreads = true; - if (OsEng.configurationManager().hasKey( - ConfigurationManager::KeyUseMultithreadedInitialization - )) - { - useMultipleThreads = OsEng.configurationManager().value( - ConfigurationManager::KeyUseMultithreadedInitialization - ); - } - - auto initFunction = [](SceneGraphNode* node){ - try { - OsEng.loadingScreen().updateItem( - node->name(), - LoadingScreen::ItemStatus::Initializing - ); - node->initialize(); - OsEng.loadingScreen().tickItem(); - OsEng.loadingScreen().updateItem( - node->name(), - LoadingScreen::ItemStatus::Finished - ); - } - catch (const ghoul::RuntimeError& e) { - LERROR(node->name() << " not initialized"); - LERRORC(std::string(_loggerCat) + "(" + e.component + ")", e.what()); - OsEng.loadingScreen().updateItem( - node->name(), - LoadingScreen::ItemStatus::Failed - ); - } - - }; - - if (useMultipleThreads) { - unsigned int nThreads = std::thread::hardware_concurrency(); - - ghoul::ThreadPool pool(nThreads == 0 ? 2 : nThreads - 1); - - OsEng.loadingScreen().postMessage("Initializing scene"); - - for (SceneGraphNode* node : _topologicallySortedNodes) { - pool.queue(initFunction, node); - } - - pool.stop(); - } - else { - for (SceneGraphNode* node : _topologicallySortedNodes) { - initFunction(node); - } - } -} - -void Scene::initializeGL() { - for (SceneGraphNode* node : _topologicallySortedNodes) { - try { - node->initializeGL(); - } - catch (const ghoul::RuntimeError& e) { - LERROR(node->name() << " not initialized"); - LERRORC(std::string(_loggerCat) + "(" + e.component + ")", e.what()); - } - } -} -*/ - void Scene::update(const UpdateData& data) { ZoneScoped @@ -609,9 +539,7 @@ void Scene::updateInterpolations() { std::remove_if( _propertyInterpolationInfos.begin(), _propertyInterpolationInfos.end(), - [](const PropertyInterpolationInfo& i) { - return i.isExpired; - } + [](const PropertyInterpolationInfo& i) { return i.isExpired; } ), _propertyInterpolationInfos.end() ); @@ -652,7 +580,7 @@ void Scene::setPropertiesFromProfile(const Profile& p) { groupName, ghoul::EasingFunction::Linear ); - //Clear lua state stack + // Clear lua state stack lua_settop(L, 0); } } @@ -688,7 +616,7 @@ ProfilePropertyLua Scene::propertyProcessValue(ghoul::lua::LuaState& L, switch (pType) { case PropertyValueType::Boolean: - result = (value == "true") ? true : false; + result = (value == "true"); break; case PropertyValueType::Float: result = std::stof(value); diff --git a/src/scene/scenegraphnode.cpp b/src/scene/scenegraphnode.cpp index f45004afcd..4737edf136 100644 --- a/src/scene/scenegraphnode.cpp +++ b/src/scene/scenegraphnode.cpp @@ -552,7 +552,7 @@ SceneGraphNode::SceneGraphNode() addProperty(_showDebugSphere); } -SceneGraphNode::~SceneGraphNode() {} // NOLINT +SceneGraphNode::~SceneGraphNode() {} void SceneGraphNode::initialize() { ZoneScoped @@ -694,10 +694,7 @@ void SceneGraphNode::update(const UpdateData& data) { newUpdateData.modelTransform.translation ); glm::dmat4 rotation = glm::dmat4(newUpdateData.modelTransform.rotation); - glm::dmat4 scaling = glm::scale( - glm::dmat4(1.0), - newUpdateData.modelTransform.scale - ); + glm::dmat4 scaling = glm::scale(glm::dmat4(1.0), newUpdateData.modelTransform.scale); _modelTransformCached = translation * rotation * scaling; @@ -883,11 +880,7 @@ void SceneGraphNode::removeDependency(SceneGraphNode& dependency) { dependency._dependentNodes.end() ); _dependencies.erase( - std::remove( - _dependencies.begin(), - _dependencies.end(), - &dependency - ), + std::remove(_dependencies.begin(), _dependencies.end(), &dependency), _dependencies.end() ); diff --git a/src/scripting/scriptengine.cpp b/src/scripting/scriptengine.cpp index 33a4f46258..917d42ac63 100644 --- a/src/scripting/scriptengine.cpp +++ b/src/scripting/scriptengine.cpp @@ -253,10 +253,7 @@ bool ScriptEngine::hasLibrary(const std::string& name) { bool ScriptEngine::runScript(const std::string& script, ScriptCallback callback) { ZoneScoped - if (script.empty()) { - LWARNING("Script was empty"); - return false; - } + ghoul_assert(!script.empty(), "Script must not be empty"); if (_logScripts) { // Write command to log before it's executed @@ -448,12 +445,10 @@ void ScriptEngine::addLibraryFunctions(lua_State* state, LuaLibrary& library, library.documentations.push_back(std::move(func)); } catch (const documentation::SpecificationError& e) { - for (const documentation::TestResult::Offense& o : e.result.offenses) - { + for (const documentation::TestResult::Offense& o : e.result.offenses) { LERRORC(o.offender, ghoul::to_string(o.reason)); } - for (const documentation::TestResult::Warning& w : e.result.warnings) - { + for (const documentation::TestResult::Warning& w : e.result.warnings) { LWARNINGC(w.offender, ghoul::to_string(w.reason)); } } @@ -463,18 +458,6 @@ void ScriptEngine::addLibraryFunctions(lua_State* state, LuaLibrary& library, } } -void ScriptEngine::remapPrintFunction() { - //ghoul::lua::logStack(_state); - // lua_getglobal(_state, _luaGlobalNamespace.c_str()); - //ghoul::lua::logStack(_state); - // lua_pushstring(_state, _printFunctionName.c_str()); - //ghoul::lua::logStack(_state); - // lua_pushcfunction(_state, _printFunctionReplacement); - //ghoul::lua::logStack(_state); - // lua_settable(_state, _setTableOffset); - //ghoul::lua::logStack(_state); -} - bool ScriptEngine::registerLuaLibrary(lua_State* state, LuaLibrary& library) { ZoneScoped @@ -548,7 +531,7 @@ std::string ScriptEngine::generateJson() const { return json.str(); } -bool ScriptEngine::writeLog(const std::string& script) { +void ScriptEngine::writeLog(const std::string& script) { ZoneScoped // Check that logging is enabled and initialize if necessary @@ -571,12 +554,12 @@ bool ScriptEngine::writeLog(const std::string& script) { std::filesystem::path(_logFilename) )); - return false; + return; } } else { _logScripts = false; - return false; + return; } } @@ -584,13 +567,10 @@ bool ScriptEngine::writeLog(const std::string& script) { std::ofstream file(_logFilename, std::ofstream::app); if (!file.good()) { LERROR(fmt::format("Could not open file '{}' for logging scripts", _logFilename)); - return false; + return; } - file << script << std::endl; - file.close(); - - return true; + file << script << '\n'; } void ScriptEngine::preSync(bool isMaster) { @@ -682,9 +662,10 @@ void ScriptEngine::queueScript(std::string script, { ZoneScoped - if (!script.empty()) { - _incomingScripts.push({ std::move(script), remoteScripting, callback }); + if (script.empty()) { + return; } + _incomingScripts.push({ std::move(script), remoteScripting, std::move(callback) }); } diff --git a/src/util/factorymanager.cpp b/src/util/factorymanager.cpp index 25ecea356f..4fa1b09841 100644 --- a/src/util/factorymanager.cpp +++ b/src/util/factorymanager.cpp @@ -24,6 +24,15 @@ #include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include namespace openspace { @@ -51,6 +60,15 @@ void FactoryManager::initialize() { ghoul_assert(!_manager, "Factory Manager must not have been initialized"); _manager = new FactoryManager; + _manager->addFactory("Renderable"); + _manager->addFactory("Translation"); + _manager->addFactory("Rotation"); + _manager->addFactory("Scale"); + _manager->addFactory("TimeFrame"); + _manager->addFactory("LightSource"); + _manager->addFactory("Task"); + _manager->addFactory("ResourceSynchronization"); + _manager->addFactory("DashboardItem"); } void FactoryManager::deinitialize() { diff --git a/src/util/httprequest.cpp b/src/util/httprequest.cpp index a32599f80c..72f2b0d462 100644 --- a/src/util/httprequest.cpp +++ b/src/util/httprequest.cpp @@ -58,7 +58,7 @@ bool HttpRequest::perform(std::chrono::milliseconds timeout) { } curl_easy_setopt(curl, CURLOPT_URL, _url.data()); - curl_easy_setopt(curl, CURLOPT_USERAGENT, "OpenSpace"); // NOLINT + curl_easy_setopt(curl, CURLOPT_USERAGENT, "OpenSpace"); curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); // The leading + in all of the lambda expressions are to cause an implicit conversion diff --git a/src/util/json_helper.cpp b/src/util/json_helper.cpp index eebcaecd16..d7c75609a6 100644 --- a/src/util/json_helper.cpp +++ b/src/util/json_helper.cpp @@ -22,6 +22,8 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ +#include + namespace openspace { std::string escapedJson(const std::string& text) { @@ -29,21 +31,27 @@ std::string escapedJson(const std::string& text) { jsonString.reserve(text.size()); for (const char& c : text) { switch (c) { + case '\b': + jsonString += "\\b"; + break; case '\t': jsonString += "\\t"; // Replace tab with \t. break; + case '\n': + jsonString += "\\\\n"; // Replace newline with \n. + break; + case '\f': + jsonString += "\\f"; + break; + case '\r': + jsonString += "\\r"; // Replace carriage return with \r. + break; case '"': jsonString += "\\\""; // Replace " with \". break; case '\\': jsonString += "\\\\"; // Replace \ with \\. break; - case '\n': - jsonString += "\\\\n"; // Replace newline with \n. - break; - case '\r': - jsonString += "\\r"; // Replace carriage return with \r. - break; default: jsonString += c; } diff --git a/src/util/planegeometry.cpp b/src/util/planegeometry.cpp index 10edcb77ae..448e6b5595 100644 --- a/src/util/planegeometry.cpp +++ b/src/util/planegeometry.cpp @@ -98,7 +98,7 @@ void PlaneGeometry::updateGeometry() { GL_FLOAT, GL_FALSE, sizeof(VertexData), - reinterpret_cast(offsetof(VertexData, s)) // NOLINT + reinterpret_cast(offsetof(VertexData, s)) ); } diff --git a/src/util/sphere.cpp b/src/util/sphere.cpp index c1c1fc01ce..8c26253c5b 100644 --- a/src/util/sphere.cpp +++ b/src/util/sphere.cpp @@ -177,7 +177,7 @@ bool Sphere::initialize() { GL_FLOAT, GL_FALSE, sizeof(Vertex), - reinterpret_cast(offsetof(Vertex, tex)) // NOLINT + reinterpret_cast(offsetof(Vertex, tex)) ); glEnableVertexAttribArray(2); @@ -187,7 +187,7 @@ bool Sphere::initialize() { GL_FLOAT, GL_FALSE, sizeof(Vertex), - reinterpret_cast(offsetof(Vertex, normal)) // NOLINT + reinterpret_cast(offsetof(Vertex, normal)) ); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _iBufferID); diff --git a/src/util/spicemanager.cpp b/src/util/spicemanager.cpp index f28f6933c2..6fb8d302d5 100644 --- a/src/util/spicemanager.cpp +++ b/src/util/spicemanager.cpp @@ -151,9 +151,9 @@ SpiceManager::TerminatorType SpiceManager::terminatorTypeFromString( SpiceManager::SpiceManager() { // Set the SPICE library to not exit the program if an error occurs - erract_c("SET", 0, const_cast("REPORT")); // NOLINT + erract_c("SET", 0, const_cast("REPORT")); // But we do not want SPICE to print the errors, we will fetch them ourselves - errprt_c("SET", 0, const_cast("NONE")); // NOLINT + errprt_c("SET", 0, const_cast("NONE")); } SpiceManager::~SpiceManager() { @@ -162,8 +162,8 @@ SpiceManager::~SpiceManager() { } // Set values back to default - erract_c("SET", 0, const_cast("DEFAULT")); // NOLINT - errprt_c("SET", 0, const_cast("DEFAULT")); // NOLINT + erract_c("SET", 0, const_cast("DEFAULT")); + errprt_c("SET", 0, const_cast("DEFAULT")); } void SpiceManager::initialize() { @@ -1043,7 +1043,7 @@ void SpiceManager::findCkCoverage(const std::string& path) { } for (SpiceInt i = 0; i < card_c(&ids); ++i) { - const SpiceInt frame = SPICE_CELL_ELEM_I(&ids, i); // NOLINT + const SpiceInt frame = SPICE_CELL_ELEM_I(&ids, i); #if defined __clang__ #pragma clang diagnostic pop @@ -1102,7 +1102,7 @@ void SpiceManager::findSpkCoverage(const std::string& path) { } for (SpiceInt i = 0; i < card_c(&ids); ++i) { - const SpiceInt obj = SPICE_CELL_ELEM_I(&ids, i); // NOLINT + const SpiceInt obj = SPICE_CELL_ELEM_I(&ids, i); #if defined __clang__ #pragma clang diagnostic pop diff --git a/src/util/syncbuffer.cpp b/src/util/syncbuffer.cpp index 122cf59003..011dc56bbb 100644 --- a/src/util/syncbuffer.cpp +++ b/src/util/syncbuffer.cpp @@ -34,7 +34,7 @@ SyncBuffer::SyncBuffer(size_t n) _dataStream.resize(_n); } -SyncBuffer::~SyncBuffer() {} // NOLINT +SyncBuffer::~SyncBuffer() {} void SyncBuffer::encode(const std::string& s) { ZoneScoped diff --git a/src/util/timemanager.cpp b/src/util/timemanager.cpp index 45d6ff2846..1b748b57b9 100644 --- a/src/util/timemanager.cpp +++ b/src/util/timemanager.cpp @@ -576,7 +576,7 @@ const Timeline& TimeManager::timeline() const { return _timeline; } -std::vector TimeManager::getSyncables() { +std::vector TimeManager::syncables() { return { &_currentTime, &_integrateFromTime }; } diff --git a/src/util/transformationmanager.cpp b/src/util/transformationmanager.cpp index 01d66005db..f0f47b5477 100644 --- a/src/util/transformationmanager.cpp +++ b/src/util/transformationmanager.cpp @@ -60,7 +60,7 @@ TransformationManager::TransformationManager() { }; } -TransformationManager::~TransformationManager() { // NOLINT +TransformationManager::~TransformationManager() { #ifdef OPENSPACE_MODULE_KAMELEON_ENABLED _kameleon = nullptr; #endif diff --git a/tests/property/test_property_listproperties.cpp b/tests/property/test_property_listproperties.cpp index ca5b1d5d7d..e1f9241fb8 100644 --- a/tests/property/test_property_listproperties.cpp +++ b/tests/property/test_property_listproperties.cpp @@ -60,8 +60,7 @@ TEST_CASE("StringListProperty: Get String Value", "[stringlistproperty]") { const std::vector list{ "a", "b", "c" }; p.setValue(list); - std::string res; - p.getStringValue(res); + std::string res = p.stringValue(); CHECK(res == "[\"a\",\"b\",\"c\"]"); } @@ -160,8 +159,7 @@ TEST_CASE("IntListProperty: Get String Value", "[intlistproperty]") { const std::vector list{ 1, 2, 3 }; p.setValue(list); - std::string res; - p.getStringValue(res); + std::string res = p.stringValue(); CHECK(res == "[1,2,3]"); } @@ -271,8 +269,7 @@ TEST_CASE("DoubleListProperty: Get String Value", "[doublelistproperty]") { const std::vector list{ 1.0, 2.0, 3.0 }; p.setValue(list); - std::string res; - p.getStringValue(res); + std::string res = p.stringValue(); CHECK(res == "[1.0,2.0,3.0]"); } diff --git a/tests/property/test_property_selectionproperty.cpp b/tests/property/test_property_selectionproperty.cpp index 4c41cba55c..f6c634a233 100644 --- a/tests/property/test_property_selectionproperty.cpp +++ b/tests/property/test_property_selectionproperty.cpp @@ -121,14 +121,12 @@ TEST_CASE("SelectionProperty: Get String Value", "[selectionproperty]") { const std::set list{ "a", "b" }; p.setValue(list); - std::string res; - p.getStringValue(res); - + std::string res = p.stringValue(); CHECK(res == "[\"a\",\"b\"]"); p.setValue({}); - p.getStringValue(res); - CHECK(res == "[]"); + std::string res2 = p.stringValue(); + CHECK(res2 == "[]"); } TEST_CASE("SelectionProperty: Set Lua Value", "[selectionproperty]") {