Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Plugin/src/SofaPython3/Prefab.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
******************************************************************************/

#pragma once
#include <sofa/simulation/graph/DAGNode.h>
#include <sofa/simulation/Node.h>
#include <sofa/core/objectmodel/DataCallback.h>

#include <sofa/helper/system/FileMonitor.h>
Expand All @@ -28,17 +28,17 @@
namespace sofa::core::objectmodel
{

class SOFAPYTHON3_API BasePrefab : public sofa::simulation::graph::DAGNode
class SOFAPYTHON3_API BasePrefab : public sofa::simulation::Node
{
public:
SOFA_CLASS(BasePrefab, sofa::simulation::graph::DAGNode);
SOFA_CLASS(BasePrefab, sofa::simulation::Node);
};

} // namespace sofa::core::objectmodel

namespace sofapython3
{
using sofa::simulation::graph::DAGNode;
using sofa::simulation::Node;
using sofa::core::objectmodel::BasePrefab;
using sofa::core::objectmodel::DataCallback;

Expand Down
2 changes: 1 addition & 1 deletion Plugin/src/SofaPython3/PythonFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <SofaPython3/PythonFactory.h>
#include <SofaPython3/DataHelper.h>

#include <sofa/simulation/graph/DAGNode.h>
#include <sofa/simulation/Node.h>

#include "sofa/simulation/AnimateBeginEvent.h"
using sofa::simulation::AnimateBeginEvent;
Expand Down
3 changes: 0 additions & 3 deletions Plugin/src/SofaPython3/SceneLoaderPY3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
#include <fstream>
#include <sofa/simulation/Simulation.h>

#include <sofa/simulation/graph/DAGNode.h>
using sofa::simulation::graph::DAGNode;

#include <SofaPython3/PythonEnvironment.h>
#include <SofaPython3/SceneLoaderPY3.h>
#include <SofaPython3/PythonFactory.h>
Expand Down
1 change: 0 additions & 1 deletion bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ bool BindingBase::SetLink(BaseLink* link, py::object value)
return true;
}


void BindingBase::SetAttr(py::object self, const std::string& s, py::object value)
{
Base* self_d = py::cast<Base*>(self);
Expand Down
32 changes: 15 additions & 17 deletions bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_Node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ using sofa::helper::logging::Message;
#include <sofa/helper/DiffLib.h>
using sofa::helper::getClosestMatch;

#include <sofa/simulation/graph/DAGNode.h>
#include <sofa/simulation/Node.h>
using sofa::core::ExecParams;

#include <SofaPython3/LinkPath.h>
Expand Down Expand Up @@ -163,22 +163,20 @@ std::string getLinkPath(Node* node){
return ("@"+node->getPathName()).c_str();
}

py_shared_ptr<Node> __init__noname() {
auto dag_node = sofa::core::objectmodel::New<sofa::simulation::graph::DAGNode>("unnamed");
return std::move(dag_node);
py_shared_ptr<Node> __init_noname__() {
auto node = sofa::core::objectmodel::New<sofa::simulation::Node>("unnamed");
return std::move(node);
}

py_shared_ptr<Node> __init__no_kwargs__(const std::string& name) {
auto dag_node = sofa::core::objectmodel::New<sofa::simulation::graph::DAGNode>(name);
return std::move(dag_node);
py_shared_ptr<Node> __init_named__(const std::string& name) {
auto node = sofa::core::objectmodel::New<sofa::simulation::Node>(name);
return std::move(node);
}

py_shared_ptr<Node> __init__(const std::string& name, const py::kwargs& kwargs) {
auto dag_node = sofa::core::objectmodel::New<sofa::simulation::graph::DAGNode>(name);

setDataFromKwargs(dag_node.get(), kwargs);

return std::move(dag_node);
py_shared_ptr<Node> __init_kwarged__(const std::string& name, const py::kwargs& kwargs) {
auto node = sofa::core::objectmodel::New<sofa::simulation::Node>(name);
setDataFromKwargs(node.get(), kwargs);
return std::move(node);
}

/// Method: init (beware this is not the python __init__, this is sofa's init())
Expand Down Expand Up @@ -681,15 +679,15 @@ void moduleAddNode(py::module &m) {
sofa::core::objectmodel::Context, py_shared_ptr<Node>>
p(m, "Node", sofapython3::doc::sofa::core::Node::Class);

PythonFactory::registerType<sofa::simulation::graph::DAGNode>(
PythonFactory::registerType<sofa::simulation::Node>(
[](sofa::core::objectmodel::Base* object)
{
return py::cast(dynamic_cast<Node*>(object->toBaseNode()));
});

p.def(py::init(&__init__noname), sofapython3::doc::sofa::core::Node::init);
p.def(py::init(&__init__no_kwargs__), sofapython3::doc::sofa::core::Node::init1Arg, py::arg("name"));
p.def(py::init(&__init__), sofapython3::doc::sofa::core::Node::init1Arg);
p.def(py::init(&__init_noname__), sofapython3::doc::sofa::core::Node::init);
p.def(py::init(&__init_named__), sofapython3::doc::sofa::core::Node::init1Arg, py::arg("name"));
p.def(py::init(&__init_kwarged__), sofapython3::doc::sofa::core::Node::init1Arg, py::arg("name"));
p.def("init", &init, sofapython3::doc::sofa::core::Node::initSofa );
p.def("add", &addKwargs, sofapython3::doc::sofa::core::Node::addKwargs);
p.def("addObject", &addObjectKwargs, sofapython3::doc::sofa::core::Node::addObjectKwargs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
#include "SofaPython3/DataHelper.h"
using sofa::simulation::Simulation;

#include <sofa/simulation/graph/DAGSimulation.h>
using sofa::simulation::graph::DAGSimulation;

#include <sofa/simulation/Node.h>
using sofa::simulation::Node;
using namespace pybind11::literals;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
#include <sofa/helper/system/PluginManager.h>
namespace py = pybind11;

#include <sofa/simulation/graph/DAGSimulation.h>
using sofa::simulation::graph::DAGSimulation ;
#include <sofa/simulation/Simulation.h>
using sofa::simulation::Simulation;

#include <sofa/simpleapi/SimpleApi.h>
Expand Down
Loading