Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/depsgraph/intern/builder/deg_builder_relations.cc')
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations.cc117
1 files changed, 64 insertions, 53 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index 14f9db767a9..a55966632d8 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -89,7 +89,6 @@
#include "BKE_particle.h"
#include "BKE_pointcache.h"
#include "BKE_rigidbody.h"
-#include "BKE_sequencer.h"
#include "BKE_shader_fx.h"
#include "BKE_shrinkwrap.h"
#include "BKE_sound.h"
@@ -99,6 +98,8 @@
#include "RNA_access.h"
#include "RNA_types.h"
+#include "SEQ_sequencer.h"
+
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h"
@@ -119,8 +120,7 @@
#include "intern/depsgraph_relation.h"
#include "intern/depsgraph_type.h"
-namespace blender {
-namespace deg {
+namespace blender::deg {
/* ***************** */
/* Relations Builder */
@@ -591,13 +591,13 @@ void DepsgraphRelationBuilder::build_collection(LayerCollection *from_layer_coll
* recurses into all the nested objects and collections. */
return;
}
- build_idproperties(collection->id.properties);
const bool group_done = built_map_.checkIsBuiltAndTag(collection);
OperationKey object_transform_final_key(object != nullptr ? &object->id : nullptr,
NodeType::TRANSFORM,
OperationCode::TRANSFORM_FINAL);
ComponentKey duplicator_key(object != nullptr ? &object->id : nullptr, NodeType::DUPLI);
if (!group_done) {
+ build_idproperties(collection->id.properties);
LISTBASE_FOREACH (CollectionObject *, cob, &collection->gobject) {
build_object(cob->ob);
}
@@ -742,7 +742,7 @@ void DepsgraphRelationBuilder::build_object_proxy_from(Object *object)
void DepsgraphRelationBuilder::build_object_proxy_group(Object *object)
{
- if (object->proxy_group == nullptr || object->proxy_group == object->proxy) {
+ if (ELEM(object->proxy_group, nullptr, object->proxy)) {
return;
}
/* Object is local here (local in .blend file, users interacts with it). */
@@ -1233,7 +1233,7 @@ void DepsgraphRelationBuilder::build_constraints(ID *id,
}
}
if (cti->flush_constraint_targets) {
- cti->flush_constraint_targets(con, &targets, 1);
+ cti->flush_constraint_targets(con, &targets, true);
}
}
}
@@ -1252,6 +1252,7 @@ void DepsgraphRelationBuilder::build_animdata(ID *id)
ComponentKey animation_key(id, NodeType::ANIMATION);
ComponentKey parameters_key(id, NodeType::PARAMETERS);
add_relation(animation_key, parameters_key, "Animation -> Parameters");
+ build_animdata_force(id);
}
}
@@ -1396,6 +1397,24 @@ void DepsgraphRelationBuilder::build_animation_images(ID *id)
}
}
+void DepsgraphRelationBuilder::build_animdata_force(ID *id)
+{
+ if (GS(id->name) != ID_OB) {
+ return;
+ }
+
+ const Object *object = (Object *)id;
+ if (object->pd == nullptr || object->pd->forcefield == PFIELD_NULL) {
+ return;
+ }
+
+ /* Updates to animation data (in the UI, for example by altering FCurve Modifier parameters
+ * animating force field strength) may need to rebuild the rigid body world. */
+ ComponentKey animation_key(id, NodeType::ANIMATION);
+ OperationKey rigidbody_key(&scene_->id, NodeType::TRANSFORM, OperationCode::RIGIDBODY_REBUILD);
+ add_relation(animation_key, rigidbody_key, "Animation -> Rigid Body");
+}
+
void DepsgraphRelationBuilder::build_action(bAction *action)
{
if (built_map_.checkIsBuiltAndTag(action)) {
@@ -1465,31 +1484,40 @@ void DepsgraphRelationBuilder::build_driver_data(ID *id, FCurve *fcu)
/* Drivers on armature-level bone settings (i.e. bbone stuff),
* which will affect the evaluation of corresponding pose bones. */
Bone *bone = (Bone *)property_entry_key.ptr.data;
- if (bone != nullptr) {
- /* Find objects which use this, and make their eval callbacks
- * depend on this. */
- for (IDNode *to_node : graph_->id_nodes) {
- if (GS(to_node->id_orig->name) == ID_OB) {
- Object *object = (Object *)to_node->id_orig;
- /* We only care about objects with pose data which use this. */
- if (object->data == id_ptr && object->pose != nullptr) {
- bPoseChannel *pchan = BKE_pose_channel_find_name(object->pose, bone->name);
- if (pchan != nullptr) {
- OperationKey bone_key(
- &object->id, NodeType::BONE, pchan->name, OperationCode::BONE_LOCAL);
- add_relation(driver_key, bone_key, "Arm Bone -> Driver -> Bone");
- }
- }
- }
+ if (bone == nullptr) {
+ fprintf(stderr, "Couldn't find armature bone name for driver path - '%s'\n", rna_path);
+ return;
+ }
+
+ const char *prop_identifier = RNA_property_identifier(property_entry_key.prop);
+ const bool driver_targets_bbone = STRPREFIX(prop_identifier, "bbone_");
+
+ /* Find objects which use this, and make their eval callbacks depend on this. */
+ for (IDNode *to_node : graph_->id_nodes) {
+ if (GS(to_node->id_orig->name) != ID_OB) {
+ continue;
}
- /* Make the driver depend on COW, similar to the generic case below. */
- if (id_ptr != id) {
- ComponentKey cow_key(id_ptr, NodeType::COPY_ON_WRITE);
- add_relation(cow_key, driver_key, "Driven CoW -> Driver", RELATION_CHECK_BEFORE_ADD);
+
+ /* We only care about objects with pose data which use this. */
+ Object *object = (Object *)to_node->id_orig;
+ if (object->data != id_ptr || object->pose == nullptr) {
+ continue;
+ }
+
+ bPoseChannel *pchan = BKE_pose_channel_find_name(object->pose, bone->name);
+ if (pchan == nullptr) {
+ continue;
}
+
+ OperationCode target_op = driver_targets_bbone ? OperationCode::BONE_SEGMENTS :
+ OperationCode::BONE_LOCAL;
+ OperationKey bone_key(&object->id, NodeType::BONE, pchan->name, target_op);
+ add_relation(driver_key, bone_key, "Arm Bone -> Driver -> Bone");
}
- else {
- fprintf(stderr, "Couldn't find armature bone name for driver path - '%s'\n", rna_path);
+ /* Make the driver depend on COW, similar to the generic case below. */
+ if (id_ptr != id) {
+ ComponentKey cow_key(id_ptr, NodeType::COPY_ON_WRITE);
+ add_relation(cow_key, driver_key, "Driven CoW -> Driver", RELATION_CHECK_BEFORE_ADD);
}
}
else {
@@ -1825,7 +1853,7 @@ void DepsgraphRelationBuilder::build_particle_systems(Object *object)
/* Keyed particle targets. */
if (ELEM(part->phystype, PART_PHYS_KEYED, PART_PHYS_BOIDS)) {
LISTBASE_FOREACH (ParticleTarget *, particle_target, &psys->targets) {
- if (particle_target->ob == nullptr || particle_target->ob == object) {
+ if (ELEM(particle_target->ob, nullptr, object)) {
continue;
}
/* Make sure target object is pulled into the graph. */
@@ -2175,7 +2203,7 @@ void DepsgraphRelationBuilder::build_object_data_geometry_datablock(ID *obdata)
/* Layer parenting need react to the parent object transformation. */
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
- if (gpl->parent != NULL) {
+ if (gpl->parent != nullptr) {
ComponentKey gpd_geom_key(&gpd->id, NodeType::GEOMETRY);
if (gpl->partype == PARBONE) {
@@ -2632,24 +2660,6 @@ void DepsgraphRelationBuilder::build_simulation(Simulation *simulation)
OperationKey nodetree_key(
&simulation->nodetree->id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EXIT);
add_relation(nodetree_key, simulation_eval_key, "NodeTree -> Simulation", 0);
-
- LISTBASE_FOREACH (SimulationDependency *, dependency, &simulation->dependencies) {
- if (dependency->id == nullptr) {
- continue;
- }
- build_id(dependency->id);
- if (GS(dependency->id->name) == ID_OB) {
- Object *object = (Object *)dependency->id;
- if (dependency->flag & SIM_DEPENDS_ON_TRANSFORM) {
- ComponentKey object_transform_key(&object->id, NodeType::TRANSFORM);
- add_relation(object_transform_key, simulation_eval_key, "Object Transform -> Simulation");
- }
- if (dependency->flag & SIM_DEPENDS_ON_GEOMETRY) {
- ComponentKey object_geometry_key(&object->id, NodeType::GEOMETRY);
- add_relation(object_geometry_key, simulation_eval_key, "Object Geometry -> Simulation");
- }
- }
- }
}
void DepsgraphRelationBuilder::build_scene_sequencer(Scene *scene)
@@ -2657,6 +2667,9 @@ void DepsgraphRelationBuilder::build_scene_sequencer(Scene *scene)
if (scene->ed == nullptr) {
return;
}
+ if (built_map_.checkIsBuiltAndTag(scene, BuilderMap::TAG_SCENE_SEQUENCER)) {
+ return;
+ }
build_scene_audio(scene);
ComponentKey scene_audio_key(&scene->id, NodeType::AUDIO);
/* Make sure dependencies from sequences data goes to the sequencer evaluation. */
@@ -2800,8 +2813,7 @@ void DepsgraphRelationBuilder::build_copy_on_write_relations(IDNode *id_node)
* to preserve that cache in copy-on-write, but for the time being
* we allow flush to layer collections component which will ensure
* that cached array of bases exists and is up-to-date. */
- if (comp_node->type == NodeType::PARAMETERS ||
- comp_node->type == NodeType::LAYER_COLLECTIONS) {
+ if (ELEM(comp_node->type, NodeType::PARAMETERS, NodeType::LAYER_COLLECTIONS)) {
rel_flag &= ~RELATION_FLAG_NO_FLUSH;
}
/* All entry operations of each component should wait for a proper
@@ -2841,7 +2853,7 @@ void DepsgraphRelationBuilder::build_copy_on_write_relations(IDNode *id_node)
/* NOTE: We currently ignore implicit relations to an external
* data-blocks for copy-on-write operations. This means, for example,
* copy-on-write component of Object will not wait for copy-on-write
- * component of it's Mesh. This is because pointers are all known
+ * component of its Mesh. This is because pointers are all known
* already so remapping will happen all correct. And then If some object
* evaluation step needs geometry, it will have transitive dependency
* to Mesh copy-on-write already. */
@@ -2913,5 +2925,4 @@ void DepsgraphRelationBuilder::constraint_walk(bConstraint * /*con*/,
data->builder->build_id(id);
}
-} // namespace deg
-} // namespace blender
+} // namespace blender::deg