Forbid renaming input presets

This commit is contained in:
Ignacio Etcheverry 2015-12-14 22:36:53 +01:00
parent fa085a9c2c
commit 577bbcc6b3
3 changed files with 16 additions and 1 deletions

View file

@ -1414,6 +1414,7 @@ Globals::Globals() {
joyb.joy_button.button_index=JOY_BUTTON_0;
va.push_back(joyb);
set("input/ui_accept",va);
input_presets.push_back("input/ui_accept");
va=Array();
key.key.scancode=KEY_SPACE;
@ -1421,6 +1422,7 @@ Globals::Globals() {
joyb.joy_button.button_index=JOY_BUTTON_3;
va.push_back(joyb);
set("input/ui_select",va);
input_presets.push_back("input/ui_select");
va=Array();
key.key.scancode=KEY_ESCAPE;
@ -1428,17 +1430,20 @@ Globals::Globals() {
joyb.joy_button.button_index=JOY_BUTTON_1;
va.push_back(joyb);
set("input/ui_cancel",va);
input_presets.push_back("input/ui_cancel");
va=Array();
key.key.scancode=KEY_TAB;
va.push_back(key);
set("input/ui_focus_next",va);
input_presets.push_back("input/ui_focus_next");
va=Array();
key.key.scancode=KEY_TAB;
key.key.mod.shift=true;
va.push_back(key);
set("input/ui_focus_prev",va);
input_presets.push_back("input/ui_focus_prev");
key.key.mod.shift=false;
va=Array();
@ -1447,6 +1452,7 @@ Globals::Globals() {
joyb.joy_button.button_index=JOY_DPAD_LEFT;
va.push_back(joyb);
set("input/ui_left",va);
input_presets.push_back("input/ui_left");
va=Array();
key.key.scancode=KEY_RIGHT;
@ -1454,6 +1460,7 @@ Globals::Globals() {
joyb.joy_button.button_index=JOY_DPAD_RIGHT;
va.push_back(joyb);
set("input/ui_right",va);
input_presets.push_back("input/ui_right");
va=Array();
key.key.scancode=KEY_UP;
@ -1461,6 +1468,7 @@ Globals::Globals() {
joyb.joy_button.button_index=JOY_DPAD_UP;
va.push_back(joyb);
set("input/ui_up",va);
input_presets.push_back("input/ui_up");
va=Array();
key.key.scancode=KEY_DOWN;
@ -1468,17 +1476,20 @@ Globals::Globals() {
joyb.joy_button.button_index=JOY_DPAD_DOWN;
va.push_back(joyb);
set("input/ui_down",va);
input_presets.push_back("input/ui_down");
va=Array();
key.key.scancode=KEY_PAGEUP;
va.push_back(key);
set("input/ui_page_up",va);
input_presets.push_back("input/ui_page_up");
va=Array();
key.key.scancode=KEY_PAGEDOWN;
va.push_back(key);
set("input/ui_page_down",va);
input_presets.push_back("input/ui_page_down");
// set("display/orientation", "landscape");

View file

@ -70,6 +70,7 @@ protected:
Map<StringName,PropertyInfo> custom_prop_info;
bool disable_platform_override;
bool using_datapack;
List<String> input_presets;
bool _set(const StringName& p_name, const Variant& p_value);
@ -124,6 +125,8 @@ public:
Vector<String> get_optimizer_presets() const;
List<String> get_input_presets() const { return input_presets; }
void set_disable_platform_override(bool p_disable);
Object* get_singleton_object(const String& p_name) const;

View file

@ -427,7 +427,8 @@ 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);
item->add_button(0,get_icon("Rename","EditorIcons"),2);
if (!Globals::get_singleton()->get_input_presets().find(pi.name))
item->add_button(0,get_icon("Rename","EditorIcons"),2);
item->add_button(0,get_icon("Remove","EditorIcons"),3);
item->set_custom_bg_color(0,get_color("prop_subsection","Editor"));
item->set_editable(0,true);