You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-20 14:45:44 +00:00
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
This commit is contained in:
@@ -83,11 +83,9 @@ static const char *_axis_names[JOY_AXIS_MAX * 2] = {
|
||||
};
|
||||
|
||||
void ProjectSettingsEditor::_unhandled_input(const Ref<InputEvent> &p_event) {
|
||||
|
||||
const Ref<InputEventKey> k = p_event;
|
||||
|
||||
if (k.is_valid() && is_window_modal_on_top() && k->is_pressed()) {
|
||||
|
||||
if (k->get_scancode_with_modifiers() == (KEY_MASK_CMD | KEY_F)) {
|
||||
if (search_button->is_pressed()) {
|
||||
search_box->grab_focus();
|
||||
@@ -103,7 +101,6 @@ void ProjectSettingsEditor::_unhandled_input(const Ref<InputEvent> &p_event) {
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::_notification(int p_what) {
|
||||
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_ENTER_TREE: {
|
||||
globals_editor->edit(ProjectSettings::get_singleton());
|
||||
@@ -124,14 +121,12 @@ void ProjectSettingsEditor::_notification(int p_what) {
|
||||
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());
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
@@ -170,7 +165,6 @@ static bool _validate_action_name(const String &p_name) {
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::_action_selected() {
|
||||
|
||||
TreeItem *ti = input_editor->get_selected();
|
||||
if (!ti || !ti->is_editable(0))
|
||||
return;
|
||||
@@ -180,13 +174,11 @@ void ProjectSettingsEditor::_action_selected() {
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::_action_edited() {
|
||||
|
||||
TreeItem *ti = input_editor->get_selected();
|
||||
if (!ti)
|
||||
return;
|
||||
|
||||
if (input_editor->get_selected_column() == 0) {
|
||||
|
||||
String new_name = ti->get_text(0);
|
||||
String old_name = add_at.substr(add_at.find("/") + 1, add_at.length());
|
||||
|
||||
@@ -194,7 +186,6 @@ void ProjectSettingsEditor::_action_edited() {
|
||||
return;
|
||||
|
||||
if (new_name == "" || !_validate_action_name(new_name)) {
|
||||
|
||||
ti->set_text(0, old_name);
|
||||
add_at = "input/" + old_name;
|
||||
|
||||
@@ -206,7 +197,6 @@ void ProjectSettingsEditor::_action_edited() {
|
||||
String action_prop = "input/" + new_name;
|
||||
|
||||
if (ProjectSettings::get_singleton()->has_setting(action_prop)) {
|
||||
|
||||
ti->set_text(0, old_name);
|
||||
add_at = "input/" + old_name;
|
||||
|
||||
@@ -235,7 +225,6 @@ void ProjectSettingsEditor::_action_edited() {
|
||||
|
||||
add_at = action_prop;
|
||||
} else if (input_editor->get_selected_column() == 1) {
|
||||
|
||||
String name = "input/" + ti->get_text(0);
|
||||
Dictionary old_action = ProjectSettings::get_singleton()->get(name);
|
||||
Dictionary new_action = old_action.duplicate();
|
||||
@@ -251,7 +240,6 @@ void ProjectSettingsEditor::_action_edited() {
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::_device_input_add() {
|
||||
|
||||
Ref<InputEvent> ie;
|
||||
String name = add_at;
|
||||
int idx = edit_idx;
|
||||
@@ -260,16 +248,13 @@ void ProjectSettingsEditor::_device_input_add() {
|
||||
Array events = action["events"];
|
||||
|
||||
switch (add_type) {
|
||||
|
||||
case INPUT_MOUSE_BUTTON: {
|
||||
|
||||
Ref<InputEventMouseButton> mb;
|
||||
mb.instance();
|
||||
mb->set_button_index(device_index->get_selected() + 1);
|
||||
mb->set_device(_get_current_device());
|
||||
|
||||
for (int i = 0; i < events.size(); i++) {
|
||||
|
||||
Ref<InputEventMouseButton> aie = events[i];
|
||||
if (aie.is_null())
|
||||
continue;
|
||||
@@ -282,7 +267,6 @@ void ProjectSettingsEditor::_device_input_add() {
|
||||
|
||||
} break;
|
||||
case INPUT_JOY_MOTION: {
|
||||
|
||||
Ref<InputEventJoypadMotion> jm;
|
||||
jm.instance();
|
||||
jm->set_axis(device_index->get_selected() >> 1);
|
||||
@@ -290,7 +274,6 @@ void ProjectSettingsEditor::_device_input_add() {
|
||||
jm->set_device(_get_current_device());
|
||||
|
||||
for (int i = 0; i < events.size(); i++) {
|
||||
|
||||
Ref<InputEventJoypadMotion> aie = events[i];
|
||||
if (aie.is_null())
|
||||
continue;
|
||||
@@ -304,7 +287,6 @@ void ProjectSettingsEditor::_device_input_add() {
|
||||
|
||||
} break;
|
||||
case INPUT_JOY_BUTTON: {
|
||||
|
||||
Ref<InputEventJoypadButton> jb;
|
||||
jb.instance();
|
||||
|
||||
@@ -312,7 +294,6 @@ void ProjectSettingsEditor::_device_input_add() {
|
||||
jb->set_device(_get_current_device());
|
||||
|
||||
for (int i = 0; i < events.size(); i++) {
|
||||
|
||||
Ref<InputEventJoypadButton> aie = events[i];
|
||||
if (aie.is_null())
|
||||
continue;
|
||||
@@ -361,7 +342,6 @@ String ProjectSettingsEditor::_get_device_string(int i_device) {
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::_press_a_key_confirm() {
|
||||
|
||||
if (last_wait_for_key.is_null())
|
||||
return;
|
||||
|
||||
@@ -381,7 +361,6 @@ void ProjectSettingsEditor::_press_a_key_confirm() {
|
||||
Array events = action["events"];
|
||||
|
||||
for (int i = 0; i < events.size(); i++) {
|
||||
|
||||
Ref<InputEventKey> aie = events[i];
|
||||
if (aie.is_null())
|
||||
continue;
|
||||
@@ -446,11 +425,9 @@ void ProjectSettingsEditor::_show_last_added(const Ref<InputEvent> &p_event, con
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::_wait_for_key(const Ref<InputEvent> &p_event) {
|
||||
|
||||
Ref<InputEventKey> k = p_event;
|
||||
|
||||
if (k.is_valid() && k->is_pressed() && k->get_scancode() != 0) {
|
||||
|
||||
last_wait_for_key = p_event;
|
||||
const String str = keycode_get_string(k->get_scancode_with_modifiers());
|
||||
|
||||
@@ -461,13 +438,10 @@ void ProjectSettingsEditor::_wait_for_key(const Ref<InputEvent> &p_event) {
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::_add_item(int p_item, Ref<InputEvent> p_exiting_event) {
|
||||
|
||||
add_type = InputType(p_item);
|
||||
|
||||
switch (add_type) {
|
||||
|
||||
case INPUT_KEY: {
|
||||
|
||||
press_a_key_label->set_text(TTR("Press a Key..."));
|
||||
press_a_key->get_ok()->set_disabled(true);
|
||||
last_wait_for_key = Ref<InputEvent>();
|
||||
@@ -476,7 +450,6 @@ void ProjectSettingsEditor::_add_item(int p_item, Ref<InputEvent> p_exiting_even
|
||||
|
||||
} break;
|
||||
case INPUT_MOUSE_BUTTON: {
|
||||
|
||||
device_index_label->set_text(TTR("Mouse Button Index:"));
|
||||
device_index->clear();
|
||||
device_index->add_item(TTR("Left Button"));
|
||||
@@ -502,11 +475,9 @@ void ProjectSettingsEditor::_add_item(int p_item, Ref<InputEvent> p_exiting_even
|
||||
|
||||
} break;
|
||||
case INPUT_JOY_MOTION: {
|
||||
|
||||
device_index_label->set_text(TTR("Joypad Axis Index:"));
|
||||
device_index->clear();
|
||||
for (int i = 0; i < JOY_AXIS_MAX * 2; i++) {
|
||||
|
||||
String desc = _axis_names[i];
|
||||
device_index->add_item(TTR("Axis") + " " + itos(i / 2) + " " + ((i & 1) ? "+" : "-") + desc);
|
||||
}
|
||||
@@ -524,12 +495,10 @@ void ProjectSettingsEditor::_add_item(int p_item, Ref<InputEvent> p_exiting_even
|
||||
|
||||
} break;
|
||||
case INPUT_JOY_BUTTON: {
|
||||
|
||||
device_index_label->set_text(TTR("Joypad Button Index:"));
|
||||
device_index->clear();
|
||||
|
||||
for (int i = 0; i < JOY_BUTTON_MAX; i++) {
|
||||
|
||||
device_index->add_item(itos(i) + ": " + String(_button_names[i]));
|
||||
}
|
||||
device_input->popup_centered_minsize(Size2(350, 95) * EDSCALE);
|
||||
@@ -551,7 +520,6 @@ void ProjectSettingsEditor::_add_item(int p_item, Ref<InputEvent> p_exiting_even
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::_edit_item(Ref<InputEvent> p_exiting_event) {
|
||||
|
||||
InputType ie_type;
|
||||
|
||||
if ((Ref<InputEventKey>(p_exiting_event)).is_valid()) {
|
||||
@@ -573,7 +541,6 @@ void ProjectSettingsEditor::_edit_item(Ref<InputEvent> p_exiting_event) {
|
||||
_add_item(ie_type, p_exiting_event);
|
||||
}
|
||||
void ProjectSettingsEditor::_action_activated() {
|
||||
|
||||
TreeItem *ti = input_editor->get_selected();
|
||||
|
||||
if (!ti || ti->get_parent() == input_editor->get_root())
|
||||
@@ -595,7 +562,6 @@ void ProjectSettingsEditor::_action_activated() {
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::_action_button_pressed(Object *p_obj, int p_column, int p_id) {
|
||||
|
||||
TreeItem *ti = Object::cast_to<TreeItem>(p_obj);
|
||||
|
||||
ERR_FAIL_COND(!ti);
|
||||
@@ -683,7 +649,6 @@ void ProjectSettingsEditor::_action_button_pressed(Object *p_obj, int p_column,
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::_update_actions() {
|
||||
|
||||
if (setting)
|
||||
return;
|
||||
|
||||
@@ -703,7 +668,6 @@ void ProjectSettingsEditor::_update_actions() {
|
||||
ProjectSettings::get_singleton()->get_property_list(&props);
|
||||
|
||||
for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) {
|
||||
|
||||
const PropertyInfo &pi = E->get();
|
||||
if (!pi.name.begins_with("input/"))
|
||||
continue;
|
||||
@@ -734,7 +698,6 @@ void ProjectSettingsEditor::_update_actions() {
|
||||
}
|
||||
|
||||
for (int i = 0; i < events.size(); i++) {
|
||||
|
||||
Ref<InputEvent> event = events[i];
|
||||
if (event.is_null())
|
||||
continue;
|
||||
@@ -743,7 +706,6 @@ void ProjectSettingsEditor::_update_actions() {
|
||||
|
||||
Ref<InputEventKey> k = event;
|
||||
if (k.is_valid()) {
|
||||
|
||||
const String str = keycode_get_string(k->get_scancode_with_modifiers());
|
||||
|
||||
action2->set_text(0, str);
|
||||
@@ -753,7 +715,6 @@ void ProjectSettingsEditor::_update_actions() {
|
||||
Ref<InputEventJoypadButton> jb = event;
|
||||
|
||||
if (jb.is_valid()) {
|
||||
|
||||
String str = _get_device_string(jb->get_device()) + ", " + TTR("Button") + " " + itos(jb->get_button_index());
|
||||
if (jb->get_button_index() >= 0 && jb->get_button_index() < JOY_BUTTON_MAX)
|
||||
str += String() + " (" + _button_names[jb->get_button_index()] + ").";
|
||||
@@ -795,7 +756,6 @@ void ProjectSettingsEditor::_update_actions() {
|
||||
Ref<InputEventJoypadMotion> jm = event;
|
||||
|
||||
if (jm.is_valid()) {
|
||||
|
||||
int ax = jm->get_axis();
|
||||
int n = 2 * ax + (jm->get_axis_value() < 0 ? 0 : 1);
|
||||
String desc = _axis_names[n];
|
||||
@@ -815,7 +775,6 @@ void ProjectSettingsEditor::_update_actions() {
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::popup_project_settings() {
|
||||
|
||||
// Restore valid window bounds or pop up at default size.
|
||||
Rect2 saved_size = EditorSettings::get_singleton()->get_project_metadata("dialog_bounds", "project_settings", Rect2());
|
||||
if (saved_size != Rect2()) {
|
||||
@@ -837,7 +796,6 @@ void ProjectSettingsEditor::update_plugins() {
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::_item_selected(const String &p_path) {
|
||||
|
||||
const String &selected_path = p_path;
|
||||
if (selected_path == String())
|
||||
return;
|
||||
@@ -846,12 +804,10 @@ void ProjectSettingsEditor::_item_selected(const String &p_path) {
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::_item_adds(String) {
|
||||
|
||||
_item_add();
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::_item_add() {
|
||||
|
||||
// Initialize the property with the default value for the given type.
|
||||
Variant::CallError ce;
|
||||
const Variant value = Variant::construct(Variant::Type(type->get_selected_id()), NULL, 0, ce);
|
||||
@@ -890,7 +846,6 @@ void ProjectSettingsEditor::_item_add() {
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::_item_del() {
|
||||
|
||||
String path = globals_editor->get_inspector()->get_selected_path();
|
||||
if (path == String()) {
|
||||
EditorNode::get_singleton()->show_warning(TTR("Select a setting item first!"));
|
||||
@@ -928,21 +883,16 @@ void ProjectSettingsEditor::_item_del() {
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::_action_check(String p_action) {
|
||||
|
||||
if (p_action == "") {
|
||||
|
||||
action_add->set_disabled(true);
|
||||
} else {
|
||||
|
||||
if (!_validate_action_name(p_action)) {
|
||||
|
||||
action_add_error->set_text(TTR("Invalid action name. It cannot be empty nor contain '/', ':', '=', '\\' or '\"'."));
|
||||
action_add_error->show();
|
||||
action_add->set_disabled(true);
|
||||
return;
|
||||
}
|
||||
if (ProjectSettings::get_singleton()->has_setting("input/" + p_action)) {
|
||||
|
||||
action_add_error->set_text(vformat(TTR("An action with the name '%s' already exists."), p_action));
|
||||
action_add_error->show();
|
||||
action_add->set_disabled(true);
|
||||
@@ -956,14 +906,12 @@ void ProjectSettingsEditor::_action_check(String p_action) {
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::_action_adds(String) {
|
||||
|
||||
if (!action_add->is_disabled()) {
|
||||
_action_add();
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::_action_add() {
|
||||
|
||||
Dictionary action;
|
||||
action["events"] = Array();
|
||||
action["deadzone"] = 0.5f;
|
||||
@@ -997,20 +945,17 @@ void ProjectSettingsEditor::_item_checked(const String &p_item, bool p_check) {
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::_save() {
|
||||
|
||||
Error err = ProjectSettings::get_singleton()->save();
|
||||
message->set_text(err != OK ? TTR("Error saving settings.") : TTR("Settings saved OK."));
|
||||
message->popup_centered(Size2(300, 100) * EDSCALE);
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::_settings_prop_edited(const String &p_name) {
|
||||
|
||||
// Method needed to discard the mandatory argument of the property_edited signal
|
||||
_settings_changed();
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::_settings_changed() {
|
||||
|
||||
timer->start();
|
||||
}
|
||||
|
||||
@@ -1019,7 +964,6 @@ void ProjectSettingsEditor::queue_save() {
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::_copy_to_platform_about_to_show() {
|
||||
|
||||
Set<String> presets;
|
||||
|
||||
presets.insert("bptc");
|
||||
@@ -1045,7 +989,6 @@ void ProjectSettingsEditor::_copy_to_platform_about_to_show() {
|
||||
}
|
||||
|
||||
for (int i = 0; i < EditorExport::get_singleton()->get_export_preset_count(); i++) {
|
||||
|
||||
List<String> p;
|
||||
EditorExport::get_singleton()->get_export_preset(i)->get_platform()->get_preset_features(EditorExport::get_singleton()->get_export_preset(i), &p);
|
||||
for (List<String>::Element *E = p.front(); E; E = E->next()) {
|
||||
@@ -1070,7 +1013,6 @@ void ProjectSettingsEditor::_copy_to_platform_about_to_show() {
|
||||
}
|
||||
|
||||
Variant ProjectSettingsEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from) {
|
||||
|
||||
TreeItem *selected = input_editor->get_selected();
|
||||
if (!selected || selected->get_parent() != input_editor->get_root())
|
||||
return Variant();
|
||||
@@ -1093,7 +1035,6 @@ Variant ProjectSettingsEditor::get_drag_data_fw(const Point2 &p_point, Control *
|
||||
}
|
||||
|
||||
bool ProjectSettingsEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const {
|
||||
|
||||
Dictionary d = p_data;
|
||||
if (!d.has("type") || d["type"] != "nodes")
|
||||
return false;
|
||||
@@ -1107,7 +1048,6 @@ bool ProjectSettingsEditor::can_drop_data_fw(const Point2 &p_point, const Varian
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) {
|
||||
|
||||
if (!can_drop_data_fw(p_point, p_data, p_from))
|
||||
return;
|
||||
|
||||
@@ -1128,7 +1068,6 @@ void ProjectSettingsEditor::drop_data_fw(const Point2 &p_point, const Variant &p
|
||||
|
||||
undo_redo->create_action(TTR("Moved Input Action Event"));
|
||||
while (iterator != target) {
|
||||
|
||||
String iterator_name = "input/" + iterator->get_text(0);
|
||||
int iterator_order = ProjectSettings::get_singleton()->get_order(iterator_name);
|
||||
undo_redo->add_do_method(ProjectSettings::get_singleton(), "set_order", iterator_name, order);
|
||||
@@ -1150,7 +1089,6 @@ void ProjectSettingsEditor::drop_data_fw(const Point2 &p_point, const Variant &p
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::_copy_to_platform(int p_which) {
|
||||
|
||||
String path = globals_editor->get_inspector()->get_selected_path();
|
||||
if (path == String()) {
|
||||
EditorNode::get_singleton()->show_warning(TTR("Select a setting item first!"));
|
||||
@@ -1185,16 +1123,13 @@ void ProjectSettingsEditor::_copy_to_platform(int p_which) {
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::add_translation(const String &p_translation) {
|
||||
|
||||
_translation_add(p_translation);
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::_translation_add(const String &p_path) {
|
||||
|
||||
PoolStringArray translations = ProjectSettings::get_singleton()->get("locale/translations");
|
||||
|
||||
for (int i = 0; i < translations.size(); i++) {
|
||||
|
||||
if (translations[i] == p_path)
|
||||
return; //exists
|
||||
}
|
||||
@@ -1211,12 +1146,10 @@ void ProjectSettingsEditor::_translation_add(const String &p_path) {
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::_translation_file_open() {
|
||||
|
||||
translation_file_open->popup_centered_ratio();
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::_translation_delete(Object *p_item, int p_column, int p_button) {
|
||||
|
||||
TreeItem *ti = Object::cast_to<TreeItem>(p_item);
|
||||
ERR_FAIL_COND(!ti);
|
||||
|
||||
@@ -1239,12 +1172,10 @@ void ProjectSettingsEditor::_translation_delete(Object *p_item, int p_column, in
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::_translation_res_file_open() {
|
||||
|
||||
translation_res_file_open->popup_centered_ratio();
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::_translation_res_add(const String &p_path) {
|
||||
|
||||
Variant prev;
|
||||
Dictionary remaps;
|
||||
|
||||
@@ -1269,11 +1200,9 @@ void ProjectSettingsEditor::_translation_res_add(const String &p_path) {
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::_translation_res_option_file_open() {
|
||||
|
||||
translation_res_option_file_open->popup_centered_ratio();
|
||||
}
|
||||
void ProjectSettingsEditor::_translation_res_option_add(const String &p_path) {
|
||||
|
||||
ERR_FAIL_COND(!ProjectSettings::get_singleton()->has_setting("locale/translation_remaps"));
|
||||
|
||||
Dictionary remaps = ProjectSettings::get_singleton()->get("locale/translation_remaps");
|
||||
@@ -1299,7 +1228,6 @@ void ProjectSettingsEditor::_translation_res_option_add(const String &p_path) {
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::_translation_res_select() {
|
||||
|
||||
if (updating_translations)
|
||||
return;
|
||||
|
||||
@@ -1307,7 +1235,6 @@ void ProjectSettingsEditor::_translation_res_select() {
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::_translation_res_option_changed() {
|
||||
|
||||
if (updating_translations)
|
||||
return;
|
||||
|
||||
@@ -1353,7 +1280,6 @@ void ProjectSettingsEditor::_translation_res_option_changed() {
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::_translation_res_delete(Object *p_item, int p_column, int p_button) {
|
||||
|
||||
if (updating_translations)
|
||||
return;
|
||||
|
||||
@@ -1380,7 +1306,6 @@ void ProjectSettingsEditor::_translation_res_delete(Object *p_item, int p_column
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::_translation_res_option_delete(Object *p_item, int p_column, int p_button) {
|
||||
|
||||
if (updating_translations)
|
||||
return;
|
||||
|
||||
@@ -1414,7 +1339,6 @@ void ProjectSettingsEditor::_translation_res_option_delete(Object *p_item, int p
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::_translation_filter_option_changed() {
|
||||
|
||||
int sel_id = translation_locale_filter_mode->get_selected_id();
|
||||
TreeItem *t = translation_filter->get_edited();
|
||||
String locale = t->get_tooltip(0);
|
||||
@@ -1463,7 +1387,6 @@ void ProjectSettingsEditor::_translation_filter_option_changed() {
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::_translation_filter_mode_changed(int p_mode) {
|
||||
|
||||
int sel_id = translation_locale_filter_mode->get_selected_id();
|
||||
|
||||
Variant prev;
|
||||
@@ -1496,7 +1419,6 @@ void ProjectSettingsEditor::_translation_filter_mode_changed(int p_mode) {
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::_update_translations() {
|
||||
|
||||
//update translations
|
||||
|
||||
if (updating_translations)
|
||||
@@ -1508,10 +1430,8 @@ void ProjectSettingsEditor::_update_translations() {
|
||||
TreeItem *root = translation_list->create_item(NULL);
|
||||
translation_list->set_hide_root(true);
|
||||
if (ProjectSettings::get_singleton()->has_setting("locale/translations")) {
|
||||
|
||||
PoolStringArray translations = ProjectSettings::get_singleton()->get("locale/translations");
|
||||
for (int i = 0; i < translations.size(); i++) {
|
||||
|
||||
TreeItem *t = translation_list->create_item(root);
|
||||
t->set_editable(0, false);
|
||||
t->set_text(0, translations[i].replace_first("res://", ""));
|
||||
@@ -1529,17 +1449,14 @@ void ProjectSettingsEditor::_update_translations() {
|
||||
|
||||
bool is_arr_empty = true;
|
||||
if (ProjectSettings::get_singleton()->has_setting("locale/locale_filter")) {
|
||||
|
||||
l_filter_all = ProjectSettings::get_singleton()->get("locale/locale_filter");
|
||||
|
||||
if (l_filter_all.size() == 2) {
|
||||
|
||||
translation_locale_filter_mode->select(l_filter_all[0]);
|
||||
is_arr_empty = false;
|
||||
}
|
||||
}
|
||||
if (is_arr_empty) {
|
||||
|
||||
l_filter_all.append(0);
|
||||
l_filter_all.append(Array());
|
||||
translation_locale_filter_mode->select(0);
|
||||
@@ -1554,7 +1471,6 @@ void ProjectSettingsEditor::_update_translations() {
|
||||
bool should_recreate_locales_list = is_short_list_when_show_all_selected || is_full_list_when_show_only_selected;
|
||||
|
||||
if (!translation_locales_list_created || should_recreate_locales_list) {
|
||||
|
||||
translation_locales_list_created = true;
|
||||
translation_filter->clear();
|
||||
root = translation_filter->create_item(NULL);
|
||||
@@ -1604,10 +1520,8 @@ void ProjectSettingsEditor::_update_translations() {
|
||||
String langnames = "";
|
||||
int l_idx = 0;
|
||||
for (int i = 0; i < names.size(); i++) {
|
||||
|
||||
if (filter_mode == SHOW_ONLY_SELECTED_LOCALES && fl_idx_count != 0) {
|
||||
if (l_filter.size() > 0) {
|
||||
|
||||
if (l_filter.find(langs[i]) != -1) {
|
||||
if (langnames.length() > 0)
|
||||
langnames += ",";
|
||||
@@ -1624,7 +1538,6 @@ void ProjectSettingsEditor::_update_translations() {
|
||||
}
|
||||
|
||||
if (ProjectSettings::get_singleton()->has_setting("locale/translation_remaps")) {
|
||||
|
||||
Dictionary remaps = ProjectSettings::get_singleton()->get("locale/translation_remaps");
|
||||
List<Variant> rk;
|
||||
remaps.get_key_list(&rk);
|
||||
@@ -1635,7 +1548,6 @@ void ProjectSettingsEditor::_update_translations() {
|
||||
keys.sort();
|
||||
|
||||
for (int i = 0; i < keys.size(); i++) {
|
||||
|
||||
TreeItem *t = translation_remap->create_item(root);
|
||||
t->set_editable(0, false);
|
||||
t->set_text(0, keys[i].replace_first("res://", ""));
|
||||
@@ -1648,7 +1560,6 @@ void ProjectSettingsEditor::_update_translations() {
|
||||
|
||||
PoolStringArray selected = remaps[keys[i]];
|
||||
for (int j = 0; j < selected.size(); j++) {
|
||||
|
||||
String s2 = selected[j];
|
||||
int qp = s2.find_last(":");
|
||||
String path = s2.substr(0, qp);
|
||||
@@ -1670,10 +1581,8 @@ void ProjectSettingsEditor::_update_translations() {
|
||||
|
||||
int f_idx = translation_locales_idxs_remap.find(idx);
|
||||
if (f_idx != -1 && fl_idx_count > 0 && filter_mode == SHOW_ONLY_SELECTED_LOCALES) {
|
||||
|
||||
t2->set_range(1, f_idx);
|
||||
} else {
|
||||
|
||||
t2->set_range(1, idx);
|
||||
}
|
||||
}
|
||||
@@ -1685,17 +1594,14 @@ void ProjectSettingsEditor::_update_translations() {
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::_toggle_search_bar(bool p_pressed) {
|
||||
|
||||
globals_editor->get_inspector()->set_use_filter(p_pressed);
|
||||
|
||||
if (p_pressed) {
|
||||
|
||||
search_bar->show();
|
||||
add_prop_bar->hide();
|
||||
search_box->grab_focus();
|
||||
search_box->select_all();
|
||||
} else {
|
||||
|
||||
search_box->clear();
|
||||
search_bar->hide();
|
||||
add_prop_bar->show();
|
||||
@@ -1703,12 +1609,10 @@ void ProjectSettingsEditor::_toggle_search_bar(bool p_pressed) {
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::set_plugins_page() {
|
||||
|
||||
tab_container->set_current_tab(plugin_settings->get_index());
|
||||
}
|
||||
|
||||
TabContainer *ProjectSettingsEditor::get_tabs() {
|
||||
|
||||
return tab_container;
|
||||
}
|
||||
|
||||
@@ -1727,7 +1631,6 @@ void ProjectSettingsEditor::_editor_restart_close() {
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_unhandled_input"), &ProjectSettingsEditor::_unhandled_input);
|
||||
ClassDB::bind_method(D_METHOD("_item_selected"), &ProjectSettingsEditor::_item_selected);
|
||||
ClassDB::bind_method(D_METHOD("_item_add"), &ProjectSettingsEditor::_item_add);
|
||||
@@ -1783,7 +1686,6 @@ void ProjectSettingsEditor::_bind_methods() {
|
||||
}
|
||||
|
||||
ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
|
||||
|
||||
singleton = this;
|
||||
set_title(TTR("Project Settings (project.godot)"));
|
||||
set_resizable(true);
|
||||
@@ -2027,7 +1929,6 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
|
||||
translation_locales_list_created = false;
|
||||
|
||||
{
|
||||
|
||||
VBoxContainer *tvb = memnew(VBoxContainer);
|
||||
translations->add_child(tvb);
|
||||
tvb->set_name(TTR("Translations"));
|
||||
|
||||
Reference in New Issue
Block a user