summaryrefslogtreecommitdiff
path: root/tools/editor/project_settings.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/editor/project_settings.cpp')
-rw-r--r--tools/editor/project_settings.cpp158
1 files changed, 87 insertions, 71 deletions
diff --git a/tools/editor/project_settings.cpp b/tools/editor/project_settings.cpp
index 968333d466..15019b8ca8 100644
--- a/tools/editor/project_settings.cpp
+++ b/tools/editor/project_settings.cpp
@@ -27,8 +27,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "project_settings.h"
+
#include "scene/gui/tab_container.h"
-#include "globals.h"
+#include "global_config.h"
#include "os/keyboard.h"
#include "editor_node.h"
#include "scene/gui/margin_container.h"
@@ -72,34 +73,38 @@ static const char* _axis_names[JOY_AXIS_MAX*2] = {
void ProjectSettings::_notification(int p_what) {
- if (p_what==NOTIFICATION_ENTER_TREE) {
-
- globals_editor->edit(GlobalConfig::get_singleton());
+ switch (p_what) {
+ case NOTIFICATION_ENTER_TREE: {
+ globals_editor->edit(GlobalConfig::get_singleton());
- search_button->set_icon(get_icon("Zoom","EditorIcons"));
- clear_button->set_icon(get_icon("Close","EditorIcons"));
+ search_button->set_icon(get_icon("Zoom","EditorIcons"));
+ clear_button->set_icon(get_icon("Close","EditorIcons"));
- translation_list->connect("button_pressed",this,"_translation_delete");
- _update_actions();
- popup_add->add_icon_item(get_icon("Keyboard","EditorIcons"),TTR("Key "),InputEvent::KEY);//"Key " - because the word 'key' has already been used as a key animation
- popup_add->add_icon_item(get_icon("JoyButton","EditorIcons"),TTR("Joy Button"),InputEvent::JOYPAD_BUTTON);
- popup_add->add_icon_item(get_icon("JoyAxis","EditorIcons"),TTR("Joy Axis"),InputEvent::JOYPAD_MOTION);
- popup_add->add_icon_item(get_icon("Mouse","EditorIcons"),TTR("Mouse Button"),InputEvent::MOUSE_BUTTON);
+ translation_list->connect("button_pressed",this,"_translation_delete");
+ _update_actions();
+ popup_add->add_icon_item(get_icon("Keyboard","EditorIcons"),TTR("Key "),InputEvent::KEY);//"Key " - because the word 'key' has already been used as a key animation
+ popup_add->add_icon_item(get_icon("JoyButton","EditorIcons"),TTR("Joy Button"),InputEvent::JOYPAD_BUTTON);
+ popup_add->add_icon_item(get_icon("JoyAxis","EditorIcons"),TTR("Joy Axis"),InputEvent::JOYPAD_MOTION);
+ popup_add->add_icon_item(get_icon("Mouse","EditorIcons"),TTR("Mouse Button"),InputEvent::MOUSE_BUTTON);
- List<String> tfn;
- ResourceLoader::get_recognized_extensions_for_type("Translation",&tfn);
- for (List<String>::Element *E=tfn.front();E;E=E->next()) {
+ List<String> tfn;
+ ResourceLoader::get_recognized_extensions_for_type("Translation",&tfn);
+ for (List<String>::Element *E=tfn.front();E;E=E->next()) {
- translation_file_open->add_filter("*."+E->get());
- }
+ translation_file_open->add_filter("*."+E->get());
+ }
- List<String> rfn;
- ResourceLoader::get_recognized_extensions_for_type("Resource",&rfn);
- for (List<String>::Element *E=rfn.front();E;E=E->next()) {
+ List<String> rfn;
+ ResourceLoader::get_recognized_extensions_for_type("Resource",&rfn);
+ for (List<String>::Element *E=rfn.front();E;E=E->next()) {
- translation_res_file_open->add_filter("*."+E->get());
- translation_res_option_file_open->add_filter("*."+E->get());
- }
+ translation_res_file_open->add_filter("*."+E->get());
+ translation_res_option_file_open->add_filter("*."+E->get());
+ }
+ } break;
+ case NOTIFICATION_POPUP_HIDE: {
+ EditorSettings::get_singleton()->set("interface/dialogs/project_settings_bounds", get_rect());
+ } break;
}
}
@@ -241,7 +246,7 @@ void ProjectSettings::_device_input_add() {
undo_redo->add_undo_method(this,"_settings_changed");
undo_redo->commit_action();
- _show_last_added(ie);
+ _show_last_added(ie, name);
}
@@ -278,12 +283,14 @@ void ProjectSettings::_press_a_key_confirm() {
undo_redo->add_undo_method(this,"_settings_changed");
undo_redo->commit_action();
- _show_last_added(ie);
+ _show_last_added(ie, name);
}
-void ProjectSettings::_show_last_added(const InputEvent& p_event) {
+void ProjectSettings::_show_last_added(const InputEvent& p_event, const String &p_name) {
TreeItem *r = input_editor->get_root();
+ String name = p_name;
+ name.erase(0,6);
if (!r)
return;
r=r->get_children();
@@ -291,6 +298,10 @@ void ProjectSettings::_show_last_added(const InputEvent& p_event) {
return;
bool found = false;
while(r){
+ if (r->get_text(0) != name) {
+ r=r->get_next();
+ continue;
+ }
TreeItem *child = r->get_children();
while(child){
Variant input = child->get_meta("__input");
@@ -376,7 +387,7 @@ void ProjectSettings::_add_item(int p_item){
} break;
case InputEvent::JOYPAD_BUTTON: {
- device_id->set_value(3);
+ device_id->set_value(0);
device_index_label->set_text(TTR("Joypad Button Index:"));
device_index->clear();
@@ -572,8 +583,12 @@ void ProjectSettings::_update_actions() {
void ProjectSettings::popup_project_settings() {
- //popup_centered(Size2(500,400));
- popup_centered_ratio();
+ // Restore valid window bounds or pop up at default size.
+ if (EditorSettings::get_singleton()->has("interface/dialogs/project_settings_bounds")) {
+ popup(EditorSettings::get_singleton()->get("interface/dialogs/project_settings_bounds"));
+ } else {
+ popup_centered_ratio();
+ }
globals_editor->update_category_list();
_update_translations();
autoload_settings->update_autoload();
@@ -779,7 +794,7 @@ void ProjectSettings::_copy_to_platform(int p_which) {
String name = catname+"/"+propname;
Variant value=GlobalConfig::get_singleton()->get(name);
- catname+="."+popup_platform->get_popup()->get_item_text(p_which);;
+ catname+="."+popup_platform->get_popup()->get_item_text(p_which);
name = catname+"/"+propname;
GlobalConfig::get_singleton()->set(name,value);
@@ -1174,41 +1189,41 @@ void ProjectSettings::set_plugins_page() {
void ProjectSettings::_bind_methods() {
- ClassDB::bind_method(_MD("_item_selected"),&ProjectSettings::_item_selected);
- ClassDB::bind_method(_MD("_item_add"),&ProjectSettings::_item_add);
- ClassDB::bind_method(_MD("_item_adds"),&ProjectSettings::_item_adds);
- ClassDB::bind_method(_MD("_item_del"),&ProjectSettings::_item_del);
- ClassDB::bind_method(_MD("_item_checked"),&ProjectSettings::_item_checked);
- ClassDB::bind_method(_MD("_save"),&ProjectSettings::_save);
- ClassDB::bind_method(_MD("_action_add"),&ProjectSettings::_action_add);
- ClassDB::bind_method(_MD("_action_adds"),&ProjectSettings::_action_adds);
- ClassDB::bind_method(_MD("_action_selected"),&ProjectSettings::_action_selected);
- ClassDB::bind_method(_MD("_action_edited"),&ProjectSettings::_action_edited);
- ClassDB::bind_method(_MD("_action_button_pressed"),&ProjectSettings::_action_button_pressed);
- ClassDB::bind_method(_MD("_update_actions"),&ProjectSettings::_update_actions);
- ClassDB::bind_method(_MD("_wait_for_key"),&ProjectSettings::_wait_for_key);
- ClassDB::bind_method(_MD("_add_item"),&ProjectSettings::_add_item);
- ClassDB::bind_method(_MD("_device_input_add"),&ProjectSettings::_device_input_add);
- ClassDB::bind_method(_MD("_press_a_key_confirm"),&ProjectSettings::_press_a_key_confirm);
- ClassDB::bind_method(_MD("_settings_prop_edited"),&ProjectSettings::_settings_prop_edited);
- ClassDB::bind_method(_MD("_copy_to_platform"),&ProjectSettings::_copy_to_platform);
- ClassDB::bind_method(_MD("_update_translations"),&ProjectSettings::_update_translations);
- ClassDB::bind_method(_MD("_translation_delete"),&ProjectSettings::_translation_delete);
- ClassDB::bind_method(_MD("_settings_changed"),&ProjectSettings::_settings_changed);
- ClassDB::bind_method(_MD("_translation_add"),&ProjectSettings::_translation_add);
- ClassDB::bind_method(_MD("_translation_file_open"),&ProjectSettings::_translation_file_open);
-
- ClassDB::bind_method(_MD("_translation_res_add"),&ProjectSettings::_translation_res_add);
- ClassDB::bind_method(_MD("_translation_res_file_open"),&ProjectSettings::_translation_res_file_open);
- ClassDB::bind_method(_MD("_translation_res_option_add"),&ProjectSettings::_translation_res_option_add);
- ClassDB::bind_method(_MD("_translation_res_option_file_open"),&ProjectSettings::_translation_res_option_file_open);
- ClassDB::bind_method(_MD("_translation_res_select"),&ProjectSettings::_translation_res_select);
- ClassDB::bind_method(_MD("_translation_res_option_changed"),&ProjectSettings::_translation_res_option_changed);
- ClassDB::bind_method(_MD("_translation_res_delete"),&ProjectSettings::_translation_res_delete);
- ClassDB::bind_method(_MD("_translation_res_option_delete"),&ProjectSettings::_translation_res_option_delete);
-
- ClassDB::bind_method(_MD("_clear_search_box"),&ProjectSettings::_clear_search_box);
- ClassDB::bind_method(_MD("_toggle_search_bar"),&ProjectSettings::_toggle_search_bar);
+ ClassDB::bind_method(D_METHOD("_item_selected"),&ProjectSettings::_item_selected);
+ ClassDB::bind_method(D_METHOD("_item_add"),&ProjectSettings::_item_add);
+ ClassDB::bind_method(D_METHOD("_item_adds"),&ProjectSettings::_item_adds);
+ ClassDB::bind_method(D_METHOD("_item_del"),&ProjectSettings::_item_del);
+ ClassDB::bind_method(D_METHOD("_item_checked"),&ProjectSettings::_item_checked);
+ ClassDB::bind_method(D_METHOD("_save"),&ProjectSettings::_save);
+ ClassDB::bind_method(D_METHOD("_action_add"),&ProjectSettings::_action_add);
+ ClassDB::bind_method(D_METHOD("_action_adds"),&ProjectSettings::_action_adds);
+ ClassDB::bind_method(D_METHOD("_action_selected"),&ProjectSettings::_action_selected);
+ ClassDB::bind_method(D_METHOD("_action_edited"),&ProjectSettings::_action_edited);
+ ClassDB::bind_method(D_METHOD("_action_button_pressed"),&ProjectSettings::_action_button_pressed);
+ ClassDB::bind_method(D_METHOD("_update_actions"),&ProjectSettings::_update_actions);
+ ClassDB::bind_method(D_METHOD("_wait_for_key"),&ProjectSettings::_wait_for_key);
+ ClassDB::bind_method(D_METHOD("_add_item"),&ProjectSettings::_add_item);
+ ClassDB::bind_method(D_METHOD("_device_input_add"),&ProjectSettings::_device_input_add);
+ ClassDB::bind_method(D_METHOD("_press_a_key_confirm"),&ProjectSettings::_press_a_key_confirm);
+ ClassDB::bind_method(D_METHOD("_settings_prop_edited"),&ProjectSettings::_settings_prop_edited);
+ ClassDB::bind_method(D_METHOD("_copy_to_platform"),&ProjectSettings::_copy_to_platform);
+ ClassDB::bind_method(D_METHOD("_update_translations"),&ProjectSettings::_update_translations);
+ ClassDB::bind_method(D_METHOD("_translation_delete"),&ProjectSettings::_translation_delete);
+ ClassDB::bind_method(D_METHOD("_settings_changed"),&ProjectSettings::_settings_changed);
+ ClassDB::bind_method(D_METHOD("_translation_add"),&ProjectSettings::_translation_add);
+ ClassDB::bind_method(D_METHOD("_translation_file_open"),&ProjectSettings::_translation_file_open);
+
+ ClassDB::bind_method(D_METHOD("_translation_res_add"),&ProjectSettings::_translation_res_add);
+ ClassDB::bind_method(D_METHOD("_translation_res_file_open"),&ProjectSettings::_translation_res_file_open);
+ ClassDB::bind_method(D_METHOD("_translation_res_option_add"),&ProjectSettings::_translation_res_option_add);
+ ClassDB::bind_method(D_METHOD("_translation_res_option_file_open"),&ProjectSettings::_translation_res_option_file_open);
+ ClassDB::bind_method(D_METHOD("_translation_res_select"),&ProjectSettings::_translation_res_select);
+ ClassDB::bind_method(D_METHOD("_translation_res_option_changed"),&ProjectSettings::_translation_res_option_changed);
+ ClassDB::bind_method(D_METHOD("_translation_res_delete"),&ProjectSettings::_translation_res_delete);
+ ClassDB::bind_method(D_METHOD("_translation_res_option_delete"),&ProjectSettings::_translation_res_option_delete);
+
+ ClassDB::bind_method(D_METHOD("_clear_search_box"),&ProjectSettings::_clear_search_box);
+ ClassDB::bind_method(D_METHOD("_toggle_search_bar"),&ProjectSettings::_toggle_search_bar);
}
@@ -1216,7 +1231,8 @@ ProjectSettings::ProjectSettings(EditorData *p_data) {
singleton=this;
- set_title(TTR("Project Settings (engine.cfg)"));
+ set_title(TTR("Project Settings (godot.cfg)"));
+ set_resizable(true);
undo_redo=&p_data->get_undo_redo();
data=p_data;
@@ -1341,7 +1357,7 @@ ProjectSettings::ProjectSettings(EditorData *p_data) {
hbc->add_spacer();
- List<StringName> ep;
+ /*List<StringName> ep;
EditorImportExport::get_singleton()->get_export_platforms(&ep);
ep.sort_custom<StringName::AlphCompare>();
@@ -1349,7 +1365,7 @@ ProjectSettings::ProjectSettings(EditorData *p_data) {
popup_platform->get_popup()->add_item( E->get() );
- }
+ }*/
popup_platform->get_popup()->connect("id_pressed",this,"_copy_to_platform");
get_ok()->set_text(TTR("Close"));
@@ -1357,12 +1373,12 @@ ProjectSettings::ProjectSettings(EditorData *p_data) {
message = memnew( ConfirmationDialog );
add_child(message);
-// message->get_cancel()->hide();
+ //message->get_cancel()->hide();
message->set_hide_on_ok(true);
Control *input_base = memnew( Control );
input_base->set_name(TTR("Input Map"));
- input_base->set_area_as_parent_rect();;
+ input_base->set_area_as_parent_rect();
tab_container->add_child(input_base);
VBoxContainer *vbc = memnew( VBoxContainer );
@@ -1424,7 +1440,7 @@ ProjectSettings::ProjectSettings(EditorData *p_data) {
hbc = memnew( HBoxContainer );
device_input->add_child(hbc);
-// device_input->set_child_rect(hbc);
+ //device_input->set_child_rect(hbc);
VBoxContainer *vbc_left = memnew( VBoxContainer );
hbc->add_child(vbc_left);