Skip to content

Commit 62c28f9

Browse files
fredroyjnbrunet
andauthored
fix test from ScriptEvent change (#129)
Co-authored-by: Jean-Nicolas Brunet <[email protected]>
1 parent 12c7593 commit 62c28f9

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <SofaPython3/Sofa/Core/Binding_PythonScriptEvent.h>
2222
#include <SofaPython3/PythonFactory.h>
2323
#include <sofa/core/objectmodel/Event.h>
24+
#include <sofa/core/objectmodel/BaseNode.h>
2425
#include <sofa/simulation/Node.h>
2526

2627
/// Makes an alias for the pybind11 namespace to increase readability.
@@ -31,7 +32,7 @@ using namespace pybind11::literals;
3132

3233
SOFA_EVENT_CPP(PythonScriptEvent)
3334

34-
PythonScriptEvent::PythonScriptEvent(sofa::core::sptr<sofa::simulation::Node> sender, const char* eventName, py::object userData)
35+
PythonScriptEvent::PythonScriptEvent(sofa::core::sptr<sofa::core::objectmodel::BaseNode> sender, const char* eventName, py::object userData)
3536
: sofa::core::objectmodel::ScriptEvent(sender,eventName)
3637
, m_userData(userData){}
3738

@@ -45,7 +46,7 @@ void moduleAddPythonScriptEvent()
4546

4647
py::dict d("type"_a=evt->getClassName(),
4748
"isHandled"_a=evt->isHandled(),
48-
"sender"_a=(evt->getSender().get() ? py::cast(evt->getSender().get()) : py::none()),
49+
"sender"_a=(evt->getSender().get() ? py::cast(dynamic_cast<sofa::simulation::Node*>(evt->getSender().get())) : py::none()),
4950
"event_name"_a=py::cast(evt->getEventName()),
5051
"userData"_a=evt->getUserData()
5152
);

bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_PythonScriptEvent.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
#include <pybind11/pybind11.h>
2424
#include <sofa/core/objectmodel/ScriptEvent.h>
25-
#include <sofa/simulation/Node.h>
25+
#include <sofa/core/objectmodel/BaseNode.h>
2626

2727
#include <SofaPython3/config.h>
2828

@@ -33,7 +33,7 @@ class PythonScriptEvent : public sofa::core::objectmodel::ScriptEvent
3333
{
3434
SOFA_EVENT_H(PythonScriptEvent)
3535
public:
36-
PythonScriptEvent(sofa::core::sptr<sofa::simulation::Node> sender, const char* eventName, pybind11::object userData=pybind11::none());
36+
PythonScriptEvent(sofa::core::sptr<sofa::core::objectmodel::BaseNode> sender, const char* eventName, pybind11::object userData=pybind11::none());
3737
~PythonScriptEvent() override;
3838
pybind11::object getUserData() const { return m_userData; }
3939
inline static const char* GetClassName() { return "PythonScriptEvent"; }

0 commit comments

Comments
 (0)