Skip to content

Commit 2c1b18a

Browse files
committed
Use docstring as tree node description.
1 parent 1a69d3a commit 2c1b18a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/python_bindings.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,12 @@ PYBIND11_MODULE(btpy_cpp, m)
150150
manifest.ports = extractPortsList(type);
151151
manifest.description = "";
152152

153+
// Use the type's docstring as the node description, if it exists.
154+
if (const auto doc = type.attr("__doc__"); !doc.is_none())
155+
{
156+
manifest.description = doc.cast<std::string>();
157+
}
158+
153159
factory.registerBuilder(manifest, makeTreeNodeBuilderFn(type, args, kwargs));
154160
})
155161
.def("register_from_plugin", &BehaviorTreeFactory::registerFromPlugin)

0 commit comments

Comments
 (0)