diff --git a/src/App/DocumentObject.cpp b/src/App/DocumentObject.cpp index 10b6fccf5e..3ceb7fd4a0 100644 --- a/src/App/DocumentObject.cpp +++ b/src/App/DocumentObject.cpp @@ -282,6 +282,16 @@ std::string DocumentObject::getFullName() const { return name; } +std::string DocumentObject::getFullLabel() const { + if(!getDocument()) + return "?"; + + auto name = getDocument()->Label.getStrValue(); + name += "#"; + name += Label.getStrValue(); + return name; +} + const char *DocumentObject::getNameInDocument() const { // Note: It can happen that we query the internal name of an object even if it is not diff --git a/src/App/DocumentObject.h b/src/App/DocumentObject.h index dee7fff9ad..a6bf95f341 100644 --- a/src/App/DocumentObject.h +++ b/src/App/DocumentObject.h @@ -140,6 +140,8 @@ public: std::string getExportName(bool forced=false) const; /// Return the object full name of the form DocName#ObjName std::string getFullName() const override; + /// Return the object full label in the form DocName#ObjName + std::string getFullLabel() const; bool isAttachedToDocument() const override; const char* detachFromDocument() override; /// gets the document in which this Object is handled