Now TerrainWorld won't save it's chunks into scenes in the editor anymore if a TerrainWorldChunkDataManager is set.

This commit is contained in:
Relintai 2025-04-07 17:04:57 +02:00
parent 5dbfdac48e
commit 117f6cffd1
2 changed files with 18 additions and 0 deletions

View File

@ -164,7 +164,13 @@ Ref<TerrainWorldChunkDataManager> TerrainWorld::get_world_chunk_data_manager() c
return _world_chunk_data_manager;
}
void TerrainWorld::set_world_chunk_data_manager(const Ref<TerrainWorldChunkDataManager> &p_data_manager) {
if (_world_chunk_data_manager == p_data_manager) {
return;
}
_world_chunk_data_manager = p_data_manager;
property_list_changed_notify();
}
float TerrainWorld::get_voxel_scale() const {
@ -1493,6 +1499,17 @@ void TerrainWorld::_generate_chunk(Ref<TerrainChunk> chunk) {
}
}
void TerrainWorld::_validate_property(PropertyInfo &property) const {
if (property.name == "chunks") {
if (_world_chunk_data_manager.is_valid()) {
// Show in editor, but don't save with the scene
property.usage = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_NETWORK;
} else {
property.usage = PROPERTY_USAGE_DEFAULT;
}
}
}
void TerrainWorld::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {

View File

@ -238,6 +238,7 @@ protected:
virtual Ref<TerrainChunk> _create_chunk(int x, int z, Ref<TerrainChunk> p_chunk);
virtual int _get_channel_index_info(const ChannelTypeInfo channel_type);
virtual void _validate_property(PropertyInfo &property) const;
virtual void _notification(int p_what);
static void _bind_methods();