From dfdf79fb03a8eec6e6cd2a098405ae13b00a05ae Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Wed, 30 Dec 2020 14:44:17 +0100 Subject: Fix T84250: Eevee world/material parameter animation not updating the viewport The WORLD_UPDATE operation (needed to free the gpu material) was already defined in DepsgraphNodeBuilder::build_world, but corresponding relation was only set up for changes in the nodetree, not for changes in the world/material itself in DepsgraphRelationBuilder::build_world. Direct changes to these surface properties in the UI were updating properly through RNA property update callbacks, but these are not called from the animation system. So now add these relations in the depsgraph. Not 100% sure this is the right place for this (since e.g. eevee engine seems to handle e.g. animated light paramters just fine through EEVEE_cache_populate / eevee_light_setup, but properly freeing gpu materials wont happen for worlds in e.g eevee_id_world_update and also not for materials) Maniphest Tasks: T84250 Differential Revision: https://developer.blender.org/D9959 --- .../depsgraph/intern/builder/deg_builder_relations.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'source/blender') diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index 0eeef1840b6..a6eb40cc6b8 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -1712,12 +1712,17 @@ void DepsgraphRelationBuilder::build_world(World *world) /* animation */ build_animdata(&world->id); build_parameters(&world->id); + + /* Animated / driven parameters (without nodetree). */ + OperationKey world_key(&world->id, NodeType::SHADING, OperationCode::WORLD_UPDATE); + ComponentKey parameters_key(&world->id, NodeType::PARAMETERS); + add_relation(parameters_key, world_key, "World's parameters"); + /* world's nodetree */ if (world->nodetree != nullptr) { build_nodetree(world->nodetree); OperationKey ntree_key( &world->nodetree->id, NodeType::SHADING, OperationCode::MATERIAL_UPDATE); - OperationKey world_key(&world->id, NodeType::SHADING, OperationCode::WORLD_UPDATE); add_relation(ntree_key, world_key, "World's NTree"); build_nested_nodetree(&world->id, world->nodetree); } @@ -2470,12 +2475,17 @@ void DepsgraphRelationBuilder::build_material(Material *material) /* animation */ build_animdata(&material->id); build_parameters(&material->id); + + /* Animated / driven parameters (without nodetree). */ + OperationKey material_key(&material->id, NodeType::SHADING, OperationCode::MATERIAL_UPDATE); + ComponentKey parameters_key(&material->id, NodeType::PARAMETERS); + add_relation(parameters_key, material_key, "Material's paramters"); + /* material's nodetree */ if (material->nodetree != nullptr) { build_nodetree(material->nodetree); OperationKey ntree_key( &material->nodetree->id, NodeType::SHADING, OperationCode::MATERIAL_UPDATE); - OperationKey material_key(&material->id, NodeType::SHADING, OperationCode::MATERIAL_UPDATE); add_relation(ntree_key, material_key, "Material's NTree"); build_nested_nodetree(&material->id, material->nodetree); } -- cgit v1.2.3