diff options
Diffstat (limited to 'tools/editor/project_settings.cpp')
-rw-r--r-- | tools/editor/project_settings.cpp | 56 |
1 files changed, 41 insertions, 15 deletions
diff --git a/tools/editor/project_settings.cpp b/tools/editor/project_settings.cpp index fd76ea3087..34bc31d20c 100644 --- a/tools/editor/project_settings.cpp +++ b/tools/editor/project_settings.cpp @@ -60,6 +60,8 @@ void ProjectSettings::_notification(int p_what) { if (p_what==NOTIFICATION_ENTER_TREE) { + globals_editor->edit(Globals::get_singleton()); + search_button->set_icon(get_icon("Zoom","EditorIcons")); clear_button->set_icon(get_icon("Close","EditorIcons")); @@ -566,10 +568,10 @@ void ProjectSettings::popup_project_settings() { //popup_centered(Size2(500,400)); popup_centered_ratio(); - globals_editor->edit(NULL); - globals_editor->edit(Globals::get_singleton()); + globals_editor->update_category_list(); _update_translations(); _update_autoload(); + plugin_settings->update_plugins(); } @@ -604,37 +606,45 @@ void ProjectSettings::_item_add() { case 3: value=""; break; } - String catname = category->get_text(); + String catname = category->get_text().strip_edges(); /*if (!catname.is_valid_identifier()) { message->set_text("Invalid Category.\nValid characters: a-z,A-Z,0-9 or _"); message->popup_centered(Size2(300,100)); return; }*/ - String propname = property->get_text(); + String propname = property->get_text().strip_edges(); /*if (!propname.is_valid_identifier()) { message->set_text("Invalid Property.\nValid characters: a-z,A-Z,0-9 or _"); message->popup_centered(Size2(300,100)); return; }*/ - String name = catname+"/"+propname; + String name = catname!="" ? catname+"/"+propname : propname; + Globals::get_singleton()->set(name,value); - globals_editor->edit(NULL); - globals_editor->edit(Globals::get_singleton()); + + globals_editor->set_current_section(catname); + globals_editor->update_category_list(); + + _settings_changed(); } void ProjectSettings::_item_del() { - String catname = category->get_text(); + String catname = category->get_text().strip_edges(); //ERR_FAIL_COND(!catname.is_valid_identifier()); - String propname = property->get_text(); + String propname = property->get_text().strip_edges(); //ERR_FAIL_COND(!propname.is_valid_identifier()); - String name = catname+"/"+propname; + String name = catname!="" ? catname+"/"+propname : propname; + Globals::get_singleton()->set(name,Variant()); - globals_editor->get_property_editor()->update_tree(); + globals_editor->set_current_section(catname); + globals_editor->update_category_list(); + + _settings_changed(); } void ProjectSettings::_action_adds(String) { @@ -739,6 +749,10 @@ void ProjectSettings::_settings_changed() { timer->start(); } +void ProjectSettings::queue_save() { + _settings_changed(); +} + void ProjectSettings::_copy_to_platform(int p_which) { @@ -952,7 +966,7 @@ void ProjectSettings::_autoload_delete(Object *p_item,int p_column, int p_button undo_redo->commit_action(); } else { - TreeItem *swap; + TreeItem *swap = NULL; if (p_button==1) { swap=ti->get_prev(); @@ -998,7 +1012,7 @@ void ProjectSettings::_translation_delete(Object *p_item,int p_column, int p_but undo_redo->create_action("Remove Translation"); undo_redo->add_do_property(Globals::get_singleton(),"locale/translations",translations); - undo_redo->add_undo_property(Globals::get_singleton(),"locale/translations",Globals::get_singleton()->get("locale/translations")); + undo_redo->add_undo_property(Globals::get_singleton(),"locale/translations",Globals::get_singleton()->get("locale/translations")); undo_redo->add_do_method(this,"_update_translations"); undo_redo->add_undo_method(this,"_update_translations"); undo_redo->add_do_method(this,"_settings_changed"); @@ -1112,7 +1126,7 @@ void ProjectSettings::_translation_res_option_changed() { ERR_FAIL_COND(!remaps.has(key)); - StringArray r = remaps[key]; + StringArray r = remaps[key]; ERR_FAIL_INDEX(idx,r.size()); r.set(idx,path+":"+langs[which]); remaps[key]=r; @@ -1382,6 +1396,11 @@ void ProjectSettings::_clear_search_box() { globals_editor->get_property_editor()->update_tree(); } +void ProjectSettings::set_plugins_page() { + + tab_container->set_current_tab( plugin_settings->get_index() ); +} + void ProjectSettings::_bind_methods() { ObjectTypeDB::bind_method(_MD("_item_selected"),&ProjectSettings::_item_selected); @@ -1438,7 +1457,7 @@ ProjectSettings::ProjectSettings(EditorData *p_data) { data=p_data; - TabContainer *tab_container = memnew( TabContainer ); + tab_container = memnew( TabContainer ); add_child(tab_container); set_child_rect(tab_container); @@ -1830,6 +1849,13 @@ ProjectSettings::ProjectSettings(EditorData *p_data) { } + { + + plugin_settings = memnew( EditorPluginSettings ); + plugin_settings->set_name("Plugins"); + tab_container->add_child(plugin_settings); + } + timer = memnew( Timer ); timer->set_wait_time(1.5); timer->connect("timeout",Globals::get_singleton(),"save"); |