chore: Rename macro LSNAME to LW_NAME

This commit is contained in:
Serhii Snitsaruk 2024-01-09 13:42:54 +01:00
parent 9645baeb30
commit 59a8ab97d8
23 changed files with 212 additions and 212 deletions

View File

@ -25,7 +25,7 @@ void BTCheckVar::set_value(Ref<BBVariant> p_value) {
value = p_value; value = p_value;
emit_changed(); emit_changed();
if (Engine::get_singleton()->is_editor_hint() && value.is_valid()) { if (Engine::get_singleton()->is_editor_hint() && value.is_valid()) {
value->connect(LSNAME(changed), Callable(this, LSNAME(emit_changed))); value->connect(LW_NAME(changed), Callable(this, LW_NAME(emit_changed)));
} }
} }

View File

@ -25,7 +25,7 @@ BT::Status BTSetVar::_tick(double p_delta) {
ERR_FAIL_COND_V_MSG(variable.is_empty(), FAILURE, "BTSetVar: `variable` is not set."); ERR_FAIL_COND_V_MSG(variable.is_empty(), FAILURE, "BTSetVar: `variable` is not set.");
ERR_FAIL_COND_V_MSG(!value.is_valid(), FAILURE, "BTSetVar: `value` is not set."); ERR_FAIL_COND_V_MSG(!value.is_valid(), FAILURE, "BTSetVar: `value` is not set.");
Variant result; Variant result;
Variant error_result = LSNAME(error_value); Variant error_result = LW_NAME(error_value);
Variant right_value = value->get_value(get_agent(), get_blackboard(), error_result); Variant right_value = value->get_value(get_agent(), get_blackboard(), error_result);
ERR_FAIL_COND_V_MSG(right_value == error_result, FAILURE, "BTSetVar: Failed to get parameter value. Returning FAILURE."); ERR_FAIL_COND_V_MSG(right_value == error_result, FAILURE, "BTSetVar: Failed to get parameter value. Returning FAILURE.");
if (operation == LimboUtility::OPERATION_NONE) { if (operation == LimboUtility::OPERATION_NONE) {
@ -49,7 +49,7 @@ void BTSetVar::set_value(Ref<BBVariant> p_value) {
value = p_value; value = p_value;
emit_changed(); emit_changed();
if (Engine::get_singleton()->is_editor_hint() && value.is_valid()) { if (Engine::get_singleton()->is_editor_hint() && value.is_valid()) {
value->connect(LSNAME(changed), Callable(this, LSNAME(emit_changed))); value->connect(LW_NAME(changed), Callable(this, LW_NAME(emit_changed)));
} }
} }

View File

@ -34,11 +34,11 @@ private:
void _select_task(); void _select_task();
#define SNAME(m_arg) ([]() -> const StringName & { static StringName sname = _scs_create(m_arg, true); return sname; })() #define SNAME(m_arg) ([]() -> const StringName & { static StringName sname = _scs_create(m_arg, true); return sname; })()
_FORCE_INLINE_ double _get_weight(int p_index) const { return get_child(p_index)->get_meta(LSNAME(_weight_), 1.0); } _FORCE_INLINE_ double _get_weight(int p_index) const { return get_child(p_index)->get_meta(LW_NAME(_weight_), 1.0); }
_FORCE_INLINE_ double _get_weight(Ref<BTTask> p_task) const { return p_task->get_meta(LSNAME(_weight_), 1.0); } _FORCE_INLINE_ double _get_weight(Ref<BTTask> p_task) const { return p_task->get_meta(LW_NAME(_weight_), 1.0); }
_FORCE_INLINE_ void _set_weight(int p_index, double p_weight) { _FORCE_INLINE_ void _set_weight(int p_index, double p_weight) {
get_child(p_index)->set_meta(LSNAME(_weight_), Variant(p_weight)); get_child(p_index)->set_meta(LW_NAME(_weight_), Variant(p_weight));
get_child(p_index)->emit_signal(LSNAME(changed)); get_child(p_index)->emit_signal(LW_NAME(changed));
} }
_FORCE_INLINE_ double _get_total_weight() const { _FORCE_INLINE_ double _get_total_weight() const {
double total = 0.0; double total = 0.0;

View File

@ -85,7 +85,7 @@ void BTCooldown::_chill() {
SceneTree *st = (SceneTree *)Engine::get_singleton()->get_main_loop(); SceneTree *st = (SceneTree *)Engine::get_singleton()->get_main_loop();
timer = st->create_timer(duration, process_pause); timer = st->create_timer(duration, process_pause);
#endif #endif
timer->connect(LSNAME(timeout), callable_mp(this, &BTCooldown::_on_timeout), CONNECT_ONE_SHOT); timer->connect(LW_NAME(timeout), callable_mp(this, &BTCooldown::_on_timeout), CONNECT_ONE_SHOT);
} }
} }

View File

@ -14,7 +14,7 @@
String BTRepeat::_generate_name() { String BTRepeat::_generate_name() {
if (forever) { if (forever) {
return LSNAME(repeat_forever); return LW_NAME(repeat_forever);
} }
return vformat("Repeat x%s", times); return vformat("Repeat x%s", times);
} }

View File

@ -17,7 +17,7 @@ void BTAwaitAnimation::set_animation_player(Ref<BBNode> p_animation_player) {
animation_player_param = p_animation_player; animation_player_param = p_animation_player;
emit_changed(); emit_changed();
if (Engine::get_singleton()->is_editor_hint() && animation_player_param.is_valid()) { if (Engine::get_singleton()->is_editor_hint() && animation_player_param.is_valid()) {
animation_player_param->connect(LSNAME(changed), Callable(this, LSNAME(emit_changed))); animation_player_param->connect(LW_NAME(changed), Callable(this, LW_NAME(emit_changed)));
} }
} }

View File

@ -25,7 +25,7 @@ void BTCheckAgentProperty::set_value(Ref<BBVariant> p_value) {
value = p_value; value = p_value;
emit_changed(); emit_changed();
if (Engine::get_singleton()->is_editor_hint() && value.is_valid()) { if (Engine::get_singleton()->is_editor_hint() && value.is_valid()) {
value->connect(LSNAME(changed), Callable(this, LSNAME(emit_changed))); value->connect(LW_NAME(changed), Callable(this, LW_NAME(emit_changed)));
} }
} }

View File

@ -17,7 +17,7 @@ void BTPauseAnimation::set_animation_player(Ref<BBNode> p_animation_player) {
animation_player_param = p_animation_player; animation_player_param = p_animation_player;
emit_changed(); emit_changed();
if (Engine::get_singleton()->is_editor_hint() && animation_player_param.is_valid()) { if (Engine::get_singleton()->is_editor_hint() && animation_player_param.is_valid()) {
animation_player_param->connect(LSNAME(changed), Callable(this, LSNAME(emit_changed))); animation_player_param->connect(LW_NAME(changed), Callable(this, LW_NAME(emit_changed)));
} }
} }

View File

@ -17,7 +17,7 @@ void BTPlayAnimation::set_animation_player(Ref<BBNode> p_animation_player) {
animation_player_param = p_animation_player; animation_player_param = p_animation_player;
emit_changed(); emit_changed();
if (Engine::get_singleton()->is_editor_hint() && animation_player_param.is_valid()) { if (Engine::get_singleton()->is_editor_hint() && animation_player_param.is_valid()) {
animation_player_param->connect(LSNAME(changed), Callable(this, LSNAME(emit_changed))); animation_player_param->connect(LW_NAME(changed), Callable(this, LW_NAME(emit_changed)));
} }
} }

View File

@ -20,7 +20,7 @@ void BTSetAgentProperty::set_value(Ref<BBVariant> p_value) {
value = p_value; value = p_value;
emit_changed(); emit_changed();
if (Engine::get_singleton()->is_editor_hint() && value.is_valid()) { if (Engine::get_singleton()->is_editor_hint() && value.is_valid()) {
value->connect(LSNAME(changed), Callable(this, LSNAME(emit_changed))); value->connect(LW_NAME(changed), Callable(this, LW_NAME(emit_changed)));
} }
} }
@ -54,7 +54,7 @@ BT::Status BTSetAgentProperty::_tick(double p_delta) {
ERR_FAIL_COND_V_MSG(!value.is_valid(), FAILURE, "BTSetAgentProperty: `value` is not set."); ERR_FAIL_COND_V_MSG(!value.is_valid(), FAILURE, "BTSetAgentProperty: `value` is not set.");
Variant result; Variant result;
StringName error_value = LSNAME(error_value); StringName error_value = LW_NAME(error_value);
Variant right_value = value->get_value(get_agent(), get_blackboard(), error_value); Variant right_value = value->get_value(get_agent(), get_blackboard(), error_value);
ERR_FAIL_COND_V_MSG(right_value == Variant(error_value), FAILURE, "BTSetAgentProperty: Couldn't get value of value-parameter."); ERR_FAIL_COND_V_MSG(right_value == Variant(error_value), FAILURE, "BTSetAgentProperty: Couldn't get value of value-parameter.");
bool r_valid; bool r_valid;

View File

@ -17,7 +17,7 @@ void BTStopAnimation::set_animation_player(Ref<BBNode> p_animation_player) {
animation_player_param = p_animation_player; animation_player_param = p_animation_player;
emit_changed(); emit_changed();
if (Engine::get_singleton()->is_editor_hint() && animation_player_param.is_valid()) { if (Engine::get_singleton()->is_editor_hint() && animation_player_param.is_valid()) {
animation_player_param->connect(LSNAME(changed), Callable(this, LSNAME(emit_changed))); animation_player_param->connect(LW_NAME(changed), Callable(this, LW_NAME(emit_changed)));
} }
} }

View File

@ -22,7 +22,7 @@ void BTCallMethod::set_node_param(Ref<BBNode> p_object) {
node_param = p_object; node_param = p_object;
emit_changed(); emit_changed();
if (Engine::get_singleton()->is_editor_hint() && node_param.is_valid()) { if (Engine::get_singleton()->is_editor_hint() && node_param.is_valid()) {
node_param->connect(LSNAME(changed), Callable(this, LSNAME(emit_changed))); node_param->connect(LW_NAME(changed), Callable(this, LW_NAME(emit_changed)));
} }
} }

View File

