mirror of
https://github.com/godotengine/godot.git
synced 2024-11-24 13:12:42 +00:00
Keep advanced toggle on when searching for settings
This commit is contained in:
parent
e4e024ab88
commit
267bb98231
@ -30,10 +30,12 @@
|
|||||||
|
|
||||||
#include "editor_sectioned_inspector.h"
|
#include "editor_sectioned_inspector.h"
|
||||||
|
|
||||||
|
#include "editor/editor_inspector.h"
|
||||||
#include "editor/editor_property_name_processor.h"
|
#include "editor/editor_property_name_processor.h"
|
||||||
#include "editor/editor_settings.h"
|
|
||||||
#include "editor/editor_string_names.h"
|
#include "editor/editor_string_names.h"
|
||||||
#include "editor/themes/editor_scale.h"
|
#include "editor/themes/editor_scale.h"
|
||||||
|
#include "scene/gui/check_button.h"
|
||||||
|
#include "scene/gui/tree.h"
|
||||||
|
|
||||||
static bool _property_path_matches(const String &p_property_path, const String &p_filter, EditorPropertyNameProcessor::Style p_style) {
|
static bool _property_path_matches(const String &p_property_path, const String &p_filter, EditorPropertyNameProcessor::Style p_style) {
|
||||||
if (p_property_path.containsn(p_filter)) {
|
if (p_property_path.containsn(p_filter)) {
|
||||||
@ -307,20 +309,37 @@ void SectionedInspector::register_search_box(LineEdit *p_box) {
|
|||||||
search_box->connect(SceneStringName(text_changed), callable_mp(this, &SectionedInspector::_search_changed));
|
search_box->connect(SceneStringName(text_changed), callable_mp(this, &SectionedInspector::_search_changed));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SectionedInspector::register_advanced_toggle(CheckButton *p_toggle) {
|
||||||
|
advanced_toggle = p_toggle;
|
||||||
|
advanced_toggle->connect(SceneStringName(toggled), callable_mp(this, &SectionedInspector::_advanced_toggled));
|
||||||
|
_advanced_toggled(advanced_toggle->is_pressed());
|
||||||
|
}
|
||||||
|
|
||||||
void SectionedInspector::_search_changed(const String &p_what) {
|
void SectionedInspector::_search_changed(const String &p_what) {
|
||||||
|
if (advanced_toggle) {
|
||||||
|
if (p_what.is_empty()) {
|
||||||
|
advanced_toggle->set_pressed_no_signal(!restrict_to_basic);
|
||||||
|
advanced_toggle->set_disabled(false);
|
||||||
|
advanced_toggle->set_tooltip_text(String());
|
||||||
|
} else {
|
||||||
|
advanced_toggle->set_pressed_no_signal(true);
|
||||||
|
advanced_toggle->set_disabled(true);
|
||||||
|
advanced_toggle->set_tooltip_text(TTR("Advanced settings are always shown when searching."));
|
||||||
|
}
|
||||||
|
}
|
||||||
update_category_list();
|
update_category_list();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SectionedInspector::_advanced_toggled(bool p_toggled_on) {
|
||||||
|
restrict_to_basic = !p_toggled_on;
|
||||||
|
update_category_list();
|
||||||
|
inspector->set_restrict_to_basic_settings(restrict_to_basic);
|
||||||
|
}
|
||||||
|
|
||||||
EditorInspector *SectionedInspector::get_inspector() {
|
EditorInspector *SectionedInspector::get_inspector() {
|
||||||
return inspector;
|
return inspector;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SectionedInspector::set_restrict_to_basic_settings(bool p_restrict) {
|
|
||||||
restrict_to_basic = p_restrict;
|
|
||||||
update_category_list();
|
|
||||||
inspector->set_restrict_to_basic_settings(p_restrict);
|
|
||||||
}
|
|
||||||
|
|
||||||
SectionedInspector::SectionedInspector() :
|
SectionedInspector::SectionedInspector() :
|
||||||
sections(memnew(Tree)),
|
sections(memnew(Tree)),
|
||||||
filter(memnew(SectionedInspectorFilter)),
|
filter(memnew(SectionedInspectorFilter)),
|
||||||
|
@ -31,11 +31,14 @@
|
|||||||
#ifndef EDITOR_SECTIONED_INSPECTOR_H
|
#ifndef EDITOR_SECTIONED_INSPECTOR_H
|
||||||
#define EDITOR_SECTIONED_INSPECTOR_H
|
#define EDITOR_SECTIONED_INSPECTOR_H
|
||||||
|
|
||||||
#include "editor/editor_inspector.h"
|
|
||||||
#include "scene/gui/split_container.h"
|
#include "scene/gui/split_container.h"
|
||||||
#include "scene/gui/tree.h"
|
|
||||||
|
|
||||||
|
class CheckButton;
|
||||||
|
class EditorInspector;
|
||||||
|
class LineEdit;
|
||||||
class SectionedInspectorFilter;
|
class SectionedInspectorFilter;
|
||||||
|
class Tree;
|
||||||
|
class TreeItem;
|
||||||
|
|
||||||
class SectionedInspector : public HSplitContainer {
|
class SectionedInspector : public HSplitContainer {
|
||||||
GDCLASS(SectionedInspector, HSplitContainer);
|
GDCLASS(SectionedInspector, HSplitContainer);
|
||||||
@ -48,6 +51,7 @@ class SectionedInspector : public HSplitContainer {
|
|||||||
HashMap<String, TreeItem *> section_map;
|
HashMap<String, TreeItem *> section_map;
|
||||||
EditorInspector *inspector = nullptr;
|
EditorInspector *inspector = nullptr;
|
||||||
LineEdit *search_box = nullptr;
|
LineEdit *search_box = nullptr;
|
||||||
|
CheckButton *advanced_toggle = nullptr;
|
||||||
|
|
||||||
String selected_category;
|
String selected_category;
|
||||||
|
|
||||||
@ -57,9 +61,12 @@ class SectionedInspector : public HSplitContainer {
|
|||||||
void _section_selected();
|
void _section_selected();
|
||||||
|
|
||||||
void _search_changed(const String &p_what);
|
void _search_changed(const String &p_what);
|
||||||
|
void _advanced_toggled(bool p_toggled_on);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void register_search_box(LineEdit *p_box);
|
void register_search_box(LineEdit *p_box);
|
||||||
|
void register_advanced_toggle(CheckButton *p_toggle);
|
||||||
|
|
||||||
EditorInspector *get_inspector();
|
EditorInspector *get_inspector();
|
||||||
void edit(Object *p_object);
|
void edit(Object *p_object);
|
||||||
String get_full_item_path(const String &p_item);
|
String get_full_item_path(const String &p_item);
|
||||||
@ -67,7 +74,6 @@ public:
|
|||||||
void set_current_section(const String &p_section);
|
void set_current_section(const String &p_section);
|
||||||
String get_current_section() const;
|
String get_current_section() const;
|
||||||
|
|
||||||
void set_restrict_to_basic_settings(bool p_restrict);
|
|
||||||
void update_category_list();
|
void update_category_list();
|
||||||
|
|
||||||
SectionedInspector();
|
SectionedInspector();
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include "core/input/input_map.h"
|
#include "core/input/input_map.h"
|
||||||
#include "core/os/keyboard.h"
|
#include "core/os/keyboard.h"
|
||||||
#include "editor/debugger/editor_debugger_node.h"
|
#include "editor/debugger/editor_debugger_node.h"
|
||||||
|
#include "editor/editor_inspector.h"
|
||||||
#include "editor/editor_log.h"
|
#include "editor/editor_log.h"
|
||||||
#include "editor/editor_node.h"
|
#include "editor/editor_node.h"
|
||||||
#include "editor/editor_property_name_processor.h"
|
#include "editor/editor_property_name_processor.h"
|
||||||
@ -806,7 +807,6 @@ void EditorSettingsDialog::_focus_current_search_box() {
|
|||||||
|
|
||||||
void EditorSettingsDialog::_advanced_toggled(bool p_button_pressed) {
|
void EditorSettingsDialog::_advanced_toggled(bool p_button_pressed) {
|
||||||
EditorSettings::get_singleton()->set("_editor_settings_advanced_mode", p_button_pressed);
|
EditorSettings::get_singleton()->set("_editor_settings_advanced_mode", p_button_pressed);
|
||||||
inspector->set_restrict_to_basic_settings(!p_button_pressed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorSettingsDialog::_editor_restart() {
|
void EditorSettingsDialog::_editor_restart() {
|
||||||
@ -860,8 +860,8 @@ EditorSettingsDialog::EditorSettingsDialog() {
|
|||||||
|
|
||||||
inspector = memnew(SectionedInspector);
|
inspector = memnew(SectionedInspector);
|
||||||
inspector->get_inspector()->set_use_filter(true);
|
inspector->get_inspector()->set_use_filter(true);
|
||||||
inspector->set_restrict_to_basic_settings(!use_advanced);
|
|
||||||
inspector->register_search_box(search_box);
|
inspector->register_search_box(search_box);
|
||||||
|
inspector->register_advanced_toggle(advanced_switch);
|
||||||
inspector->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
inspector->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||||
tab_general->add_child(inspector);
|
tab_general->add_child(inspector);
|
||||||
inspector->get_inspector()->connect("property_edited", callable_mp(this, &EditorSettingsDialog::_settings_property_edited));
|
inspector->get_inspector()->connect("property_edited", callable_mp(this, &EditorSettingsDialog::_settings_property_edited));
|
||||||
|
@ -33,11 +33,8 @@
|
|||||||
#include "core/config/project_settings.h"
|
#include "core/config/project_settings.h"
|
||||||
#include "core/io/resource_importer.h"
|
#include "core/io/resource_importer.h"
|
||||||
#include "editor/action_map_editor.h"
|
#include "editor/action_map_editor.h"
|
||||||
#include "editor/editor_autoload_settings.h"
|
#include "editor/editor_inspector.h"
|
||||||
#include "editor/editor_sectioned_inspector.h"
|
#include "editor/editor_sectioned_inspector.h"
|
||||||
#include "editor/localization_editor.h"
|
|
||||||
#include "editor/plugins/editor_plugin_settings.h"
|
|
||||||
#include "editor/shader_globals_editor.h"
|
|
||||||
#include "scene/gui/center_container.h"
|
#include "scene/gui/center_container.h"
|
||||||
|
|
||||||
class ImportDefaultsEditorSettings : public Object {
|
class ImportDefaultsEditorSettings : public Object {
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
#include "project_settings_editor.h"
|
#include "project_settings_editor.h"
|
||||||
|
|
||||||
#include "core/config/project_settings.h"
|
#include "core/config/project_settings.h"
|
||||||
#include "editor/editor_log.h"
|
#include "editor/editor_inspector.h"
|
||||||
#include "editor/editor_node.h"
|
#include "editor/editor_node.h"
|
||||||
#include "editor/editor_settings.h"
|
#include "editor/editor_settings.h"
|
||||||
#include "editor/editor_string_names.h"
|
#include "editor/editor_string_names.h"
|
||||||
@ -106,7 +106,6 @@ void ProjectSettingsEditor::_update_advanced(bool p_is_advanced) {
|
|||||||
void ProjectSettingsEditor::_advanced_toggled(bool p_button_pressed) {
|
void ProjectSettingsEditor::_advanced_toggled(bool p_button_pressed) {
|
||||||
EditorSettings::get_singleton()->set_project_metadata("project_settings", "advanced_mode", p_button_pressed);
|
EditorSettings::get_singleton()->set_project_metadata("project_settings", "advanced_mode", p_button_pressed);
|
||||||
_update_advanced(p_button_pressed);
|
_update_advanced(p_button_pressed);
|
||||||
general_settings_inspector->set_restrict_to_basic_settings(!p_button_pressed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectSettingsEditor::_setting_selected(const String &p_path) {
|
void ProjectSettingsEditor::_setting_selected(const String &p_path) {
|
||||||
@ -688,6 +687,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
|
|||||||
general_settings_inspector = memnew(SectionedInspector);
|
general_settings_inspector = memnew(SectionedInspector);
|
||||||
general_settings_inspector->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
general_settings_inspector->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||||
general_settings_inspector->register_search_box(search_box);
|
general_settings_inspector->register_search_box(search_box);
|
||||||
|
general_settings_inspector->register_advanced_toggle(advanced);
|
||||||
general_settings_inspector->get_inspector()->set_use_filter(true);
|
general_settings_inspector->get_inspector()->set_use_filter(true);
|
||||||
general_settings_inspector->get_inspector()->connect("property_selected", callable_mp(this, &ProjectSettingsEditor::_setting_selected));
|
general_settings_inspector->get_inspector()->connect("property_selected", callable_mp(this, &ProjectSettingsEditor::_setting_selected));
|
||||||
general_settings_inspector->get_inspector()->connect("property_edited", callable_mp(this, &ProjectSettingsEditor::_setting_edited));
|
general_settings_inspector->get_inspector()->connect("property_edited", callable_mp(this, &ProjectSettingsEditor::_setting_edited));
|
||||||
@ -771,11 +771,10 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
|
|||||||
bool use_advanced = EditorSettings::get_singleton()->get_project_metadata("project_settings", "advanced_mode", false);
|
bool use_advanced = EditorSettings::get_singleton()->get_project_metadata("project_settings", "advanced_mode", false);
|
||||||
|
|
||||||
if (use_advanced) {
|
if (use_advanced) {
|
||||||
advanced->set_pressed_no_signal(true);
|
advanced->set_pressed(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
_update_advanced(use_advanced);
|
_update_advanced(use_advanced);
|
||||||
general_settings_inspector->set_restrict_to_basic_settings(!use_advanced);
|
|
||||||
|
|
||||||
import_defaults_editor = memnew(ImportDefaultsEditor);
|
import_defaults_editor = memnew(ImportDefaultsEditor);
|
||||||
import_defaults_editor->set_name(TTR("Import Defaults"));
|
import_defaults_editor->set_name(TTR("Import Defaults"));
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include "shader_globals_editor.h"
|
#include "shader_globals_editor.h"
|
||||||
|
|
||||||
#include "core/config/project_settings.h"
|
#include "core/config/project_settings.h"
|
||||||
|
#include "editor/editor_inspector.h"
|
||||||
#include "editor/editor_node.h"
|
#include "editor/editor_node.h"
|
||||||
#include "editor/editor_undo_redo_manager.h"
|
#include "editor/editor_undo_redo_manager.h"
|
||||||
#include "servers/rendering/shader_language.h"
|
#include "servers/rendering/shader_language.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user