diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-05-28 15:49:12 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-05-28 15:49:12 +0200 |
commit | f87be863cacff5d1cc448c061d1d8d0b67172eea (patch) | |
tree | 50c50f07de6dc7a2acc9e11e14353c6548fea2e3 /editor/plugins/tiles/tile_set_atlas_source_editor.cpp | |
parent | a10897ddc0b0ab57fe67e7d0b9b3415ed8e74a5c (diff) | |
parent | 85eac455139ae527951bf5fd49cedbac3535fd4d (diff) | |
download | redot-engine-f87be863cacff5d1cc448c061d1d8d0b67172eea.tar.gz |
Merge pull request #92322 from groud/implement_custom_data_label
Display custom data name instead of indices in TileData inspector
Diffstat (limited to 'editor/plugins/tiles/tile_set_atlas_source_editor.cpp')
-rw-r--r-- | editor/plugins/tiles/tile_set_atlas_source_editor.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp index 1daba1f665..03070bc6b5 100644 --- a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp +++ b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp @@ -2938,6 +2938,18 @@ bool EditorInspectorPluginTileData::parse_property(Object *p_object, const Varia add_property_editor(p_path, ep); return true; } + } else if (p_path.begins_with("custom_data_") && p_path.trim_prefix("custom_data_").is_valid_int()) { + // Custom data layers. + int layer_index = components[0].trim_prefix("custom_data_").to_int(); + ERR_FAIL_COND_V(layer_index < 0, false); + EditorProperty *ep = EditorInspectorDefaultPlugin::get_editor_for_property(p_object, p_type, p_path, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT); + const TileSetAtlasSourceEditor::AtlasTileProxyObject *proxy_obj = Object::cast_to<TileSetAtlasSourceEditor::AtlasTileProxyObject>(p_object); + const TileSetAtlasSource *atlas_source = *proxy_obj->get_edited_tile_set_atlas_source(); + ERR_FAIL_NULL_V(atlas_source, false); + const TileSet *tile_set = atlas_source->get_tile_set(); + ERR_FAIL_NULL_V(tile_set, false); + add_property_editor(p_path, ep, false, tile_set->get_custom_data_layer_name(layer_index)); + return true; } return false; } |