Merge pull request #5980 from profelis/PR-run-btn-availability
Run button availability check
This commit is contained in:
commit
3ca08d2a0f
@ -518,23 +518,23 @@ void ProjectManager::_panel_draw(Node *p_hb) {
|
|||||||
|
|
||||||
void ProjectManager::_update_project_buttons()
|
void ProjectManager::_update_project_buttons()
|
||||||
{
|
{
|
||||||
String single_selected = "";
|
|
||||||
if (selected_list.size() == 1) {
|
|
||||||
single_selected = selected_list.front()->key();
|
|
||||||
}
|
|
||||||
|
|
||||||
single_selected_main = "";
|
|
||||||
for(int i=0;i<scroll_childs->get_child_count();i++) {
|
for(int i=0;i<scroll_childs->get_child_count();i++) {
|
||||||
|
|
||||||
CanvasItem *item = scroll_childs->get_child(i)->cast_to<CanvasItem>();
|
CanvasItem *item = scroll_childs->get_child(i)->cast_to<CanvasItem>();
|
||||||
item->update();
|
item->update();
|
||||||
|
}
|
||||||
if (single_selected!="" && single_selected == item->get_meta("name"))
|
|
||||||
single_selected_main = item->get_meta("main_scene");
|
bool has_runnable_scene = false;
|
||||||
|
for (Map<String,String>::Element *E=selected_list.front(); E; E=E->next()) {
|
||||||
|
const String &selected_main = E->get();
|
||||||
|
if (selected_main == "") continue;
|
||||||
|
has_runnable_scene = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
erase_btn->set_disabled(selected_list.size()<1);
|
erase_btn->set_disabled(selected_list.size()<1);
|
||||||
open_btn->set_disabled(selected_list.size()<1);
|
open_btn->set_disabled(selected_list.size()<1);
|
||||||
run_btn->set_disabled(selected_list.size()<1 || (selected_list.size()==1 && single_selected_main==""));
|
run_btn->set_disabled(!has_runnable_scene);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectManager::_panel_input(const InputEvent& p_ev,Node *p_hb) {
|
void ProjectManager::_panel_input(const InputEvent& p_ev,Node *p_hb) {
|
||||||
@ -1072,7 +1072,6 @@ void ProjectManager::_erase_project_confirm() {
|
|||||||
EditorSettings::get_singleton()->save();
|
EditorSettings::get_singleton()->save();
|
||||||
selected_list.clear();
|
selected_list.clear();
|
||||||
last_clicked = "";
|
last_clicked = "";
|
||||||
single_selected_main="";
|
|
||||||
_load_recent_projects();
|
_load_recent_projects();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,6 @@ class ProjectManager : public Control {
|
|||||||
VBoxContainer *scroll_childs;
|
VBoxContainer *scroll_childs;
|
||||||
Map<String, String> selected_list; // name -> main_scene
|
Map<String, String> selected_list; // name -> main_scene
|
||||||
String last_clicked;
|
String last_clicked;
|
||||||
String single_selected_main;
|
|
||||||
bool importing;
|
bool importing;
|
||||||
|
|
||||||
HBoxContainer *projects_hb;
|
HBoxContainer *projects_hb;
|
||||||
@ -69,8 +68,6 @@ class ProjectManager : public Control {
|
|||||||
|
|
||||||
Control *gui_base;
|
Control *gui_base;
|
||||||
|
|
||||||
void _item_doubleclicked();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void _scan_projects();
|
void _scan_projects();
|
||||||
|
Loading…
Reference in New Issue
Block a user