Update documentation

This commit is contained in:
Serhii Snitsaruk 2023-07-20 22:15:30 +02:00
parent d2eede3f76
commit 0c2ee8ba8e
21 changed files with 61 additions and 23 deletions

View File

@ -57,7 +57,7 @@ void Blackboard::_bind_methods() {
ClassDB::bind_method(D_METHOD("has_var", "p_key"), &Blackboard::has_var); ClassDB::bind_method(D_METHOD("has_var", "p_key"), &Blackboard::has_var);
ClassDB::bind_method(D_METHOD("set_parent_scope", "p_blackboard"), &Blackboard::set_parent_scope); ClassDB::bind_method(D_METHOD("set_parent_scope", "p_blackboard"), &Blackboard::set_parent_scope);
ClassDB::bind_method(D_METHOD("get_parent_scope"), &Blackboard::get_parent_scope); ClassDB::bind_method(D_METHOD("get_parent_scope"), &Blackboard::get_parent_scope);
ClassDB::bind_method(D_METHOD("erase_var"), &Blackboard::erase_var); ClassDB::bind_method(D_METHOD("erase_var", "p_key"), &Blackboard::erase_var);
ClassDB::bind_method(D_METHOD("prefetch_nodepath_vars", "p_node"), &Blackboard::prefetch_nodepath_vars); ClassDB::bind_method(D_METHOD("prefetch_nodepath_vars", "p_node"), &Blackboard::prefetch_nodepath_vars);
ClassDB::bind_method(D_METHOD("top"), &Blackboard::top); ClassDB::bind_method(D_METHOD("top"), &Blackboard::top);
} }

View File

@ -28,24 +28,34 @@ def get_doc_classes():
"BBColorArray", "BBColorArray",
"BBDictionary", "BBDictionary",
"BBFloat", "BBFloat",
"BBFloatArray",
"BBInt", "BBInt",
"BBIntArray", "BBIntArray",
"BBNode", "BBNode",
"BBParam", "BBParam",
"BBPlane", "BBPlane",
"BBQuat", "BBQuat",
"BBQuaternion",
"BBRealArray", "BBRealArray",
"BBRect2", "BBRect2",
"BBRect2i",
"BBString", "BBString",
"BBStringArray", "BBStringArray",
"BBStringName",
"BBTransform", "BBTransform",
"BBTransform2D", "BBTransform2D",
"BBTransform3D",
"BBVariant", "BBVariant",
"BBVector2", "BBVector2",
"BBVector2Array", "BBVector2Array",
"BBVector2i",
"BBVector3", "BBVector3",
"BBVector3Array", "BBVector3Array",
"BBVector3i",
"BBVector4",
"BBVector4i",
"BehaviorTree", "BehaviorTree",
"BehaviorTreeView",
"Blackboard", "Blackboard",
"BTAction", "BTAction",
"BTAlwaysFail", "BTAlwaysFail",

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="BBFloatArray" inherits="BBParam" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <class name="BBFloatArray" inherits="BBParam" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
<brief_description> <brief_description>
</brief_description> </brief_description>
<description> <description>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="BBQuaternion" inherits="BBParam" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <class name="BBQuaternion" inherits="BBParam" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
<brief_description> <brief_description>
</brief_description> </brief_description>
<description> <description>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="BBRect2i" inherits="BBParam" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <class name="BBRect2i" inherits="BBParam" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
<brief_description> <brief_description>
</brief_description> </brief_description>
<description> <description>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="BBStringName" inherits="BBParam" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <class name="BBStringName" inherits="BBParam" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
<brief_description> <brief_description>
</brief_description> </brief_description>
<description> <description>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="BBTransform3D" inherits="BBParam" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <class name="BBTransform3D" inherits="BBParam" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
<brief_description> <brief_description>
</brief_description> </brief_description>
<description> <description>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="BBVector2i" inherits="BBParam" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <class name="BBVector2i" inherits="BBParam" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
<brief_description> <brief_description>
</brief_description> </brief_description>
<description> <description>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="BBVector3i" inherits="BBParam" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <class name="BBVector3i" inherits="BBParam" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
<brief_description> <brief_description>
</brief_description> </brief_description>
<description> <description>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="BBVector4" inherits="BBParam" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <class name="BBVector4" inherits="BBParam" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
<brief_description> <brief_description>
</brief_description> </brief_description>
<description> <description>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="BBVector4i" inherits="BBParam" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <class name="BBVector4i" inherits="BBParam" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
<brief_description> <brief_description>
</brief_description> </brief_description>
<description> <description>

View File

@ -27,7 +27,8 @@
Start on a cooldown, as if the child was executed before the first BT tick. Start on a cooldown, as if the child was executed before the first BT tick.
</member> </member>
<member name="trigger_on_failure" type="bool" setter="set_trigger_on_failure" getter="get_trigger_on_failure" default="false"> <member name="trigger_on_failure" type="bool" setter="set_trigger_on_failure" getter="get_trigger_on_failure" default="false">
Trigger cooldown, if the child returns [code]FAILURE[/code]. Trigger cooldown, if the child also returns [code]FAILURE[/code].
Otherwise, cooldown will only be triggered when the child returns [code]SUCCESS[/code]
</member> </member>
</members> </members>
</class> </class>

