Merge branch 'master' into feature/model-animation

* Resolve conflicts

* Master has error with changing focus
This commit is contained in:
Malin Ejdbo
2021-04-21 10:23:10 +02:00
137 changed files with 1690 additions and 1910 deletions

View File

@@ -0,0 +1,65 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2021 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __OPENSPACE_CORE___DOUBLELISTPROPERTY___H__
#define __OPENSPACE_CORE___DOUBLELISTPROPERTY___H__
#include <openspace/properties/listproperty.h>
namespace openspace::properties {
class DoubleListProperty : public ListProperty<double> {
public:
DoubleListProperty(Property::PropertyInfo info);
DoubleListProperty(Property::PropertyInfo info, std::vector<double> values);
using TemplateProperty<std::vector<double>>::operator std::vector<double>;
using TemplateProperty<std::vector<double>>::operator=;
};
template <>
std::string PropertyDelegate<TemplateProperty<std::vector<double>>>::className();
template <>
template <>
std::vector<double>
PropertyDelegate<TemplateProperty<std::vector<double>>>::fromLuaValue(
lua_State* state, bool& success);
template <>
template <>
bool PropertyDelegate<TemplateProperty<std::vector<double>>>::toLuaValue(
lua_State* state, const std::vector<double>& value);
template <>
int PropertyDelegate<TemplateProperty<std::vector<double>>>::typeLua();
template <>
template <>
bool PropertyDelegate<TemplateProperty<std::vector<double>>>::toString(
std::string& outValue, const std::vector<double>& inValue);
} // namespace openspace::properties
#endif // __OPENSPACE_CORE___DOUBLELISTPROPERTY___H__

View File

@@ -0,0 +1,64 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2021 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __OPENSPACE_CORE___INTLISTPROPERTY___H__
#define __OPENSPACE_CORE___INTLISTPROPERTY___H__
#include <openspace/properties/listproperty.h>
namespace openspace::properties {
class IntListProperty : public ListProperty<int> {
public:
IntListProperty(Property::PropertyInfo info);
IntListProperty(Property::PropertyInfo info, std::vector<int> values);
using TemplateProperty<std::vector<int>>::operator std::vector<int>;
using TemplateProperty<std::vector<int>>::operator=;
};
template <>
std::string PropertyDelegate<TemplateProperty<std::vector<int>>>::className();
template <>
template <>
std::vector<int> PropertyDelegate<TemplateProperty<std::vector<int>>>::fromLuaValue(
lua_State* state, bool& success);
template <>
template <>
bool PropertyDelegate<TemplateProperty<std::vector<int>>>::toLuaValue(
lua_State* state, const std::vector<int>& value);
template <>
int PropertyDelegate<TemplateProperty<std::vector<int>>>::typeLua();
template <>
template <>
bool PropertyDelegate<TemplateProperty<std::vector<int>>>::toString(
std::string& outValue, const std::vector<int>& inValue);
} // namespace openspace::properties
#endif // __OPENSPACE_CORE___INTLISTPROPERTY___H__

View File

@@ -0,0 +1,66 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2021 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __OPENSPACE_CORE___STRINGLISTPROPERTY___H__
#define __OPENSPACE_CORE___STRINGLISTPROPERTY___H__
#include <openspace/properties/listproperty.h>
#include <string>
namespace openspace::properties {
class StringListProperty : public ListProperty<std::string> {
public:
StringListProperty(Property::PropertyInfo info);
StringListProperty(Property::PropertyInfo info, std::vector<std::string> values);
using TemplateProperty<std::vector<std::string>>::operator std::vector<std::string>;
using TemplateProperty<std::vector<std::string>>::operator=;
};
template <>
std::string PropertyDelegate<TemplateProperty<std::vector<std::string>>>::className();
template <>
template <>
std::vector<std::string>
PropertyDelegate<TemplateProperty<std::vector<std::string>>>::fromLuaValue(
lua_State* state, bool& success);
template <>
template <>
bool PropertyDelegate<TemplateProperty<std::vector<std::string>>>::toLuaValue(
lua_State* state, const std::vector<std::string>& value);
template <>
int PropertyDelegate<TemplateProperty<std::vector<std::string>>>::typeLua();
template <>
template <>
bool PropertyDelegate<TemplateProperty<std::vector<std::string>>>::toString(
std::string& outValue, const std::vector<std::string>& inValue);
} // namespace openspace::properties
#endif // __OPENSPACE_CORE___STRINGLISTPROPERTY___H__

