Skip to content

Commit f1bd435

Browse files
committed
[Sofa.Core] Add an attribute 'link' to Binding_BaseData.
So we can write: object.position.link instead of object.position.getLinkPath() Which will make the syntax a bit more compact. Signed-off-by: Damien Marchal <damien.marchal@univ-lille1.fr>
1 parent e7a9eaf commit f1bd435

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ py::object __getattr__(py::object self, const std::string& s)
137137
if(s == "value")
138138
return PythonFactory::valueToPython_ro(py::cast<BaseData*>(self));
139139

140+
if(s == "link")
141+
return py::cast((py::cast<BaseData*>(self))->getLinkPath());
142+
140143
/// BaseData does not support dynamic attributes, if you think this is an important feature
141144
/// please request for its integration.
142145
throw py::attribute_error("There is no attribute '"+s+"'");

0 commit comments

Comments
 (0)