Skip to content

Commit

Permalink
Add placeholder items to TileSet layer list
Browse files Browse the repository at this point in the history
Co-authored-by: MewPurPur <mew.pur.pur@abv.bg>
  • Loading branch information
KoBeWi and MewPurPur committed Jul 20, 2023
1 parent 0c2144d commit bb64588
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions editor/icons/Info.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions editor/plugins/tiles/tile_set_atlas_source_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,8 @@ void TileSetAtlasSourceEditor::_update_tile_data_editors() {
tile_data_editors["probability"] = tile_data_probability_editor;
}

Color disabled_color = get_theme_color("disabled_font_color", "Editor");

// --- Physics ---
ADD_TILE_DATA_EDITOR_GROUP(TTR("Physics"));
for (int i = 0; i < tile_set->get_physics_layers_count(); i++) {
Expand All @@ -748,6 +750,16 @@ void TileSetAtlasSourceEditor::_update_tile_data_editors() {
tile_data_editors.erase(vformat("physics_layer_%d", i));
}

if (tile_set->get_physics_layers_count() == 0) {
item = tile_data_editors_tree->create_item(group);
item->set_icon(0, get_theme_icon("Info", "EditorIcons"));
item->set_icon_modulate(0, disabled_color);
item->set_text(0, TTR("No physics layers"));
item->set_tooltip_text(0, TTR("Create and customize physics layers in the inspector of the TileSet resource."));
item->set_selectable(0, false);
item->set_custom_color(0, disabled_color);
}

// --- Navigation ---
ADD_TILE_DATA_EDITOR_GROUP(TTR("Navigation"));
for (int i = 0; i < tile_set->get_navigation_layers_count(); i++) {
Expand All @@ -766,6 +778,16 @@ void TileSetAtlasSourceEditor::_update_tile_data_editors() {
tile_data_editors.erase(vformat("navigation_layer_%d", i));
}

if (tile_set->get_navigation_layers_count() == 0) {
item = tile_data_editors_tree->create_item(group);
item->set_icon(0, get_theme_icon("Info", "EditorIcons"));
item->set_icon_modulate(0, disabled_color);
item->set_text(0, TTR("No navigation layers"));
item->set_tooltip_text(0, TTR("Create and customize navigation layers in the inspector of the TileSet resource."));
item->set_selectable(0, false);
item->set_custom_color(0, disabled_color);
}

// --- Custom Data ---
ADD_TILE_DATA_EDITOR_GROUP(TTR("Custom Data"));
for (int i = 0; i < tile_set->get_custom_data_layers_count(); i++) {
Expand Down Expand Up @@ -799,6 +821,16 @@ void TileSetAtlasSourceEditor::_update_tile_data_editors() {
tile_data_editors.erase(vformat("custom_data_%d", i));
}

if (tile_set->get_custom_data_layers_count() == 0) {
item = tile_data_editors_tree->create_item(group);
item->set_icon(0, get_theme_icon("Info", "EditorIcons"));
item->set_icon_modulate(0, disabled_color);
item->set_text(0, TTR("No custom data layers"));
item->set_tooltip_text(0, TTR("Create and customize custom data layers in the inspector of the TileSet resource."));
item->set_selectable(0, false);
item->set_custom_color(0, disabled_color);
}

#undef ADD_TILE_DATA_EDITOR_GROUP
#undef ADD_TILE_DATA_EDITOR

Expand Down

0 comments on commit bb64588

Please sign in to comment.