View File

@@ -0,0 +1,46 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2021 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __OPENSPACE_CORE___LISTPROPERTY___H__
#define __OPENSPACE_CORE___LISTPROPERTY___H__
#include <openspace/properties/templateproperty.h>
#include <vector>
namespace openspace::properties {
template <typename T>
class ListProperty : public TemplateProperty<std::vector<T>> {
public:
ListProperty(Property::PropertyInfo info);
ListProperty(Property::PropertyInfo info, std::vector<T> values);
virtual ~ListProperty() = 0;
};
} // namespace openspace::properties
#include "openspace/properties/listproperty.inl"
#endif // __OPENSPACE_CORE___LISTPROPERTY___H__

View File

@@ -22,18 +22,20 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __OPENSPACE_CORE___STRINGLISTPROPERTY___H__
#define __OPENSPACE_CORE___STRINGLISTPROPERTY___H__
#include <openspace/properties/templateproperty.h>
#include <string>
#include <vector>
namespace openspace::properties {
REGISTER_TEMPLATEPROPERTY_HEADER(StringListProperty, std::vector<std::string>)
template <typename T>
ListProperty<T>::ListProperty(Property::PropertyInfo info)
: TemplateProperty<std::vector<T>>(std::move(info))
{}
template <typename T>
ListProperty<T>::ListProperty(Property::PropertyInfo info, std::vector<T> values)
: TemplateProperty<std::vector<T>>(std::move(info), std::move(values))
{}
template <typename T>
ListProperty<T>::~ListProperty() {}
} // namespace openspace::properties
#endif // __OPENSPACE_CORE___STRINGLISTPROPERTY___H__

View File

@@ -46,7 +46,6 @@ public:
int typeLua() const override;
bool getStringValue(std::string& value) const override;
bool setStringValue(std::string value) override;
T minValue() const;
void setMinValue(T value);
@@ -66,10 +65,8 @@ public:
using TemplateProperty<T>::operator=;
void setInterpolationTarget(std::any value) override;
void setLuaInterpolationTarget(lua_State* state) override;
void setStringInterpolationTarget(std::string value) override;
void interpolateValue(float t,
ghoul::EasingFunc<float> easingFunc = nullptr) override;

View File