@ -38,7 +38,7 @@ void ActionBanner::close() {
void ActionBanner::add_action(const String &p_name, const Callable &p_action, bool p_auto_close) { void ActionBanner::add_action(const String &p_name, const Callable &p_action, bool p_auto_close) {
Button *action_btn = memnew(Button); Button *action_btn = memnew(Button);
action_btn->set_text(p_name); action_btn->set_text(p_name);
action_btn->connect(LSNAME(pressed), callable_mp(this, &ActionBanner::_execute_action).bind(p_action, p_auto_close)); action_btn->connect(LW_NAME(pressed), callable_mp(this, &ActionBanner::_execute_action).bind(p_action, p_auto_close));
hbox->add_child(action_btn); hbox->add_child(action_btn);
} }
@ -61,7 +61,7 @@ void ActionBanner::_execute_action(const Callable &p_action, bool p_auto_close)
void ActionBanner::_notification(int p_what) { void ActionBanner::_notification(int p_what) {
switch (p_what) { switch (p_what) {
case NOTIFICATION_THEME_CHANGED: { case NOTIFICATION_THEME_CHANGED: {
icon->set_texture(get_theme_icon(LSNAME(StatusWarning), LSNAME(EditorIcons))); icon->set_texture(get_theme_icon(LW_NAME(StatusWarning), LW_NAME(EditorIcons)));
} break; } break;
} }
} }

View File

@ -103,13 +103,13 @@ void BehaviorTreeView::update_tree(const BehaviorTreeData &p_data) {
item->set_icon_max_width(0, 16 * EDSCALE); // Force user icon size. item->set_icon_max_width(0, 16 * EDSCALE); // Force user icon size.
if (task_data.status == BTTask::SUCCESS) { if (task_data.status == BTTask::SUCCESS) {
item->set_custom_draw(0, this, LSNAME(_draw_success_status)); item->set_custom_draw(0, this, LW_NAME(_draw_success_status));
item->set_icon(1, theme_cache.icon_success); item->set_icon(1, theme_cache.icon_success);
} else if (task_data.status == BTTask::FAILURE) { } else if (task_data.status == BTTask::FAILURE) {
item->set_custom_draw(0, this, LSNAME(_draw_failure_status)); item->set_custom_draw(0, this, LW_NAME(_draw_failure_status));
item->set_icon(1, theme_cache.icon_failure); item->set_icon(1, theme_cache.icon_failure);
} else if (task_data.status == BTTask::RUNNING) { } else if (task_data.status == BTTask::RUNNING) {
item->set_custom_draw(0, this, LSNAME(_draw_running_status)); item->set_custom_draw(0, this, LW_NAME(_draw_running_status));
item->set_icon(1, theme_cache.icon_running); item->set_icon(1, theme_cache.icon_running);
} }
@ -134,11 +134,11 @@ void BehaviorTreeView::clear() {
} }
void BehaviorTreeView::_do_update_theme_item_cache() { void BehaviorTreeView::_do_update_theme_item_cache() {
theme_cache.icon_running = get_theme_icon(LSNAME(LimboExtraClock), LSNAME(EditorIcons)); theme_cache.icon_running = get_theme_icon(LW_NAME(LimboExtraClock), LW_NAME(EditorIcons));
theme_cache.icon_success = get_theme_icon(LSNAME(BTAlwaysSucceed), LSNAME(EditorIcons)); theme_cache.icon_success = get_theme_icon(LW_NAME(BTAlwaysSucceed), LW_NAME(EditorIcons));
theme_cache.icon_failure = get_theme_icon(LSNAME(BTAlwaysFail), LSNAME(EditorIcons)); theme_cache.icon_failure = get_theme_icon(LW_NAME(BTAlwaysFail), LW_NAME(EditorIcons));
theme_cache.font_custom_name = get_theme_font(LSNAME(bold), LSNAME(EditorFonts)); theme_cache.font_custom_name = get_theme_font(LW_NAME(bold), LW_NAME(EditorFonts));
Color running_border = Color::html("#fea900"); Color running_border = Color::html("#fea900");
Color running_fill = Color(running_border, 0.1); Color running_fill = Color(running_border, 0.1);
@ -174,7 +174,7 @@ void BehaviorTreeView::_do_update_theme_item_cache() {
void BehaviorTreeView::_notification(int p_what) { void BehaviorTreeView::_notification(int p_what) {
switch (p_what) { switch (p_what) {
case NOTIFICATION_READY: { case NOTIFICATION_READY: {
tree->connect(LSNAME(item_collapsed), callable_mp(this, &BehaviorTreeView::_item_collapsed)); tree->connect(LW_NAME(item_collapsed), callable_mp(this, &BehaviorTreeView::_item_collapsed));
} break; } break;
case NOTIFICATION_POSTINITIALIZE: case NOTIFICATION_POSTINITIALIZE:
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: case NOTIFICATION_LAYOUT_DIRECTION_CHANGED:

View File

@ -137,10 +137,10 @@ void LimboDebugger::_track_tree(NodePath p_path) {
Ref<Resource> bt; Ref<Resource> bt;
#ifdef LIMBOAI_MODULE #ifdef LIMBOAI_MODULE
bool r_valid = false; bool r_valid = false;
bt = node->get(LSNAME(behavior_tree), &r_valid); bt = node->get(LW_NAME(behavior_tree), &r_valid);
#endif #endif
#ifdef LIMBOAI_GDEXTENSION #ifdef LIMBOAI_GDEXTENSION
bt = node->get(LSNAME(behavior_tree)); bt = node->get(LW_NAME(behavior_tree));
#endif #endif
if (bt.is_valid()) { if (bt.is_valid()) {
@ -150,9 +150,9 @@ void LimboDebugger::_track_tree(NodePath p_path) {
} }
if (node->is_class("BTPlayer")) { if (node->is_class("BTPlayer")) {
node->connect(LSNAME(updated), callable_mp(this, &LimboDebugger::_on_bt_updated).bind(p_path)); node->connect(LW_NAME(updated), callable_mp(this, &LimboDebugger::_on_bt_updated).bind(p_path));
} else if (node->is_class("BTState")) { } else if (node->is_class("BTState")) {
node->connect(LSNAME(updated), callable_mp(this, &LimboDebugger::_on_state_updated).bind(p_path)); node->connect(LW_NAME(updated), callable_mp(this, &LimboDebugger::_on_state_updated).bind(p_path));
} }
} }
@ -168,9 +168,9 @@ void LimboDebugger::_untrack_tree() {
ERR_FAIL_COND(node == nullptr); ERR_FAIL_COND(node == nullptr);
if (node->is_class("BTPlayer")) { if (node->is_class("BTPlayer")) {
node->disconnect(LSNAME(updated), callable_mp(this, &LimboDebugger::_on_bt_updated)); node->disconnect(LW_NAME(updated), callable_mp(this, &LimboDebugger::_on_bt_updated));
} else if (node->is_class("BTState")) { } else if (node->is_class("BTState")) {
node->disconnect(LSNAME(updated), callable_mp(this, &LimboDebugger::_on_state_updated)); node->disconnect(LW_NAME(updated), callable_mp(this, &LimboDebugger::_on_state_updated));
} }
} }

View File

@ -93,19 +93,19 @@ void LimboAIEditor::_add_task(const Ref<BTTask> &p_task) {
} }
if (parent.is_null()) { if (parent.is_null()) {
// When tree is empty. // When tree is empty.
undo_redo->add_do_method(task_tree->get_bt().ptr(), LSNAME(set_root_task), p_task); undo_redo->add_do_method(task_tree->get_bt().ptr(), LW_NAME(set_root_task), p_task);
undo_redo->add_undo_method(task_tree->get_bt().ptr(), LSNAME(set_root_task), task_tree->get_bt()->get_root_task()); undo_redo->add_undo_method(task_tree->get_bt().ptr(), LW_NAME(set_root_task), task_tree->get_bt()->get_root_task());
} else { } else {
if (Input::get_singleton()->is_key_pressed(LW_KEY(SHIFT)) && selected->get_parent().is_valid()) { if (Input::get_singleton()->is_key_pressed(LW_KEY(SHIFT)) && selected->get_parent().is_valid()) {
// When shift is pressed, insert task after the currently selected and on the same level. // When shift is pressed, insert task after the currently selected and on the same level.
parent = selected->get_parent(); parent = selected->get_parent();
insert_idx = selected->get_index() + 1; insert_idx = selected->get_index() + 1;
} }
undo_redo->add_do_method(parent.ptr(), LSNAME(add_child_at_index), p_task, insert_idx); undo_redo->add_do_method(parent.ptr(), LW_NAME(add_child_at_index), p_task, insert_idx);
undo_redo->add_undo_method(parent.ptr(), LSNAME(remove_child), p_task); undo_redo->add_undo_method(parent.ptr(), LW_NAME(remove_child), p_task);
} }
undo_redo->add_do_method(task_tree, LSNAME(update_tree)); undo_redo->add_do_method(task_tree, LW_NAME(update_tree));
undo_redo->add_undo_method(task_tree, LSNAME(update_tree)); undo_redo->add_undo_method(task_tree, LW_NAME(update_tree));
undo_redo->commit_action(); undo_redo->commit_action();
_mark_as_dirty(true); _mark_as_dirty(true);
@ -147,14 +147,14 @@ void LimboAIEditor::_remove_task(const Ref<BTTask> &p_task) {
undo_redo->create_action(TTR("Remove BT Task")); undo_redo->create_action(TTR("Remove BT Task"));
if (p_task->get_parent() == nullptr) { if (p_task->get_parent() == nullptr) {
ERR_FAIL_COND(task_tree->get_bt()->get_root_task() != p_task); ERR_FAIL_COND(task_tree->get_bt()->get_root_task() != p_task);
undo_redo->add_do_method(task_tree->get_bt().ptr(), LSNAME(set_root_task), Variant()); undo_redo->add_do_method(task_tree->get_bt().ptr(), LW_NAME(set_root_task), Variant());
undo_redo->add_undo_method(task_tree->get_bt().ptr(), LSNAME(set_root_task), task_tree->get_bt()->get_root_task()); undo_redo->add_undo_method(task_tree->get_bt().ptr(), LW_NAME(set_root_task), task_tree->get_bt()->get_root_task());
} else { } else {
undo_redo->add_do_method(p_task->get_parent().ptr(), LSNAME(remove_child), p_task); undo_redo->add_do_method(p_task->get_parent().ptr(), LW_NAME(remove_child), p_task);
undo_redo->add_undo_method(p_task->get_parent().ptr(), LSNAME(add_child_at_index), p_task, p_task->get_index()); undo_redo->add_undo_method(p_task->get_parent().ptr(), LW_NAME(add_child_at_index), p_task, p_task->get_index());
} }
undo_redo->add_do_method(task_tree, LSNAME(update_tree)); undo_redo->add_do_method(task_tree, LW_NAME(update_tree));
undo_redo->add_undo_method(task_tree, LSNAME(update_tree)); undo_redo->add_undo_method(task_tree, LW_NAME(update_tree));
undo_redo->commit_action(); undo_redo->commit_action();
} }
@ -264,7 +264,7 @@ void LimboAIEditor::_edit_project_settings() {
#ifdef LIMBOAI_MODULE #ifdef LIMBOAI_MODULE
ProjectSettingsEditor::get_singleton()->set_general_page("limbo_ai/behavior_tree"); ProjectSettingsEditor::get_singleton()->set_general_page("limbo_ai/behavior_tree");
ProjectSettingsEditor::get_singleton()->popup_project_settings(); ProjectSettingsEditor::get_singleton()->popup_project_settings();
ProjectSettingsEditor::get_singleton()->connect(LSNAME(visibility_changed), callable_mp(this, &LimboAIEditor::_update_banners), CONNECT_ONE_SHOT); ProjectSettingsEditor::get_singleton()->connect(LW_NAME(visibility_changed), callable_mp(this, &LimboAIEditor::_update_banners), CONNECT_ONE_SHOT);
#else // LIMBOAI_GDEXTENSION #else // LIMBOAI_GDEXTENSION
// TODO: Find a way to show project setting in GDExtension. // TODO: Find a way to show project setting in GDExtension.
// TODO: Maybe show a popup dialog instead. // TODO: Maybe show a popup dialog instead.
@ -298,17 +298,17 @@ void LimboAIEditor::_extract_subtree(const String &p_path) {
subtree->set_subtree(bt); subtree->set_subtree(bt);
if (selected->is_root()) { if (selected->is_root()) {
undo_redo->add_do_method(task_tree->get_bt().ptr(), LSNAME(set_root_task), subtree); undo_redo->add_do_method(task_tree->get_bt().ptr(), LW_NAME(set_root_task), subtree);
undo_redo->add_undo_method(task_tree->get_bt().ptr(), LSNAME(set_root_task), selected); undo_redo->add_undo_method(task_tree->get_bt().ptr(), LW_NAME(set_root_task), selected);
} else { } else {
int idx = selected->get_index(); int idx = selected->get_index();
undo_redo->add_do_method(selected->get_parent().ptr(), LSNAME(remove_child), selected); undo_redo->add_do_method(selected->get_parent().ptr(), LW_NAME(remove_child), selected);
undo_redo->add_do_method(selected->get_parent().ptr(), LSNAME(add_child_at_index), subtree, idx); undo_redo->add_do_method(selected->get_parent().ptr(), LW_NAME(add_child_at_index), subtree, idx);
undo_redo->add_undo_method(selected->get_parent().ptr(), LSNAME(remove_child), subtree); undo_redo->add_undo_method(selected->get_parent().ptr(), LW_NAME(remove_child), subtree);
undo_redo->add_undo_method(selected->get_parent().ptr(), LSNAME(add_child_at_index), selected, idx); undo_redo->add_undo_method(selected->get_parent().ptr(), LW_NAME(add_child_at_index), selected, idx);
} }
undo_redo->add_do_method(task_tree, LSNAME(update_tree)); undo_redo->add_do_method(task_tree, LW_NAME(update_tree));
undo_redo->add_undo_method(task_tree, LSNAME(update_tree)); undo_redo->add_undo_method(task_tree, LW_NAME(update_tree));
undo_redo->commit_action(); undo_redo->commit_action();
EDIT_RESOURCE(task_tree->get_selected()); EDIT_RESOURCE(task_tree->get_selected());
@ -447,12 +447,12 @@ void LimboAIEditor::_action_selected(int p_id) {
int idx = sel->get_index(); int idx = sel->get_index();
if (idx > 0 && idx < parent->get_child_count()) { if (idx > 0 && idx < parent->get_child_count()) {
undo_redo->create_action(TTR("Move BT Task")); undo_redo->create_action(TTR("Move BT Task"));
undo_redo->add_do_method(parent.ptr(), LSNAME(remove_child), sel); undo_redo->add_do_method(parent.ptr(), LW_NAME(remove_child), sel);
undo_redo->add_do_method(parent.ptr(), LSNAME(add_child_at_index), sel, idx - 1); undo_redo->add_do_method(parent.ptr(), LW_NAME(add_child_at_index), sel, idx - 1);
undo_redo->add_undo_method(parent.ptr(), LSNAME(remove_child), sel); undo_redo->add_undo_method(parent.ptr(), LW_NAME(remove_child), sel);
undo_redo->add_undo_method(parent.ptr(), LSNAME(add_child_at_index), sel, idx); undo_redo->add_undo_method(parent.ptr(), LW_NAME(add_child_at_index), sel, idx);
undo_redo->add_do_method(task_tree, LSNAME(update_tree)); undo_redo->add_do_method(task_tree, LW_NAME(update_tree));
undo_redo->add_undo_method(task_tree, LSNAME(update_tree)); undo_redo->add_undo_method(task_tree, LW_NAME(update_tree));
undo_redo->commit_action(); undo_redo->commit_action();
_mark_as_dirty(true); _mark_as_dirty(true);
} }
@ -465,12 +465,12 @@ void LimboAIEditor::_action_selected(int p_id) {
int idx = sel->get_index(); int idx = sel->get_index();
if (idx >= 0 && idx < (parent->get_child_count() - 1)) { if (idx >= 0 && idx < (parent->get_child_count() - 1)) {
undo_redo->create_action(TTR("Move BT Task")); undo_redo->create_action(TTR("Move BT Task"));
undo_redo->add_do_method(parent.ptr(), LSNAME(remove_child), sel); undo_redo->add_do_method(parent.ptr(), LW_NAME(remove_child), sel);
undo_redo->add_do_method(parent.ptr(), LSNAME(add_child_at_index), sel, idx + 1); undo_redo->add_do_method(parent.ptr(), LW_NAME(add_child_at_index), sel, idx + 1);
undo_redo->add_undo_method(parent.ptr(), LSNAME(remove_child), sel); undo_redo->add_undo_method(parent.ptr(), LW_NAME(remove_child), sel);
undo_redo->add_undo_method(parent.ptr(), LSNAME(add_child_at_index), sel, idx); undo_redo->add_undo_method(parent.ptr(), LW_NAME(add_child_at_index), sel, idx);
undo_redo->add_do_method(task_tree, LSNAME(update_tree)); undo_redo->add_do_method(task_tree, LW_NAME(update_tree));
undo_redo->add_undo_method(task_tree, LSNAME(update_tree)); undo_redo->add_undo_method(task_tree, LW_NAME(update_tree));
undo_redo->commit_action(); undo_redo->commit_action();
_mark_as_dirty(true); _mark_as_dirty(true);
} }
@ -485,10 +485,10 @@ void LimboAIEditor::_action_selected(int p_id) {
parent = sel; parent = sel;
} }
const Ref<BTTask> &sel_dup = sel->clone(); const Ref<BTTask> &sel_dup = sel->clone();
undo_redo->add_do_method(parent.ptr(), LSNAME(add_child_at_index), sel_dup, sel->get_index() + 1); undo_redo->add_do_method(parent.ptr(), LW_NAME(add_child_at_index), sel_dup, sel->get_index() + 1);
undo_redo->add_undo_method(parent.ptr(), LSNAME(remove_child), sel_dup); undo_redo->add_undo_method(parent.ptr(), LW_NAME(remove_child), sel_dup);
undo_redo->add_do_method(task_tree, LSNAME(update_tree)); undo_redo->add_do_method(task_tree, LW_NAME(update_tree));
undo_redo->add_undo_method(task_tree, LSNAME(update_tree)); undo_redo->add_undo_method(task_tree, LW_NAME(update_tree));
undo_redo->commit_action(); undo_redo->commit_action();
_mark_as_dirty(true); _mark_as_dirty(true);
} }
@ -499,15 +499,15 @@ void LimboAIEditor::_action_selected(int p_id) {
Ref<BTTask> parent = sel->get_parent(); Ref<BTTask> parent = sel->get_parent();
ERR_FAIL_COND(parent.is_null()); ERR_FAIL_COND(parent.is_null());
undo_redo->create_action(TTR("Make Root")); undo_redo->create_action(TTR("Make Root"));
undo_redo->add_do_method(parent.ptr(), LSNAME(remove_child), sel); undo_redo->add_do_method(parent.ptr(), LW_NAME(remove_child), sel);
Ref<BTTask> old_root = task_tree->get_bt()->get_root_task(); Ref<BTTask> old_root = task_tree->get_bt()->get_root_task();
undo_redo->add_do_method(task_tree->get_bt().ptr(), LSNAME(set_root_task), sel); undo_redo->add_do_method(task_tree->get_bt().ptr(), LW_NAME(set_root_task), sel);
undo_redo->add_do_method(sel.ptr(), LSNAME(add_child), old_root); undo_redo->add_do_method(sel.ptr(), LW_NAME(add_child), old_root);
undo_redo->add_undo_method(sel.ptr(), LSNAME(remove_child), old_root); undo_redo->add_undo_method(sel.ptr(), LW_NAME(remove_child), old_root);
undo_redo->add_undo_method(task_tree->get_bt().ptr(), LSNAME(set_root_task), old_root); undo_redo->add_undo_method(task_tree->get_bt().ptr(), LW_NAME(set_root_task), old_root);
undo_redo->add_undo_method(parent.ptr(), LSNAME(add_child_at_index), sel, sel->get_index()); undo_redo->add_undo_method(parent.ptr(), LW_NAME(add_child_at_index), sel, sel->get_index());
undo_redo->add_do_method(task_tree, LSNAME(update_tree)); undo_redo->add_do_method(task_tree, LW_NAME(update_tree));
undo_redo->add_undo_method(task_tree, LSNAME(update_tree)); undo_redo->add_undo_method(task_tree, LW_NAME(update_tree));
undo_redo->commit_action(); undo_redo->commit_action();
_mark_as_dirty(true); _mark_as_dirty(true);
} }
@ -523,14 +523,14 @@ void LimboAIEditor::_action_selected(int p_id) {
if (sel.is_valid()) { if (sel.is_valid()) {
undo_redo->create_action(TTR("Remove BT Task")); undo_redo->create_action(TTR("Remove BT Task"));
if (sel->is_root()) { if (sel->is_root()) {
undo_redo->add_do_method(task_tree->get_bt().ptr(), LSNAME(set_root_task), Variant()); undo_redo->add_do_method(task_tree->get_bt().ptr(), LW_NAME(set_root_task), Variant());
undo_redo->add_undo_method(task_tree->get_bt().ptr(), LSNAME(set_root_task), task_tree->get_bt()->get_root_task()); undo_redo->add_undo_method(task_tree->get_bt().ptr(), LW_NAME(set_root_task), task_tree->get_bt()->get_root_task());
} else { } else {
undo_redo->add_do_method(sel->get_parent().ptr(), LSNAME(remove_child), sel); undo_redo->add_do_method(sel->get_parent().ptr(), LW_NAME(remove_child), sel);
undo_redo->add_undo_method(sel->get_parent().ptr(), LSNAME(add_child_at_index), sel, sel->get_index()); undo_redo->add_undo_method(sel->get_parent().ptr(), LW_NAME(add_child_at_index), sel, sel->get_index());
} }
undo_redo->add_do_method(task_tree, LSNAME(update_tree)); undo_redo->add_do_method(task_tree, LW_NAME(update_tree));
undo_redo->add_undo_method(task_tree, LSNAME(update_tree)); undo_redo->add_undo_method(task_tree, LW_NAME(update_tree));
undo_redo->commit_action(); undo_redo->commit_action();
EDIT_RESOURCE(task_tree->get_selected()); EDIT_RESOURCE(task_tree->get_selected());
_mark_as_dirty(true); _mark_as_dirty(true);
@ -707,29 +707,29 @@ void LimboAIEditor::_on_task_dragged(Ref<BTTask> p_task, Ref<BTTask> p_to_task,
EditorUndoRedoManager *undo_redo = GET_UNDO_REDO(); EditorUndoRedoManager *undo_redo = GET_UNDO_REDO();
undo_redo->create_action(TTR("Drag BT Task")); undo_redo->create_action(TTR("Drag BT Task"));
undo_redo->add_do_method(p_task->get_parent().ptr(), LSNAME(remove_child), p_task); undo_redo->add_do_method(p_task->get_parent().ptr(), LW_NAME(remove_child), p_task);
if (p_type == 0) { if (p_type == 0) {
undo_redo->add_do_method(p_to_task.ptr(), LSNAME(add_child), p_task); undo_redo->add_do_method(p_to_task.ptr(), LW_NAME(add_child), p_task);
undo_redo->add_undo_method(p_to_task.ptr(), LSNAME(remove_child), p_task); undo_redo->add_undo_method(p_to_task.ptr(), LW_NAME(remove_child), p_task);
} else { } else {
int drop_idx = p_to_task->get_index(); int drop_idx = p_to_task->get_index();
if (p_to_task->get_parent() == p_task->get_parent() && drop_idx > p_task->get_index()) { if (p_to_task->get_parent() == p_task->get_parent() && drop_idx > p_task->get_index()) {
drop_idx -= 1; drop_idx -= 1;
} }
if (p_type == -1) { if (p_type == -1) {
undo_redo->add_do_method(p_to_task->get_parent().ptr(), LSNAME(add_child_at_index), p_task, drop_idx); undo_redo->add_do_method(p_to_task->get_parent().ptr(), LW_NAME(add_child_at_index), p_task, drop_idx);
undo_redo->add_undo_method(p_to_task->get_parent().ptr(), LSNAME(remove_child), p_task); undo_redo->add_undo_method(p_to_task->get_parent().ptr(), LW_NAME(remove_child), p_task);
} else if (p_type == 1) { } else if (p_type == 1) {
undo_redo->add_do_method(p_to_task->get_parent().ptr(), LSNAME(add_child_at_index), p_task, drop_idx + 1); undo_redo->add_do_method(p_to_task->get_parent().ptr(), LW_NAME(add_child_at_index), p_task, drop_idx + 1);
undo_redo->add_undo_method(p_to_task->get_parent().ptr(), LSNAME(remove_child), p_task); undo_redo->add_undo_method(p_to_task->get_parent().ptr(), LW_NAME(remove_child), p_task);
} }
} }
undo_redo->add_undo_method(p_task->get_parent().ptr(), "add_child_at_index", p_task, p_task->get_index()); undo_redo->add_undo_method(p_task->get_parent().ptr(), "add_child_at_index", p_task, p_task->get_index());
undo_redo->add_do_method(task_tree, LSNAME(update_tree)); undo_redo->add_do_method(task_tree, LW_NAME(update_tree));
undo_redo->add_undo_method(task_tree, LSNAME(update_tree)); undo_redo->add_undo_method(task_tree, LW_NAME(update_tree));
undo_redo->commit_action(); undo_redo->commit_action();
_mark_as_dirty(true); _mark_as_dirty(true);
@ -782,10 +782,10 @@ void LimboAIEditor::_task_type_selected(const String &p_class_or_path) {
EditorUndoRedoManager *undo_redo = GET_UNDO_REDO(); EditorUndoRedoManager *undo_redo = GET_UNDO_REDO();
undo_redo->create_action(TTR("Change BT task type")); undo_redo->create_action(TTR("Change BT task type"));
undo_redo->add_do_method(this, LSNAME(_replace_task), selected_task, new_task); undo_redo->add_do_method(this, LW_NAME(_replace_task), selected_task, new_task);
undo_redo->add_undo_method(this, LSNAME(_replace_task), new_task, selected_task); undo_redo->add_undo_method(this, LW_NAME(_replace_task), new_task, selected_task);
undo_redo->add_do_method(task_tree, LSNAME(update_tree)); undo_redo->add_do_method(task_tree, LW_NAME(update_tree));
undo_redo->add_undo_method(task_tree, LSNAME(update_tree)); undo_redo->add_undo_method(task_tree, LW_NAME(update_tree));
undo_redo->commit_action(); undo_redo->commit_action();
_mark_as_dirty(true); _mark_as_dirty(true);
} }
@ -862,10 +862,10 @@ void LimboAIEditor::_rename_task_confirmed() {
EditorUndoRedoManager *undo_redo = GET_UNDO_REDO(); EditorUndoRedoManager *undo_redo = GET_UNDO_REDO();
undo_redo->create_action(TTR("Set Custom Name")); undo_redo->create_action(TTR("Set Custom Name"));
undo_redo->add_do_method(task_tree->get_selected().ptr(), LSNAME(set_custom_name), rename_edit->get_text()); undo_redo->add_do_method(task_tree->get_selected().ptr(), LW_NAME(set_custom_name), rename_edit->get_text());
undo_redo->add_undo_method(task_tree->get_selected().ptr(), LSNAME(set_custom_name), task_tree->get_selected()->get_custom_name()); undo_redo->add_undo_method(task_tree->get_selected().ptr(), LW_NAME(set_custom_name), task_tree->get_selected()->get_custom_name());
undo_redo->add_do_method(task_tree, LSNAME(update_task), task_tree->get_selected()); undo_redo->add_do_method(task_tree, LW_NAME(update_task), task_tree->get_selected());
undo_redo->add_undo_method(task_tree, LSNAME(update_task), task_tree->get_selected()); undo_redo->add_undo_method(task_tree, LW_NAME(update_task), task_tree->get_selected());
undo_redo->commit_action(); undo_redo->commit_action();
} }
@ -890,7 +890,7 @@ void LimboAIEditor::_update_favorite_tasks() {
String task_meta = favorite_tasks[i]; String task_meta = favorite_tasks[i];
if (task_meta.is_empty() || (!FILE_EXISTS(task_meta) && !ClassDB::class_exists(task_meta))) { if (task_meta.is_empty() || (!FILE_EXISTS(task_meta) && !ClassDB::class_exists(task_meta))) {
call_deferred(LSNAME(_update_banners)); call_deferred(LW_NAME(_update_banners));
continue; continue;
} }
@ -902,13 +902,13 @@ void LimboAIEditor::_update_favorite_tasks() {
task_name = task_meta.trim_prefix("BT"); task_name = task_meta.trim_prefix("BT");
} }
btn->set_text(task_name); btn->set_text(task_name);
btn->set_meta(LSNAME(task_meta), task_meta); btn->set_meta(LW_NAME(task_meta), task_meta);
BUTTON_SET_ICON(btn, LimboUtility::get_singleton()->get_task_icon(task_meta)); BUTTON_SET_ICON(btn, LimboUtility::get_singleton()->get_task_icon(task_meta));
btn->set_tooltip_text(vformat(TTR("Add %s task."), task_name)); btn->set_tooltip_text(vformat(TTR("Add %s task."), task_name));
btn->set_flat(true); btn->set_flat(true);
btn->add_theme_constant_override(LSNAME(icon_max_width), 16 * EDSCALE); // Force user icons to be of the proper size. btn->add_theme_constant_override(LW_NAME(icon_max_width), 16 * EDSCALE); // Force user icons to be of the proper size.
btn->set_focus_mode(Control::FOCUS_NONE); btn->set_focus_mode(Control::FOCUS_NONE);
btn->connect(LSNAME(pressed), callable_mp(this, &LimboAIEditor::_add_task_by_class_or_path).bind(task_meta)); btn->connect(LW_NAME(pressed), callable_mp(this, &LimboAIEditor::_add_task_by_class_or_path).bind(task_meta));
fav_tasks_hbox->add_child(btn); fav_tasks_hbox->add_child(btn);
} }
} }
@ -932,7 +932,7 @@ void LimboAIEditor::_update_misc_menu() {
void LimboAIEditor::_update_banners() { void LimboAIEditor::_update_banners() {
for (int i = 0; i < banners->get_child_count(); i++) { for (int i = 0; i < banners->get_child_count(); i++) {
if (banners->get_child(i)->has_meta(LSNAME(managed))) { if (banners->get_child(i)->has_meta(LW_NAME(managed))) {
banners->get_child(i)->queue_free(); banners->get_child(i)->queue_free();
} }
} }
@ -944,8 +944,8 @@ void LimboAIEditor::_update_banners() {
banner->set_text(vformat(TTR("Task folder not found: %s"), task_dir)); banner->set_text(vformat(TTR("Task folder not found: %s"), task_dir));
banner->add_action(TTR("Create"), callable_mp(this, &LimboAIEditor::_create_user_task_dir), true); banner->add_action(TTR("Create"), callable_mp(this, &LimboAIEditor::_create_user_task_dir), true);
banner->add_action(TTR("Edit Path..."), callable_mp(this, &LimboAIEditor::_edit_project_settings)); banner->add_action(TTR("Edit Path..."), callable_mp(this, &LimboAIEditor::_edit_project_settings));
banner->set_meta(LSNAME(managed), Variant(true)); banner->set_meta(LW_NAME(managed), Variant(true));
banners->call_deferred(LSNAME(add_child), banner); banners->call_deferred(LW_NAME(add_child), banner);
} }
} }
@ -958,26 +958,26 @@ void LimboAIEditor::_update_banners() {
banner->set_text(vformat(TTR("Favorite task not found: %s"), task_meta)); banner->set_text(vformat(TTR("Favorite task not found: %s"), task_meta));
banner->add_action(TTR("Remove"), callable_mp(this, &LimboAIEditor::_remove_task_from_favorite).bind(task_meta), true); banner->add_action(TTR("Remove"), callable_mp(this, &LimboAIEditor::_remove_task_from_favorite).bind(task_meta), true);
banner->add_action(TTR("Edit Favorite Tasks..."), callable_mp(this, &LimboAIEditor::_edit_project_settings)); banner->add_action(TTR("Edit Favorite Tasks..."), callable_mp(this, &LimboAIEditor::_edit_project_settings));
banner->set_meta(LSNAME(managed), Variant(true)); banner->set_meta(LW_NAME(managed), Variant(true));
banners->call_deferred(LSNAME(add_child), banner); banners->call_deferred(LW_NAME(add_child), banner);
} }
} }
} }
void LimboAIEditor::_do_update_theme_item_cache() { void LimboAIEditor::_do_update_theme_item_cache() {
theme_cache.duplicate_task_icon = get_theme_icon(LSNAME(Duplicate), LSNAME(EditorIcons)); theme_cache.duplicate_task_icon = get_theme_icon(LW_NAME(Duplicate), LW_NAME(EditorIcons));
theme_cache.edit_script_icon = get_theme_icon(LSNAME(Script), LSNAME(EditorIcons)); theme_cache.edit_script_icon = get_theme_icon(LW_NAME(Script), LW_NAME(EditorIcons));
theme_cache.make_root_icon = get_theme_icon(LSNAME(NewRoot), LSNAME(EditorIcons)); theme_cache.make_root_icon = get_theme_icon(LW_NAME(NewRoot), LW_NAME(EditorIcons));
theme_cache.move_task_down_icon = get_theme_icon(LSNAME(MoveDown), LSNAME(EditorIcons)); theme_cache.move_task_down_icon = get_theme_icon(LW_NAME(MoveDown), LW_NAME(EditorIcons));
theme_cache.move_task_up_icon = get_theme_icon(LSNAME(MoveUp), LSNAME(EditorIcons)); theme_cache.move_task_up_icon = get_theme_icon(LW_NAME(MoveUp), LW_NAME(EditorIcons));
theme_cache.open_debugger_icon = get_theme_icon(LSNAME(Debug), LSNAME(EditorIcons)); theme_cache.open_debugger_icon = get_theme_icon(LW_NAME(Debug), LW_NAME(EditorIcons));
theme_cache.open_doc_icon = get_theme_icon(LSNAME(Help), LSNAME(EditorIcons)); theme_cache.open_doc_icon = get_theme_icon(LW_NAME(Help), LW_NAME(EditorIcons));
theme_cache.percent_icon = get_theme_icon(LSNAME(LimboPercent), LSNAME(EditorIcons)); theme_cache.percent_icon = get_theme_icon(LW_NAME(LimboPercent), LW_NAME(EditorIcons));
theme_cache.remove_task_icon = get_theme_icon(LSNAME(Remove), LSNAME(EditorIcons)); theme_cache.remove_task_icon = get_theme_icon(LW_NAME(Remove), LW_NAME(EditorIcons));
theme_cache.rename_task_icon = get_theme_icon(LSNAME(Rename), LSNAME(EditorIcons)); theme_cache.rename_task_icon = get_theme_icon(LW_NAME(Rename), LW_NAME(EditorIcons));
theme_cache.change_type_icon = get_theme_icon(LSNAME(Reload), LSNAME(EditorIcons)); theme_cache.change_type_icon = get_theme_icon(LW_NAME(Reload), LW_NAME(EditorIcons));
theme_cache.extract_subtree_icon = get_theme_icon(LSNAME(LimboExtractSubtree), LSNAME(EditorIcons)); theme_cache.extract_subtree_icon = get_theme_icon(LW_NAME(LimboExtractSubtree), LW_NAME(EditorIcons));
theme_cache.behavior_tree_icon = get_theme_icon(LSNAME(BehaviorTree), LSNAME(EditorIcons)); theme_cache.behavior_tree_icon = get_theme_icon(LW_NAME(BehaviorTree), LW_NAME(EditorIcons));
} }
void LimboAIEditor::_notification(int p_what) { void LimboAIEditor::_notification(int p_what) {
@ -1003,8 +1003,8 @@ void LimboAIEditor::_notification(int p_what) {
save_dialog->connect("file_selected", callable_mp(this, &LimboAIEditor::_save_bt)); save_dialog->connect("file_selected", callable_mp(this, &LimboAIEditor::_save_bt));
load_dialog->connect("file_selected", callable_mp(this, &LimboAIEditor::_load_bt)); load_dialog->connect("file_selected", callable_mp(this, &LimboAIEditor::_load_bt));
extract_dialog->connect("file_selected", callable_mp(this, &LimboAIEditor::_extract_subtree)); extract_dialog->connect("file_selected", callable_mp(this, &LimboAIEditor::_extract_subtree));
new_btn->connect(LSNAME(pressed), callable_mp(this, &LimboAIEditor::_new_bt)); new_btn->connect(LW_NAME(pressed), callable_mp(this, &LimboAIEditor::_new_bt));
load_btn->connect(LSNAME(pressed), callable_mp(this, &LimboAIEditor::_popup_file_dialog).bind(load_dialog)); load_btn->connect(LW_NAME(pressed), callable_mp(this, &LimboAIEditor::_popup_file_dialog).bind(load_dialog));
task_tree->connect("rmb_pressed", callable_mp(this, &LimboAIEditor::_on_tree_rmb)); task_tree->connect("rmb_pressed", callable_mp(this, &LimboAIEditor::_on_tree_rmb));
task_tree->connect("task_selected", callable_mp(this, &LimboAIEditor::_on_tree_task_selected)); task_tree->connect("task_selected", callable_mp(this, &LimboAIEditor::_on_tree_task_selected));
task_tree->connect("task_dragged", callable_mp(this, &LimboAIEditor::_on_task_dragged)); task_tree->connect("task_dragged", callable_mp(this, &LimboAIEditor::_on_task_dragged));
@ -1012,24 +1012,24 @@ void LimboAIEditor::_notification(int p_what) {
task_tree->connect("probability_clicked", callable_mp(this, &LimboAIEditor::_action_selected).bind(ACTION_EDIT_PROBABILITY)); task_tree->connect("probability_clicked", callable_mp(this, &LimboAIEditor::_action_selected).bind(ACTION_EDIT_PROBABILITY));
task_tree->connect("visibility_changed", callable_mp(this, &LimboAIEditor::_on_visibility_changed)); task_tree->connect("visibility_changed", callable_mp(this, &LimboAIEditor::_on_visibility_changed));
task_tree->connect("visibility_changed", callable_mp(this, &LimboAIEditor::_update_banners)); task_tree->connect("visibility_changed", callable_mp(this, &LimboAIEditor::_update_banners));
save_btn->connect(LSNAME(pressed), callable_mp(this, &LimboAIEditor::_on_save_pressed)); save_btn->connect(LW_NAME(pressed), callable_mp(this, &LimboAIEditor::_on_save_pressed));
misc_btn->connect(LSNAME(pressed), callable_mp(this, &LimboAIEditor::_update_misc_menu)); misc_btn->connect(LW_NAME(pressed), callable_mp(this, &LimboAIEditor::_update_misc_menu));
misc_btn->get_popup()->connect("id_pressed", callable_mp(this, &LimboAIEditor::_misc_option_selected)); misc_btn->get_popup()->connect("id_pressed", callable_mp(this, &LimboAIEditor::_misc_option_selected));
history_back->connect(LSNAME(pressed), callable_mp(this, &LimboAIEditor::_on_history_back)); history_back->connect(LW_NAME(pressed), callable_mp(this, &LimboAIEditor::_on_history_back));
history_forward->connect(LSNAME(pressed), callable_mp(this, &LimboAIEditor::_on_history_forward)); history_forward->connect(LW_NAME(pressed), callable_mp(this, &LimboAIEditor::_on_history_forward));
header->connect(LSNAME(pressed), callable_mp(this, &LimboAIEditor::_on_header_pressed)); header->connect(LW_NAME(pressed), callable_mp(this, &LimboAIEditor::_on_header_pressed));
task_palette->connect("task_selected", callable_mp(this, &LimboAIEditor::_add_task_by_class_or_path)); task_palette->connect("task_selected", callable_mp(this, &LimboAIEditor::_add_task_by_class_or_path));
task_palette->connect("favorite_tasks_changed", callable_mp(this, &LimboAIEditor::_update_favorite_tasks)); task_palette->connect("favorite_tasks_changed", callable_mp(this, &LimboAIEditor::_update_favorite_tasks));
change_type_palette->connect("task_selected", callable_mp(this, &LimboAIEditor::_task_type_selected)); change_type_palette->connect("task_selected", callable_mp(this, &LimboAIEditor::_task_type_selected));
menu->connect("id_pressed", callable_mp(this, &LimboAIEditor::_action_selected)); menu->connect("id_pressed", callable_mp(this, &LimboAIEditor::_action_selected));
weight_mode->connect(LSNAME(pressed), callable_mp(this, &LimboAIEditor::_update_probability_edit)); weight_mode->connect(LW_NAME(pressed), callable_mp(this, &LimboAIEditor::_update_probability_edit));
percent_mode->connect(LSNAME(pressed), callable_mp(this, &LimboAIEditor::_update_probability_edit)); percent_mode->connect(LW_NAME(pressed), callable_mp(this, &LimboAIEditor::_update_probability_edit));
probability_edit->connect("value_changed", callable_mp(this, &LimboAIEditor::_on_probability_edited)); probability_edit->connect("value_changed", callable_mp(this, &LimboAIEditor::_on_probability_edited));
probability_popup->connect("popup_hide", callable_mp(this, &LimboAIEditor::_probability_popup_closed)); probability_popup->connect("popup_hide", callable_mp(this, &LimboAIEditor::_probability_popup_closed));
disk_changed->connect("confirmed", callable_mp(this, &LimboAIEditor::_reload_modified)); disk_changed->connect("confirmed", callable_mp(this, &LimboAIEditor::_reload_modified));
disk_changed->connect("custom_action", callable_mp(this, &LimboAIEditor::_resave_modified)); disk_changed->connect("custom_action", callable_mp(this, &LimboAIEditor::_resave_modified));
rename_dialog->connect("confirmed", callable_mp(this, &LimboAIEditor::_rename_task_confirmed)); rename_dialog->connect("confirmed", callable_mp(this, &LimboAIEditor::_rename_task_confirmed));
new_script_btn->connect(LSNAME(pressed), callable_mp(SCRIPT_EDITOR(), &ScriptEditor::open_script_create_dialog).bind("BTAction", String(GLOBAL_GET("limbo_ai/behavior_tree/user_task_dir_1")).path_join("new_task"))); new_script_btn->connect(LW_NAME(pressed), callable_mp(SCRIPT_EDITOR(), &ScriptEditor::open_script_create_dialog).bind("BTAction", String(GLOBAL_GET("limbo_ai/behavior_tree/user_task_dir_1")).path_join("new_task")));
EDITOR_FILE_SYSTEM()->connect("resources_reload", callable_mp(this, &LimboAIEditor::_on_resources_reload)); EDITOR_FILE_SYSTEM()->connect("resources_reload", callable_mp(this, &LimboAIEditor::_on_resources_reload));
@ -1037,13 +1037,13 @@ void LimboAIEditor::_notification(int p_what) {
case NOTIFICATION_THEME_CHANGED: { case NOTIFICATION_THEME_CHANGED: {
_do_update_theme_item_cache(); _do_update_theme_item_cache();
BUTTON_SET_ICON(new_btn, get_theme_icon(LSNAME(New), LSNAME(EditorIcons))); BUTTON_SET_ICON(new_btn, get_theme_icon(LW_NAME(New), LW_NAME(EditorIcons)));
BUTTON_SET_ICON(load_btn, get_theme_icon(LSNAME(Load), LSNAME(EditorIcons))); BUTTON_SET_ICON(load_btn, get_theme_icon(LW_NAME(Load), LW_NAME(EditorIcons)));
BUTTON_SET_ICON(save_btn, get_theme_icon(LSNAME(Save), LSNAME(EditorIcons))); BUTTON_SET_ICON(save_btn, get_theme_icon(LW_NAME(Save), LW_NAME(EditorIcons)));
BUTTON_SET_ICON(new_script_btn, get_theme_icon(LSNAME(ScriptCreate), LSNAME(EditorIcons))); BUTTON_SET_ICON(new_script_btn, get_theme_icon(LW_NAME(ScriptCreate), LW_NAME(EditorIcons)));
BUTTON_SET_ICON(history_back, get_theme_icon(LSNAME(Back), LSNAME(EditorIcons))); BUTTON_SET_ICON(history_back, get_theme_icon(LW_NAME(Back), LW_NAME(EditorIcons)));
BUTTON_SET_ICON(history_forward, get_theme_icon(LSNAME(Forward), LSNAME(EditorIcons))); BUTTON_SET_ICON(history_forward, get_theme_icon(LW_NAME(Forward), LW_NAME(EditorIcons)));
BUTTON_SET_ICON(misc_btn, get_theme_icon(LSNAME(Tools), LSNAME(EditorIcons))); BUTTON_SET_ICON(misc_btn, get_theme_icon(LW_NAME(Tools), LW_NAME(EditorIcons)));
_update_favorite_tasks(); _update_favorite_tasks();
_update_header(); _update_header();

View File

@ -54,7 +54,7 @@ void ModeSwitchButton::set_mode(int p_id, bool p_no_signal) {
_set_mode_by_index(idx); _set_mode_by_index(idx);
if (!p_no_signal) { if (!p_no_signal) {
emit_signal(LSNAME(mode_changed)); emit_signal(LW_NAME(mode_changed));
} }
} }
@ -66,7 +66,7 @@ void ModeSwitchButton::clear() {
void ModeSwitchButton::_notification(int p_what) { void ModeSwitchButton::_notification(int p_what) {
switch (p_what) { switch (p_what) {
case NOTIFICATION_READY: { case NOTIFICATION_READY: {
connect(LSNAME(pressed), callable_mp(this, &ModeSwitchButton::next_mode)); connect(LW_NAME(pressed), callable_mp(this, &ModeSwitchButton::next_mode));
} break; } break;
} }
} }

View File

@ -90,7 +90,7 @@ TaskButton::TaskButton() {
//**** TaskPaletteSection //**** TaskPaletteSection
void TaskPaletteSection::_on_task_button_pressed(const String &p_task) { void TaskPaletteSection::_on_task_button_pressed(const String &p_task) {
emit_signal(LSNAME(task_button_pressed), p_task); emit_signal(LW_NAME(task_button_pressed), p_task);
} }
void TaskPaletteSection::_on_task_button_gui_input(const Ref<InputEvent> &p_event, const String &p_task) { void TaskPaletteSection::_on_task_button_gui_input(const Ref<InputEvent> &p_event, const String &p_task) {
@ -100,7 +100,7 @@ void TaskPaletteSection::_on_task_button_gui_input(const Ref<InputEvent> &p_even
Ref<InputEventMouseButton> mb = p_event; Ref<InputEventMouseButton> mb = p_event;
if (mb.is_valid() && mb->get_button_index() == LW_MBTN(RIGHT)) { if (mb.is_valid() && mb->get_button_index() == LW_MBTN(RIGHT)) {
emit_signal(LSNAME(task_button_rmb), p_task); emit_signal(LW_NAME(task_button_rmb), p_task);
} }
} }
@ -130,9 +130,9 @@ void TaskPaletteSection::add_task_button(const String &p_name, const Ref<Texture
btn->set_text(p_name); btn->set_text(p_name);
BUTTON_SET_ICON(btn, icon); BUTTON_SET_ICON(btn, icon);
btn->set_tooltip_text(p_tooltip); btn->set_tooltip_text(p_tooltip);
btn->add_theme_constant_override(LSNAME(icon_max_width), 16 * EDSCALE); // Force user icons to be of the proper size. btn->add_theme_constant_override(LW_NAME(icon_max_width), 16 * EDSCALE); // Force user icons to be of the proper size.
btn->connect(LSNAME(pressed), callable_mp(this, &TaskPaletteSection::_on_task_button_pressed).bind(p_meta)); btn->connect(LW_NAME(pressed), callable_mp(this, &TaskPaletteSection::_on_task_button_pressed).bind(p_meta));
btn->connect(LSNAME(gui_input), callable_mp(this, &TaskPaletteSection::_on_task_button_gui_input).bind(p_meta)); btn->connect(LW_NAME(gui_input), callable_mp(this, &TaskPaletteSection::_on_task_button_gui_input).bind(p_meta));
tasks_container->add_child(btn); tasks_container->add_child(btn);
} }
@ -146,19 +146,19 @@ bool TaskPaletteSection::is_collapsed() const {
} }
void TaskPaletteSection::_do_update_theme_item_cache() { void TaskPaletteSection::_do_update_theme_item_cache() {
theme_cache.arrow_down_icon = get_theme_icon(LSNAME(GuiTreeArrowDown), LSNAME(EditorIcons)); theme_cache.arrow_down_icon = get_theme_icon(LW_NAME(GuiTreeArrowDown), LW_NAME(EditorIcons));
theme_cache.arrow_right_icon = get_theme_icon(LSNAME(GuiTreeArrowRight), LSNAME(EditorIcons)); theme_cache.arrow_right_icon = get_theme_icon(LW_NAME(GuiTreeArrowRight), LW_NAME(EditorIcons));
} }
void TaskPaletteSection::_notification(int p_what) { void TaskPaletteSection::_notification(int p_what) {
switch (p_what) { switch (p_what) {
case NOTIFICATION_READY: { case NOTIFICATION_READY: {
section_header->connect(LSNAME(pressed), callable_mp(this, &TaskPaletteSection::_on_header_pressed)); section_header->connect(LW_NAME(pressed), callable_mp(this, &TaskPaletteSection::_on_header_pressed));
} break; } break;
case NOTIFICATION_THEME_CHANGED: { case NOTIFICATION_THEME_CHANGED: {
_do_update_theme_item_cache(); _do_update_theme_item_cache();
BUTTON_SET_ICON(section_header, (is_collapsed() ? theme_cache.arrow_right_icon : theme_cache.arrow_down_icon)); BUTTON_SET_ICON(section_header, (is_collapsed() ? theme_cache.arrow_right_icon : theme_cache.arrow_down_icon));
section_header->add_theme_font_override(LSNAME(font), get_theme_font(LSNAME(bold), LSNAME(EditorFonts))); section_header->add_theme_font_override(LW_NAME(font), get_theme_font(LW_NAME(bold), LW_NAME(EditorFonts)));
} break; } break;
} }
} }
@ -213,13 +213,13 @@ void TaskPalette::_menu_action_selected(int p_id) {
} }
ProjectSettings::get_singleton()->set_setting("limbo_ai/behavior_tree/favorite_tasks", favorite_tasks); ProjectSettings::get_singleton()->set_setting("limbo_ai/behavior_tree/favorite_tasks", favorite_tasks);
ProjectSettings::get_singleton()->save(); ProjectSettings::get_singleton()->save();
emit_signal(LSNAME(favorite_tasks_changed)); emit_signal(LW_NAME(favorite_tasks_changed));
} break; } break;
} }
} }
void TaskPalette::_on_task_button_pressed(const String &p_task) { void TaskPalette::_on_task_button_pressed(const String &p_task) {
emit_signal(LSNAME(task_selected), p_task); emit_signal(LW_NAME(task_selected), p_task);
} }
void TaskPalette::_on_task_button_rmb(const String &p_task) { void TaskPalette::_on_task_button_rmb(const String &p_task) {
@ -294,7 +294,7 @@ void TaskPalette::_update_filter_popup() {
category_item->set_pressed_no_signal(LOGICAL_XOR( category_item->set_pressed_no_signal(LOGICAL_XOR(
filter_settings.excluded_categories.has(cat), filter_settings.excluded_categories.has(cat),
filter_settings.category_filter == FilterSettings::CategoryFilter::CATEGORY_INCLUDE)); filter_settings.category_filter == FilterSettings::CategoryFilter::CATEGORY_INCLUDE));
category_item->connect(LSNAME(toggled), callable_mp(this, &TaskPalette::_category_item_toggled).bind(cat)); category_item->connect(LW_NAME(toggled), callable_mp(this, &TaskPalette::_category_item_toggled).bind(cat));
category_list->add_child(category_item); category_list->add_child(category_item);
} }
@ -370,7 +370,7 @@ void TaskPalette::_category_item_toggled(bool p_pressed, const String &p_categor
} }
void TaskPalette::_filter_data_changed() { void TaskPalette::_filter_data_changed() {
call_deferred(LSNAME(refresh)); call_deferred(LW_NAME(refresh));
_update_filter_button(); _update_filter_button();
} }
@ -477,8 +477,8 @@ void TaskPalette::refresh() {
sec->add_task_button(tname, icon, descr, task_meta); sec->add_task_button(tname, icon, descr, task_meta);
} }
sec->set_filter(""); sec->set_filter("");
sec->connect(LSNAME(task_button_pressed), callable_mp(this, &TaskPalette::_on_task_button_pressed)); sec->connect(LW_NAME(task_button_pressed), callable_mp(this, &TaskPalette::_on_task_button_pressed));
sec->connect(LSNAME(task_button_rmb), callable_mp(this, &TaskPalette::_on_task_button_rmb)); sec->connect(LW_NAME(task_button_rmb), callable_mp(this, &TaskPalette::_on_task_button_rmb));
sections->add_child(sec); sections->add_child(sec);
sec->set_collapsed(!dialog_mode && collapsed_sections.has(cat)); sec->set_collapsed(!dialog_mode && collapsed_sections.has(cat));
} }
@ -495,32 +495,32 @@ void TaskPalette::use_dialog_mode() {
} }
void TaskPalette::_do_update_theme_item_cache() { void TaskPalette::_do_update_theme_item_cache() {
theme_cache.add_to_favorites_icon = get_theme_icon(LSNAME(Favorites), LSNAME(EditorIcons)); theme_cache.add_to_favorites_icon = get_theme_icon(LW_NAME(Favorites), LW_NAME(EditorIcons));
theme_cache.edit_script_icon = get_theme_icon(LSNAME(Script), LSNAME(EditorIcons)); theme_cache.edit_script_icon = get_theme_icon(LW_NAME(Script), LW_NAME(EditorIcons));
theme_cache.open_doc_icon = get_theme_icon(LSNAME(Help), LSNAME(EditorIcons)); theme_cache.open_doc_icon = get_theme_icon(LW_NAME(Help), LW_NAME(EditorIcons));
theme_cache.remove_from_favorites_icon = get_theme_icon(LSNAME(NonFavorite), LSNAME(EditorIcons)); theme_cache.remove_from_favorites_icon = get_theme_icon(LW_NAME(NonFavorite), LW_NAME(EditorIcons));
theme_cache.category_choice_background = get_theme_stylebox(LSNAME(normal), LSNAME(LineEdit)); theme_cache.category_choice_background = get_theme_stylebox(LW_NAME(normal), LW_NAME(LineEdit));
} }
void TaskPalette::_notification(int p_what) { void TaskPalette::_notification(int p_what) {
switch (p_what) { switch (p_what) {
case NOTIFICATION_READY: { case NOTIFICATION_READY: {
// **** Signals // **** Signals
tool_filters->connect(LSNAME(pressed), callable_mp(this, &TaskPalette::_show_filter_popup)); tool_filters->connect(LW_NAME(pressed), callable_mp(this, &TaskPalette::_show_filter_popup));
filter_edit->connect(LSNAME(text_changed), callable_mp(this, &TaskPalette::_apply_filter)); filter_edit->connect(LW_NAME(text_changed), callable_mp(this, &TaskPalette::_apply_filter));
tool_refresh->connect(LSNAME(pressed), callable_mp(this, &TaskPalette::refresh)); tool_refresh->connect(LW_NAME(pressed), callable_mp(this, &TaskPalette::refresh));
menu->connect(LSNAME(id_pressed), callable_mp(this, &TaskPalette::_menu_action_selected)); menu->connect(LW_NAME(id_pressed), callable_mp(this, &TaskPalette::_menu_action_selected));
type_all->connect(LSNAME(pressed), callable_mp(this, &TaskPalette::_type_filter_changed)); type_all->connect(LW_NAME(pressed), callable_mp(this, &TaskPalette::_type_filter_changed));
type_core->connect(LSNAME(pressed), callable_mp(this, &TaskPalette::_type_filter_changed)); type_core->connect(LW_NAME(pressed), callable_mp(this, &TaskPalette::_type_filter_changed));
type_user->connect(LSNAME(pressed), callable_mp(this, &TaskPalette::_type_filter_changed)); type_user->connect(LW_NAME(pressed), callable_mp(this, &TaskPalette::_type_filter_changed));
category_all->connect(LSNAME(pressed), callable_mp(this, &TaskPalette::_category_filter_changed)); category_all->connect(LW_NAME(pressed), callable_mp(this, &TaskPalette::_category_filter_changed));
category_include->connect(LSNAME(pressed), callable_mp(this, &TaskPalette::_category_filter_changed)); category_include->connect(LW_NAME(pressed), callable_mp(this, &TaskPalette::_category_filter_changed));
category_exclude->connect(LSNAME(pressed), callable_mp(this, &TaskPalette::_category_filter_changed)); category_exclude->connect(LW_NAME(pressed), callable_mp(this, &TaskPalette::_category_filter_changed));
category_choice->connect(LSNAME(draw), callable_mp(this, &TaskPalette::_draw_filter_popup_background)); category_choice->connect(LW_NAME(draw), callable_mp(this, &TaskPalette::_draw_filter_popup_background));
select_all->connect(LSNAME(pressed), callable_mp(this, &TaskPalette::_set_all_filter_categories).bind(true)); select_all->connect(LW_NAME(pressed), callable_mp(this, &TaskPalette::_set_all_filter_categories).bind(true));
deselect_all->connect(LSNAME(pressed), callable_mp(this, &TaskPalette::_set_all_filter_categories).bind(false)); deselect_all->connect(LW_NAME(pressed), callable_mp(this, &TaskPalette::_set_all_filter_categories).bind(false));
filter_popup->connect(LSNAME(popup_hide), callable_mp(this, &TaskPalette::_update_filter_button)); filter_popup->connect(LW_NAME(popup_hide), callable_mp(this, &TaskPalette::_update_filter_button));
} break; } break;
case NOTIFICATION_ENTER_TREE: { case NOTIFICATION_ENTER_TREE: {
Ref<ConfigFile> cf; Ref<ConfigFile> cf;
@ -578,12 +578,12 @@ void TaskPalette::_notification(int p_what) {
case NOTIFICATION_THEME_CHANGED: { case NOTIFICATION_THEME_CHANGED: {
_do_update_theme_item_cache(); _do_update_theme_item_cache();
BUTTON_SET_ICON(tool_filters, get_theme_icon(LSNAME(AnimationFilter), LSNAME(EditorIcons))); BUTTON_SET_ICON(tool_filters, get_theme_icon(LW_NAME(AnimationFilter), LW_NAME(EditorIcons)));
BUTTON_SET_ICON(tool_refresh, get_theme_icon(LSNAME(Reload), LSNAME(EditorIcons))); BUTTON_SET_ICON(tool_refresh, get_theme_icon(LW_NAME(Reload), LW_NAME(EditorIcons)));
BUTTON_SET_ICON(select_all, get_theme_icon(LSNAME(LimboSelectAll), LSNAME(EditorIcons))); BUTTON_SET_ICON(select_all, get_theme_icon(LW_NAME(LimboSelectAll), LW_NAME(EditorIcons)));
BUTTON_SET_ICON(deselect_all, get_theme_icon(LSNAME(LimboDeselectAll), LSNAME(EditorIcons))); BUTTON_SET_ICON(deselect_all, get_theme_icon(LW_NAME(LimboDeselectAll), LW_NAME(EditorIcons)));
filter_edit->set_right_icon(get_theme_icon(LSNAME(Search), LSNAME(EditorIcons))); filter_edit->set_right_icon(get_theme_icon(LW_NAME(Search), LW_NAME(EditorIcons)));
category_choice->queue_redraw(); category_choice->queue_redraw();

View File

@ -48,7 +48,7 @@ void TaskTree::_update_item(TreeItem *p_item) {
if (p_item->get_parent()) { if (p_item->get_parent()) {
Ref<BTProbabilitySelector> sel = p_item->get_parent()->get_metadata(0); Ref<BTProbabilitySelector> sel = p_item->get_parent()->get_metadata(0);
if (sel.is_valid() && sel->has_probability(p_item->get_index())) { if (sel.is_valid() && sel->has_probability(p_item->get_index())) {
p_item->set_custom_draw(0, this, LSNAME(_draw_probability)); p_item->set_custom_draw(0, this, LW_NAME(_draw_probability));
p_item->set_cell_mode(0, TreeItem::CELL_MODE_CUSTOM); p_item->set_cell_mode(0, TreeItem::CELL_MODE_CUSTOM);
} }
} }
@ -138,10 +138,10 @@ void TaskTree::_on_item_mouse_selected(const Vector2 &p_pos, MouseButton p_butto
if (p_button_index == LW_MBTN(LEFT)) { if (p_button_index == LW_MBTN(LEFT)) {
Rect2 rect = get_selected_probability_rect(); Rect2 rect = get_selected_probability_rect();
if (rect != Rect2() && rect.has_point(p_pos)) { if (rect != Rect2() && rect.has_point(p_pos)) {
emit_signal(LSNAME(probability_clicked)); emit_signal(LW_NAME(probability_clicked));
} }
} else if (p_button_index == LW_MBTN(RIGHT)) { } else if (p_button_index == LW_MBTN(RIGHT)) {
emit_signal(LSNAME(rmb_pressed), get_screen_position() + p_pos); emit_signal(LW_NAME(rmb_pressed), get_screen_position() + p_pos);
} }
} }
@ -149,17 +149,17 @@ void TaskTree::_on_item_selected() {
Callable on_task_changed = callable_mp(this, &TaskTree::_on_task_changed); Callable on_task_changed = callable_mp(this, &TaskTree::_on_task_changed);
if (last_selected.is_valid()) { if (last_selected.is_valid()) {
update_task(last_selected); update_task(last_selected);
if (last_selected->is_connected(LSNAME(changed), on_task_changed)) { if (last_selected->is_connected(LW_NAME(changed), on_task_changed)) {
last_selected->disconnect(LSNAME(changed), on_task_changed); last_selected->disconnect(LW_NAME(changed), on_task_changed);
} }
} }
last_selected = get_selected(); last_selected = get_selected();
last_selected->connect(LSNAME(changed), on_task_changed); last_selected->connect(LW_NAME(changed), on_task_changed);
emit_signal(LSNAME(task_selected), last_selected); emit_signal(LW_NAME(task_selected), last_selected);
} }
void TaskTree::_on_item_activated() { void TaskTree::_on_item_activated() {
emit_signal(LSNAME(task_activated)); emit_signal(LW_NAME(task_activated));
} }
void TaskTree::_on_task_changed() { void TaskTree::_on_task_changed() {
@ -170,8 +170,8 @@ void TaskTree::load_bt(const Ref<BehaviorTree> &p_behavior_tree) {
ERR_FAIL_COND_MSG(p_behavior_tree.is_null(), "Tried to load a null tree."); ERR_FAIL_COND_MSG(p_behavior_tree.is_null(), "Tried to load a null tree.");
Callable on_task_changed = callable_mp(this, &TaskTree::_on_task_changed); Callable on_task_changed = callable_mp(this, &TaskTree::_on_task_changed);
if (last_selected.is_valid() && last_selected->is_connected(LSNAME(changed), on_task_changed)) { if (last_selected.is_valid() && last_selected->is_connected(LW_NAME(changed), on_task_changed)) {
last_selected->disconnect(LSNAME(changed), on_task_changed); last_selected->disconnect(LW_NAME(changed), on_task_changed);
} }
bt = p_behavior_tree; bt = p_behavior_tree;
@ -184,8 +184,8 @@ void TaskTree::load_bt(const Ref<BehaviorTree> &p_behavior_tree) {
void TaskTree::unload() { void TaskTree::unload() {
Callable on_task_changed = callable_mp(this, &TaskTree::_on_task_changed); Callable on_task_changed = callable_mp(this, &TaskTree::_on_task_changed);
if (last_selected.is_valid() && last_selected->is_connected(LSNAME(changed), on_task_changed)) { if (last_selected.is_valid() && last_selected->is_connected(LW_NAME(changed), on_task_changed)) {
last_selected->disconnect(LSNAME(changed), on_task_changed); last_selected->disconnect(LW_NAME(changed), on_task_changed);
} }
bt->unreference(); bt->unreference();
@ -300,7 +300,7 @@ void TaskTree::_drop_data_fw(const Point2 &p_point, const Variant &p_data) {
TreeItem *item = tree->get_item_at_position(p_point); TreeItem *item = tree->get_item_at_position(p_point);
if (item && d.has("task")) { if (item && d.has("task")) {
Ref<BTTask> task = d["task"]; Ref<BTTask> task = d["task"];
emit_signal(LSNAME(task_dragged), task, item->get_metadata(0), tree->get_drop_section_at_position(p_point)); emit_signal(LW_NAME(task_dragged), task, item->get_metadata(0), tree->get_drop_section_at_position(p_point));
} }
} }
@ -337,21 +337,21 @@ void TaskTree::_draw_probability(Object *item_obj, Rect2 rect) {
} }
void TaskTree::_do_update_theme_item_cache() { void TaskTree::_do_update_theme_item_cache() {
theme_cache.name_font = get_theme_font(LSNAME(font)); theme_cache.name_font = get_theme_font(LW_NAME(font));
theme_cache.custom_name_font = get_theme_font(LSNAME(bold), LSNAME(EditorFonts)); theme_cache.custom_name_font = get_theme_font(LW_NAME(bold), LW_NAME(EditorFonts));
theme_cache.comment_font = get_theme_font(LSNAME(doc_italic), LSNAME(EditorFonts)); theme_cache.comment_font = get_theme_font(LW_NAME(doc_italic), LW_NAME(EditorFonts));
theme_cache.probability_font = get_theme_font(LSNAME(font)); theme_cache.probability_font = get_theme_font(LW_NAME(font));
theme_cache.name_font_size = get_theme_font_size(LSNAME(font_size)); theme_cache.name_font_size = get_theme_font_size(LW_NAME(font_size));
theme_cache.probability_font_size = Math::floor(get_theme_font_size(LSNAME(font_size)) * 0.9); theme_cache.probability_font_size = Math::floor(get_theme_font_size(LW_NAME(font_size)) * 0.9);
theme_cache.task_warning_icon = get_theme_icon(LSNAME(NodeWarning), LSNAME(EditorIcons)); theme_cache.task_warning_icon = get_theme_icon(LW_NAME(NodeWarning), LW_NAME(EditorIcons));
theme_cache.comment_color = get_theme_color(LSNAME(disabled_font_color), LSNAME(Editor)); theme_cache.comment_color = get_theme_color(LW_NAME(disabled_font_color), LW_NAME(Editor));
theme_cache.probability_font_color = get_theme_color(LSNAME(font_color), LSNAME(Editor)); theme_cache.probability_font_color = get_theme_color(LW_NAME(font_color), LW_NAME(Editor));
theme_cache.probability_bg.instantiate(); theme_cache.probability_bg.instantiate();
theme_cache.probability_bg->set_bg_color(get_theme_color(LSNAME(accent_color), LSNAME(Editor)) * Color(1, 1, 1, 0.25)); theme_cache.probability_bg->set_bg_color(get_theme_color(LW_NAME(accent_color), LW_NAME(Editor)) * Color(1, 1, 1, 0.25));
theme_cache.probability_bg->set_corner_radius_all(12.0 * EDSCALE); theme_cache.probability_bg->set_corner_radius_all(12.0 * EDSCALE);
} }
@ -410,7 +410,7 @@ TaskTree::TaskTree() {
TaskTree::~TaskTree() { TaskTree::~TaskTree() {
Callable on_task_changed = callable_mp(this, &TaskTree::_on_task_changed); Callable on_task_changed = callable_mp(this, &TaskTree::_on_task_changed);
if (last_selected.is_valid() && last_selected->is_connected(LSNAME(changed), on_task_changed)) { if (last_selected.is_valid() && last_selected->is_connected(LW_NAME(changed), on_task_changed)) {
last_selected->disconnect(LSNAME(changed), on_task_changed); last_selected->disconnect(LW_NAME(changed), on_task_changed);
} }
} }

View File

@ -185,7 +185,7 @@ bool LimboHSM::dispatch(const String &p_event, const Variant &p_cargo) {
} }
} }
if (!event_consumed && p_event == LSNAME(EVENT_FINISHED) && !(get_parent() && get_parent()->is_class("LimboState"))) { if (!event_consumed && p_event == LW_NAME(EVENT_FINISHED) && !(get_parent() && get_parent()->is_class("LimboState"))) {
_exit(); _exit();
} }

View File

@ -83,7 +83,7 @@ public:
LimboState *call_on_exit(const Callable &p_callable); LimboState *call_on_exit(const Callable &p_callable);
LimboState *call_on_update(const Callable &p_callable); LimboState *call_on_update(const Callable &p_callable);
_FORCE_INLINE_ String event_finished() const { return LSNAME(EVENT_FINISHED); } _FORCE_INLINE_ String event_finished() const { return LW_NAME(EVENT_FINISHED); }
LimboState *get_root() const; LimboState *get_root() const;
bool is_active() const { return active; } bool is_active() const { return active; }

View File

@ -36,7 +36,7 @@
#define RAND_RANGE(m_from, m_to) (Math::random(m_from, m_to)) #define RAND_RANGE(m_from, m_to) (Math::random(m_from, m_to))
#define RANDF() (Math::randf()) #define RANDF() (Math::randf())
#define VCALL(m_method) (GDVIRTUAL_CALL(method)) #define VCALL(m_method) (GDVIRTUAL_CALL(method))
#define VCALL_ARGS(method, ...) (call(LSNAME(method), __VA_ARGS__)) #define VCALL_ARGS(method, ...) (call(LW_NAME(method), __VA_ARGS__))
#define BUTTON_SET_ICON(m_btn, m_icon) m_btn->set_icon(m_icon) #define BUTTON_SET_ICON(m_btn, m_icon) m_btn->set_icon(m_icon)
#define RESOURCE_LOAD(m_path, m_hint) ResourceLoader::load(m_path, m_hint) #define RESOURCE_LOAD(m_path, m_hint) ResourceLoader::load(m_path, m_hint)
#define RESOURCE_LOAD_NO_CACHE(m_path, m_hint) ResourceLoader::load(m_path, m_hint, ResourceLoader::CACHE_MODE_IGNORE) #define RESOURCE_LOAD_NO_CACHE(m_path, m_hint) ResourceLoader::load(m_path, m_hint, ResourceLoader::CACHE_MODE_IGNORE)
@ -87,8 +87,8 @@ using namespace godot;
#define IS_CLASS(m_obj, m_class) (m_obj->get_class_static() == m_class::get_class_static()) #define IS_CLASS(m_obj, m_class) (m_obj->get_class_static() == m_class::get_class_static())
#define RAND_RANGE(m_from, m_to) (UtilityFunctions::randf_range(m_from, m_to)) #define RAND_RANGE(m_from, m_to) (UtilityFunctions::randf_range(m_from, m_to))
#define RANDF() (UtilityFunctions::randf()) #define RANDF() (UtilityFunctions::randf())
#define VCALL(m_name) (call(LSNAME(m_name))) #define VCALL(m_name) (call(LW_NAME(m_name)))
#define VCALL_ARGS(m_name, ...) (call(LSNAME(m_name), __VA_ARGS__)) #define VCALL_ARGS(m_name, ...) (call(LW_NAME(m_name), __VA_ARGS__))
#define BUTTON_SET_ICON(m_btn, m_icon) m_btn->set_button_icon(m_icon) #define BUTTON_SET_ICON(m_btn, m_icon) m_btn->set_button_icon(m_icon)
#define RESOURCE_LOAD(m_path, m_hint) ResourceLoader::get_singleton()->load(m_path, m_hint) #define RESOURCE_LOAD(m_path, m_hint) ResourceLoader::get_singleton()->load(m_path, m_hint)
#define RESOURCE_LOAD_NO_CACHE(m_path, m_hint) ResourceLoader::get_singleton()->load(m_path, m_hint, ResourceLoader::CACHE_MODE_IGNORE) #define RESOURCE_LOAD_NO_CACHE(m_path, m_hint) ResourceLoader::get_singleton()->load(m_path, m_hint, ResourceLoader::CACHE_MODE_IGNORE)

View File

@ -147,6 +147,6 @@ public:
String repeat_forever; String repeat_forever;
}; };
#define LSNAME(m_arg) LimboStringNames::get_singleton()->m_arg #define LW_NAME(m_arg) LimboStringNames::get_singleton()->m_arg
#endif // LIMBO_STRING_NAMES_H #endif // LIMBO_STRING_NAMES_H