From c14e9cc48b3865f0a4db58fe4ab4817ceb4b87ea Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Thu, 24 Mar 2022 17:19:59 +0800 Subject: [PATCH] Update inspector layer names when project settings changed --- editor/editor_properties.cpp | 9 +++++++++ editor/editor_properties.h | 1 + 2 files changed, 10 insertions(+) diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 8829625c8..ef5413226 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -1017,6 +1017,8 @@ void EditorPropertyLayers::update_property() { } void EditorPropertyLayers::setup(LayerType p_layer_type) { + layer_type = p_layer_type; + String basename; int layer_group_size = 0; int layer_count = 0; @@ -1101,10 +1103,15 @@ void EditorPropertyLayers::_menu_pressed(int p_menu) { _grid_changed(grid->value); } +void EditorPropertyLayers::_refresh_names() { + setup(layer_type); +} + void EditorPropertyLayers::_bind_methods() { ClassDB::bind_method(D_METHOD("_grid_changed"), &EditorPropertyLayers::_grid_changed); ClassDB::bind_method(D_METHOD("_button_pressed"), &EditorPropertyLayers::_button_pressed); ClassDB::bind_method(D_METHOD("_menu_pressed"), &EditorPropertyLayers::_menu_pressed); + ClassDB::bind_method(D_METHOD("_refresh_names"), &EditorPropertyLayers::_refresh_names); } EditorPropertyLayers::EditorPropertyLayers() { @@ -1129,6 +1136,8 @@ EditorPropertyLayers::EditorPropertyLayers() { layers->set_hide_on_checkable_item_selection(false); layers->connect("id_pressed", this, "_menu_pressed"); layers->connect("popup_hide", button, "set_pressed", varray(false)); + + ProjectSettings::get_singleton()->connect("project_settings_changed", this, "_refresh_names"); } ///////////////////// INT ///////////////////////// diff --git a/editor/editor_properties.h b/editor/editor_properties.h index d555e685b..8472c1c8d 100644 --- a/editor/editor_properties.h +++ b/editor/editor_properties.h @@ -296,6 +296,7 @@ private: void _button_pressed(); void _menu_pressed(int p_menu); + void _refresh_names(); protected: static void _bind_methods();