From e851011678f8f0f01bac2151510bbd8f0d019eb9 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Sat, 19 Aug 2023 13:12:24 +0200 Subject: [PATCH] Rename dialog now says "Edit comment" for comments --- editor/limbo_ai_editor_plugin.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/editor/limbo_ai_editor_plugin.cpp b/editor/limbo_ai_editor_plugin.cpp index aa0bad0..de8a6cb 100644 --- a/editor/limbo_ai_editor_plugin.cpp +++ b/editor/limbo_ai_editor_plugin.cpp @@ -938,9 +938,18 @@ void LimboAIEditor::_action_selected(int p_id) { if (!task_tree->get_selected().is_valid()) { return; } - + Ref task = task_tree->get_selected(); + if (task->is_class_ptr(BTComment::get_class_ptr_static())) { + rename_dialog->set_title(TTR("Edit Comment")); + rename_dialog->get_ok_button()->set_text(TTR("OK")); + rename_edit->set_placeholder(TTR("Comment")); + } else { + rename_dialog->set_title(TTR("Rename Task")); + rename_dialog->get_ok_button()->set_text(TTR("Rename")); + rename_edit->set_placeholder(TTR("Custom Name")); + } + rename_edit->set_text(task->get_custom_name()); rename_dialog->popup_centered(); - rename_edit->set_text(task_tree->get_selected()->get_custom_name()); rename_edit->select_all(); rename_edit->grab_focus(); } break; @@ -1449,19 +1458,15 @@ LimboAIEditor::LimboAIEditor() { rename_dialog = memnew(ConfirmationDialog); { - rename_dialog->set_title("Rename Task"); - VBoxContainer *vbc = memnew(VBoxContainer); rename_dialog->add_child(vbc); rename_edit = memnew(LineEdit); vbc->add_child(rename_edit); - rename_edit->set_placeholder("Custom Name"); rename_edit->set_h_size_flags(Control::SIZE_EXPAND_FILL); rename_edit->set_custom_minimum_size(Size2(350.0, 0.0)); rename_dialog->register_text_enter(rename_edit); - rename_dialog->get_ok_button()->set_text(TTR("Rename")); rename_dialog->connect("confirmed", callable_mp(this, &LimboAIEditor::_rename_task_confirmed)); } add_child(rename_dialog);