From 02002407944974d9d4c9810017455a8f3c729f98 Mon Sep 17 00:00:00 2001 From: Damien Marchal Date: Thu, 30 Oct 2025 23:11:00 +0100 Subject: [PATCH] Remove the implementation of getPathName as it is now in BaseData See: https://github.com/sofa-framework/sofa/pull/5759 --- Plugin/src/SofaPython3/DataHelper.cpp | 10 +--------- .../SofaPython3/Sofa/Core/Binding_BaseData.cpp | 16 ++-------------- 2 files changed, 3 insertions(+), 23 deletions(-) diff --git a/Plugin/src/SofaPython3/DataHelper.cpp b/Plugin/src/SofaPython3/DataHelper.cpp index 2f4ab166..df6f5986 100644 --- a/Plugin/src/SofaPython3/DataHelper.cpp +++ b/Plugin/src/SofaPython3/DataHelper.cpp @@ -95,15 +95,7 @@ std::ostream& operator<<(std::ostream& out, const py::buffer_info& p) std::string getPathTo(Base* b) { - BaseNode* node = dynamic_cast(b); - if(node) - return node->getPathName(); - BaseObject* object = dynamic_cast(b); - if(object) - return object->getPathName(); - - assert(true && "Only Base & BaseObject are supported"); - return ""; + return b->getPathName(); } const char* getFormat(const AbstractTypeInfo& nfo) diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseData.cpp b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseData.cpp index 8aed7ffa..25f37de6 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseData.cpp +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseData.cpp @@ -45,18 +45,6 @@ using sofa::defaulttype::AbstractTypeInfo; namespace sofapython3 { -std::string getPathName(BaseData& self) -{ - Base* b= self.getOwner(); - std::string prefix = getPathTo(b); - return prefix+"."+self.getName(); -} - -std::string getLinkPath(BaseData& self) -{ - return "@"+getPathName(self); -} - bool hasChanged(BaseData& data) { if (data.isDirty()) { @@ -230,8 +218,8 @@ void moduleAddBaseData(py::module& m) data.def("getOwner", &getOwner, sofapython3::doc::baseData::getOwner); data.def("getParent", &BaseData::getParent, sofapython3::doc::baseData::getParent); data.def("typeName", [](BaseData& data){ return data.getValueTypeInfo()->name(); }, sofapython3::doc::baseData::typeName); - data.def("getPathName", getPathName, sofapython3::doc::baseData::getPathName); - data.def("getLinkPath", getLinkPath, sofapython3::doc::baseData::getLinkPath); + data.def("getPathName", &BaseData::getPathName, sofapython3::doc::baseData::getPathName); + data.def("getLinkPath", &BaseData::getLinkPath, sofapython3::doc::baseData::getLinkPath); data.def("hasChanged", hasChanged, sofapython3::doc::baseData::hasChanged); data.def("isSet", isSet, sofapython3::doc::baseData::isSet); data.def("toList", toList, sofapython3::doc::baseData::toList);