Disable some task palette functionality when it is in dialog mode
This commit is contained in:
parent
f94aca4433
commit
08a8ef9c77
|
@ -323,6 +323,7 @@ void LimboAIEditor::_action_selected(int p_id) {
|
|||
rename_edit->grab_focus();
|
||||
} break;
|
||||
case ACTION_CHANGE_TYPE: {
|
||||
change_type_palette->clear_filter();
|
||||
change_type_palette->refresh();
|
||||
Rect2 rect = Rect2(get_global_mouse_position(), Size2(400.0, 600.0) * EDSCALE);
|
||||
change_type_popup->popup(rect);
|
||||
|
@ -1092,6 +1093,7 @@ LimboAIEditor::LimboAIEditor() {
|
|||
add_child(change_type_popup);
|
||||
change_type_palette = memnew(TaskPalette);
|
||||
change_type_popup->add_child(change_type_palette);
|
||||
change_type_palette->use_dialog_mode();
|
||||
change_type_palette->connect("task_selected", callable_mp(this, &LimboAIEditor::_task_type_selected));
|
||||
|
||||
banners = memnew(VBoxContainer);
|
||||
|
|
|
@ -179,6 +179,10 @@ void TaskPalette::_on_task_button_pressed(const String &p_task) {
|
|||
}
|
||||
|
||||
void TaskPalette::_on_task_button_rmb(const String &p_task) {
|
||||
if (dialog_mode) {
|
||||
return;
|
||||
}
|
||||
|
||||
ERR_FAIL_COND(p_task.is_empty());
|
||||
|
||||
context_task = p_task;
|
||||
|
@ -415,14 +419,20 @@ void TaskPalette::refresh() {
|
|||
sec->connect(SNAME("task_button_pressed"), callable_mp(this, &TaskPalette::_on_task_button_pressed));
|
||||
sec->connect(SNAME("task_button_rmb"), callable_mp(this, &TaskPalette::_on_task_button_rmb));
|
||||
sections->add_child(sec);
|
||||
sec->set_collapsed(collapsed_sections.has(cat));
|
||||
sec->set_collapsed(!dialog_mode && collapsed_sections.has(cat));
|
||||
}
|
||||
|
||||
if (!filter_edit->get_text().is_empty()) {
|
||||
if (!dialog_mode && !filter_edit->get_text().is_empty()) {
|
||||
_apply_filter(filter_edit->get_text());
|
||||
}
|
||||
}
|
||||
|
||||
void TaskPalette::use_dialog_mode() {
|
||||
tool_filters->hide();
|
||||
tool_refresh->hide();
|
||||
dialog_mode = true;
|
||||
}
|
||||
|
||||
void TaskPalette::_update_theme_item_cache() {
|
||||
PanelContainer::_update_theme_item_cache();
|
||||
|
||||
|
|
|
@ -118,6 +118,7 @@ private:
|
|||
VBoxContainer *category_list;
|
||||
|
||||
String context_task;
|
||||
bool dialog_mode = false;
|
||||
|
||||
void _menu_action_selected(int p_id);
|
||||
void _on_task_button_pressed(const String &p_task);
|
||||
|
@ -149,6 +150,8 @@ protected:
|
|||
|
||||
public:
|
||||
void refresh();
|
||||
void use_dialog_mode();
|
||||
void clear_filter() { filter_edit->set_text(""); }
|
||||
|
||||
TaskPalette();
|
||||
~TaskPalette();
|
||||
|
|
Loading…
Reference in New Issue