@@ -108,10 +108,12 @@ PortsList extractPortsList(const py::type& type)
108
108
return ports;
109
109
}
110
110
111
- NodeBuilder makeTreeNodeBuilderFn (const py::type& type)
111
+ NodeBuilder makeTreeNodeBuilderFn (const py::type& type, const py::args& args,
112
+ const py::kwargs& kwargs)
112
113
{
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);
115
117
116
118
// TODO: Increment the object's reference count or else it
117
119
// will be GC'd at the end of this scope. The downside is
@@ -135,7 +137,8 @@ PYBIND11_MODULE(btpy_cpp, m)
135
137
py::class_<BehaviorTreeFactory>(m, " BehaviorTreeFactory" )
136
138
.def (py::init ())
137
139
.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) {
139
142
const std::string name = type.attr (" __name__" ).cast <std::string>();
140
143
141
144
TreeNodeManifest manifest;
@@ -144,7 +147,7 @@ PYBIND11_MODULE(btpy_cpp, m)
144
147
manifest.ports = extractPortsList (type);
145
148
manifest.description = " " ;
146
149
147
- factory.registerBuilder (manifest, makeTreeNodeBuilderFn (type));
150
+ factory.registerBuilder (manifest, makeTreeNodeBuilderFn (type, args, kwargs ));
148
151
})
149
152
.def (" create_tree_from_text" ,
150
153
[](BehaviorTreeFactory& factory, const std::string& text) -> Tree {
0 commit comments