@@ -94,7 +94,7 @@ py::object BindingBase::GetAttr(Base* self, const std::string& s, bool doThrowEx
9494 // / Search if there is a link with the given name.
9595 // / If this is the case returns the corresponding python type.
9696 if (BaseLink* l = self->findLink (s))
97- return py::cast (l-> getLinkedBase () );
97+ return py::cast (l);
9898
9999 // / Search if we are quering for a 'magic' and private __data__ property
100100 // / this one allows to traverse all the data in the object
@@ -400,6 +400,12 @@ py::object BindingBase::getData(Base& self, const std::string& s)
400400 return py::none ();
401401}
402402
403+
404+ std::string BindingBase::getPathName (Base& self)
405+ {
406+ return self.toBaseNode () ? self.toBaseNode ()->getPathName () : self.toBaseObject ()->getPathName ();
407+ }
408+
403409void moduleAddBase (py::module &m)
404410{
405411 py::class_<Base, Base::SPtr> base (m, " Base" , py::dynamic_attr (), doc::base::BaseClass);
@@ -425,7 +431,7 @@ void moduleAddBase(py::module &m)
425431 base.def (" getLinks" , &BindingBase::getLinks, pybind11::return_value_policy::reference, sofapython3::doc::base::getLinks);
426432 base.def (" addData" , &BindingBase::addData, " name" _a, " value" _a = py::none (), " default" _a = py::none (), " help" _a = " " , " group" _a = " " , " type" _a = " " , sofapython3::doc::base::addData);
427433 base.def (" addData" , &BindingBase::addDataFromData, sofapython3::doc::base::addDataInitialized);
428- base.def (" addLink" , &BindingBase::addLink, " name" _a, " value" _a, " help" _a = " " , sofapython3::doc::base::addLink);
434+ base.def (" addLink" , &BindingBase::addLink, " name" _a, " value" _a = py::none () , " help" _a = " " , sofapython3::doc::base::addLink);
429435 base.def (" __getattr__" , &BindingBase::__getattr__);
430436 base.def (" __setattr__" , &BindingBase::__setattr__);
431437 base.def (" getData" , &BindingBase::getData, sofapython3::doc::base::getData);
@@ -434,6 +440,7 @@ void moduleAddBase(py::module &m)
434440 base.def (" getLoggedMessagesAsString" , &BindingBase::getLoggedMessagesAsString, sofapython3::doc::base::getLoggedMessagesAsString);
435441 base.def (" countLoggedMessages" , &BindingBase::countLoggedMessages, sofapython3::doc::base::countLoggedMessages);
436442 base.def (" clearLoggedMessages" , &BindingBase::clearLoggedMessages, sofapython3::doc::base::clearLoggedMessages);
443+ base.def (" getPathName" , &BindingBase::getPathName);
437444}
438445
439446} // / namespace sofapython3
0 commit comments