View File

@ -6,7 +6,7 @@
<description> <description>
BT composite that executes tasks simultaneously until one of the criterea is met. BTParallel will execute each task from first to last at least once before returning a result. BT composite that executes tasks simultaneously until one of the criterea is met. BTParallel will execute each task from first to last at least once before returning a result.
If set to [member repeat], the tasks will be executed again, even if they returned [code]SUCCESS[/code] or [code]FAILURE[/code] on the previous tick. If set to [member repeat], the tasks will be executed again, even if they returned [code]SUCCESS[/code] or [code]FAILURE[/code] on the previous tick.
Returns [code]FAILURE[/code] when a required number of tasks return [code]FAILURE[/code]. When not set to [member repeat], if no criteria was met, but all tasks returned [code]SUCCESS[/code] or [code]FAILURE[/code], a [code]FAILURE[/code] will be returned. Returns [code]FAILURE[/code] when a required number of tasks return [code]FAILURE[/code]. When [member repeat] is set to [code]false[/code], if none of the criteria were met, and all child tasks returned [code]SUCCESS[/code] or [code]FAILURE[/code], [BTParallel] will return [code]FAILURE[/code].
Returns [code]SUCCESS[/code] when a required number of tasks return [code]SUCCESS[/code]. Returns [code]SUCCESS[/code] when a required number of tasks return [code]SUCCESS[/code].
Returns [code]RUNNING[/code] after executing all tasks from first to last, and for as long as the above criterea are not met. Returns [code]RUNNING[/code] after executing all tasks from first to last, and for as long as the above criterea are not met.
</description> </description>
@ -14,10 +14,14 @@
</tutorials> </tutorials>
<members> <members>
<member name="num_failures_required" type="int" setter="set_num_failures_required" getter="get_num_failures_required" default="1"> <member name="num_failures_required" type="int" setter="set_num_failures_required" getter="get_num_failures_required" default="1">
When the specified number of child tasks return [code]SUCCESS[/code], [BTParallel] will also return [code]SUCCESS[/code].
</member> </member>
<member name="num_successes_required" type="int" setter="set_num_successes_required" getter="get_num_successes_required" default="1"> <member name="num_successes_required" type="int" setter="set_num_successes_required" getter="get_num_successes_required" default="1">
When the specified number of child tasks return [code]FAILURE[/code], [BTParallel] will also return [code]FAILURE[/code].
</member> </member>
<member name="repeat" type="bool" setter="set_repeat" getter="get_repeat" default="false"> <member name="repeat" type="bool" setter="set_repeat" getter="get_repeat" default="false">
When [code]true[/code], the tasks will be executed again, even if they returned [code]SUCCESS[/code] or [code]FAILURE[/code] on the previous tick.
When [code]false[/code], if none of the criteria were met, and all child tasks returned [code]SUCCESS[/code] or [code]FAILURE[/code], [BTParallel] will return [code]FAILURE[/code].
</member> </member>
</members> </members>
</class> </class>

View File

@ -46,6 +46,9 @@
<member name="blackboard" type="Blackboard" setter="" getter="get_blackboard"> <member name="blackboard" type="Blackboard" setter="" getter="get_blackboard">
[Blackboard] instance that contains data shared by the tasks in [BehaviorTree]. [Blackboard] instance that contains data shared by the tasks in [BehaviorTree].
</member> </member>
<member name="monitor_performance" type="bool" setter="_set_monitor_performance" getter="_get_monitor_performance" default="false">
Add a performance monitor to "Debugger-&gt;Monitors" for each instance of this [BTPlayer].
</member>
<member name="prefetch_nodepath_vars" type="bool" setter="set_prefetch_nodepath_vars" getter="get_prefetch_nodepath_vars" default="true"> <member name="prefetch_nodepath_vars" type="bool" setter="set_prefetch_nodepath_vars" getter="get_prefetch_nodepath_vars" default="true">
If [code]true[/code], any NodePath variables in the [Blackboard] are replaced with references during tree instantiation. References are retrieved by calling [method Node.get_node] of BTPlayer. If [code]true[/code], any NodePath variables in the [Blackboard] are replaced with references during tree instantiation. References are retrieved by calling [method Node.get_node] of BTPlayer.
</member> </member>
@ -61,6 +64,12 @@
Argument [code]p_status[/code] holds the status returned by the behavior tree. Argument [code]p_status[/code] holds the status returned by the behavior tree.
</description> </description>
</signal> </signal>
<signal name="updated">
<param index="0" name="p_status" type="int" />
<description>
Emitted when BTPlayer has finished updating/ticking the tree.
</description>
</signal>
</signals> </signals>
<constants> <constants>
<constant name="IDLE" value="0" enum="UpdateMode"> <constant name="IDLE" value="0" enum="UpdateMode">

