Fix editing custom data for tilesets

This commit is contained in:
Julian 2025-04-04 14:28:01 -04:00
parent 27b2ba667c
commit 38305a2ad0

View file

@ -6952,6 +6952,16 @@ bool TileData::_get(const StringName &p_name, Variant &r_ret) const {
}
}
#endif // NAVIGATION_2D_DISABLED
else if (components.size() == 1 && components[0].begins_with("custom_data_") && components[0].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);
if (layer_index >= custom_data.size()) {
return false;
}
r_ret = get_custom_data_by_layer_id(layer_index);
return true;
}
}
return false;