@@ -75,16 +75,6 @@ namespace openspace::properties {
\
template <> \
template <> \
TYPE PropertyDelegate<TemplateProperty<TYPE>>::fromString(const std::string& value, \
bool& success); \
\
template <> \
template <> \
TYPE PropertyDelegate<NumericalProperty<TYPE>>::fromString(const std::string& value, \
bool& success); \
\
template <> \
template <> \
bool PropertyDelegate<TemplateProperty<TYPE>>::toString(std::string& outValue, \
const TYPE& inValue); \
\
@@ -98,7 +88,6 @@ namespace openspace::properties {
DEFAULT_MIN_VALUE, DEFAULT_MAX_VALUE, \
DEFAULT_STEPPING, FROM_LUA_LAMBDA_EXPRESSION, \
TO_LUA_LAMBDA_EXPRESSION, \
FROM_STRING_LAMBDA_EXPRESSION, \
TO_STRING_LAMBDA_EXPRESSION, LUA_TYPE) \
template <> \
std::string PropertyDelegate<TemplateProperty<TYPE>>::className() \
@@ -187,25 +176,6 @@ namespace openspace::properties {
\
template <> \
template <> \
TYPE PropertyDelegate<TemplateProperty<TYPE>>::fromString(const std::string& value, \
bool& success) \
{ \
return FROM_STRING_LAMBDA_EXPRESSION(value, success); \
} \
\
template <> \
template <> \
TYPE PropertyDelegate<NumericalProperty<TYPE>>::fromString(const std::string& value, \
bool& success) \
{ \
return PropertyDelegate<TemplateProperty<TYPE>>::fromString<TYPE>( \
value, \
success \
); \
} \
\
template <> \
template <> \
bool PropertyDelegate<TemplateProperty<TYPE>>::toString(std::string& outValue, \
const TYPE& inValue) \
{ \
@@ -336,18 +306,6 @@ bool NumericalProperty<T>::getStringValue(std::string& value) const {
return success;
}
template <typename T>
bool NumericalProperty<T>::setStringValue(std::string value) {
bool success = false;
T thisValue = PropertyDelegate<NumericalProperty<T>>::template fromString<T>(
value, success
);
if (success) {
TemplateProperty<T>::set(std::any(std::move(thisValue)));
}
return success;
}
template <typename T>
T NumericalProperty<T>::minValue() const {
return _minimumValue;
@@ -442,19 +400,6 @@ void NumericalProperty<T>::setLuaInterpolationTarget(lua_State* state) {
}
}
template <typename T>
void NumericalProperty<T>::setStringInterpolationTarget(std::string value) {
bool success = false;
T thisValue = PropertyDelegate<NumericalProperty<T>>::template fromString<T>(
value,
success
);
if (success) {
_interpolationStart = TemplateProperty<T>::_value;
_interpolationEnd = std::move(thisValue);
}
}
template <typename T>
void NumericalProperty<T>::interpolateValue(float t,
ghoul::EasingFunc<float> easingFunction)

View File

@@ -44,8 +44,7 @@ class PropertyOwner;
* used as a URI. This class is an abstract base class and each subclass (most notable
* TemplateProperty) needs to implement the methods Property::className, Property::get,
* Property::set, Property::type(), Property::getLuaValue, Property::setLuaValue,
* Property::getStringValue, Property::setStringValue and Property::typeLua to make full
* use of the infrastructure.
* Property::getStringValue, and Property::typeLua to make full use of the infrastructure.
* The most common types can be implemented by creating a specialized instantiation of
* TemplateProperty, which provides default implementations for these methods.
*
@@ -217,8 +216,7 @@ public:
/**
* This method encodes the encapsulated \p value of this Property as a
* <code>std::string</code>. The specific details of this serialization is up to the
* property developer. The implementation has to be synchronized with the
* Property::setStringValue method. The default implementation is a no-op.
* property developer. The default implementation is a no-op.
*
* \param value The value to which the Property will be encoded
* \return \p true if the encoding succeeded, \p false otherwise
@@ -235,18 +233,6 @@ public:
*/
std::string getStringValue() const;
/**
* This method sets the value encapsulated by this Property by deserializing the
* passed <code>std::string</code>. The specific details of the deserialization are up
* to the Property developer. The implementation has to be synchronized with the
* Property::getLuaValue method. The default implementation is a no-op.
*
* \param value The value from which the Property will be decoded
* \return \c true if the decoding and setting of the value succeeded, \c false
* otherwise
*/
virtual bool setStringValue(std::string value);
/**
* This method registers a \p callback function that will be called every time if
* either Property:set or Property::setLuaValue was called with a value that is
@@ -385,9 +371,9 @@ public:
/**
* This method determines if this Property should be read-only in external
* applications. This setting is only a hint and does not need to be followed by GUI
* applications and does not have any effect on the Property::set,
* Property::setLuaValue, or Property::setStringValue methods. The value is stored in
* the metaData Dictionary with the key: \c isReadOnly. The default value is \c false.
* applications and does not have any effect on the Property::set or
* Property::setLuaValue methods. The value is stored in the metaData Dictionary
* with the key: \c isReadOnly. The default value is \c false.
*
* \param state \c true if the Property should be read only, \c false otherwise
*/
@@ -456,7 +442,6 @@ public:
/// Interpolation methods
virtual void setInterpolationTarget(std::any value);
virtual void setLuaInterpolationTarget(lua_State* state);
virtual void setStringInterpolationTarget(std::string value);
virtual void interpolateValue(float t,
ghoul::EasingFunc<float> easingFunction = nullptr);

View File

@@ -150,9 +150,6 @@ public:
*/
static int typeLua();
template <typename U>
static U fromString(const std::string& value, bool& success);
template <typename U>
static bool toString(std::string& outValue, const U& inValue);
};

View File

@@ -91,11 +91,4 @@ bool PropertyDelegate<T>::toString(std::string&, const U&) {
return false;
}
template <typename T>
template <typename U>
U PropertyDelegate<T>::fromString(const std::string&, bool&) {
static_assert(sizeof(T) == 0,
"Unimplemented PropertyDelegate::fromString specialization");
}
} // namespace openspace::properties

View File

@@ -27,62 +27,120 @@
#include <openspace/properties/templateproperty.h>
#include <set>
#include <vector>
namespace openspace::properties {
class SelectionProperty : public TemplateProperty<std::vector<int>> {
public:
struct Option {
int value;
std::string description;
};
class SelectionProperty : public TemplateProperty<std::set<std::string>> {
public:
SelectionProperty(Property::PropertyInfo info);
void addOption(Option option);
void removeOptions();
const std::vector<Option>& options() const;
/**
* This method sets the stored value to the provided value <code>val</code>.
* If the value is different, the listeners are notified. It also removes any
* invalid keys in the input set. A key is invalid if it does not correspond to
* an existing option in the SelectionProperty
*
* \param val The new value for this SelectionProperty
*/
void setValue(std::set<std::string> val) override;
using TemplateProperty<std::vector<int>>::operator std::vector<int>;
/**
* Checks if an option given by the provided <code>key</code> exists.
*
* \param key The key that should be checked for existence
* \return \c if the option exists; \c false otherwise
*/
bool hasOption(const std::string& key) const;
using TemplateProperty<std::vector<int>>::operator=;
/**
* Checks if an option given by the provided <code>key</code> is selected.
*
* \param key The key that should be checked
* \return \c true if the option is selected; \c false otherwise
*/
bool isSelected(const std::string& key) const;
/**
* Checks if the SelectionProperty has any selected values, that is, if its
* value is empty.
*
* \return \c true if there are selected options; \c false otherwise
*/
bool hasSelected() const;
/**
* Returns all available options for this SelectionProperty. Should be
* sorted alphabetically.
*
* \return A list of all available options
*/
const std::vector<std::string>& options() const;
/**
* This method sets all available options at once, removing any potential duplicates.
* If a selection exists, it is updated to that any selected option that does not
* match the new set of options is removed.
*
* \param keys The keys for the options to be set
*/
void setOptions(const std::vector<std::string>& keys);
/**
* Adds an individual option, if it did not already exist.
*
* \param key The key for the option to be added
*/
void addOption(const std::string& key);
/**
* This method clears the selection list, that is the value of this SelectionProperty
*/
void clearSelection();
/**
* This method clears the options list. As the selection must match the available
* options, the selection list is cleared as well.
*/
void clearOptions();
using TemplateProperty<std::set<std::string>>::operator std::set<std::string>;
using TemplateProperty<std::set<std::string>>::operator=;
private:
static const std::string OptionsKey;
void sortOptions();
bool removeInvalidKeys(std::set<std::string>& keys);
std::string generateAdditionalJsonDescription() const override;
/// The list of options which have been registered with this OptionProperty
std::vector<Option> _options;
std::vector<int> _values;
// A list of all available options that can be selected
std::vector<std::string> _options;
};
template <>
std::string PropertyDelegate<TemplateProperty<std::vector<int>>>::className();
std::string PropertyDelegate<TemplateProperty<std::set<std::string>>>::className();
template <>
template <>
std::vector<int> PropertyDelegate<TemplateProperty<std::vector<int>>>::fromLuaValue(
lua_State* state, bool& success);
std::set<std::string>
PropertyDelegate<TemplateProperty<std::set<std::string>>>::fromLuaValue(lua_State* state,
bool& success);
template <>
template <>
bool PropertyDelegate<TemplateProperty<std::vector<int>>>::toLuaValue(lua_State* state,
const std::vector<int>& value);
bool PropertyDelegate<TemplateProperty<std::set<std::string>>>::toLuaValue(
lua_State* state, const std::set<std::string>& value);
template <>
int PropertyDelegate<TemplateProperty<std::vector<int>>>::typeLua();
int PropertyDelegate<TemplateProperty<std::set<std::string>>>::typeLua();
template <>
template <>
std::vector<int> PropertyDelegate<TemplateProperty<std::vector<int>>>::fromString(
const std::string& value, bool& success);
template <>
template <>
bool PropertyDelegate<TemplateProperty<std::vector<int>>>::toString(
std::string& outValue, const std::vector<int>& inValue);
bool PropertyDelegate<TemplateProperty<std::set<std::string>>>::toString(
std::string& outValue, const std::set<std::string>& inValue);
} // namespace openspace::properties

View File

@@ -118,7 +118,7 @@ public:
bool getLuaValue(lua_State* state) const override;
/**
* Sets the value of this TemplateProprty by decoding the object at the top of the Lua
* Sets the value of this TemplateProperty by decoding the object at the top of the Lua
* stack and, if successful, assigning it using the Property::set method. The decoding
* is performed by calling the PropertyDelegate::fromLuaValue with the template
* parameter <code>T</code> as argument. If the decoding is successful, the new value
@@ -132,10 +132,18 @@ public:
/// \see Property::typeLua
int typeLua() const override;
/**
* This method encodes the stored value into a std::string object. The encoding is
* performed by calling PropertyDelegate::toStringValue with the template parameter
* <code>T</code> as an argument. This method has to be specialized for each new
* type, or a compile-time error will occur. The resulting encoding must also be a
* valid JSON representation fo the property.
*
* \param value The string object in which to store the resulting encoding
* \return \c true if the encoding succeeded; \c false otherwise
*/
bool getStringValue(std::string& value) const override;
bool setStringValue(std::string value) override;
/**
* Returns the description for this TemplateProperty as a Lua script that returns a
* table on execution.
@@ -169,15 +177,15 @@ public:
* the TemplateProperty::set method. It will be done internally by this method and it
* allows assignments such as <code>prop = T(1)</code>.
*
* \param val The value that should be set.
* \param val The value that should be set
*/
TemplateProperty<T>& operator=(T val);
/**
* These method sets the stored value to the provided value <code>val</code>,
* moving it into place. This move only happens if the provided value <code>val</code>
* This method sets the stored value to the provided value <code>val</code>,
* moving it into place. The move only happens if the provided value <code>val</code>
* is different from the stored value, which needs an operator== to exist for the type
* <code>T</code>. If the value are different, the listeners are notified.
* <code>T</code>. If the value is different, the listeners are notified.
*
* \param val The new value for this TemplateProperty
*/

View File

@@ -59,11 +59,6 @@ namespace openspace::properties {
\
template <> \
template <> \
TYPE PropertyDelegate<TemplateProperty<TYPE>>::fromString(const std::string& value, \
bool& success); \
\
template <> \
template <> \
bool PropertyDelegate<TemplateProperty<TYPE>>::toString(std::string& outValue, \
const TYPE& inValue);
@@ -86,7 +81,6 @@ namespace openspace::properties {
#define REGISTER_TEMPLATEPROPERTY_SOURCE(CLASS_NAME, TYPE, DEFAULT_VALUE, \
FROM_LUA_LAMBDA_EXPRESSION, \
TO_LUA_LAMBDA_EXPRESSION, \
FROM_STRING_LAMBDA_EXPRESSION, \
TO_STRING_LAMBDA_EXPRESSION, LUA_TYPE) \
template <> \
std::string PropertyDelegate<TemplateProperty<TYPE>>::className() \
@@ -124,14 +118,6 @@ namespace openspace::properties {
\
template <> \
template <> \
TYPE PropertyDelegate<TemplateProperty<TYPE>>::fromString(const std::string& value, \
bool& success) \
{ \
return FROM_STRING_LAMBDA_EXPRESSION(value, success); \
} \
\
template <> \
template <> \
bool PropertyDelegate<TemplateProperty<TYPE>>::toString(std::string& outValue, \
const TYPE& inValue) \
{ \
@@ -194,11 +180,7 @@ std::any TemplateProperty<T>::get() const {
template <typename T>
void TemplateProperty<T>::set(std::any value) {
T v = std::any_cast<T>(std::move(value));
if (v != _value) {
_value = std::move(v);
notifyChangeListeners();
_isValueDirty = true;
}
setValue(v);
}
template <typename T>
@@ -242,17 +224,4 @@ bool TemplateProperty<T>::getStringValue(std::string& value) const {
return success;
}
template <typename T>
bool TemplateProperty<T>::setStringValue(std::string value) {
bool success = false;
T thisValue = PropertyDelegate<TemplateProperty<T>>::template fromString<T>(
value,
success
);
if (success) {
set(std::any(thisValue));
}
return success;
}
} // namespace openspace::properties