Skip to content

Commit 9dea46c

Browse files
authored
[Bindings] Follow the renaming of OBJExporter into VisualModelOBJExporter (#220)
1 parent 6d404cd commit 9dea46c

File tree

6 files changed

+25
-21
lines changed

6 files changed

+25
-21
lines changed

bindings/SofaExporter/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ project(Bindings.SofaExporter)
33
set(HEADER_FILES
44
${CMAKE_CURRENT_SOURCE_DIR}/src/SofaExporter/Binding_STLExporter.h
55
${CMAKE_CURRENT_SOURCE_DIR}/src/SofaExporter/Binding_STLExporter_doc.h
6-
${CMAKE_CURRENT_SOURCE_DIR}/src/SofaExporter/Binding_OBJExporter.h
7-
${CMAKE_CURRENT_SOURCE_DIR}/src/SofaExporter/Binding_OBJExporter_doc.h
6+
${CMAKE_CURRENT_SOURCE_DIR}/src/SofaExporter/Binding_VisualModelOBJExporter.h
7+
${CMAKE_CURRENT_SOURCE_DIR}/src/SofaExporter/Binding_VisualModelOBJExporter_doc.h
88
)
99

1010
set(SOURCE_FILES
1111
${CMAKE_CURRENT_SOURCE_DIR}/src/SofaExporter/Binding_STLExporter.cpp
12-
${CMAKE_CURRENT_SOURCE_DIR}/src/SofaExporter/Binding_OBJExporter.cpp
12+
${CMAKE_CURRENT_SOURCE_DIR}/src/SofaExporter/Binding_VisualModelOBJExporter.cpp
1313
${CMAKE_CURRENT_SOURCE_DIR}/src/SofaExporter/Module_SofaExporter.cpp
1414
)
1515

bindings/SofaExporter/src/SofaExporter/Binding_OBJExporter.cpp renamed to bindings/SofaExporter/src/SofaExporter/Binding_VisualModelOBJExporter.cpp

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,32 @@
1919
******************************************************************************/
2020

2121
#include <SofaPython3/Sofa/Core/Binding_Base.h>
22-
#include <SofaExporter/Binding_OBJExporter.h>
23-
#include <SofaExporter/Binding_OBJExporter_doc.h>
22+
#include <SofaExporter/Binding_VisualModelOBJExporter.h>
23+
#include <SofaExporter/Binding_VisualModelOBJExporter_doc.h>
2424

2525
#include <SofaPython3/PythonFactory.h>
2626
#include <SofaPython3/Sofa/Core/Binding_BaseObject.h>
27-
#include <SofaExporter/OBJExporter.h>
27+
#include <SofaExporter/VisualModelOBJExporter.h>
2828

29-
using sofa::component::exporter::OBJExporter;
29+
using sofa::component::exporter::VisualModelOBJExporter;
3030

3131
namespace py { using namespace pybind11; }
3232

3333
namespace sofapython3 {
3434

35-
void moduleAddOBJExporter(py::module &m)
35+
void moduleAddVisualModelOBJExporter(py::module &m)
3636
{
37-
PythonFactory::registerType<OBJExporter>([](sofa::core::objectmodel::Base* object)
37+
PythonFactory::registerType<VisualModelOBJExporter>([](sofa::core::objectmodel::Base* object)
3838
{
39-
return py::cast(dynamic_cast<OBJExporter*>(object));
39+
return py::cast(dynamic_cast<VisualModelOBJExporter*>(object));
4040
});
4141

42-
py::class_<OBJExporter, sofa::core::objectmodel::BaseObject, py_shared_ptr<OBJExporter>> p(m, "OBJExporter");
42+
py::class_<VisualModelOBJExporter, sofa::core::objectmodel::BaseObject, py_shared_ptr<VisualModelOBJExporter>> p(m, "VisualModelOBJExporter");
4343

44-
p.def("write", &OBJExporter::write, sofapython3::doc::SofaExporter::OBJExporter::write::docstring);
44+
p.def("write", &VisualModelOBJExporter::write, sofapython3::doc::SofaExporter::VisualModelOBJExporter::write::docstring);
45+
46+
SOFA_ATTRIBUTE_DISABLED("v21.12", "PR#2505", "The OBJExporter class has been renamed in VisualModelOBJExporter.")
47+
py::class_<VisualModelOBJExporter, sofa::core::objectmodel::BaseObject, py_shared_ptr<VisualModelOBJExporter>> p_deprecated(m, "OBJExporter");
4548
}
4649

4750
} // namespace sofapython3

bindings/SofaExporter/src/SofaExporter/Binding_OBJExporter.h renamed to bindings/SofaExporter/src/SofaExporter/Binding_VisualModelOBJExporter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@
2424

2525
namespace sofapython3 {
2626

27-
void moduleAddOBJExporter(pybind11::module &m);
27+
void moduleAddVisualModelOBJExporter(pybind11::module &m);
2828

2929
} /// namespace sofapython3

bindings/SofaExporter/src/SofaExporter/Binding_OBJExporter_doc.h renamed to bindings/SofaExporter/src/SofaExporter/Binding_VisualModelOBJExporter_doc.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020

2121
#pragma once
2222

23-
namespace sofapython3::doc::SofaExporter::OBJExporter::write {
23+
namespace sofapython3::doc::SofaExporter::VisualModelOBJExporter::write {
2424

2525
static auto docstring =
2626
R"(
2727
Exports an OBJ file
2828
---------------------------------------
2929
30-
Will export a binary or ascii file depending on the binary flag of OBJExporter
30+
Will export a binary or ascii file depending on the binary flag of VisualModelOBJExporter
3131
Will auto-number the exported files
3232
3333
Example of use:
@@ -40,7 +40,7 @@ static auto docstring =
4040
n = Sofa.Core.Node("root"")
4141
4242
# Add STLExporter
43-
n.addObject("OBJExporter", name="exporter", ...)
43+
n.addObject("VisualModelOBJExporter", name="exporter", ...)
4444
4545
# writes down the stl file
4646
n.exporter.write()

bindings/SofaExporter/src/SofaExporter/Module_SofaExporter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
namespace py = pybind11;
2323

2424
#include <SofaExporter/Binding_STLExporter.h>
25-
#include <SofaExporter/Binding_OBJExporter.h>
25+
#include <SofaExporter/Binding_VisualModelOBJExporter.h>
2626

2727
namespace sofapython3
2828
{
@@ -44,14 +44,14 @@ PYBIND11_MODULE(SofaExporter, m) {
4444
:toctree: _autosummary/_autosummary
4545
4646
SofaExporter.STLExporter
47-
SofaExporter.OBJExporter
47+
SofaExporter.VisualModelOBJExporter
4848
4949
)doc";
5050

5151
py::module::import("Sofa.Core");
5252

5353
moduleAddSTLExporter(m);
54-
moduleAddOBJExporter(m);
54+
moduleAddVisualModelOBJExporter(m);
5555
}
5656

5757
} // namespace sofapython3

examples/liver.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@ def createScene(root):
3535
root.addObject('DefaultAnimationLoop')
3636

3737
root.addObject('VisualStyle', displayFlags="showCollisionModels")
38-
root.addObject('RequiredPlugin', pluginName="SofaOpenglVisual SofaBoundaryCondition SofaGeneralLoader SofaGeneralSimpleFem")
38+
root.addObject('RequiredPlugin', pluginName="SofaImplicitOdeSolver SofaLoader SofaOpenglVisual SofaBoundaryCondition SofaGeneralLoader SofaGeneralSimpleFem")
3939
root.addObject('DefaultPipeline', name="CollisionPipeline")
40-
root.addObject('BruteForceDetection', name="N2")
40+
root.addObject('BruteForceBroadPhase', name="BroadPhase")
41+
root.addObject('BVHNarrowPhase', name="NarrowPhase")
4142
root.addObject('DefaultContactManager', name="CollisionResponse", response="default")
4243
root.addObject('DiscreteIntersection')
4344

0 commit comments

Comments
 (0)