Merge pull request #46373 from dalexeev/3.2-proposal-1545

[3.2] Merge Category and Property fields in the Project Settings
This commit is contained in:
Rémi Verschelde 2021-03-04 10:19:12 +01:00 committed by GitHub
commit 1134fade46
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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++) {

View file

@ -73,7 +73,6 @@ class ProjectSettingsEditor : public AcceptDialog {
HBoxContainer *add_prop_bar;
AcceptDialog *message;
LineEdit *category;
LineEdit *property;
OptionButton *type;
PopupMenu *popup_add;