Skip to content

Commit 0200240

Browse files
committed
Remove the implementation of getPathName as it is now in BaseData
See: sofa-framework/sofa#5759
1 parent 8ba1e2c commit 0200240

File tree

2 files changed

+3
-23
lines changed

2 files changed

+3
-23
lines changed

Plugin/src/SofaPython3/DataHelper.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,7 @@ std::ostream& operator<<(std::ostream& out, const py::buffer_info& p)
9595

9696
std::string getPathTo(Base* b)
9797
{
98-
BaseNode* node = dynamic_cast<BaseNode*>(b);
99-
if(node)
100-
return node->getPathName();
101-
BaseObject* object = dynamic_cast<BaseObject*>(b);
102-
if(object)
103-
return object->getPathName();
104-
105-
assert(true && "Only Base & BaseObject are supported");
106-
return "";
98+
return b->getPathName();
10799
}
108100

109101
const char* getFormat(const AbstractTypeInfo& nfo)

bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseData.cpp

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,6 @@ using sofa::defaulttype::AbstractTypeInfo;
4545
namespace sofapython3
4646
{
4747

48-
std::string getPathName(BaseData& self)
49-
{
50-
Base* b= self.getOwner();
51-
std::string prefix = getPathTo(b);
52-
return prefix+"."+self.getName();
53-
}
54-
55-
std::string getLinkPath(BaseData& self)
56-
{
57-
return "@"+getPathName(self);
58-
}
59-
6048
bool hasChanged(BaseData& data)
6149
{
6250
if (data.isDirty()) {
@@ -230,8 +218,8 @@ void moduleAddBaseData(py::module& m)
230218
data.def("getOwner", &getOwner, sofapython3::doc::baseData::getOwner);
231219
data.def("getParent", &BaseData::getParent, sofapython3::doc::baseData::getParent);
232220
data.def("typeName", [](BaseData& data){ return data.getValueTypeInfo()->name(); }, sofapython3::doc::baseData::typeName);
233-
data.def("getPathName", getPathName, sofapython3::doc::baseData::getPathName);
234-
data.def("getLinkPath", getLinkPath, sofapython3::doc::baseData::getLinkPath);
221+
data.def("getPathName", &BaseData::getPathName, sofapython3::doc::baseData::getPathName);
222+
data.def("getLinkPath", &BaseData::getLinkPath, sofapython3::doc::baseData::getLinkPath);
235223
data.def("hasChanged", hasChanged, sofapython3::doc::baseData::hasChanged);
236224
data.def("isSet", isSet, sofapython3::doc::baseData::isSet);
237225
data.def("toList", toList, sofapython3::doc::baseData::toList);

0 commit comments

Comments
 (0)