Fix #129642: material lost after first frame in uncached simulation zone

The issue was that some checks didn't handle the no-cache case correctly.

Pull Request: https://projects.blender.org/blender/blender/pulls/129959
This commit is contained in:
Jacques Lucke
2024-11-07 14:25:57 +01:00
parent da767bcbdc
commit 5cdaa7b0f0

View File

@@ -1236,7 +1236,7 @@ class NodesModifierSimulationParams : public nodes::GeoNodesSimulationParams {
}
/* If there are no baked frames, we don't need keep track of the data-blocks. */
if (!node_cache.bake.frames.is_empty()) {
if (!node_cache.bake.frames.is_empty() || node_cache.prev_cache.has_value()) {
for (const NodesModifierDataBlock &data_block : Span{bake.data_blocks, bake.data_blocks_num})
{
data_block_map.old_mappings.add(data_block, data_block.id);
@@ -1661,7 +1661,7 @@ static void add_data_block_items_writeback(const ModifierEvalContext &ctx,
item.key))
{
/* Only writeback if the bake node has actually baked anything. */
if (!node_cache->bake.frames.is_empty()) {
if (!node_cache->bake.frames.is_empty() || node_cache->prev_cache.has_value()) {
data.new_mappings = std::move(item.value->data_block_map.new_mappings);
}
}