Clean up unused string names

This commit is contained in:
Serhii Snitsaruk 2024-08-21 20:04:35 +02:00
parent 472f360cf9
commit 9da16a1e0f
No known key found for this signature in database
GPG Key ID: A965EF8799FFEC2D
8 changed files with 12 additions and 52 deletions

View File

@ -43,7 +43,7 @@ BT::Status BTInstance::update(double p_delta) {
#endif
last_status = root_task->execute(p_delta);
emit_signal(LimboStringNames::get_singleton()->updated, last_status);
emit_signal(LW_NAME(updated), last_status);
#ifdef DEBUG_ENABLED
double end = Time::get_singleton()->get_ticks_usec();

View File

@ -125,6 +125,7 @@ String BTTask::get_task_name() {
Ref<Script> task_script = get_script();
if (task_script.is_valid()) {
// ! CURSED: Currently, has_method() doesn't return true for ClassDB-registered native virtual methods. This may break in the future.
bool has_generate_method = has_method(LW_NAME(_generate_name));
ERR_FAIL_COND_V_MSG(has_generate_method && !task_script->is_tool(), _generate_name(), vformat("BTTask: @tool annotation is required if _generate_name is defined: %s", task_script->get_path()));
if (task_script->is_tool() && has_generate_method) {

View File

@ -1219,7 +1219,7 @@ void LimboAIEditor::_update_favorite_tasks() {
String task_meta = favorite_tasks[i];
if (task_meta.is_empty() || (!FILE_EXISTS(task_meta) && !ClassDB::class_exists(task_meta))) {
call_deferred(LW_NAME(_update_banners));
callable_mp(this, &LimboAIEditor::_update_banners).call_deferred();
continue;
}

View File

@ -420,7 +420,7 @@ void TaskPalette::_category_item_toggled(bool p_pressed, const String &p_categor
}
void TaskPalette::_filter_data_changed() {
call_deferred(LW_NAME(refresh));
callable_mp(this, &TaskPalette::refresh).call_deferred();
_update_filter_button();
}

View File

@ -60,7 +60,7 @@ void LimboHSM::change_active_state(LimboState *p_state) {
active_state->_enter();
active_state->set_process_input(true);
emit_signal(LimboStringNames::get_singleton()->active_state_changed, active_state, previous_active);
emit_signal(LW_NAME(active_state_changed), active_state, previous_active);
}
void LimboHSM::_enter() {

View File

@ -63,7 +63,7 @@ LimboState *LimboState::named(const String &p_name) {
void LimboState::_enter() {
active = true;
GDVIRTUAL_CALL(_enter);
emit_signal(LimboStringNames::get_singleton()->entered);
emit_signal(LW_NAME(entered));
}
void LimboState::_exit() {
@ -71,18 +71,18 @@ void LimboState::_exit() {
return;
}
GDVIRTUAL_CALL(_exit);
emit_signal(LimboStringNames::get_singleton()->exited);
emit_signal(LW_NAME(exited));
active = false;
}
void LimboState::_update(double p_delta) {
GDVIRTUAL_CALL(_update, p_delta);
emit_signal(LimboStringNames::get_singleton()->updated, p_delta);
emit_signal(LW_NAME(updated), p_delta);
}
void LimboState::_setup() {
GDVIRTUAL_CALL(_setup);
emit_signal(LimboStringNames::get_singleton()->setup);
emit_signal(LW_NAME(setup));
}
void LimboState::_initialize(Node *p_agent, const Ref<Blackboard> &p_blackboard) {
@ -154,19 +154,19 @@ bool LimboState::dispatch(const StringName &p_event, const Variant &p_cargo) {
LimboState *LimboState::call_on_enter(const Callable &p_callable) {
ERR_FAIL_COND_V(!p_callable.is_valid(), this);
connect(LimboStringNames::get_singleton()->entered, p_callable);
connect(LW_NAME(entered), p_callable);
return this;
}
LimboState *LimboState::call_on_exit(const Callable &p_callable) {
ERR_FAIL_COND_V(!p_callable.is_valid(), this);
connect(LimboStringNames::get_singleton()->exited, p_callable);
connect(LW_NAME(exited), p_callable);
return this;
}
LimboState *LimboState::call_on_update(const Callable &p_callable) {
ERR_FAIL_COND_V(!p_callable.is_valid(), this);
connect(LimboStringNames::get_singleton()->updated, p_callable);
connect(LW_NAME(updated), p_callable);
return this;
}

View File

@ -27,14 +27,8 @@
LimboStringNames *LimboStringNames::singleton = nullptr;
LimboStringNames::LimboStringNames() {
_enter = SN("_enter");
_exit = SN("_exit");
_generate_name = SN("_generate_name");
_get_configuration_warnings = SN("_get_configuration_warnings");
_replace_task = SN("_replace_task");
_setup = SN("_setup");
_tick = SN("_tick");
_update_banners = SN("_update_banners");
_update_task_tree = SN("_update_task_tree");
_weight_ = SN("_weight_");
accent_color = SN("accent_color");
@ -46,19 +40,12 @@ LimboStringNames::LimboStringNames() {
add_child = SN("add_child");
add_child_at_index = SN("add_child_at_index");
AnimationFilter = SN("AnimationFilter");
Back = SN("Back");
behavior_tree = SN("behavior_tree");
behavior_tree_finished = SN("behavior_tree_finished");
BehaviorTree = SN("BehaviorTree");
bold = SN("bold");
BTAlwaysFail = SN("BTAlwaysFail");
BTAlwaysSucceed = SN("BTAlwaysSucceed");
button_down = SN("button_down");
button_up = SN("button_up");
call_deferred = SN("call_deferred");
changed = SN("changed");
connect = SN("connect");
dark_color_1 = SN("dark_color_1");
dark_color_2 = SN("dark_color_2");
Debug = SN("Debug");
disabled_font_color = SN("disabled_font_color");
@ -71,7 +58,6 @@ LimboStringNames::LimboStringNames() {
EditorFonts = SN("EditorFonts");
EditorIcons = SN("EditorIcons");
EditorStyles = SN("EditorStyles");
emit_changed = SN("emit_changed");
entered = SN("entered");
error_value = SN("error_value");
EVENT_FAILURE = SN("failure");
@ -84,7 +70,6 @@ LimboStringNames::LimboStringNames() {
font = SN("font");
font_color = SN("font_color");
font_size = SN("font_size");
Forward = SN("Forward");
freed = SN("freed");
gui_input = SN("gui_input");
GuiOptionArrow = SN("GuiOptionArrow");
@ -97,10 +82,6 @@ LimboStringNames::LimboStringNames() {
Info = SN("Info");
item_collapsed = SN("item_collapsed");
item_selected = SN("item_selected");
LimboDeselectAll = SN("LimboDeselectAll");
LimboExtraClock = SN("LimboExtraClock");
LimboPercent = SN("LimboPercent");
LimboSelectAll = SN("LimboSelectAll");
LimboVarAdd = SN("LimboVarAdd");
LimboVarEmpty = SN("LimboVarEmpty");
LimboVarError = SN("LimboVarError");
@ -125,7 +106,6 @@ LimboStringNames::LimboStringNames() {
popup_hide = SN("popup_hide");
pressed = SN("pressed");
probability_clicked = SN("probability_clicked");
refresh = SN("refresh");
Reload = SN("Reload");
Remove = SN("Remove");
remove_child = SN("remove_child");

View File

@ -43,14 +43,8 @@ class LimboStringNames {
public:
_FORCE_INLINE_ static LimboStringNames *get_singleton() { return singleton; }
StringName _enter;
StringName _exit;
StringName _generate_name;
StringName _get_configuration_warnings;
StringName _replace_task;
StringName _setup;
StringName _tick;
StringName _update_banners;
StringName _update_task_tree;
StringName _weight_;
StringName accent_color;
@ -62,19 +56,12 @@ public:
StringName add_child;
StringName Add;
StringName AnimationFilter;
StringName Back;
StringName behavior_tree_finished;
StringName behavior_tree;
StringName BehaviorTree;
StringName bold;
StringName BTAlwaysFail;
StringName BTAlwaysSucceed;
StringName button_down;
StringName button_up;
StringName call_deferred;
StringName changed;
StringName connect;
StringName dark_color_1;
StringName dark_color_2;
StringName Debug;
StringName disabled_font_color;
@ -87,7 +74,6 @@ public:
StringName EditorFonts;
StringName EditorIcons;
StringName EditorStyles;
StringName emit_changed;
StringName entered;
StringName error_value;
StringName EVENT_FAILURE;
@ -100,7 +86,6 @@ public:
StringName font_color;
StringName font_size;
StringName font;
StringName Forward;
StringName freed;
StringName gui_input;
StringName GuiOptionArrow;
@ -113,11 +98,6 @@ public:
StringName Info;
StringName item_collapsed;
StringName item_selected;
StringName LimboDeselectAll;
StringName LimboExtraClock;
StringName LimboExtractSubtree;
StringName LimboPercent;
StringName LimboSelectAll;
StringName LimboVarAdd;
StringName LimboVarEmpty;
StringName LimboVarError;
@ -142,7 +122,6 @@ public:
StringName popup_hide;
StringName pressed;
StringName probability_clicked;
StringName refresh;
StringName Reload;
StringName remove_child;
StringName Remove;