From 117f6cffd17d71440db35ecb9906590d13dce785 Mon Sep 17 00:00:00 2001 From: Relintai Date: Mon, 7 Apr 2025 17:04:57 +0200 Subject: [PATCH] Now TerrainWorld won't save it's chunks into scenes in the editor anymore if a TerrainWorldChunkDataManager is set. --- modules/terraman/world/terrain_world.cpp | 17 +++++++++++++++++ modules/terraman/world/terrain_world.h | 1 + 2 files changed, 18 insertions(+) diff --git a/modules/terraman/world/terrain_world.cpp b/modules/terraman/world/terrain_world.cpp index 35ec06d36..61647a4e9 100644 --- a/modules/terraman/world/terrain_world.cpp +++ b/modules/terraman/world/terrain_world.cpp @@ -164,7 +164,13 @@ Ref TerrainWorld::get_world_chunk_data_manager() c return _world_chunk_data_manager; } void TerrainWorld::set_world_chunk_data_manager(const Ref &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 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: { diff --git a/modules/terraman/world/terrain_world.h b/modules/terraman/world/terrain_world.h index bb9adb055..0b025c15f 100644 --- a/modules/terraman/world/terrain_world.h +++ b/modules/terraman/world/terrain_world.h @@ -238,6 +238,7 @@ protected: virtual Ref _create_chunk(int x, int z, Ref 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();