@@ -108,10 +108,12 @@ PortsList extractPortsList(const py::type& type)
108108 return ports;
109109}
110110
111- NodeBuilder makeTreeNodeBuilderFn (const py::type& type)
111+ NodeBuilder makeTreeNodeBuilderFn (const py::type& type, const py::args& args,
112+ const py::kwargs& kwargs)
112113{
113- return [type](const auto & name, const auto & config) -> auto {
114- py::object obj = type (name, config);
114+ return [=](const auto & name, const auto & config) -> auto {
115+ py::object obj;
116+ obj = type (name, config, *args, **kwargs);
115117
116118 // TODO: Increment the object's reference count or else it
117119 // will be GC'd at the end of this scope. The downside is
@@ -135,7 +137,8 @@ PYBIND11_MODULE(btpy_cpp, m)
135137 py::class_<BehaviorTreeFactory>(m, " BehaviorTreeFactory" )
136138 .def (py::init ())
137139 .def (" register" ,
138- [](BehaviorTreeFactory& factory, const py::type type) {
140+ [](BehaviorTreeFactory& factory, const py::type type, const py::args& args,
141+ const py::kwargs& kwargs) {
139142 const std::string name = type.attr (" __name__" ).cast <std::string>();
140143
141144 TreeNodeManifest manifest;
@@ -144,7 +147,7 @@ PYBIND11_MODULE(btpy_cpp, m)
144147 manifest.ports = extractPortsList (type);
145148 manifest.description = " " ;
146149
147- factory.registerBuilder (manifest, makeTreeNodeBuilderFn (type));
150+ factory.registerBuilder (manifest, makeTreeNodeBuilderFn (type, args, kwargs ));
148151 })
149152 .def (" create_tree_from_text" ,
150153 [](BehaviorTreeFactory& factory, const std::string& text) -> Tree {
0 commit comments