1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Merge Category and Property fields in the Project Settings

Closes godotengine/godot-proposals#1545.
This commit is contained in:
Danil Alexeev
2021-02-24 14:27:19 +03:00
parent 9fa85b343c
commit 72e8697d8c
2 changed files with 7 additions and 21 deletions

View File

@@ -828,8 +828,7 @@ void ProjectSettingsEditor::_item_selected(const String &p_path) {
const String &selected_path = p_path;
if (selected_path == String())
return;
category->set_text(globals_editor->get_current_section());
property->set_text(selected_path);
property->set_text(globals_editor->get_current_section().plus_file(selected_path));
popup_copy_to_feature->set_disabled(false);
}
@@ -845,19 +844,16 @@ void ProjectSettingsEditor::_item_add() {
Variant::CallError ce;
const Variant value = Variant::construct(Variant::Type(type->get_selected() + 1), NULL, 0, ce);
String catname = category->get_text().strip_edges();
String propname = property->get_text().strip_edges();
String name = property->get_text().strip_edges();
if (propname.empty()) {
if (name.empty()) {
return;
}
if (catname.empty()) {
catname = "global";
if (name.find("/") == -1) {
name = "global/" + name;
}
String name = catname + "/" + propname;
undo_redo->create_action(TTR("Add Global Property"));
undo_redo->add_do_property(ProjectSettings::get_singleton(), name, value);
@@ -876,7 +872,7 @@ void ProjectSettingsEditor::_item_add() {
undo_redo->commit_action();
globals_editor->set_current_section(catname);
globals_editor->set_current_section(name.get_slice("/", 1));
_settings_changed();
}
@@ -1811,15 +1807,6 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
Label *l = memnew(Label);
add_prop_bar->add_child(l);
l->set_text(TTR("Category:"));
category = memnew(LineEdit);
category->set_h_size_flags(Control::SIZE_EXPAND_FILL);
add_prop_bar->add_child(category);
category->connect("text_entered", this, "_item_adds");
l = memnew(Label);
add_prop_bar->add_child(l);
l->set_text(TTR("Property:"));
property = memnew(LineEdit);
@@ -1832,7 +1819,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
l->set_text(TTR("Type:"));
type = memnew(OptionButton);
type->set_h_size_flags(Control::SIZE_EXPAND_FILL);
type->set_custom_minimum_size(Size2(100, 0) * EDSCALE);
add_prop_bar->add_child(type);
for (int i = 0; i < Variant::VARIANT_MAX; i++) {