diff --git a/include/openspace/properties/property.h b/include/openspace/properties/property.h index 9b042bbed7..1d5506f9a9 100644 --- a/include/openspace/properties/property.h +++ b/include/openspace/properties/property.h @@ -167,6 +167,15 @@ public: * \return The unique identifier of this Property */ const std::string& identifier() const; + + /** + * Returns the fully qualified name for this Property that uniquely identifies this + * Property within OpenSpace. It consists of the identifier preceded by + * all levels of PropertyOwner%s separated with .; for example: + * owner1.owner2.identifier. + * \return The fully qualified identifier for this Property + */ + std::string fullyQualifiedIdentifier() const; /** * Returns the PropertyOwner of this Property or nullptr, if it does not @@ -189,7 +198,7 @@ public: * key. * \return The human-readable GUI name for this Property */ - const std::string& guiName() const; + std::string guiName() const; /** * Sets the identifier of the group that this Property belongs to. Property groups can diff --git a/src/properties/property.cpp b/src/properties/property.cpp index 81347f43bd..d634887101 100644 --- a/src/properties/property.cpp +++ b/src/properties/property.cpp @@ -22,7 +22,9 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include "openspace/properties/property.h" +#include + +#include #include @@ -63,6 +65,17 @@ const std::string& Property::identifier() const { return _identifier; } +std::string Property::fullyQualifiedIdentifier() const { + std::string identifier = _identifier; + PropertyOwner* currentOwner = owner(); + while (currentOwner) { + std::string ownerId = currentOwner->name(); + identifier = ownerId + "." + identifier; + currentOwner = currentOwner->owner(); + } + return identifier; +} + boost::any Property::get() const { return boost::any(); } @@ -85,7 +98,7 @@ int Property::typeLua() const { return LUA_TNONE; } -const std::string& Property::guiName() const { +std::string Property::guiName() const { std::string result; _metaData.getValue(_metaDataKeyGuiName, result); return std::move(result);