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.cpp313
1 files changed, 138 insertions, 175 deletions
diff --git a/tools/editor/project_settings.cpp b/tools/editor/project_settings.cpp
index 02d95abfa2..15d03b8a2b 100644
--- a/tools/editor/project_settings.cpp
+++ b/tools/editor/project_settings.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -27,6 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "project_settings.h"
+
#include "scene/gui/tab_container.h"
#include "globals.h"
#include "os/keyboard.h"
@@ -74,7 +75,7 @@ void ProjectSettings::_notification(int p_what) {
if (p_what==NOTIFICATION_ENTER_TREE) {
- globals_editor->edit(Globals::get_singleton());
+ globals_editor->edit(GlobalConfig::get_singleton());
search_button->set_icon(get_icon("Zoom","EditorIcons"));
clear_button->set_icon(get_icon("Close","EditorIcons"));
@@ -82,8 +83,8 @@ void ProjectSettings::_notification(int p_what) {
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::JOYSTICK_BUTTON);
- popup_add->add_icon_item(get_icon("JoyAxis","EditorIcons"),TTR("Joy Axis"),InputEvent::JOYSTICK_MOTION);
+ 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;
@@ -136,7 +137,7 @@ void ProjectSettings::_action_edited() {
String action_prop="input/"+new_name;
- if (Globals::get_singleton()->has(action_prop)) {
+ if (GlobalConfig::get_singleton()->has(action_prop)) {
ti->set_text(0,old_name);
add_at="input/"+old_name;
@@ -146,20 +147,17 @@ void ProjectSettings::_action_edited() {
return;
}
- int order = Globals::get_singleton()->get_order(add_at);
- Array va = Globals::get_singleton()->get(add_at);
- bool persisting = Globals::get_singleton()->is_persisting(add_at);
+ int order = GlobalConfig::get_singleton()->get_order(add_at);
+ Array va = GlobalConfig::get_singleton()->get(add_at);
setting=true;
undo_redo->create_action(TTR("Rename Input Action Event"));
- undo_redo->add_do_method(Globals::get_singleton(),"clear",add_at);
- undo_redo->add_do_method(Globals::get_singleton(),"set",action_prop,va);
- undo_redo->add_do_method(Globals::get_singleton(),"set_persisting",action_prop,persisting);
- undo_redo->add_do_method(Globals::get_singleton(),"set_order",action_prop,order);
- undo_redo->add_undo_method(Globals::get_singleton(),"clear",action_prop);
- undo_redo->add_undo_method(Globals::get_singleton(),"set",add_at,va);
- undo_redo->add_undo_method(Globals::get_singleton(),"set_persisting",add_at,persisting);
- undo_redo->add_undo_method(Globals::get_singleton(),"set_order",add_at,order);
+ undo_redo->add_do_method(GlobalConfig::get_singleton(),"clear",add_at);
+ undo_redo->add_do_method(GlobalConfig::get_singleton(),"set",action_prop,va);
+ undo_redo->add_do_method(GlobalConfig::get_singleton(),"set_order",action_prop,order);
+ undo_redo->add_undo_method(GlobalConfig::get_singleton(),"clear",action_prop);
+ undo_redo->add_undo_method(GlobalConfig::get_singleton(),"set",add_at,va);
+ undo_redo->add_undo_method(GlobalConfig::get_singleton(),"set_order",add_at,order);
undo_redo->add_do_method(this,"_update_actions");
undo_redo->add_undo_method(this,"_update_actions");
undo_redo->add_do_method(this,"_settings_changed");
@@ -179,9 +177,9 @@ void ProjectSettings::_device_input_add() {
InputEvent ie;
String name=add_at;
- Variant old_val = Globals::get_singleton()->get(name);
+ Variant old_val = GlobalConfig::get_singleton()->get(name);
Array arr=old_val;
- ie.device=device_id->get_val();
+ ie.device=device_id->get_value();
ie.type=add_type;
@@ -201,7 +199,7 @@ void ProjectSettings::_device_input_add() {
}
} break;
- case InputEvent::JOYSTICK_MOTION: {
+ case InputEvent::JOYPAD_MOTION: {
ie.joy_motion.axis = device_index->get_selected()>>1;
ie.joy_motion.axis_value = device_index->get_selected()&1?1:-1;
@@ -210,20 +208,20 @@ void ProjectSettings::_device_input_add() {
for(int i=0;i<arr.size();i++) {
InputEvent aie=arr[i];
- if (aie.device == ie.device && aie.type==InputEvent::JOYSTICK_MOTION && aie.joy_motion.axis==ie.joy_motion.axis && aie.joy_motion.axis_value==ie.joy_motion.axis_value) {
+ if (aie.device == ie.device && aie.type==InputEvent::JOYPAD_MOTION && aie.joy_motion.axis==ie.joy_motion.axis && aie.joy_motion.axis_value==ie.joy_motion.axis_value) {
return;
}
}
} break;
- case InputEvent::JOYSTICK_BUTTON: {
+ case InputEvent::JOYPAD_BUTTON: {
ie.joy_button.button_index=device_index->get_selected();
for(int i=0;i<arr.size();i++) {
InputEvent aie=arr[i];
- if (aie.device == ie.device && aie.type==InputEvent::JOYSTICK_BUTTON && aie.joy_button.button_index==ie.joy_button.button_index) {
+ if (aie.device == ie.device && aie.type==InputEvent::JOYPAD_BUTTON && aie.joy_button.button_index==ie.joy_button.button_index) {
return;
}
}
@@ -236,9 +234,8 @@ void ProjectSettings::_device_input_add() {
arr.push_back(ie);
undo_redo->create_action(TTR("Add Input Action Event"));
- undo_redo->add_do_method(Globals::get_singleton(),"set",name,arr);
- undo_redo->add_do_method(Globals::get_singleton(),"set_persisting",name,true);
- undo_redo->add_undo_method(Globals::get_singleton(),"set",name,old_val);
+ undo_redo->add_do_method(GlobalConfig::get_singleton(),"set",name,arr);
+ undo_redo->add_undo_method(GlobalConfig::get_singleton(),"set",name,old_val);
undo_redo->add_do_method(this,"_update_actions");
undo_redo->add_undo_method(this,"_update_actions");
undo_redo->add_do_method(this,"_settings_changed");
@@ -260,7 +257,7 @@ void ProjectSettings::_press_a_key_confirm() {
ie.key.mod=last_wait_for_key.key.mod;
String name=add_at;
- Variant old_val = Globals::get_singleton()->get(name);
+ Variant old_val = GlobalConfig::get_singleton()->get(name);
Array arr=old_val;
for(int i=0;i<arr.size();i++) {
@@ -274,9 +271,8 @@ void ProjectSettings::_press_a_key_confirm() {
arr.push_back(ie);
undo_redo->create_action(TTR("Add Input Action Event"));
- undo_redo->add_do_method(Globals::get_singleton(),"set",name,arr);
- undo_redo->add_do_method(Globals::get_singleton(),"set_persisting",name,true);
- undo_redo->add_undo_method(Globals::get_singleton(),"set",name,old_val);
+ undo_redo->add_do_method(GlobalConfig::get_singleton(),"set",name,arr);
+ undo_redo->add_undo_method(GlobalConfig::get_singleton(),"set",name,old_val);
undo_redo->add_do_method(this,"_update_actions");
undo_redo->add_undo_method(this,"_update_actions");
undo_redo->add_do_method(this,"_settings_changed");
@@ -352,7 +348,7 @@ void ProjectSettings::_add_item(int p_item){
} break;
case InputEvent::MOUSE_BUTTON: {
- device_id->set_val(0);
+ device_id->set_value(0);
device_index_label->set_text(TTR("Mouse Button Index:"));
device_index->clear();
device_index->add_item(TTR("Left Button"));
@@ -366,10 +362,10 @@ void ProjectSettings::_add_item(int p_item){
device_index->add_item(TTR("Button 9"));
device_input->popup_centered_minsize(Size2(350,95));
} break;
- case InputEvent::JOYSTICK_MOTION: {
+ case InputEvent::JOYPAD_MOTION: {
- device_id->set_val(0);
- device_index_label->set_text(TTR("Joystick Axis Index:"));
+ device_id->set_value(0);
+ device_index_label->set_text(TTR("Joypad Axis Index:"));
device_index->clear();
for(int i=0;i<JOY_AXIS_MAX*2;i++) {
@@ -379,10 +375,10 @@ void ProjectSettings::_add_item(int p_item){
device_input->popup_centered_minsize(Size2(350,95));
} break;
- case InputEvent::JOYSTICK_BUTTON: {
+ case InputEvent::JOYPAD_BUTTON: {
- device_id->set_val(3);
- device_index_label->set_text(TTR("Joystick Button Index:"));
+ device_id->set_value(3);
+ device_index_label->set_text(TTR("Joypad Button Index:"));
device_index->clear();
for(int i=0;i<JOY_BUTTON_MAX;i++) {
@@ -423,14 +419,13 @@ void ProjectSettings::_action_button_pressed(Object* p_obj, int p_column,int p_i
//remove main thing
String name="input/"+ti->get_text(0);
- Variant old_val = Globals::get_singleton()->get(name);
- int order=Globals::get_singleton()->get_order(name);
+ Variant old_val = GlobalConfig::get_singleton()->get(name);
+ int order=GlobalConfig::get_singleton()->get_order(name);
undo_redo->create_action(TTR("Add Input Action"));
- undo_redo->add_do_method(Globals::get_singleton(),"clear",name);
- undo_redo->add_undo_method(Globals::get_singleton(),"set",name,old_val);
- undo_redo->add_undo_method(Globals::get_singleton(),"set_order",name,order);
- undo_redo->add_undo_method(Globals::get_singleton(),"set_persisting",name,Globals::get_singleton()->is_persisting(name));
+ undo_redo->add_do_method(GlobalConfig::get_singleton(),"clear",name);
+ undo_redo->add_undo_method(GlobalConfig::get_singleton(),"set",name,old_val);
+ undo_redo->add_undo_method(GlobalConfig::get_singleton(),"set_order",name,order);
undo_redo->add_do_method(this,"_update_actions");
undo_redo->add_undo_method(this,"_update_actions");
undo_redo->add_do_method(this,"_settings_changed");
@@ -440,7 +435,7 @@ void ProjectSettings::_action_button_pressed(Object* p_obj, int p_column,int p_i
} else {
//remove action
String name="input/"+ti->get_parent()->get_text(0);
- Variant old_val = Globals::get_singleton()->get(name);
+ Variant old_val = GlobalConfig::get_singleton()->get(name);
int idx = ti->get_metadata(0);
Array va = old_val;
@@ -456,8 +451,8 @@ void ProjectSettings::_action_button_pressed(Object* p_obj, int p_column,int p_i
undo_redo->create_action(TTR("Erase Input Action Event"));
- undo_redo->add_do_method(Globals::get_singleton(),"set",name,va);
- undo_redo->add_undo_method(Globals::get_singleton(),"set",name,old_val);
+ undo_redo->add_do_method(GlobalConfig::get_singleton(),"set",name,va);
+ undo_redo->add_undo_method(GlobalConfig::get_singleton(),"set",name,old_val);
undo_redo->add_do_method(this,"_update_actions");
undo_redo->add_undo_method(this,"_update_actions");
undo_redo->add_do_method(this,"_settings_changed");
@@ -480,7 +475,7 @@ void ProjectSettings::_update_actions() {
input_editor->set_hide_root(true);
List<PropertyInfo> props;
- Globals::get_singleton()->get_property_list(&props);
+ GlobalConfig::get_singleton()->get_property_list(&props);
for(List<PropertyInfo>::Element *E=props.front();E;E=E->next()) {
@@ -496,7 +491,7 @@ void ProjectSettings::_update_actions() {
//item->set_cell_mode(0,TreeItem::CELL_MODE_CHECK);
item->set_text(0,name);
item->add_button(0,get_icon("Add","EditorIcons"),1);
- if (!Globals::get_singleton()->get_input_presets().find(pi.name)) {
+ if (!GlobalConfig::get_singleton()->get_input_presets().find(pi.name)) {
item->add_button(0,get_icon("Remove","EditorIcons"),2);
item->set_editable(0,true);
}
@@ -504,7 +499,7 @@ void ProjectSettings::_update_actions() {
//item->set_checked(0,pi.usage&PROPERTY_USAGE_CHECKED);
- Array actions=Globals::get_singleton()->get(pi.name);
+ Array actions=GlobalConfig::get_singleton()->get(pi.name);
for(int i=0;i<actions.size();i++) {
@@ -532,7 +527,7 @@ void ProjectSettings::_update_actions() {
action->set_icon(0,get_icon("Keyboard","EditorIcons"));
} break;
- case InputEvent::JOYSTICK_BUTTON: {
+ case InputEvent::JOYPAD_BUTTON: {
String str = TTR("Device")+" "+itos(ie.device)+", "+TTR("Button")+" "+itos(ie.joy_button.button_index);
if (ie.joy_button.button_index>=0 && ie.joy_button.button_index<JOY_BUTTON_MAX)
@@ -558,7 +553,7 @@ void ProjectSettings::_update_actions() {
action->set_text(0,str);
action->set_icon(0,get_icon("Mouse","EditorIcons"));
} break;
- case InputEvent::JOYSTICK_MOTION: {
+ case InputEvent::JOYPAD_MOTION: {
int ax = ie.joy_motion.axis;
int n = 2*ax + (ie.joy_motion.axis_value<0 ? 0:1);
@@ -636,13 +631,12 @@ void ProjectSettings::_item_add() {
undo_redo->create_action("Add Global Property");
- undo_redo->add_do_property(Globals::get_singleton(), name, value);
- undo_redo->add_do_method(Globals::get_singleton(), "set_persisting", name, true);
+ undo_redo->add_do_property(GlobalConfig::get_singleton(), name, value);
- if (Globals::get_singleton()->has(name)) {
- undo_redo->add_undo_property(Globals::get_singleton(), name, Globals::get_singleton()->get(name));
+ if (GlobalConfig::get_singleton()->has(name)) {
+ undo_redo->add_undo_property(GlobalConfig::get_singleton(), name, GlobalConfig::get_singleton()->get(name));
} else {
- undo_redo->add_undo_property(Globals::get_singleton(), name, Variant());
+ undo_redo->add_undo_property(GlobalConfig::get_singleton(), name, Variant());
}
undo_redo->add_do_method(globals_editor, "update_category_list");
@@ -669,10 +663,9 @@ void ProjectSettings::_item_del() {
undo_redo->create_action("Delete Global Property");
- undo_redo->add_do_property(Globals::get_singleton(), name, Variant());
+ undo_redo->add_do_property(GlobalConfig::get_singleton(), name, Variant());
- undo_redo->add_undo_property(Globals::get_singleton(), name, Globals::get_singleton()->get(name));
- undo_redo->add_undo_method(Globals::get_singleton(), "set_persisting", name, Globals::get_singleton()->is_persisting(name));
+ undo_redo->add_undo_property(GlobalConfig::get_singleton(), name, GlobalConfig::get_singleton()->get(name));
undo_redo->add_do_method(globals_editor, "update_category_list");
undo_redo->add_undo_method(globals_editor, "update_category_list");
@@ -699,7 +692,7 @@ void ProjectSettings::_action_add() {
return;
}
- if (Globals::get_singleton()->has("input/"+action)) {
+ if (GlobalConfig::get_singleton()->has("input/"+action)) {
message->set_text(vformat(TTR("Action '%s' already exists!"),action));
message->popup_centered(Size2(300,100));
return;
@@ -708,9 +701,8 @@ void ProjectSettings::_action_add() {
Array va;
String name = "input/"+action;
undo_redo->create_action(TTR("Add Input Action Event"));
- undo_redo->add_do_method(Globals::get_singleton(),"set",name,va);
- undo_redo->add_do_method(Globals::get_singleton(),"set_persisting",name,true);
- undo_redo->add_undo_method(Globals::get_singleton(),"clear",name);
+ undo_redo->add_do_method(GlobalConfig::get_singleton(),"set",name,va);
+ undo_redo->add_undo_method(GlobalConfig::get_singleton(),"clear",name);
undo_redo->add_do_method(this,"_update_actions");
undo_redo->add_undo_method(this,"_update_actions");
undo_redo->add_do_method(this,"_settings_changed");
@@ -737,23 +729,14 @@ void ProjectSettings::_action_add() {
void ProjectSettings::_item_checked(const String& p_item, bool p_check) {
- undo_redo->create_action(TTR("Toggle Persisting"));
- String full_item = globals_editor->get_full_item_path(p_item);
- undo_redo->add_do_method(Globals::get_singleton(),"set_persisting",full_item,p_check);
- undo_redo->add_undo_method(Globals::get_singleton(),"set_persisting",full_item,!p_check);
- undo_redo->add_do_method(this,"_settings_changed");
- undo_redo->add_undo_method(this,"_settings_changed");
- undo_redo->add_do_method(globals_editor->get_property_editor(),"update_tree");
- undo_redo->add_undo_method(globals_editor->get_property_editor(),"update_tree");
- undo_redo->commit_action();
}
void ProjectSettings::_save() {
- Error err = Globals::get_singleton()->save();
+ Error err = GlobalConfig::get_singleton()->save();
message->set_text(err!=OK?TTR("Error saving settings."):TTR("Settings saved OK."));
message->popup_centered(Size2(300,100));
}
@@ -764,21 +747,6 @@ void ProjectSettings::_settings_prop_edited(const String& p_name) {
String full_item = globals_editor->get_full_item_path(p_name);
- if (!Globals::get_singleton()->is_persisting(full_item)) {
- Globals::get_singleton()->set_persisting(full_item,true);
-
- {
- //small usability workaround, if anything related to resolution scaling or size is modified, change all of them together
- if (full_item=="display/width" || full_item=="display/height" || full_item=="display/stretch_mode") {
- Globals::get_singleton()->set_persisting("display/height",true);
- Globals::get_singleton()->set_persisting("display/width",true);
- }
- }
-
-
-// globals_editor->update_property(p_name);
- globals_editor->get_property_editor()->update_tree();
- }
_settings_changed();
}
@@ -810,12 +778,12 @@ void ProjectSettings::_copy_to_platform(int p_which) {
}
String name = catname+"/"+propname;
- Variant value=Globals::get_singleton()->get(name);
+ 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;
- Globals::get_singleton()->set(name,value);
+ GlobalConfig::get_singleton()->set(name,value);
globals_editor->get_property_editor()->update_tree();
}
@@ -828,7 +796,7 @@ void ProjectSettings::add_translation(const String& p_translation) {
void ProjectSettings::_translation_add(const String& p_path) {
- StringArray translations = Globals::get_singleton()->get("locale/translations");
+ PoolStringArray translations = GlobalConfig::get_singleton()->get("locale/translations");
for(int i=0;i<translations.size();i++) {
@@ -839,9 +807,8 @@ void ProjectSettings::_translation_add(const String& p_path) {
translations.push_back(p_path);
undo_redo->create_action(TTR("Add 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_do_method(Globals::get_singleton(),"set_persisting","locale/translations",true);
+ undo_redo->add_do_property(GlobalConfig::get_singleton(),"locale/translations",translations);
+ undo_redo->add_undo_property(GlobalConfig::get_singleton(),"locale/translations",GlobalConfig::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");
@@ -862,15 +829,15 @@ void ProjectSettings::_translation_delete(Object *p_item,int p_column, int p_but
int idx=ti->get_metadata(0);
- StringArray translations = Globals::get_singleton()->get("locale/translations");
+ PoolStringArray translations = GlobalConfig::get_singleton()->get("locale/translations");
ERR_FAIL_INDEX(idx,translations.size());
translations.remove(idx);
undo_redo->create_action(TTR("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_do_property(GlobalConfig::get_singleton(),"locale/translations",translations);
+ undo_redo->add_undo_property(GlobalConfig::get_singleton(),"locale/translations",GlobalConfig::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");
@@ -891,20 +858,19 @@ void ProjectSettings::_translation_res_add(const String& p_path){
Variant prev;
Dictionary remaps;
- if (Globals::get_singleton()->has("locale/translation_remaps")) {
- remaps = Globals::get_singleton()->get("locale/translation_remaps");
+ if (GlobalConfig::get_singleton()->has("locale/translation_remaps")) {
+ remaps = GlobalConfig::get_singleton()->get("locale/translation_remaps");
prev=remaps;
}
if (remaps.has(p_path))
return; //pointless already has it
- remaps[p_path]=StringArray();
+ remaps[p_path]=PoolStringArray();
undo_redo->create_action(TTR("Add Remapped Path"));
- undo_redo->add_do_property(Globals::get_singleton(),"locale/translation_remaps",remaps);
- undo_redo->add_do_method(Globals::get_singleton(),"set_persisting","locale/translation_remaps",true);
- undo_redo->add_undo_property(Globals::get_singleton(),"locale/translation_remaps",prev);
+ undo_redo->add_do_property(GlobalConfig::get_singleton(),"locale/translation_remaps",remaps);
+ undo_redo->add_undo_property(GlobalConfig::get_singleton(),"locale/translation_remaps",prev);
undo_redo->add_do_method(this,"_update_translations");
undo_redo->add_undo_method(this,"_update_translations");
undo_redo->add_do_method(this,"_settings_changed");
@@ -920,9 +886,9 @@ void ProjectSettings::_translation_res_option_file_open(){
}
void ProjectSettings::_translation_res_option_add(const String& p_path) {
- ERR_FAIL_COND(!Globals::get_singleton()->has("locale/translation_remaps"));
+ ERR_FAIL_COND(!GlobalConfig::get_singleton()->has("locale/translation_remaps"));
- Dictionary remaps = Globals::get_singleton()->get("locale/translation_remaps");
+ Dictionary remaps = GlobalConfig::get_singleton()->get("locale/translation_remaps");
TreeItem *k = translation_remap->get_selected();
ERR_FAIL_COND(!k);
@@ -930,15 +896,14 @@ void ProjectSettings::_translation_res_option_add(const String& p_path) {
String key = k->get_metadata(0);
ERR_FAIL_COND(!remaps.has(key));
- StringArray r = remaps[key];
+ PoolStringArray r = remaps[key];
r.push_back(p_path+":"+"en");
remaps[key]=r;
undo_redo->create_action(TTR("Resource Remap Add Remap"));
- undo_redo->add_do_property(Globals::get_singleton(),"locale/translation_remaps",remaps);
- undo_redo->add_do_method(Globals::get_singleton(),"set_persisting","locale/translation_remaps",true);
- undo_redo->add_undo_property(Globals::get_singleton(),"locale/translation_remaps",Globals::get_singleton()->get("locale/translation_remaps"));
+ undo_redo->add_do_property(GlobalConfig::get_singleton(),"locale/translation_remaps",remaps);
+ undo_redo->add_undo_property(GlobalConfig::get_singleton(),"locale/translation_remaps",GlobalConfig::get_singleton()->get("locale/translation_remaps"));
undo_redo->add_do_method(this,"_update_translations");
undo_redo->add_undo_method(this,"_update_translations");
undo_redo->add_do_method(this,"_settings_changed");
@@ -963,10 +928,10 @@ void ProjectSettings::_translation_res_option_changed() {
if (updating_translations)
return;
- if (!Globals::get_singleton()->has("locale/translation_remaps"))
+ if (!GlobalConfig::get_singleton()->has("locale/translation_remaps"))
return;
- Dictionary remaps = Globals::get_singleton()->get("locale/translation_remaps");
+ Dictionary remaps = GlobalConfig::get_singleton()->get("locale/translation_remaps");
TreeItem *k = translation_remap->get_selected();
ERR_FAIL_COND(!k);
@@ -984,16 +949,15 @@ void ProjectSettings::_translation_res_option_changed() {
ERR_FAIL_COND(!remaps.has(key));
- StringArray r = remaps[key];
+ PoolStringArray r = remaps[key];
ERR_FAIL_INDEX(idx,r.size());
r.set(idx,path+":"+langs[which]);
remaps[key]=r;
updating_translations=true;
undo_redo->create_action(TTR("Change Resource Remap Language"));
- undo_redo->add_do_property(Globals::get_singleton(),"locale/translation_remaps",remaps);
- undo_redo->add_do_method(Globals::get_singleton(),"set_persisting","locale/translation_remaps",true);
- undo_redo->add_undo_property(Globals::get_singleton(),"locale/translation_remaps",Globals::get_singleton()->get("locale/translation_remaps"));
+ undo_redo->add_do_property(GlobalConfig::get_singleton(),"locale/translation_remaps",remaps);
+ undo_redo->add_undo_property(GlobalConfig::get_singleton(),"locale/translation_remaps",GlobalConfig::get_singleton()->get("locale/translation_remaps"));
undo_redo->add_do_method(this,"_update_translations");
undo_redo->add_undo_method(this,"_update_translations");
undo_redo->add_do_method(this,"_settings_changed");
@@ -1010,10 +974,10 @@ void ProjectSettings::_translation_res_delete(Object *p_item,int p_column, int p
if (updating_translations)
return;
- if (!Globals::get_singleton()->has("locale/translation_remaps"))
+ if (!GlobalConfig::get_singleton()->has("locale/translation_remaps"))
return;
- Dictionary remaps = Globals::get_singleton()->get("locale/translation_remaps");
+ Dictionary remaps = GlobalConfig::get_singleton()->get("locale/translation_remaps");
TreeItem *k = p_item->cast_to<TreeItem>();
@@ -1023,9 +987,8 @@ void ProjectSettings::_translation_res_delete(Object *p_item,int p_column, int p
remaps.erase(key);
undo_redo->create_action(TTR("Remove Resource Remap"));
- undo_redo->add_do_property(Globals::get_singleton(),"locale/translation_remaps",remaps);
- undo_redo->add_do_method(Globals::get_singleton(),"set_persisting","locale/translation_remaps",true);
- undo_redo->add_undo_property(Globals::get_singleton(),"locale/translation_remaps",Globals::get_singleton()->get("locale/translation_remaps"));
+ undo_redo->add_do_property(GlobalConfig::get_singleton(),"locale/translation_remaps",remaps);
+ undo_redo->add_undo_property(GlobalConfig::get_singleton(),"locale/translation_remaps",GlobalConfig::get_singleton()->get("locale/translation_remaps"));
undo_redo->add_do_method(this,"_update_translations");
undo_redo->add_undo_method(this,"_update_translations");
undo_redo->add_do_method(this,"_settings_changed");
@@ -1038,10 +1001,10 @@ void ProjectSettings::_translation_res_option_delete(Object *p_item,int p_column
if (updating_translations)
return;
- if (!Globals::get_singleton()->has("locale/translation_remaps"))
+ if (!GlobalConfig::get_singleton()->has("locale/translation_remaps"))
return;
- Dictionary remaps = Globals::get_singleton()->get("locale/translation_remaps");
+ Dictionary remaps = GlobalConfig::get_singleton()->get("locale/translation_remaps");
TreeItem *k = translation_remap->get_selected();
ERR_FAIL_COND(!k);
@@ -1052,16 +1015,15 @@ void ProjectSettings::_translation_res_option_delete(Object *p_item,int p_column
int idx = ed->get_metadata(0);
ERR_FAIL_COND(!remaps.has(key));
- StringArray r = remaps[key];
+ PoolStringArray r = remaps[key];
ERR_FAIL_INDEX(idx,remaps.size());
r.remove(idx);
remaps[key]=r;
undo_redo->create_action(TTR("Remove Resource Remap Option"));
- undo_redo->add_do_property(Globals::get_singleton(),"locale/translation_remaps",remaps);
- undo_redo->add_do_method(Globals::get_singleton(),"set_persisting","locale/translation_remaps",true);
- undo_redo->add_undo_property(Globals::get_singleton(),"locale/translation_remaps",Globals::get_singleton()->get("locale/translation_remaps"));
+ undo_redo->add_do_property(GlobalConfig::get_singleton(),"locale/translation_remaps",remaps);
+ undo_redo->add_undo_property(GlobalConfig::get_singleton(),"locale/translation_remaps",GlobalConfig::get_singleton()->get("locale/translation_remaps"));
undo_redo->add_do_method(this,"_update_translations");
undo_redo->add_undo_method(this,"_update_translations");
undo_redo->add_do_method(this,"_settings_changed");
@@ -1082,9 +1044,9 @@ void ProjectSettings::_update_translations() {
translation_list->clear();
TreeItem *root = translation_list->create_item(NULL);
translation_list->set_hide_root(true);
- if (Globals::get_singleton()->has("locale/translations")) {
+ if (GlobalConfig::get_singleton()->has("locale/translations")) {
- StringArray translations = Globals::get_singleton()->get("locale/translations");
+ PoolStringArray translations = GlobalConfig::get_singleton()->get("locale/translations");
for(int i=0;i<translations.size();i++) {
TreeItem *t = translation_list->create_item(root);
@@ -1121,9 +1083,9 @@ void ProjectSettings::_update_translations() {
langnames+=names[i];
}
- if (Globals::get_singleton()->has("locale/translation_remaps")) {
+ if (GlobalConfig::get_singleton()->has("locale/translation_remaps")) {
- Dictionary remaps = Globals::get_singleton()->get("locale/translation_remaps");
+ Dictionary remaps = GlobalConfig::get_singleton()->get("locale/translation_remaps");
List<Variant> rk;
remaps.get_key_list(&rk);
Vector<String> keys;
@@ -1144,7 +1106,7 @@ void ProjectSettings::_update_translations() {
t->select(0);
translation_res_option_add_button->set_disabled(false);
- StringArray selected = remaps[keys[i]];
+ PoolStringArray selected = remaps[keys[i]];
for(int j=0;j<selected.size();j++) {
String s = selected[j];
@@ -1213,41 +1175,41 @@ void ProjectSettings::set_plugins_page() {
void ProjectSettings::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("_item_selected"),&ProjectSettings::_item_selected);
- ObjectTypeDB::bind_method(_MD("_item_add"),&ProjectSettings::_item_add);
- ObjectTypeDB::bind_method(_MD("_item_adds"),&ProjectSettings::_item_adds);
- ObjectTypeDB::bind_method(_MD("_item_del"),&ProjectSettings::_item_del);
- ObjectTypeDB::bind_method(_MD("_item_checked"),&ProjectSettings::_item_checked);
- ObjectTypeDB::bind_method(_MD("_save"),&ProjectSettings::_save);
- ObjectTypeDB::bind_method(_MD("_action_add"),&ProjectSettings::_action_add);
- ObjectTypeDB::bind_method(_MD("_action_adds"),&ProjectSettings::_action_adds);
- ObjectTypeDB::bind_method(_MD("_action_selected"),&ProjectSettings::_action_selected);
- ObjectTypeDB::bind_method(_MD("_action_edited"),&ProjectSettings::_action_edited);
- ObjectTypeDB::bind_method(_MD("_action_button_pressed"),&ProjectSettings::_action_button_pressed);
- ObjectTypeDB::bind_method(_MD("_update_actions"),&ProjectSettings::_update_actions);
- ObjectTypeDB::bind_method(_MD("_wait_for_key"),&ProjectSettings::_wait_for_key);
- ObjectTypeDB::bind_method(_MD("_add_item"),&ProjectSettings::_add_item);
- ObjectTypeDB::bind_method(_MD("_device_input_add"),&ProjectSettings::_device_input_add);
- ObjectTypeDB::bind_method(_MD("_press_a_key_confirm"),&ProjectSettings::_press_a_key_confirm);
- ObjectTypeDB::bind_method(_MD("_settings_prop_edited"),&ProjectSettings::_settings_prop_edited);
- ObjectTypeDB::bind_method(_MD("_copy_to_platform"),&ProjectSettings::_copy_to_platform);
- ObjectTypeDB::bind_method(_MD("_update_translations"),&ProjectSettings::_update_translations);
- ObjectTypeDB::bind_method(_MD("_translation_delete"),&ProjectSettings::_translation_delete);
- ObjectTypeDB::bind_method(_MD("_settings_changed"),&ProjectSettings::_settings_changed);
- ObjectTypeDB::bind_method(_MD("_translation_add"),&ProjectSettings::_translation_add);
- ObjectTypeDB::bind_method(_MD("_translation_file_open"),&ProjectSettings::_translation_file_open);
-
- ObjectTypeDB::bind_method(_MD("_translation_res_add"),&ProjectSettings::_translation_res_add);
- ObjectTypeDB::bind_method(_MD("_translation_res_file_open"),&ProjectSettings::_translation_res_file_open);
- ObjectTypeDB::bind_method(_MD("_translation_res_option_add"),&ProjectSettings::_translation_res_option_add);
- ObjectTypeDB::bind_method(_MD("_translation_res_option_file_open"),&ProjectSettings::_translation_res_option_file_open);
- ObjectTypeDB::bind_method(_MD("_translation_res_select"),&ProjectSettings::_translation_res_select);
- ObjectTypeDB::bind_method(_MD("_translation_res_option_changed"),&ProjectSettings::_translation_res_option_changed);
- ObjectTypeDB::bind_method(_MD("_translation_res_delete"),&ProjectSettings::_translation_res_delete);
- ObjectTypeDB::bind_method(_MD("_translation_res_option_delete"),&ProjectSettings::_translation_res_option_delete);
-
- ObjectTypeDB::bind_method(_MD("_clear_search_box"),&ProjectSettings::_clear_search_box);
- ObjectTypeDB::bind_method(_MD("_toggle_search_bar"),&ProjectSettings::_toggle_search_bar);
+ 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);
}
@@ -1262,7 +1224,7 @@ ProjectSettings::ProjectSettings(EditorData *p_data) {
tab_container = memnew( TabContainer );
add_child(tab_container);
- set_child_rect(tab_container);
+ //set_child_rect(tab_container);
//tab_container->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_BEGIN, 15 );
//tab_container->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END, 15 );
@@ -1347,6 +1309,7 @@ ProjectSettings::ProjectSettings(EditorData *p_data) {
globals_editor = memnew( SectionedPropertyEditor );
props_base->add_child(globals_editor);
+ globals_editor->get_property_editor()->set_undo_redo(EditorNode::get_singleton()->get_undo_redo());
//globals_editor->hide_top_label();
globals_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
globals_editor->get_property_editor()->register_text_enter(search_box);
@@ -1389,18 +1352,18 @@ ProjectSettings::ProjectSettings(EditorData *p_data) {
}
- popup_platform->get_popup()->connect("item_pressed",this,"_copy_to_platform");
+ popup_platform->get_popup()->connect("id_pressed",this,"_copy_to_platform");
get_ok()->set_text(TTR("Close"));
set_hide_on_ok(true);
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 );
@@ -1437,7 +1400,7 @@ ProjectSettings::ProjectSettings(EditorData *p_data) {
input_editor->connect("button_pressed",this,"_action_button_pressed");
popup_add = memnew( PopupMenu );
add_child(popup_add);
- popup_add->connect("item_pressed",this,"_add_item");
+ popup_add->connect("id_pressed",this,"_add_item");
press_a_key = memnew( ConfirmationDialog );
press_a_key->set_focus_mode(FOCUS_ALL);
@@ -1451,7 +1414,7 @@ ProjectSettings::ProjectSettings(EditorData *p_data) {
l->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_BEGIN,30);
press_a_key_label=l;
press_a_key->add_child(l);
- press_a_key->connect("input_event",this,"_wait_for_key");
+ press_a_key->connect("gui_input",this,"_wait_for_key");
press_a_key->connect("confirmed",this,"_press_a_key_confirm");
@@ -1462,7 +1425,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);
@@ -1472,7 +1435,7 @@ ProjectSettings::ProjectSettings(EditorData *p_data) {
vbc_left->add_child(l);
device_id = memnew( SpinBox );
- device_id->set_val(0);
+ device_id->set_value(0);
vbc_left->add_child(device_id);
VBoxContainer *vbc_right = memnew( VBoxContainer );
@@ -1606,7 +1569,7 @@ ProjectSettings::ProjectSettings(EditorData *p_data) {
timer = memnew( Timer );
timer->set_wait_time(1.5);
- timer->connect("timeout",Globals::get_singleton(),"save");
+ timer->connect("timeout",GlobalConfig::get_singleton(),"save");
timer->set_one_shot(true);
add_child(timer);