From 3fb5e838677d8db0c193da1a7c70cb5c392a4610 Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Thu, 28 Jan 2021 15:52:54 +0100 Subject: Fix T85139: Force field texture missing depsgraph relation If a force field was of type "Texture", any changes of that texture (e.g. its type - as reported in T85139 - or also its properties) were not properly updating rigid bodies and particle systems. Now ensure that texture is actually in the depsgraph and set up relation accordingly. Also fixes T75198. Maniphest Tasks: T85139 Differential Revision: https://developer.blender.org/D10234 --- .../depsgraph/intern/builder/deg_builder_nodes.cc | 5 +++++ .../depsgraph/intern/builder/deg_builder_relations.cc | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) (limited to 'source/blender/depsgraph') diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index dcdf2f48607..2edd4ddf853 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -650,6 +650,11 @@ void DepsgraphNodeBuilder::build_object(int base_index, if (object->particlesystem.first != nullptr) { build_particle_systems(object, is_visible); } + /* Force field Texture. */ + if ((object->pd != nullptr) && (object->pd->forcefield == PFIELD_TEXTURE) && + (object->pd->tex != nullptr)) { + build_texture(object->pd->tex); + } /* Proxy object to copy from. */ build_object_proxy_from(object, is_visible); build_object_proxy_group(object, is_visible); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index fcaa3854d37..ed78956e548 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -434,6 +434,13 @@ void DepsgraphRelationBuilder::add_particle_forcefield_relations(const Operation add_relation(mod_key, key, name); } + /* Force field Texture. */ + if ((relation->pd != nullptr) && (relation->pd->forcefield == PFIELD_TEXTURE) && + (relation->pd->tex != nullptr)) { + ComponentKey tex_key(&relation->pd->tex->id, NodeType::GENERIC_DATABLOCK); + add_relation(tex_key, key, "Force field Texture"); + } + /* Smoke flow relations. */ if (relation->pd->forcefield == PFIELD_FLUIDFLOW && relation->pd->f_source) { ComponentKey trf_key(&relation->pd->f_source->id, NodeType::TRANSFORM); @@ -712,6 +719,11 @@ void DepsgraphRelationBuilder::build_object(Object *object) if (object->particlesystem.first != nullptr) { build_particle_systems(object); } + /* Force field Texture. */ + if ((object->pd != nullptr) && (object->pd->forcefield == PFIELD_TEXTURE) && + (object->pd->tex != nullptr)) { + build_texture(object->pd->tex); + } /* Proxy object to copy from. */ build_object_proxy_from(object); build_object_proxy_group(object); @@ -1725,6 +1737,11 @@ void DepsgraphRelationBuilder::build_rigidbody(Scene *scene) ComponentKey effector_geometry_key(&effector_relation->ob->id, NodeType::GEOMETRY); add_relation(effector_geometry_key, rb_init_key, "RigidBody Field"); } + if ((effector_relation->pd->forcefield == PFIELD_TEXTURE) && + (effector_relation->pd->tex != nullptr)) { + ComponentKey tex_key(&effector_relation->pd->tex->id, NodeType::GENERIC_DATABLOCK); + add_relation(tex_key, rb_init_key, "Force field Texture"); + } } } /* Objects. */ -- cgit v1.2.3