Fix _get_configuration_warning() is not called for scripts

This commit is contained in:
Serhii Snitsaruk 2022-11-22 23:15:48 +01:00
parent ce2041391a
commit 5220c1c6e7
4 changed files with 8 additions and 7 deletions

View File

@ -249,14 +249,14 @@ Ref<BTTask> BTTask::next_sibling() const {
} }
String BTTask::get_configuration_warning() const { String BTTask::get_configuration_warning() const {
return String(); String warning = "";
if (get_script_instance() &&
get_script_instance()->has_method(LimboStringNames::get_singleton()->_get_configuration_warning)) {
warning = get_script_instance()->call(LimboStringNames::get_singleton()->_get_configuration_warning);
}
return warning;
} }
// Ref<Texture> BTTask::get_icon() const {
// // FIXME: Potential problem if tools are not built.
// return EditorNode::get_singleton()->get_class_icon(get_class(), "Object");
// }
void BTTask::print_tree(int p_initial_tabs) const { void BTTask::print_tree(int p_initial_tabs) const {
String tabs = "--"; String tabs = "--";
for (int i = 0; i < p_initial_tabs; i++) { for (int i = 0; i < p_initial_tabs; i++) {

View File

@ -73,7 +73,6 @@ public:
int get_child_index(const Ref<BTTask> &p_child) const; int get_child_index(const Ref<BTTask> &p_child) const;
Ref<BTTask> next_sibling() const; Ref<BTTask> next_sibling() const;
virtual String get_configuration_warning() const; virtual String get_configuration_warning() const;
// virtual Ref<Texture> get_icon() const;
void print_tree(int p_initial_tabs = 0) const; void print_tree(int p_initial_tabs = 0) const;
BTTask(); BTTask();

View File

@ -18,4 +18,5 @@ LimboStringNames::LimboStringNames() {
updated = StaticCString::create("updated"); updated = StaticCString::create("updated");
_update = StaticCString::create("_update"); _update = StaticCString::create("_update");
state_changed = StaticCString::create("state_changed"); state_changed = StaticCString::create("state_changed");
_get_configuration_warning = StaticCString::create("_get_configuration_warning");
} }

View File

@ -35,6 +35,7 @@ public:
StringName updated; StringName updated;
StringName _update; StringName _update;
StringName state_changed; StringName state_changed;
StringName _get_configuration_warning;
}; };
#endif // LIMBO_STRING_NAMES_H #endif // LIMBO_STRING_NAMES_H