View File

@ -1,15 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="BTProbability" inherits="BTDecorator" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd"> <class name="BTProbability" inherits="BTDecorator" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
<brief_description> <brief_description>
BT decorator that executes child with probability. BT decorator that executes child with a given probability.
</brief_description> </brief_description>
<description> <description>
BT decorator that executes its child task with a probability of the [member run_chance]. Returns FAILURE if the execution didn't happen. BT decorator that executes child with a given probability defined by [member run_chance].
Returns the result of the child task if it was executed, otherwise returns [code]FAILURE[/code].
</description> </description>
<tutorials> <tutorials>
</tutorials> </tutorials>
<members> <members>
<member name="run_chance" type="float" setter="set_run_chance" getter="get_run_chance" default="0.5"> <member name="run_chance" type="float" setter="set_run_chance" getter="get_run_chance" default="0.5">
Probability that defines how likely the child task will be executed.
</member> </member>
</members> </members>
</class> </class>

View File

@ -188,6 +188,10 @@
<member name="custom_name" type="String" setter="set_custom_name" getter="get_custom_name" default="&quot;&quot;"> <member name="custom_name" type="String" setter="set_custom_name" getter="get_custom_name" default="&quot;&quot;">
User provided name for the task. If not empty, [code]custom_name[/code] is used by the editor to display the task. See [method get_task_name]. User provided name for the task. If not empty, [code]custom_name[/code] is used by the editor to display the task. See [method get_task_name].
</member> </member>
<member name="elapsed_time" type="float" setter="" getter="get_elapsed_time" default="0.0">
Elapsed time since the task was entered.
Returns 0 when task is not [code]RUNNING[/code].
</member>
<member name="status" type="int" setter="" getter="get_status"> <member name="status" type="int" setter="" getter="get_status">
Last execution [enum TaskStatus] returned by [method _tick]. Last execution [enum TaskStatus] returned by [method _tick].
</member> </member>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="BTWait" inherits="BTAction" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd"> <class name="BTWait" inherits="BTAction" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
<brief_description> <brief_description>
BT action that waits for a [member duration] to pass and returns [code]SUCCESS[/code]. BT action that waits for a [member duration] to pass and then returns [code]SUCCESS[/code].
</brief_description> </brief_description>
<description> <description>
</description> </description>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="BTWaitTicks" inherits="BTAction" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd"> <class name="BTWaitTicks" inherits="BTAction" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
<brief_description> <brief_description>
BT action that waits for a number of ticks to pass and returns SUCCESS. BT action that waits for a specified number of ticks to pass and then returns [code]SUCCESS[/code].
</brief_description> </brief_description>
<description> <description>
</description> </description>
@ -9,6 +9,7 @@
</tutorials> </tutorials>
<members> <members>
<member name="num_ticks" type="int" setter="set_num_ticks" getter="get_num_ticks" default="1"> <member name="num_ticks" type="int" setter="set_num_ticks" getter="get_num_ticks" default="1">
Number of ticks to wait before returning [code]SUCCESS[/code].
</member> </member>
</members> </members>
</class> </class>

View File

@ -22,5 +22,12 @@
Returns name of a [BTTask] status code. Returns name of a [BTTask] status code.
</description> </description>
</method> </method>
<method name="get_task_icon" qualifiers="const">
<return type="Texture2D" />
<param index="0" name="p_class_or_script_path" type="String" />
<description>
Returns the icon texture associated with a task, given its class name or script resource path.
</description>
</method>
</methods> </methods>
</class> </class>

View File

@ -178,9 +178,9 @@ void initialize_limboai_module(ModuleInitializationLevel p_level) {
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) { if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) {
EditorPlugins::add_by_type<LimboAIEditorPlugin>(); EditorPlugins::add_by_type<LimboAIEditorPlugin>();
} else if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE) { } // else if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE) {
GDREGISTER_CLASS(BehaviorTreeView); // GDREGISTER_CLASS(BehaviorTreeView);
} // }
#endif #endif
} }

View File

@ -59,7 +59,7 @@ Ref<Texture2D> LimboUtility::get_task_icon(String p_class_or_script_path) const
void LimboUtility::_bind_methods() { void LimboUtility::_bind_methods() {
ClassDB::bind_method(D_METHOD("decorate_var", "p_variable"), &LimboUtility::decorate_var); ClassDB::bind_method(D_METHOD("decorate_var", "p_variable"), &LimboUtility::decorate_var);
ClassDB::bind_method(D_METHOD("get_status_name", "p_status"), &LimboUtility::get_status_name); ClassDB::bind_method(D_METHOD("get_status_name", "p_status"), &LimboUtility::get_status_name);
ClassDB::bind_method(D_METHOD("get_task_icon"), &LimboUtility::get_task_icon); ClassDB::bind_method(D_METHOD("get_task_icon", "p_class_or_script_path"), &LimboUtility::get_task_icon);
} }
LimboUtility::LimboUtility() { LimboUtility::LimboUtility() {