Skip to content

Commit

Permalink
Merge pull request #59464 from timothyqiu/update-layer-names-3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
akien-mga authored Mar 24, 2022
2 parents 788abaf + 91b6c28 commit c08e753
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions editor/editor_properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,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;
Expand Down Expand Up @@ -1036,10 +1038,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() {
Expand All @@ -1064,6 +1071,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 /////////////////////////
Expand Down
1 change: 1 addition & 0 deletions editor/editor_properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ class EditorPropertyLayers : public EditorProperty {

void _button_pressed();
void _menu_pressed(int p_menu);
void _refresh_names();

protected:
static void _bind_methods();
Expand Down

0 comments on commit c08e753

Please sign in to comment.