Util: Function to decorate output variable
This commit is contained in:
parent
95c2496adf
commit
899335d1fe
|
@ -77,7 +77,7 @@ String BTCallMethod::_generate_name() {
|
||||||
method != StringName() ? method : "???",
|
method != StringName() ? method : "???",
|
||||||
args_str,
|
args_str,
|
||||||
node_param.is_valid() && !node_param->to_string().is_empty() ? node_param->to_string() : "???",
|
node_param.is_valid() && !node_param->to_string().is_empty() ? node_param->to_string() : "???",
|
||||||
result_var.is_empty() ? "" : LW_NAME(output_var_prefix) + LimboUtility::get_singleton()->decorate_var(result_var));
|
result_var.is_empty() ? "" : LimboUtility::get_singleton()->decorate_output_var(result_var));
|
||||||
}
|
}
|
||||||
|
|
||||||
BT::Status BTCallMethod::_tick(double p_delta) {
|
BT::Status BTCallMethod::_tick(double p_delta) {
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<class name="BehaviorTreeData" inherits="RefCounted" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
<class name="BehaviorTreeData" inherits="RefCounted" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||||
<brief_description>
|
<brief_description>
|
||||||
Represents current state of a [BehaviorTree] instance.
|
Represents current state of a [BehaviorTree] instance.
|
||||||
</brief_description>
|
</brief_description>
|
||||||
<description>
|
<description>
|
||||||
This class is used by the LimboAI debugger for the serialization and deserialization of [BehaviorTree] instance data.
|
This class is used by the LimboAI debugger for the serialization and deserialization of [BehaviorTree] instance data.
|
||||||
Additionally, it can be used with [BehaviorTreeView] to visualize the current state of a [BehaviorTree] instance. It is meant to be utilized in custom in-game tools.
|
Additionally, it can be used with [BehaviorTreeView] to visualize the current state of a [BehaviorTree] instance. It is meant to be utilized in custom in-game tools.
|
||||||
</description>
|
</description>
|
||||||
<tutorials>
|
<tutorials>
|
||||||
</tutorials>
|
</tutorials>
|
||||||
|
@ -14,8 +14,8 @@
|
||||||
<return type="BehaviorTreeData" />
|
<return type="BehaviorTreeData" />
|
||||||
<param index="0" name="p_tree_instance" type="BTTask" />
|
<param index="0" name="p_tree_instance" type="BTTask" />
|
||||||
<description>
|
<description>
|
||||||
Returns current state of the [param p_tree_instance] encoded as a [BehaviorTreeData], suitable for use with [BehaviorTreeView].
|
Returns current state of the [param p_tree_instance] encoded as a [BehaviorTreeData], suitable for use with [BehaviorTreeView].
|
||||||
Behavior tree instance can be acquired with [method BTPlayer.get_tree_instance].
|
Behavior tree instance can be acquired with [method BTPlayer.get_tree_instance].
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
</methods>
|
</methods>
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<class name="BehaviorTreeView" inherits="Control" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
<class name="BehaviorTreeView" inherits="Control" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||||
<brief_description>
|
<brief_description>
|
||||||
Visualizes the current state of a [BehaviorTree] instance.
|
Visualizes the current state of a [BehaviorTree] instance.
|
||||||
</brief_description>
|
</brief_description>
|
||||||
<description>
|
<description>
|
||||||
Visualizes the current state of a [BehaviorTree] instance. See also [BehaviorTreeData].
|
Visualizes the current state of a [BehaviorTree] instance. See also [BehaviorTreeData].
|
||||||
</description>
|
</description>
|
||||||
<tutorials>
|
<tutorials>
|
||||||
</tutorials>
|
</tutorials>
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
<return type="void" />
|
<return type="void" />
|
||||||
<param index="0" name="p_behavior_tree_data" type="BehaviorTreeData" />
|
<param index="0" name="p_behavior_tree_data" type="BehaviorTreeData" />
|
||||||
<description>
|
<description>
|
||||||
Updates the representation of a [BehaviorTree] instance. See also [BehaviorTreeData].
|
Updates the representation of a [BehaviorTree] instance. See also [BehaviorTreeData].
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
</methods>
|
</methods>
|
||||||
|
|
|
@ -8,6 +8,13 @@
|
||||||
<tutorials>
|
<tutorials>
|
||||||
</tutorials>
|
</tutorials>
|
||||||
<methods>
|
<methods>
|
||||||
|
<method name="decorate_output_var" qualifiers="const">
|
||||||
|
<return type="String" />
|
||||||
|
<param index="0" name="p_variable" type="String" />
|
||||||
|
<description>
|
||||||
|
Just like [method decorate_var], produces a string with a [Blackboard] variable name that is formatted for display, and also adds an additional symbol to indicate that the variable is used as an output.
|
||||||
|
</description>
|
||||||
|
</method>
|
||||||
<method name="decorate_var" qualifiers="const">
|
<method name="decorate_var" qualifiers="const">
|
||||||
<return type="String" />
|
<return type="String" />
|
||||||
<param index="0" name="p_variable" type="String" />
|
<param index="0" name="p_variable" type="String" />
|
||||||
|
|
|
@ -56,6 +56,10 @@ String LimboUtility::decorate_var(String p_variable) const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String LimboUtility::decorate_output_var(String p_variable) const {
|
||||||
|
return LW_NAME(output_var_prefix) + decorate_var(p_variable);
|
||||||
|
}
|
||||||
|
|
||||||
String LimboUtility::get_status_name(int p_status) const {
|
String LimboUtility::get_status_name(int p_status) const {
|
||||||
switch (p_status) {
|
switch (p_status) {
|
||||||
case BTTask::FRESH:
|
case BTTask::FRESH:
|
||||||
|
@ -606,6 +610,7 @@ void LimboUtility::open_doc_class(const String &p_class_name) {
|
||||||
|
|
||||||
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("decorate_output_var", "p_variable"), &LimboUtility::decorate_output_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", "p_class_or_script_path"), &LimboUtility::get_task_icon);
|
ClassDB::bind_method(D_METHOD("get_task_icon", "p_class_or_script_path"), &LimboUtility::get_task_icon);
|
||||||
|
|
||||||
|
|
|
@ -79,6 +79,7 @@ public:
|
||||||
static LimboUtility *get_singleton();
|
static LimboUtility *get_singleton();
|
||||||
|
|
||||||
String decorate_var(String p_variable) const;
|
String decorate_var(String p_variable) const;
|
||||||
|
String decorate_output_var(String p_variable) const;
|
||||||
String get_status_name(int p_status) const;
|
String get_status_name(int p_status) const;
|
||||||
Ref<Texture2D> get_task_icon(String p_class_or_script_path) const;
|
Ref<Texture2D> get_task_icon(String p_class_or_script_path) const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue