Skip to content

Commit f1ac0f0

Browse files
authored
Fix BaseMeshTopology inheritance (#385)
1 parent b13cf03 commit f1ac0f0

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ using namespace sofa::core::topology;
3737
namespace sofapython3 {
3838

3939
void moduleAddBaseMeshTopology(py::module& m) {
40-
py::class_<BaseMeshTopology, Base, py_shared_ptr<BaseMeshTopology>> c (m, "BaseMeshTopology");
40+
py::class_<BaseMeshTopology, Topology, py_shared_ptr<BaseMeshTopology>> c (m, "BaseMeshTopology");
4141

4242
/// register the BaseMeshTopology binding in the downcasting subsystem
4343
PythonFactory::registerType<BaseMeshTopology>([](sofa::core::objectmodel::Base* object)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ using namespace sofa::core::topology;
3636
namespace sofapython3 {
3737

3838
void moduleAddTopology(py::module& m) {
39-
py::class_<Topology, Base, py_shared_ptr<Topology>> c (m, "Topology");
39+
py::class_<Topology, BaseObject, py_shared_ptr<Topology>> c (m, "Topology");
4040
}
4141

4242
} // namespace sofapython3

bindings/Sofa/tests/Core/BaseObject.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,12 @@ def test_getName(self):
6464

6565
def test_getCategories(self):
6666
root = create_scene("rootNode")
67-
c = root.addObject("MechanicalObject", name="t")
68-
self.assertEqual(c.getCategories(), ["MechanicalState"])
67+
68+
mecha = root.addObject("MechanicalObject", name="t")
69+
self.assertEqual(mecha.getCategories(), ["MechanicalState"])
70+
71+
topo = root.addObject("MeshTopology", name="topology")
72+
self.assertEqual(topo.getCategories(), ["Topology"])
6973

7074
def test_getPathName(self):
7175
root = create_scene("rootNode")

0 commit comments

Comments
 (0)