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) {
|
||||||
|
|
|
@ -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