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

Allow EditorInspector to change its property name style when necessary

Previously, an EditorInspector's property name can only be set from
outside. Inspectors used for settings needs to respond to changes in
editor settings. So a few boilerplate code is almost always needed,
including watching for a certain editor setting in `_notification()`.

This commit adds a `set_use_settings_style()` function to tell the
inspector to watch for editor settings changes on its own.
This commit is contained in:
Haoyu Qiu
2023-03-02 20:37:02 +08:00
parent 9f12e7b52d
commit d24ee551ec
12 changed files with 32 additions and 67 deletions

View File

@@ -36,7 +36,6 @@
#include "editor/editor_autoload_settings.h"
#include "editor/editor_plugin_settings.h"
#include "editor/editor_sectioned_inspector.h"
#include "editor/editor_settings.h"
#include "editor/localization_editor.h"
#include "editor/shader_globals_editor.h"
#include "scene/gui/center_container.h"
@@ -82,11 +81,6 @@ protected:
void ImportDefaultsEditor::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
inspector->set_property_name_style(EditorPropertyNameProcessor::get_settings_style());
} break;
case NOTIFICATION_PREDELETE: {
inspector->edit(nullptr);
} break;