diff --git a/blackboard/blackboard_plan.cpp b/blackboard/blackboard_plan.cpp index acc100b..5278cc5 100644 --- a/blackboard/blackboard_plan.cpp +++ b/blackboard/blackboard_plan.cpp @@ -429,7 +429,7 @@ void BlackboardPlan::_bind_methods() { ClassDB::bind_method(D_METHOD("sync_with_base_plan"), &BlackboardPlan::sync_with_base_plan); ClassDB::bind_method(D_METHOD("set_parent_scope_plan_provider", "callable"), &BlackboardPlan::set_parent_scope_plan_provider); ClassDB::bind_method(D_METHOD("get_parent_scope_plan_provider"), &BlackboardPlan::get_parent_scope_plan_provider); - ClassDB::bind_method(D_METHOD("create_blackboard", "node"), &BlackboardPlan::create_blackboard); + ClassDB::bind_method(D_METHOD("create_blackboard", "node", "parent_scope"), &BlackboardPlan::create_blackboard); ClassDB::bind_method(D_METHOD("populate_blackboard", "blackboard", "overwrite", "node"), &BlackboardPlan::populate_blackboard); // To avoid cluttering the member namespace, we do not export unnecessary properties in this class. diff --git a/doc/source/classes/class_blackboardplan.rst b/doc/source/classes/class_blackboardplan.rst index f19a4c7..88b2ba3 100644 --- a/doc/source/classes/class_blackboardplan.rst +++ b/doc/source/classes/class_blackboardplan.rst @@ -35,16 +35,20 @@ Methods :widths: auto +---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`Blackboard` | :ref:`create_blackboard` **(** Node node **)** | + | :ref:`Blackboard` | :ref:`create_blackboard` **(** Node node, :ref:`Blackboard` parent_scope **)** | +---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`BlackboardPlan` | :ref:`get_base_plan` **(** **)** |const| | +---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | Callable | :ref:`get_parent_scope_plan_provider` **(** **)** |const| | + +---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | bool | :ref:`is_derived` **(** **)** |const| | +---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`populate_blackboard` **(** :ref:`Blackboard` blackboard, bool overwrite, Node node **)** | +---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_base_plan` **(** :ref:`BlackboardPlan` blackboard_plan **)** | +---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | void | :ref:`set_parent_scope_plan_provider` **(** Callable callable **)** | + +---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`sync_with_base_plan` **(** **)** | +---------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -83,7 +87,7 @@ Method Descriptions .. rst-class:: classref-method -:ref:`Blackboard` **create_blackboard** **(** Node node **)** +:ref:`Blackboard` **create_blackboard** **(** Node node, :ref:`Blackboard` parent_scope **)** Constructs a new instance of a :ref:`Blackboard` using this plan. If ``NodePath`` prefetching is enabled, ``node`` will be used to retrieve node instances for ``NodePath`` variables and substitute their values. @@ -103,6 +107,18 @@ Returns the base plan. See :ref:`is_derived` **(** **)** |virtual| | - +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ - | void | :ref:`_exit` **(** **)** |virtual| | - +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ - | String | :ref:`_generate_name` **(** **)** |virtual| |const| | - +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ - | PackedStringArray | :ref:`_get_configuration_warnings` **(** **)** |virtual| |const| | - +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ - | void | :ref:`_setup` **(** **)** |virtual| | - +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`Status` | :ref:`_tick` **(** float delta **)** |virtual| | - +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ - | void | :ref:`abort` **(** **)** | - +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ - | void | :ref:`add_child` **(** :ref:`BTTask` task **)** | - +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ - | void | :ref:`add_child_at_index` **(** :ref:`BTTask` task, int idx **)** | - +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`BTTask` | :ref:`clone` **(** **)** |const| | - +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`Status` | :ref:`execute` **(** float delta **)** | - +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`BTTask` | :ref:`get_child` **(** int idx **)** |const| | - +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ - | int | :ref:`get_child_count` **(** **)** |const| | - +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ - | int | :ref:`get_child_count_excluding_comments` **(** **)** |const| | - +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ - | int | :ref:`get_index` **(** **)** |const| | - +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`BTTask` | :ref:`get_parent` **(** **)** |const| | - +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`BTTask` | :ref:`get_root` **(** **)** |const| | - +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ - | String | :ref:`get_task_name` **(** **)** | - +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ - | bool | :ref:`has_child` **(** :ref:`BTTask` task **)** |const| | - +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ - | void | :ref:`initialize` **(** Node agent, :ref:`Blackboard` blackboard, Node scene_root **)** | - +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ - | bool | :ref:`is_descendant_of` **(** :ref:`BTTask` task **)** |const| | - +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ - | bool | :ref:`is_root` **(** **)** |const| | - +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`BTTask` | :ref:`next_sibling` **(** **)** |const| | - +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ - | void | :ref:`print_tree` **(** int initial_tabs=0 **)** | - +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ - | void | :ref:`remove_child` **(** :ref:`BTTask` task **)** | - +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ - | void | :ref:`remove_child_at_index` **(** int idx **)** | - +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ + +-----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ + | void | :ref:`_enter` **(** **)** |virtual| | + +-----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ + | void | :ref:`_exit` **(** **)** |virtual| | + +-----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ + | String | :ref:`_generate_name` **(** **)** |virtual| |const| | + +-----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ + | PackedStringArray | :ref:`_get_configuration_warnings` **(** **)** |virtual| |const| | + +-----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ + | void | :ref:`_setup` **(** **)** |virtual| | + +-----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`Status` | :ref:`_tick` **(** float delta **)** |virtual| | + +-----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ + | void | :ref:`abort` **(** **)** | + +-----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ + | void | :ref:`add_child` **(** :ref:`BTTask` task **)** | + +-----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ + | void | :ref:`add_child_at_index` **(** :ref:`BTTask` task, int idx **)** | + +-----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`BTTask` | :ref:`clone` **(** **)** |const| | + +-----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`BehaviorTree` | :ref:`editor_get_behavior_tree` **(** **)** | + +-----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`Status` | :ref:`execute` **(** float delta **)** | + +-----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`BTTask` | :ref:`get_child` **(** int idx **)** |const| | + +-----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ + | int | :ref:`get_child_count` **(** **)** |const| | + +-----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ + | int | :ref:`get_child_count_excluding_comments` **(** **)** |const| | + +-----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ + | int | :ref:`get_index` **(** **)** |const| | + +-----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`BTTask` | :ref:`get_parent` **(** **)** |const| | + +-----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`BTTask` | :ref:`get_root` **(** **)** |const| | + +-----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ + | String | :ref:`get_task_name` **(** **)** | + +-----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ + | bool | :ref:`has_child` **(** :ref:`BTTask` task **)** |const| | + +-----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ + | void | :ref:`initialize` **(** Node agent, :ref:`Blackboard` blackboard, Node scene_root **)** | + +-----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ + | bool | :ref:`is_descendant_of` **(** :ref:`BTTask` task **)** |const| | + +-----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ + | bool | :ref:`is_root` **(** **)** |const| | + +-----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`BTTask` | :ref:`next_sibling` **(** **)** |const| | + +-----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ + | void | :ref:`print_tree` **(** int initial_tabs=0 **)** | + +-----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ + | void | :ref:`remove_child` **(** :ref:`BTTask` task **)** | + +-----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ + | void | :ref:`remove_child_at_index` **(** int idx **)** | + +-----------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator @@ -366,6 +368,18 @@ Duplicates the task and its children, copying the exported members. Sub-resource ---- +.. _class_BTTask_method_editor_get_behavior_tree: + +.. rst-class:: classref-method + +:ref:`BehaviorTree` **editor_get_behavior_tree** **(** **)** + +Returns the behavior tree that owns this task. This is only available in the editor. + +.. rst-class:: classref-item-separator + +---- + .. _class_BTTask_method_execute: .. rst-class:: classref-method diff --git a/doc_classes/BTTask.xml b/doc_classes/BTTask.xml index 1c922ee..ff2085c 100644 --- a/doc_classes/BTTask.xml +++ b/doc_classes/BTTask.xml @@ -79,6 +79,12 @@ Duplicates the task and its children, copying the exported members. Sub-resources are shared for efficiency, except for [BBParam] subtypes, which are always copied. Used by the editor to instantiate [BehaviorTree] and copy-paste tasks. + + + + Returns the behavior tree that owns this task. This is only available in the editor. + + diff --git a/doc_classes/BlackboardPlan.xml b/doc_classes/BlackboardPlan.xml index 2be4080..5e3fe24 100644 --- a/doc_classes/BlackboardPlan.xml +++ b/doc_classes/BlackboardPlan.xml @@ -11,6 +11,7 @@ + Constructs a new instance of a [Blackboard] using this plan. If [NodePath] prefetching is enabled, [param node] will be used to retrieve node instances for [NodePath] variables and substitute their values. @@ -21,6 +22,12 @@ Returns the base plan. See [method is_derived]. + + + + Returns the parent scope plan provider - a callable that returns a [BlackboardPlan]. + + @@ -44,6 +51,13 @@ Use with caution, as it will remove variables not present in the base plan. Only use this for custom tooling. + + + + + Sets the parent scope plan provider - a callable that returns a [BlackboardPlan]. Used to provide hints in the inspector. When set, mapping feature becomes available. + +