summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfox <12120644+foxydevloper@users.noreply.github.com>2021-05-24 15:16:02 -0400
committerfoxydevloper <12120644+foxydevloper@users.noreply.github.com>2022-07-31 10:38:44 -0400
commit41cc9f9a4304a3bf8928a361e718130191280f69 (patch)
tree08fde6dc9003696092cf114abbf2350c3cc669fa
parent475592a3bc2d2150dcbd9179fff653e3c55505a1 (diff)
Hide altering custom properties in basic mode
Hides the row for adding and removing custom properties from showing up when advanced mode is disabled.
-rw-r--r--editor/project_settings_editor.cpp20
-rw-r--r--editor/project_settings_editor.h2
2 files changed, 15 insertions, 7 deletions
diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp
index be1ad1ca9c..9164837a0d 100644
--- a/editor/project_settings_editor.cpp
+++ b/editor/project_settings_editor.cpp
@@ -74,8 +74,13 @@ void ProjectSettingsEditor::_setting_edited(const String &p_name) {
queue_save();
}
+void ProjectSettingsEditor::_update_advanced(bool p_is_advanced) {
+ custom_properties->set_visible(p_is_advanced);
+}
+
void ProjectSettingsEditor::_advanced_toggled(bool p_button_pressed) {
EditorSettings::get_singleton()->set_project_metadata("project_settings", "advanced_mode", p_button_pressed);
+ _update_advanced(p_button_pressed);
general_settings_inspector->set_restrict_to_basic_settings(!p_button_pressed);
}
@@ -584,35 +589,35 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
advanced->connect("toggled", callable_mp(this, &ProjectSettingsEditor::_advanced_toggled));
search_bar->add_child(advanced);
- HBoxContainer *header = memnew(HBoxContainer);
- general_editor->add_child(header);
+ custom_properties = memnew(HBoxContainer);
+ general_editor->add_child(custom_properties);
property_box = memnew(LineEdit);
property_box->set_placeholder(TTR("Select a Setting or Type its Name"));
property_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
property_box->connect("text_changed", callable_mp(this, &ProjectSettingsEditor::_property_box_changed));
- header->add_child(property_box);
+ custom_properties->add_child(property_box);
feature_box = memnew(OptionButton);
feature_box->set_custom_minimum_size(Size2(120, 0) * EDSCALE);
feature_box->connect("item_selected", callable_mp(this, &ProjectSettingsEditor::_feature_selected));
- header->add_child(feature_box);
+ custom_properties->add_child(feature_box);
type_box = memnew(OptionButton);
type_box->set_custom_minimum_size(Size2(120, 0) * EDSCALE);
- header->add_child(type_box);
+ custom_properties->add_child(type_box);
add_button = memnew(Button);
add_button->set_text(TTR("Add"));
add_button->set_disabled(true);
add_button->connect("pressed", callable_mp(this, &ProjectSettingsEditor::_add_setting));
- header->add_child(add_button);
+ custom_properties->add_child(add_button);
del_button = memnew(Button);
del_button->set_text(TTR("Delete"));
del_button->set_disabled(true);
del_button->connect("pressed", callable_mp(this, &ProjectSettingsEditor::_delete_setting));
- header->add_child(del_button);
+ custom_properties->add_child(del_button);
general_settings_inspector = memnew(SectionedInspector);
general_settings_inspector->get_inspector()->set_undo_redo(EditorNode::get_singleton()->get_undo_redo());
@@ -693,6 +698,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
advanced->set_pressed(true);
}
+ _update_advanced(use_advanced);
general_settings_inspector->set_restrict_to_basic_settings(!use_advanced);
import_defaults_editor = memnew(ImportDefaultsEditor);
diff --git a/editor/project_settings_editor.h b/editor/project_settings_editor.h
index 455aaae11c..849c50b9ba 100644
--- a/editor/project_settings_editor.h
+++ b/editor/project_settings_editor.h
@@ -61,6 +61,7 @@ class ProjectSettingsEditor : public AcceptDialog {
LineEdit *search_box = nullptr;
CheckButton *advanced = nullptr;
+ HBoxContainer *custom_properties = nullptr;
LineEdit *property_box = nullptr;
OptionButton *feature_box = nullptr;
OptionButton *type_box = nullptr;
@@ -77,6 +78,7 @@ class ProjectSettingsEditor : public AcceptDialog {
UndoRedo *undo_redo = nullptr;
void _advanced_toggled(bool p_button_pressed);
+ void _update_advanced(bool p_is_advanced);
void _property_box_changed(const String &p_text);
void _update_property_box();
void _feature_selected(int p_index);