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')
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_nodes.cc46
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_nodes_layer_collection.cc2
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc8
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc8
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations.cc197
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations.h16
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations_layer_collection.cc2
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc45
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc6
-rw-r--r--source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc6
-rw-r--r--source/blender/depsgraph/intern/depsgraph.cc6
-rw-r--r--source/blender/depsgraph/intern/depsgraph_build.cc8
-rw-r--r--source/blender/depsgraph/intern/depsgraph_eval.cc15
-rw-r--r--source/blender/depsgraph/intern/depsgraph_query_iter.cc19
-rw-r--r--source/blender/depsgraph/intern/depsgraph_tag.cc72
-rw-r--r--source/blender/depsgraph/intern/depsgraph_type_defines.cc2
-rw-r--r--source/blender/depsgraph/intern/depsgraph_types.h3
-rw-r--r--source/blender/depsgraph/intern/eval/deg_eval.cc2
-rw-r--r--source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc34
-rw-r--r--source/blender/depsgraph/intern/eval/deg_eval_flush.cc4
-rw-r--r--source/blender/depsgraph/intern/nodes/deg_node_component.cc6
21 files changed, 345 insertions, 162 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index ddae761cea0..b65c16591dc 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@ -90,6 +90,7 @@ extern "C" {
#include "BKE_node.h"
#include "BKE_object.h"
#include "BKE_particle.h"
+#include "BKE_pointcache.h"
#include "BKE_rigidbody.h"
#include "BKE_sound.h"
#include "BKE_tracking.h"
@@ -196,7 +197,7 @@ IDDepsNode *DepsgraphNodeBuilder::add_id_node(ID *id, bool do_tag)
*
* NOTE: Zero number of components indicates that ID node was just created.
*/
- if (BLI_ghash_size(id_node->components) == 0) {
+ if (BLI_ghash_len(id_node->components) == 0) {
ComponentDepsNode *comp_cow =
id_node->add_component(DEG_NODE_TYPE_COPY_ON_WRITE);
OperationDepsNode *op_cow = comp_cow->add_operation(
@@ -429,7 +430,7 @@ void DepsgraphNodeBuilder::build_group(Group *group)
}
group_id->tag |= LIB_TAG_DOIT;
/* Build group objects. */
- BLI_LISTBASE_FOREACH (Base *, base, &group->view_layer->object_bases) {
+ LISTBASE_FOREACH (Base *, base, &group->view_layer->object_bases) {
build_object(NULL, base->object, DEG_ID_LINKED_INDIRECTLY);
}
/* Operation to evaluate the whole view layer.
@@ -699,7 +700,7 @@ void DepsgraphNodeBuilder::build_animdata(ID *id)
}
/* drivers */
- BLI_LISTBASE_FOREACH (FCurve *, fcu, &adt->drivers) {
+ LISTBASE_FOREACH (FCurve *, fcu, &adt->drivers) {
/* create driver */
build_driver(id, fcu);
}
@@ -817,7 +818,7 @@ void DepsgraphNodeBuilder::build_rigidbody(Scene *scene)
/* objects - simulation participants */
if (rbw->group) {
- BLI_LISTBASE_FOREACH (Base *, base, &rbw->group->view_layer->object_bases) {
+ LISTBASE_FOREACH (Base *, base, &rbw->group->view_layer->object_bases) {
Object *object = base->object;
if (!object || (object->type != OB_MESH))
@@ -853,8 +854,7 @@ void DepsgraphNodeBuilder::build_particles(Object *object)
* blackbox evaluation step for one particle system referenced by
* the particle systems stack. All dependencies link to this operation.
*/
-
- /* component for all particle systems */
+ /* Component for all particle systems. */
ComponentDepsNode *psys_comp =
add_component_node(&object->id, DEG_NODE_TYPE_EVAL_PARTICLES);
@@ -868,17 +868,14 @@ void DepsgraphNodeBuilder::build_particles(Object *object)
scene_cow,
ob_cow),
DEG_OPCODE_PARTICLE_SYSTEM_EVAL_INIT);
-
- /* particle systems */
- BLI_LISTBASE_FOREACH (ParticleSystem *, psys, &object->particlesystem) {
+ /* Build all particle systems. */
+ LISTBASE_FOREACH (ParticleSystem *, psys, &object->particlesystem) {
ParticleSettings *part = psys->part;
-
/* Build particle settings operations.
*
* NOTE: The call itself ensures settings are only build once.
*/
build_particle_settings(part);
-
/* Update on particle settings change. */
add_operation_node(psys_comp,
function_bind(BKE_particle_system_settings_eval,
@@ -886,15 +883,36 @@ void DepsgraphNodeBuilder::build_particles(Object *object)
psys),
DEG_OPCODE_PARTICLE_SETTINGS_EVAL,
psys->name);
-
/* Particle system evaluation. */
add_operation_node(psys_comp,
NULL,
DEG_OPCODE_PARTICLE_SYSTEM_EVAL,
psys->name);
+ /* Visualization of particle system. */
+ switch (part->ren_as) {
+ case PART_DRAW_OB:
+ if (part->dup_ob != NULL) {
+ build_object(NULL,
+ part->dup_ob,
+ DEG_ID_LINKED_INDIRECTLY);
+ }
+ break;
+ case PART_DRAW_GR:
+ if (part->dup_group != NULL) {
+ build_group(part->dup_group);
+ }
+ break;
+ }
}
/* TODO(sergey): Do we need a point cache operations here? */
+ add_operation_node(&object->id,
+ DEG_NODE_TYPE_CACHE,
+ function_bind(BKE_ptcache_object_reset,
+ scene_cow,
+ ob_cow,
+ PTCACHE_RESET_DEPSGRAPH),
+ DEG_OPCODE_POINT_CACHE_RESET);
}
void DepsgraphNodeBuilder::build_particle_settings(ParticleSettings *part) {
@@ -986,7 +1004,7 @@ void DepsgraphNodeBuilder::build_obdata_geom(Object *object)
// TODO: "Done" operation
/* Cloth modifier. */
- BLI_LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) {
+ LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) {
if (md->type == eModifierType_Cloth) {
build_cloth(object);
}
@@ -1231,7 +1249,7 @@ void DepsgraphNodeBuilder::build_nodetree(bNodeTree *ntree)
ntree),
DEG_OPCODE_MATERIAL_UPDATE);
/* nodetree's nodes... */
- BLI_LISTBASE_FOREACH (bNode *, bnode, &ntree->nodes) {
+ LISTBASE_FOREACH (bNode *, bnode, &ntree->nodes) {
ID *id = bnode->id;
if (id == NULL) {
continue;
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_layer_collection.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_layer_collection.cc
index 137a79e7276..2ee526b7128 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_layer_collection.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_layer_collection.cc
@@ -94,7 +94,7 @@ void DepsgraphNodeBuilder::build_layer_collections(ID *owner_id,
ListBase *layer_collections,
LayerCollectionState *state)
{
- BLI_LISTBASE_FOREACH (LayerCollection *, layer_collection, layer_collections) {
+ LISTBASE_FOREACH (LayerCollection *, layer_collection, layer_collections) {
build_layer_collection(owner_id, layer_collection, state);
}
}
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc
index 2fc42efa440..c3116db6146 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc
@@ -247,7 +247,7 @@ void DepsgraphNodeBuilder::build_rig(Object *object)
op_node->set_as_exit();
/* bones */
- BLI_LISTBASE_FOREACH (bPoseChannel *, pchan, &object_cow->pose->chanbase) {
+ LISTBASE_FOREACH (bPoseChannel *, pchan, &object_cow->pose->chanbase) {
/* Node for bone evaluation. */
op_node = add_operation_node(&object->id, DEG_NODE_TYPE_BONE, pchan->name, NULL,
DEG_OPCODE_BONE_LOCAL);
@@ -293,7 +293,7 @@ void DepsgraphNodeBuilder::build_rig(Object *object)
* as in ik-tree building
* - Animated chain-lengths are a problem.
*/
- BLI_LISTBASE_FOREACH (bConstraint *, con, &pchan->constraints) {
+ LISTBASE_FOREACH (bConstraint *, con, &pchan->constraints) {
switch (con->type) {
case CONSTRAINT_TYPE_KINEMATIC:
build_ik_pose(object, pchan, con);
@@ -347,8 +347,8 @@ void DepsgraphNodeBuilder::build_proxy_rig(Object *object)
object_cow),
DEG_OPCODE_POSE_INIT);
op_node->set_as_entry();
- BLI_LISTBASE_FOREACH (bPoseChannel *, pchan, &object_cow->pose->chanbase) {
- /* Local bone transform. */
+
+ LISTBASE_FOREACH (bPoseChannel *, pchan, &object->pose->chanbase) {
op_node = add_operation_node(&object->id,
DEG_NODE_TYPE_BONE,
pchan->name,
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc
index 4ca19f4e14f..7a0fc790780 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc
@@ -84,7 +84,7 @@ void DepsgraphNodeBuilder::build_view_layer(
* otherwise remapping will not replace objects with their CoW versions
* for CoW bases.
*/
- BLI_LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) {
+ LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) {
Object *object = base->object;
add_id_node(&object->id, false);
}
@@ -145,15 +145,15 @@ void DepsgraphNodeBuilder::build_view_layer(
build_gpencil(scene->gpd);
}
/* Cache file. */
- BLI_LISTBASE_FOREACH (CacheFile *, cachefile, &bmain_->cachefiles) {
+ LISTBASE_FOREACH (CacheFile *, cachefile, &bmain_->cachefiles) {
build_cachefile(cachefile);
}
/* Masks. */
- BLI_LISTBASE_FOREACH (Mask *, mask, &bmain_->mask) {
+ LISTBASE_FOREACH (Mask *, mask, &bmain_->mask) {
build_mask(mask);
}
/* Movie clips. */
- BLI_LISTBASE_FOREACH (MovieClip *, clip, &bmain_->movieclip) {
+ LISTBASE_FOREACH (MovieClip *, clip, &bmain_->movieclip) {
build_movieclip(clip);
}
/* Collections. */
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index cfb73ecc2ad..cff6c926278 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -67,7 +67,7 @@ extern "C" {
#include "DNA_scene_types.h"
#include "DNA_texture_types.h"
#include "DNA_world_types.h"
-#include "DNA_object_force.h"
+#include "DNA_object_force_types.h"
#include "BKE_action.h"
#include "BKE_armature.h"
@@ -194,7 +194,7 @@ static bool particle_system_depends_on_time(ParticleSystem *psys)
static bool object_particles_depends_on_time(Object *object)
{
- BLI_LISTBASE_FOREACH (ParticleSystem *, psys, &object->particlesystem) {
+ LISTBASE_FOREACH (ParticleSystem *, psys, &object->particlesystem) {
if (particle_system_depends_on_time(psys)) {
return true;
}
@@ -347,7 +347,7 @@ void DepsgraphRelationBuilder::add_forcefield_relations(
{
ListBase *effectors = pdInitEffectors(NULL, scene, object, psys, eff, false);
if (effectors != NULL) {
- BLI_LISTBASE_FOREACH (EffectorCache *, eff, effectors) {
+ LISTBASE_FOREACH (EffectorCache *, eff, effectors) {
if (eff->ob != object) {
ComponentKey eff_key(&eff->ob->id, DEG_NODE_TYPE_TRANSFORM);
add_relation(eff_key, key, name);
@@ -423,20 +423,20 @@ void DepsgraphRelationBuilder::build_group(Object *object, Group *group)
{
ID *group_id = &group->id;
bool group_done = (group_id->tag & LIB_TAG_DOIT) != 0;
- OperationKey object_local_transform_key(&object->id,
+ OperationKey object_local_transform_key(object != NULL ? &object->id : NULL,
DEG_NODE_TYPE_TRANSFORM,
DEG_OPCODE_TRANSFORM_LOCAL);
-
if (!group_done) {
- BLI_LISTBASE_FOREACH (Base *, base, &group->view_layer->object_bases) {
+ LISTBASE_FOREACH (Base *, base, &group->view_layer->object_bases) {
build_object(NULL, base->object);
}
group_id->tag |= LIB_TAG_DOIT;
}
-
- BLI_LISTBASE_FOREACH (Base *, base, &group->view_layer->object_bases) {
- ComponentKey dupli_transform_key(&base->object->id, DEG_NODE_TYPE_TRANSFORM);
- add_relation(dupli_transform_key, object_local_transform_key, "Dupligroup");
+ if (object != NULL) {
+ LISTBASE_FOREACH (Base *, base, &group->view_layer->object_bases) {
+ ComponentKey dupli_transform_key(&base->object->id, DEG_NODE_TYPE_TRANSFORM);
+ add_relation(dupli_transform_key, object_local_transform_key, "Dupligroup");
+ }
}
}
@@ -776,7 +776,7 @@ void DepsgraphRelationBuilder::build_constraints(ID *id,
else if (cti->get_constraint_targets) {
ListBase targets = {NULL, NULL};
cti->get_constraint_targets(con, &targets);
- BLI_LISTBASE_FOREACH (bConstraintTarget *, ct, &targets) {
+ LISTBASE_FOREACH (bConstraintTarget *, ct, &targets) {
if (ct->tar == NULL) {
continue;
}
@@ -939,18 +939,7 @@ void DepsgraphRelationBuilder::build_animdata_curves(ID *id)
ComponentKey adt_key(id, DEG_NODE_TYPE_ANIMATION);
TimeSourceKey time_src_key;
add_relation(time_src_key, adt_key, "TimeSrc -> Animation");
- /* Build relations from animation operation to properties it changes. */
- build_animdata_curves_targets(id);
-}
-
-void DepsgraphRelationBuilder::build_animdata_curves_targets(ID *id)
-{
- AnimData *adt = BKE_animdata_from_id(id);
- if (adt == NULL || adt->action == NULL) {
- return;
- }
- /* Get source operation. */
- ComponentKey adt_key(id, DEG_NODE_TYPE_ANIMATION);
+ /* Get source operations. */
DepsNode *node_from = get_node(adt_key);
BLI_assert(node_from != NULL);
if (node_from == NULL) {
@@ -958,10 +947,28 @@ void DepsgraphRelationBuilder::build_animdata_curves_targets(ID *id)
}
OperationDepsNode *operation_from = node_from->get_exit_operation();
BLI_assert(operation_from != NULL);
+ /* Build relations from animation operation to properties it changes. */
+ if (adt->action != NULL) {
+ build_animdata_curves_targets(id, adt_key,
+ operation_from,
+ &adt->action->curves);
+ }
+ LISTBASE_FOREACH(NlaTrack *, nlt, &adt->nla_tracks) {
+ build_animdata_nlastrip_targets(id, adt_key,
+ operation_from,
+ &nlt->strips);
+ }
+}
+
+void DepsgraphRelationBuilder::build_animdata_curves_targets(
+ ID *id, ComponentKey &adt_key,
+ OperationDepsNode *operation_from,
+ ListBase *curves)
+{
/* Iterate over all curves and build relations. */
PointerRNA id_ptr;
RNA_id_pointer_create(id, &id_ptr);
- BLI_LISTBASE_FOREACH (FCurve *, fcu, &adt->action->curves) {
+ LISTBASE_FOREACH(FCurve *, fcu, curves) {
PointerRNA ptr;
PropertyRNA *prop;
int index;
@@ -1004,6 +1011,25 @@ void DepsgraphRelationBuilder::build_animdata_curves_targets(ID *id)
}
}
+void DepsgraphRelationBuilder::build_animdata_nlastrip_targets(
+ ID *id, ComponentKey &adt_key,
+ OperationDepsNode *operation_from,
+ ListBase *strips)
+{
+ LISTBASE_FOREACH(NlaStrip *, strip, strips) {
+ if (strip->act != NULL) {
+ build_animdata_curves_targets(id, adt_key,
+ operation_from,
+ &strip->act->curves);
+ }
+ else if (strip->strips.first != NULL) {
+ build_animdata_nlastrip_targets(id, adt_key,
+ operation_from,
+ &strip->strips);
+ }
+ }
+}
+
void DepsgraphRelationBuilder::build_animdata_drivers(ID *id)
{
AnimData *adt = BKE_animdata_from_id(id);
@@ -1011,7 +1037,7 @@ void DepsgraphRelationBuilder::build_animdata_drivers(ID *id)
return;
}
ComponentKey adt_key(id, DEG_NODE_TYPE_ANIMATION);
- BLI_LISTBASE_FOREACH (FCurve *, fcu, &adt->drivers) {
+ LISTBASE_FOREACH (FCurve *, fcu, &adt->drivers) {
OperationKey driver_key(id,
DEG_NODE_TYPE_PARAMETERS,
DEG_OPCODE_DRIVER,
@@ -1034,7 +1060,7 @@ void DepsgraphRelationBuilder::build_animdata_drivers(ID *id)
*/
if (fcu->array_index > 0) {
FCurve *fcu_prev = NULL;
- BLI_LISTBASE_FOREACH (FCurve *, fcu_candidate, &adt->drivers) {
+ LISTBASE_FOREACH (FCurve *, fcu_candidate, &adt->drivers) {
/* Writing to different RNA paths is */
const char *rna_path = fcu->rna_path ? fcu->rna_path : "";
if (!STREQ(fcu_candidate->rna_path, rna_path)) {
@@ -1183,7 +1209,7 @@ void DepsgraphRelationBuilder::build_driver_variables(ID *id, FCurve *fcu)
const char *rna_path = fcu->rna_path ? fcu->rna_path : "";
const RNAPathKey self_key(id, rna_path);
- BLI_LISTBASE_FOREACH (DriverVar *, dvar, &driver->variables) {
+ LISTBASE_FOREACH (DriverVar *, dvar, &driver->variables) {
/* Only used targets. */
DRIVER_TARGETS_USED_LOOPER(dvar)
{
@@ -1298,7 +1324,7 @@ void DepsgraphRelationBuilder::build_rigidbody(Scene *scene)
/* objects - simulation participants */
if (rbw->group) {
- BLI_LISTBASE_FOREACH (Base *, base, &rbw->group->view_layer->object_bases) {
+ LISTBASE_FOREACH (Base *, base, &rbw->group->view_layer->object_bases) {
Object *object = base->object;
if (object == NULL || object->type != OB_MESH) {
continue;
@@ -1352,7 +1378,7 @@ void DepsgraphRelationBuilder::build_rigidbody(Scene *scene)
/* constraints */
if (rbw->constraints) {
- BLI_LISTBASE_FOREACH (Base *, base, &rbw->constraints->view_layer->object_bases) {
+ LISTBASE_FOREACH (Base *, base, &rbw->constraints->view_layer->object_bases) {
Object *object = base->object;
if (object == NULL || !object->rigidbody_constraint) {
continue;
@@ -1387,8 +1413,8 @@ void DepsgraphRelationBuilder::build_particles(Object *object)
DEG_NODE_TYPE_EVAL_PARTICLES,
DEG_OPCODE_PARTICLE_SYSTEM_EVAL_INIT);
- /* particle systems */
- BLI_LISTBASE_FOREACH (ParticleSystem *, psys, &object->particlesystem) {
+ /* Particle systems. */
+ LISTBASE_FOREACH (ParticleSystem *, psys, &object->particlesystem) {
ParticleSettings *part = psys->part;
/* Build particle settings relations.
@@ -1420,20 +1446,13 @@ void DepsgraphRelationBuilder::build_particles(Object *object)
add_relation(psys_key,
particle_settings_recalc_clear_key,
"Particle Settings Recalc Clear");
-
- /* XXX: if particle system is later re-enabled, we must do full rebuild? */
- if (!psys_check_enabled(object, psys, G.is_rendering))
- continue;
-
add_relation(eval_init_key, psys_key, "Init -> PSys");
-
/* TODO(sergey): Currently particle update is just a placeholder,
* hook it to the ubereval node so particle system is getting updated
* on playback.
*/
add_relation(psys_key, obdata_ubereval_key, "PSys -> UberEval");
-
- /* collisions */
+ /* Collisions */
if (part->type != PART_HAIR) {
add_collision_relations(psys_key,
scene_,
@@ -1453,8 +1472,7 @@ void DepsgraphRelationBuilder::build_particles(Object *object)
true,
"Hair Collision");
}
-
- /* effectors */
+ /* Effectors. */
add_forcefield_relations(psys_key,
scene_,
object,
@@ -1462,35 +1480,46 @@ void DepsgraphRelationBuilder::build_particles(Object *object)
part->effector_weights,
part->type == PART_HAIR,
"Particle Field");
-
- /* boids */
+ /* Boids .*/
if (part->boids) {
- BLI_LISTBASE_FOREACH (BoidState *, state, &part->boids->states) {
- BLI_LISTBASE_FOREACH (BoidRule *, rule, &state->rules) {
+ LISTBASE_FOREACH (BoidState *, state, &part->boids->states) {
+ LISTBASE_FOREACH (BoidRule *, rule, &state->rules) {
Object *ruleob = NULL;
- if (rule->type == eBoidRuleType_Avoid)
+ if (rule->type == eBoidRuleType_Avoid) {
ruleob = ((BoidRuleGoalAvoid *)rule)->ob;
- else if (rule->type == eBoidRuleType_FollowLeader)
+ }
+ else if (rule->type == eBoidRuleType_FollowLeader) {
ruleob = ((BoidRuleFollowLeader *)rule)->ob;
-
+ }
if (ruleob) {
- ComponentKey ruleob_key(&ruleob->id, DEG_NODE_TYPE_TRANSFORM);
+ ComponentKey ruleob_key(&ruleob->id,
+ DEG_NODE_TYPE_TRANSFORM);
add_relation(ruleob_key, psys_key, "Boid Rule");
}
}
}
}
-
- if (part->ren_as == PART_DRAW_OB && part->dup_ob) {
- ComponentKey dup_ob_key(&part->dup_ob->id, DEG_NODE_TYPE_TRANSFORM);
- add_relation(dup_ob_key, psys_key, "Particle Object Visualization");
- if (part->dup_ob->type == OB_MBALL) {
- ComponentKey dup_geometry_key(&part->dup_ob->id,
- DEG_NODE_TYPE_GEOMETRY);
- add_relation(obdata_ubereval_key,
- dup_geometry_key,
- "Particle MBall Visualization");
- }
+ switch (part->ren_as) {
+ case PART_DRAW_OB:
+ if (part->dup_ob != NULL) {
+ /* Make sure object's relations are all built. */
+ build_object(NULL, part->dup_ob);
+ /* Build relation for the particle visualization. */
+ build_particles_visualization_object(object,
+ psys,
+ part->dup_ob);
+ }
+ break;
+ case PART_DRAW_GR:
+ if (part->dup_group != NULL) {
+ build_group(NULL, part->dup_group);
+ LISTBASE_FOREACH (GroupObject *, go, &part->dup_group->gobject) {
+ build_particles_visualization_object(object,
+ psys,
+ go->ob);
+ }
+ }
+ break;
}
}
@@ -1503,7 +1532,11 @@ void DepsgraphRelationBuilder::build_particles(Object *object)
ComponentKey transform_key(&object->id, DEG_NODE_TYPE_TRANSFORM);
add_relation(transform_key, obdata_ubereval_key, "Partcile Eval");
- /* TODO(sergey): Do we need a point cache operations here? */
+ OperationKey point_cache_reset_key(&object->id,
+ DEG_NODE_TYPE_CACHE,
+ DEG_OPCODE_POINT_CACHE_RESET);
+ add_relation(transform_key, point_cache_reset_key, "Object Transform -> Point Cache Reset");
+ add_relation(point_cache_reset_key, obdata_ubereval_key, "Point Cache Reset -> UberEval");
}
void DepsgraphRelationBuilder::build_particle_settings(ParticleSettings *part)
@@ -1526,6 +1559,28 @@ void DepsgraphRelationBuilder::build_particle_settings(ParticleSettings *part)
add_relation(eval_key, recalc_clear_key, "Particle Settings Clear Recalc");
}
+void DepsgraphRelationBuilder::build_particles_visualization_object(
+ Object *object,
+ ParticleSystem *psys,
+ Object *draw_object)
+{
+ OperationKey psys_key(&object->id,
+ DEG_NODE_TYPE_EVAL_PARTICLES,
+ DEG_OPCODE_PARTICLE_SYSTEM_EVAL,
+ psys->name);
+ OperationKey obdata_ubereval_key(&object->id,
+ DEG_NODE_TYPE_GEOMETRY,
+ DEG_OPCODE_GEOMETRY_UBEREVAL);
+ ComponentKey dup_ob_key(&draw_object->id, DEG_NODE_TYPE_TRANSFORM);
+ add_relation(dup_ob_key, psys_key, "Particle Object Visualization");
+ if (draw_object->type == OB_MBALL) {
+ ComponentKey dup_geometry_key(&draw_object->id, DEG_NODE_TYPE_GEOMETRY);
+ add_relation(obdata_ubereval_key,
+ dup_geometry_key,
+ "Particle MBall Visualization");
+ }
+}
+
void DepsgraphRelationBuilder::build_cloth(Object *object,
ModifierData * /*md*/)
{
@@ -1613,7 +1668,7 @@ void DepsgraphRelationBuilder::build_obdata_geom(Object *object)
/* Modifiers */
if (object->modifiers.first != NULL) {
- BLI_LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) {
+ LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) {
const ModifierTypeInfo *mti = modifierType_getInfo((ModifierType)md->type);
if (mti->updateDepsgraph) {
DepsNodeHandle handle = create_node_handle(obdata_ubereval_key);
@@ -1834,7 +1889,7 @@ void DepsgraphRelationBuilder::build_nodetree(bNodeTree *ntree)
build_animdata(ntree_id);
ComponentKey shading_key(ntree_id, DEG_NODE_TYPE_SHADING);
/* nodetree's nodes... */
- BLI_LISTBASE_FOREACH (bNode *, bnode, &ntree->nodes) {
+ LISTBASE_FOREACH (bNode *, bnode, &ntree->nodes) {
ID *id = bnode->id;
if (id == NULL) {
continue;
@@ -2050,6 +2105,22 @@ void DepsgraphRelationBuilder::build_copy_on_write_relations(IDDepsNode *id_node
if (op_node->inlinks.size() == 0) {
graph_->add_new_relation(op_cow, op_node, "CoW Dependency");
}
+ else {
+ bool has_same_id_dependency = false;
+ foreach (DepsRelation *rel, op_node->inlinks) {
+ if (rel->from->type != DEG_NODE_TYPE_OPERATION) {
+ continue;
+ }
+ OperationDepsNode *op_node_from = (OperationDepsNode *)rel->from;
+ if (op_node_from->owner->owner == op_node->owner->owner) {
+ has_same_id_dependency = true;
+ break;
+ }
+ }
+ if (!has_same_id_dependency) {
+ graph_->add_new_relation(op_cow, op_node, "CoW Dependency");
+ }
+ }
}
GHASH_FOREACH_END();
/* NOTE: We currently ignore implicit relations to an external
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
index 30b3219f989..ea7e23eca79 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
@@ -67,13 +67,13 @@ struct bNodeTree;
struct Object;
struct bPoseChannel;
struct bConstraint;
+struct ParticleSystem;
+struct ParticleSettings;
struct Scene;
struct ViewLayer;
struct Tex;
struct World;
struct EffectorWeights;
-struct ParticleSystem;
-struct ParticleSettings;
struct PropertyRNA;
@@ -205,7 +205,14 @@ struct DepsgraphRelationBuilder
RootPChanMap *root_map);
void build_animdata(ID *id);
void build_animdata_curves(ID *id);
- void build_animdata_curves_targets(ID *id);
+ void build_animdata_curves_targets(ID *id,
+ ComponentKey &adt_key,
+ OperationDepsNode *operation_from,
+ ListBase *curves);
+ void build_animdata_nlastrip_targets(ID *id,
+ ComponentKey &adt_key,
+ OperationDepsNode *operation_from,
+ ListBase *strips);
void build_animdata_drivers(ID *id);
void build_driver(ID *id, FCurve *fcurve);
void build_driver_data(ID *id, FCurve *fcurve);
@@ -214,6 +221,9 @@ struct DepsgraphRelationBuilder
void build_rigidbody(Scene *scene);
void build_particles(Object *object);
void build_particle_settings(ParticleSettings *part);
+ void build_particles_visualization_object(Object *object,
+ ParticleSystem *psys,
+ Object *draw_object);
void build_cloth(Object *object, ModifierData *md);
void build_ik_pose(Object *object,
bPoseChannel *pchan,
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_layer_collection.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_layer_collection.cc
index 9cf82b5fb47..e2154558ed7 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations_layer_collection.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_layer_collection.cc
@@ -92,7 +92,7 @@ void DepsgraphRelationBuilder::build_layer_collections(
ListBase *layer_collections,
LayerCollectionState *state)
{
- BLI_LISTBASE_FOREACH (LayerCollection *, layer_collection, layer_collections) {
+ LISTBASE_FOREACH (LayerCollection *, layer_collection, layer_collections) {
/* Recurs into the layer. */
build_layer_collection(owner_id, layer_collection, state);
}
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
index ad812a4b505..f3c3772e512 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
@@ -341,8 +341,8 @@ void DepsgraphRelationBuilder::build_rig(Object *object)
*/
RootPChanMap root_map;
bool pose_depends_on_local_transform = false;
- BLI_LISTBASE_FOREACH (bPoseChannel *, pchan, &object->pose->chanbase) {
- BLI_LISTBASE_FOREACH (bConstraint *, con, &pchan->constraints) {
+ LISTBASE_FOREACH (bPoseChannel *, pchan, &object->pose->chanbase) {
+ LISTBASE_FOREACH (bConstraint *, con, &pchan->constraints) {
switch (con->type) {
case CONSTRAINT_TYPE_KINEMATIC:
build_ik_pose(object, pchan, con, &root_map);
@@ -382,7 +382,7 @@ void DepsgraphRelationBuilder::build_rig(Object *object)
}
/* links between operations for each bone */
- BLI_LISTBASE_FOREACH (bPoseChannel *, pchan, &object->pose->chanbase) {
+ LISTBASE_FOREACH (bPoseChannel *, pchan, &object->pose->chanbase) {
OperationKey bone_local_key(&object->id, DEG_NODE_TYPE_BONE, pchan->name, DEG_OPCODE_BONE_LOCAL);
OperationKey bone_pose_key(&object->id, DEG_NODE_TYPE_BONE, pchan->name, DEG_OPCODE_BONE_POSE_PARENT);
OperationKey bone_ready_key(&object->id, DEG_NODE_TYPE_BONE, pchan->name, DEG_OPCODE_BONE_READY);
@@ -443,16 +443,43 @@ void DepsgraphRelationBuilder::build_rig(Object *object)
void DepsgraphRelationBuilder::build_proxy_rig(Object *object)
{
- OperationKey pose_init_key(&object->id, DEG_NODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_INIT);
- OperationKey pose_done_key(&object->id, DEG_NODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_DONE);
- BLI_LISTBASE_FOREACH (bPoseChannel *, pchan, &object->pose->chanbase) {
- OperationKey bone_local_key(&object->id, DEG_NODE_TYPE_BONE, pchan->name, DEG_OPCODE_BONE_LOCAL);
- OperationKey bone_ready_key(&object->id, DEG_NODE_TYPE_BONE, pchan->name, DEG_OPCODE_BONE_READY);
- OperationKey bone_done_key(&object->id, DEG_NODE_TYPE_BONE, pchan->name, DEG_OPCODE_BONE_DONE);
+ Object *proxy_from = object->proxy_from;
+ OperationKey pose_init_key(&object->id,
+ DEG_NODE_TYPE_EVAL_POSE,
+ DEG_OPCODE_POSE_INIT);
+ OperationKey pose_done_key(&object->id,
+ DEG_NODE_TYPE_EVAL_POSE,
+ DEG_OPCODE_POSE_DONE);
+ LISTBASE_FOREACH (bPoseChannel *, pchan, &object->pose->chanbase) {
+ OperationKey bone_local_key(&object->id,
+ DEG_NODE_TYPE_BONE, pchan->name,
+ DEG_OPCODE_BONE_LOCAL);
+ OperationKey bone_ready_key(&object->id,
+ DEG_NODE_TYPE_BONE,
+ pchan->name,
+ DEG_OPCODE_BONE_READY);
+ OperationKey bone_done_key(&object->id,
+ DEG_NODE_TYPE_BONE,
+ pchan->name,
+ DEG_OPCODE_BONE_DONE);
add_relation(pose_init_key, bone_local_key, "Pose Init -> Bone Local");
add_relation(bone_local_key, bone_ready_key, "Local -> Ready");
add_relation(bone_ready_key, bone_done_key, "Ready -> Done");
add_relation(bone_done_key, pose_done_key, "Bone Done -> Pose Done");
+
+ if (pchan->prop != NULL) {
+ OperationKey bone_parameters(&object->id,
+ DEG_NODE_TYPE_PARAMETERS,
+ DEG_OPCODE_PARAMETERS_EVAL,
+ pchan->name);
+ OperationKey from_bone_parameters(&proxy_from->id,
+ DEG_NODE_TYPE_PARAMETERS,
+ DEG_OPCODE_PARAMETERS_EVAL,
+ pchan->name);
+ add_relation(from_bone_parameters,
+ bone_parameters,
+ "Proxy Bone Parameters");
+ }
}
}
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc
index cfb98fe2f79..074d20bb750 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc
@@ -78,7 +78,7 @@ void DepsgraphRelationBuilder::build_view_layer(Scene *scene, ViewLayer *view_la
* passed to the evaluation functions. During relations builder we only
* do NULL-pointer check of the base, so it's fine to pass original one.
*/
- BLI_LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) {
+ LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) {
build_object(base, base->object);
}
if (scene->camera != NULL) {
@@ -105,11 +105,11 @@ void DepsgraphRelationBuilder::build_view_layer(Scene *scene, ViewLayer *view_la
build_gpencil(scene->gpd);
}
/* Masks. */
- BLI_LISTBASE_FOREACH (Mask *, mask, &bmain_->mask) {
+ LISTBASE_FOREACH (Mask *, mask, &bmain_->mask) {
build_mask(mask);
}
/* Movie clips. */
- BLI_LISTBASE_FOREACH (MovieClip *, clip, &bmain_->movieclip) {
+ LISTBASE_FOREACH (MovieClip *, clip, &bmain_->movieclip) {
build_movieclip(clip);
}
/* Collections. */
diff --git a/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc b/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc
index 8fc4c0bcec1..ee40ca50ab5 100644
--- a/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc
+++ b/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc
@@ -346,7 +346,7 @@ static void deg_debug_graphviz_node(const DebugContext &ctx,
case DEG_NODE_TYPE_ID_REF:
{
const IDDepsNode *id_node = (const IDDepsNode *)node;
- if (BLI_ghash_size(id_node->components) == 0) {
+ if (BLI_ghash_len(id_node->components) == 0) {
deg_debug_graphviz_node_single(ctx, node);
}
else {
@@ -405,7 +405,7 @@ static bool deg_debug_graphviz_is_cluster(const DepsNode *node)
case DEG_NODE_TYPE_ID_REF:
{
const IDDepsNode *id_node = (const IDDepsNode *)node;
- return BLI_ghash_size(id_node->components) > 0;
+ return BLI_ghash_len(id_node->components) > 0;
}
case DEG_NODE_TYPE_PARAMETERS:
case DEG_NODE_TYPE_ANIMATION:
@@ -467,7 +467,7 @@ static void deg_debug_graphviz_node_relations(const DebugContext &ctx,
deg_debug_fprintf(ctx, "[");
/* Note: without label an id seem necessary to avoid bugs in graphviz/dot */
deg_debug_fprintf(ctx, "id=\"%s\"", rel->name);
- deg_debug_fprintf(ctx, "label=\"%s\"", rel->name);
+ // deg_debug_fprintf(ctx, "label=\"%s\"", rel->name);
deg_debug_fprintf(ctx, ",color="); deg_debug_graphviz_relation_color(ctx, rel);
deg_debug_fprintf(ctx, ",penwidth=\"%f\"", penwidth);
/* NOTE: edge from node to own cluster is not possible and gives graphviz
diff --git a/source/blender/depsgraph/intern/depsgraph.cc b/source/blender/depsgraph/intern/depsgraph.cc
index 3a78c9050f7..3b5ea2bfc3f 100644
--- a/source/blender/depsgraph/intern/depsgraph.cc
+++ b/source/blender/depsgraph/intern/depsgraph.cc
@@ -167,7 +167,7 @@ static bool pointer_to_component_node_criteria(
return true;
}
else if (object->pose != NULL) {
- BLI_LISTBASE_FOREACH(bPoseChannel *, pchan, &object->pose->chanbase) {
+ LISTBASE_FOREACH(bPoseChannel *, pchan, &object->pose->chanbase) {
if (BLI_findindex(&pchan->constraints, con) != -1) {
/* bone transforms */
*type = DEG_NODE_TYPE_BONE;
@@ -220,6 +220,10 @@ static bool pointer_to_component_node_criteria(
*subdata = seq->name; // xxx?
return true;
}
+ else if (RNA_struct_is_a(ptr->type, &RNA_NodeSocket)) {
+ *type = DEG_NODE_TYPE_SHADING;
+ return true;
+ }
if (prop != NULL) {
/* All unknown data effectively falls under "parameter evaluation". */
*type = DEG_NODE_TYPE_PARAMETERS;
diff --git a/source/blender/depsgraph/intern/depsgraph_build.cc b/source/blender/depsgraph/intern/depsgraph_build.cc
index 902cbe039cd..377f2d3b4c5 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.cc
+++ b/source/blender/depsgraph/intern/depsgraph_build.cc
@@ -47,7 +47,7 @@ extern "C" {
#include "DNA_cachefile_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
-#include "DNA_object_force.h"
+#include "DNA_object_force_types.h"
#include "BKE_main.h"
#include "BKE_collision.h"
@@ -215,7 +215,7 @@ void DEG_graph_build_from_view_layer(Depsgraph *graph,
* This now could happen for both visible scene is changed and extra
* dependency graph was created for render engine.
*/
- const bool need_on_visible_update = (deg_graph->scene == NULL);
+ const bool need_on_visible_update = (deg_graph->id_nodes.size() == 0);
/* 1) Generate all the nodes in the graph first */
DEG::DepsgraphNodeBuilder node_builder(bmain, deg_graph);
@@ -294,8 +294,8 @@ void DEG_graph_relations_update(Depsgraph *graph,
void DEG_relations_tag_update(Main *bmain)
{
DEG_DEBUG_PRINTF("%s: Tagging relations for update.\n", __func__);
- BLI_LISTBASE_FOREACH (Scene *, scene, &bmain->scene) {
- BLI_LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
+ LISTBASE_FOREACH (Scene *, scene, &bmain->scene) {
+ LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
Depsgraph *depsgraph =
(Depsgraph *)BKE_scene_get_depsgraph(scene,
view_layer,
diff --git a/source/blender/depsgraph/intern/depsgraph_eval.cc b/source/blender/depsgraph/intern/depsgraph_eval.cc
index ad1a850a807..4fb5a8ff580 100644
--- a/source/blender/depsgraph/intern/depsgraph_eval.cc
+++ b/source/blender/depsgraph/intern/depsgraph_eval.cc
@@ -76,17 +76,20 @@ void DEG_evaluation_context_init(EvaluationContext *eval_ctx,
eval_ctx->mode = mode;
}
-void DEG_evaluation_context_init_from_scene(EvaluationContext *eval_ctx,
- Scene *scene,
- ViewLayer *view_layer,
- RenderEngineType *engine_type,
- eEvaluationMode mode)
+void DEG_evaluation_context_init_from_scene(
+ EvaluationContext *eval_ctx,
+ Scene *scene,
+ ViewLayer *view_layer,
+ RenderEngineType *engine_type,
+ eObjectMode object_mode,
+ eEvaluationMode mode)
{
DEG_evaluation_context_init(eval_ctx, mode);
eval_ctx->depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true);
eval_ctx->view_layer = view_layer;
eval_ctx->engine_type = engine_type;
eval_ctx->ctime = BKE_scene_frame_get(scene);
+ eval_ctx->object_mode = object_mode;
}
/* Free evaluation context. */
@@ -125,5 +128,5 @@ void DEG_evaluate_on_framechange(EvaluationContext *eval_ctx,
bool DEG_needs_eval(Depsgraph *graph)
{
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph);
- return BLI_gset_size(deg_graph->entry_tags) != 0;
+ return BLI_gset_len(deg_graph->entry_tags) != 0;
}
diff --git a/source/blender/depsgraph/intern/depsgraph_query_iter.cc b/source/blender/depsgraph/intern/depsgraph_query_iter.cc
index 30c9d9f10be..fd54030a4e0 100644
--- a/source/blender/depsgraph/intern/depsgraph_query_iter.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query_iter.cc
@@ -110,10 +110,18 @@ static bool deg_objects_dupli_iterator_next(BLI_Iterator *iter)
Object *dupli_parent = data->dupli_parent;
Object *temp_dupli_object = &data->temp_dupli_object;
*temp_dupli_object = *dob->ob;
- temp_dupli_object->transflag &= ~OB_DUPLI;
temp_dupli_object->select_color = dupli_parent->select_color;
temp_dupli_object->base_flag = dupli_parent->base_flag | BASE_FROMDUPLI;
+ /* Duplicated elements shouldn't care whether their original collection is visible or not. */
+ temp_dupli_object->base_flag |= BASE_VISIBLED;
+
+ if (BKE_object_is_visible(temp_dupli_object, (eObjectVisibilityCheck)data->visibility_check) == false) {
+ continue;
+ }
+
+ temp_dupli_object->transflag &= ~OB_DUPLI;
+
if (dob->collection_properties != NULL) {
temp_dupli_object->base_collection_properties = dob->collection_properties;
IDP_MergeGroup(temp_dupli_object->base_collection_properties,
@@ -181,11 +189,7 @@ static void DEG_iterator_objects_step(BLI_Iterator *iter, DEG::IDDepsNode *id_no
data->dupli_parent = object;
data->dupli_list = object_duplilist(&data->eval_ctx, data->scene, object);
data->dupli_object_next = (DupliObject *)data->dupli_list->first;
- const eObjectVisibilityCheck mode =
- (data->mode == DEG_ITER_OBJECT_MODE_RENDER)
- ? OB_VISIBILITY_CHECK_FOR_RENDER
- : OB_VISIBILITY_CHECK_FOR_VIEWPORT;
- if (BKE_object_is_visible(object, mode) == false) {
+ if (BKE_object_is_visible(object, (eObjectVisibilityCheck)data->visibility_check) == false) {
return;
}
}
@@ -220,6 +224,9 @@ void DEG_iterator_objects_begin(BLI_Iterator *iter, DEGObjectIterData *data)
data->scene = DEG_get_evaluated_scene(depsgraph);
data->id_node_index = 0;
data->num_id_nodes = num_id_nodes;
+ data->visibility_check = (data->mode == DEG_ITER_OBJECT_MODE_RENDER)
+ ? OB_VISIBILITY_CHECK_FOR_RENDER
+ : OB_VISIBILITY_CHECK_FOR_VIEWPORT;
DEG::IDDepsNode *id_node = deg_graph->id_nodes[data->id_node_index];
DEG_iterator_objects_step(iter, id_node);
diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc
index 38f43f5720b..b0b3cbe0f8c 100644
--- a/source/blender/depsgraph/intern/depsgraph_tag.cc
+++ b/source/blender/depsgraph/intern/depsgraph_tag.cc
@@ -40,12 +40,15 @@
#include "BLI_task.h"
extern "C" {
+#include "DNA_curve_types.h"
+#include "DNA_key_types.h"
+#include "DNA_lattice_types.h"
+#include "DNA_mesh_types.h"
#include "DNA_object_types.h"
#include "DNA_particle_types.h"
#include "DNA_screen_types.h"
#include "DNA_windowmanager_types.h"
-
#include "BKE_idcode.h"
#include "BKE_library.h"
#include "BKE_main.h"
@@ -92,6 +95,7 @@ void depsgraph_geometry_tag_to_component(const ID *id,
case OB_CURVE:
case OB_SURF:
case OB_FONT:
+ case OB_LATTICE:
case OB_MBALL:
*component_type = DEG_NODE_TYPE_GEOMETRY;
break;
@@ -294,11 +298,50 @@ void deg_graph_id_tag_legacy_compat(Main *bmain,
ID *id,
eDepsgraph_Tag tag)
{
- if (tag == DEG_TAG_GEOMETRY && GS(id->name) == ID_OB) {
- Object *object = (Object *)id;
- ID *data_id = (ID *)object->data;
- if (data_id != NULL) {
- DEG_id_tag_update_ex(bmain, data_id, 0);
+ if (tag == DEG_TAG_GEOMETRY || tag == 0) {
+ switch (GS(id->name)) {
+ case ID_OB:
+ {
+ Object *object = (Object *)id;
+ ID *data_id = (ID *)object->data;
+ if (data_id != NULL) {
+ DEG_id_tag_update_ex(bmain, data_id, 0);
+ }
+ break;
+ }
+ /* TODO(sergey): Shape keys are annoying, maybe we should find a
+ * way to chain geometry evaluation to them, so we don't need extra
+ * tagging here.
+ */
+ case ID_ME:
+ {
+ Mesh *mesh = (Mesh *)id;
+ ID *key_id = &mesh->key->id;
+ if (key_id != NULL) {
+ DEG_id_tag_update_ex(bmain, key_id, 0);
+ }
+ break;
+ }
+ case ID_LT:
+ {
+ Lattice *lattice = (Lattice *)id;
+ ID *key_id = &lattice->key->id;
+ if (key_id != NULL) {
+ DEG_id_tag_update_ex(bmain, key_id, 0);
+ }
+ break;
+ }
+ case ID_CU:
+ {
+ Curve *curve = (Curve *)id;
+ ID *key_id = &curve->key->id;
+ if (key_id != NULL) {
+ DEG_id_tag_update_ex(bmain, key_id, 0);
+ }
+ break;
+ }
+ default:
+ break;
}
}
}
@@ -364,6 +407,7 @@ void deg_graph_id_tag_update(Main *bmain, Depsgraph *graph, ID *id, int flag)
if (id_node != NULL) {
id_node->tag_update(graph);
}
+ deg_graph_id_tag_legacy_compat(bmain, id, (eDepsgraph_Tag)0);
}
int current_flag = flag;
while (current_flag != 0) {
@@ -396,8 +440,8 @@ void deg_ensure_scene_view_layer(Depsgraph *graph,
void deg_id_tag_update(Main *bmain, ID *id, int flag)
{
deg_graph_id_tag_update(bmain, NULL, id, flag);
- BLI_LISTBASE_FOREACH (Scene *, scene, &bmain->scene) {
- BLI_LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
+ LISTBASE_FOREACH (Scene *, scene, &bmain->scene) {
+ LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
Depsgraph *depsgraph =
(Depsgraph *)BKE_scene_get_depsgraph(scene,
view_layer,
@@ -437,8 +481,12 @@ void deg_graph_on_visible_update(Main *bmain, Depsgraph *graph)
scene_iter = scene_iter->set)
{
IDDepsNode *scene_id_node = graph->find_id_node(&scene_iter->id);
- BLI_assert(scene_id_node != NULL);
- scene_id_node->tag_update(graph);
+ if (scene_id_node != NULL) {
+ scene_id_node->tag_update(graph);
+ }
+ else {
+ BLI_assert(graph->need_update);
+ }
}
}
@@ -507,8 +555,8 @@ void DEG_graph_on_visible_update(Main *bmain, Depsgraph *depsgraph)
void DEG_on_visible_update(Main *bmain, const bool UNUSED(do_time))
{
- BLI_LISTBASE_FOREACH (Scene *, scene, &bmain->scene) {
- BLI_LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
+ LISTBASE_FOREACH (Scene *, scene, &bmain->scene) {
+ LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
Depsgraph *depsgraph =
(Depsgraph *)BKE_scene_get_depsgraph(scene,
view_layer,
diff --git a/source/blender/depsgraph/intern/depsgraph_type_defines.cc b/source/blender/depsgraph/intern/depsgraph_type_defines.cc
index 22df3161428..886601225c7 100644
--- a/source/blender/depsgraph/intern/depsgraph_type_defines.cc
+++ b/source/blender/depsgraph/intern/depsgraph_type_defines.cc
@@ -119,6 +119,8 @@ static const char *stringify_opcode(eDepsOperation_Code opcode)
STRINGIFY_OPCODE(PARTICLE_SYSTEM_EVAL);
STRINGIFY_OPCODE(PARTICLE_SETTINGS_EVAL);
STRINGIFY_OPCODE(PARTICLE_SETTINGS_RECALC_CLEAR);
+ /* Point Cache. */
+ STRINGIFY_OPCODE(POINT_CACHE_RESET);
/* Batch cache. */
STRINGIFY_OPCODE(GEOMETRY_SELECT_UPDATE);
/* Masks. */
diff --git a/source/blender/depsgraph/intern/depsgraph_types.h b/source/blender/depsgraph/intern/depsgraph_types.h
index d091f42bf80..3f4df21b8d6 100644
--- a/source/blender/depsgraph/intern/depsgraph_types.h
+++ b/source/blender/depsgraph/intern/depsgraph_types.h
@@ -240,6 +240,9 @@ typedef enum eDepsOperation_Code {
DEG_OPCODE_PARTICLE_SETTINGS_EVAL,
DEG_OPCODE_PARTICLE_SETTINGS_RECALC_CLEAR,
+ /* Point Cache. ------------------------------------- */
+ DEG_OPCODE_POINT_CACHE_RESET,
+
/* Collections. ------------------------------------- */
DEG_OPCODE_VIEW_LAYER_INIT,
DEG_OPCODE_VIEW_LAYER_EVAL,
diff --git a/source/blender/depsgraph/intern/eval/deg_eval.cc b/source/blender/depsgraph/intern/eval/deg_eval.cc
index a6c6a16a528..c3aa84943d3 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval.cc
@@ -231,7 +231,7 @@ void deg_evaluate_on_refresh(EvaluationContext *eval_ctx,
Depsgraph *graph)
{
/* Nothing to update, early out. */
- if (BLI_gset_size(graph->entry_tags) == 0) {
+ if (BLI_gset_len(graph->entry_tags) == 0) {
return;
}
/* Set time for the current graph evaluation context. */
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
index a6668208574..8bdc68d9351 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
@@ -63,8 +63,10 @@ extern "C" {
#include "DNA_object_types.h"
#ifdef NESTED_ID_NASTY_WORKAROUND
+# include "DNA_curve_types.h"
# include "DNA_key_types.h"
# include "DNA_lamp_types.h"
+# include "DNA_lattice_types.h"
# include "DNA_linestyle_types.h"
# include "DNA_material_types.h"
# include "DNA_node_types.h"
@@ -91,8 +93,10 @@ namespace {
#ifdef NESTED_ID_NASTY_WORKAROUND
union NestedIDHackTempStorage {
+ Curve curve;
FreestyleLineStyle linestyle;
Lamp lamp;
+ Lattice lattice;
Material material;
Mesh mesh;
Scene scene;
@@ -118,6 +122,8 @@ void nested_id_hack_discard_pointers(ID *id_cow)
SPECIAL_CASE(ID_TE, Tex, nodetree)
SPECIAL_CASE(ID_WO, World, nodetree)
+ SPECIAL_CASE(ID_CU, Curve, key)
+ SPECIAL_CASE(ID_LT, Lattice, key)
SPECIAL_CASE(ID_ME, Mesh, key)
# undef SPECIAL_CASE
@@ -150,6 +156,8 @@ const ID *nested_id_hack_get_discarded_pointers(NestedIDHackTempStorage *storage
SPECIAL_CASE(ID_TE, Tex, nodetree, tex)
SPECIAL_CASE(ID_WO, World, nodetree, world)
+ SPECIAL_CASE(ID_CU, Curve, key, curve)
+ SPECIAL_CASE(ID_LT, Lattice, key, lattice)
SPECIAL_CASE(ID_ME, Mesh, key, mesh)
# undef SPECIAL_CASE
@@ -182,6 +190,8 @@ void nested_id_hack_restore_pointers(const ID *old_id, ID *new_id)
SPECIAL_CASE(ID_TE, Tex, nodetree)
SPECIAL_CASE(ID_WO, World, nodetree)
+ SPECIAL_CASE(ID_CU, Curve, key)
+ SPECIAL_CASE(ID_LT, Lattice, key)
SPECIAL_CASE(ID_ME, Mesh, key)
#undef SPECIAL_CASE
@@ -218,6 +228,8 @@ void ntree_hack_remap_pointers(const Depsgraph *depsgraph, ID *id_cow)
SPECIAL_CASE(ID_TE, Tex, nodetree, bNodeTree)
SPECIAL_CASE(ID_WO, World, nodetree, bNodeTree)
+ SPECIAL_CASE(ID_CU, Curve, key, Key)
+ SPECIAL_CASE(ID_LT, Lattice, key, Key)
SPECIAL_CASE(ID_ME, Mesh, key, Key)
#undef SPECIAL_CASE
@@ -424,11 +436,9 @@ void update_special_pointers(const Depsgraph *depsgraph,
* new copy of the object.
*/
Object *object_cow = (Object *)id_cow;
- const Object *object_orig = (const Object *)id_orig;
(void) object_cow; /* Ignored for release builds. */
BLI_assert(object_cow->derivedFinal == NULL);
BLI_assert(object_cow->derivedDeform == NULL);
- object_cow->mode = object_orig->mode;
break;
}
case ID_ME:
@@ -451,18 +461,6 @@ void update_special_pointers(const Depsgraph *depsgraph,
}
break;
}
- case ID_SCE:
- {
- const Scene *scene_orig = (const Scene *)id_orig;
- Scene *scene_cow = (Scene *)id_cow;
- if (scene_orig->obedit != NULL) {
- scene_cow->obedit = (Object *)depsgraph->get_cow_id(&scene_orig->obedit->id);
- }
- else {
- scene_cow->obedit = NULL;
- }
- break;
- }
default:
break;
}
@@ -612,13 +610,6 @@ void update_copy_on_write_scene(const Depsgraph *depsgraph,
update_copy_on_write_view_layers(depsgraph, scene_cow, scene_orig);
update_copy_on_write_scene_collection(scene_cow->collection,
scene_orig->collection);
- // Update edit object pointer.
- if (scene_orig->obedit != NULL) {
- scene_cow->obedit = (Object *)depsgraph->get_cow_id(&scene_orig->obedit->id);
- }
- else {
- scene_cow->obedit = NULL;
- }
/* Synchronize active render engine. */
BLI_strncpy(scene_cow->view_render.engine_id,
scene_orig->view_render.engine_id,
@@ -640,7 +631,6 @@ void update_copy_on_write_object(const Depsgraph * /*depsgraph*/,
extract_pose_from_pose(pose_cow, pose_orig);
/* Update object itself. */
BKE_object_transform_copy(object_cow, object_orig);
- object_cow->mode = object_orig->mode;
}
/* Update copy-on-write version of datablock from it's original ID without re-building
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
index c0d5e08b80f..b4e1c2f4e1a 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
@@ -214,7 +214,7 @@ void flush_engine_data_update(ID *id)
return;
}
Object *object = (Object *)id;
- BLI_LISTBASE_FOREACH(ObjectEngineData *, engine_data, &object->drawdata) {
+ LISTBASE_FOREACH(ObjectEngineData *, engine_data, &object->drawdata) {
engine_data->recalc |= id->recalc;
}
}
@@ -271,7 +271,7 @@ void deg_graph_flush_updates(Main *bmain, Depsgraph *graph)
BLI_assert(bmain != NULL);
BLI_assert(graph != NULL);
/* Nothing to update, early out. */
- if (BLI_gset_size(graph->entry_tags) == 0) {
+ if (BLI_gset_len(graph->entry_tags) == 0) {
return;
}
/* Reset all flags, get ready for the flush. */
diff --git a/source/blender/depsgraph/intern/nodes/deg_node_component.cc b/source/blender/depsgraph/intern/nodes/deg_node_component.cc
index 1f56edd1f87..6c33856555e 100644
--- a/source/blender/depsgraph/intern/nodes/deg_node_component.cc
+++ b/source/blender/depsgraph/intern/nodes/deg_node_component.cc
@@ -301,7 +301,7 @@ OperationDepsNode *ComponentDepsNode::get_entry_operation()
if (entry_operation) {
return entry_operation;
}
- else if (operations_map != NULL && BLI_ghash_size(operations_map) == 1) {
+ else if (operations_map != NULL && BLI_ghash_len(operations_map) == 1) {
OperationDepsNode *op_node = NULL;
/* TODO(sergey): This is somewhat slow. */
GHASH_FOREACH_BEGIN(OperationDepsNode *, tmp, operations_map)
@@ -324,7 +324,7 @@ OperationDepsNode *ComponentDepsNode::get_exit_operation()
if (exit_operation) {
return exit_operation;
}
- else if (operations_map != NULL && BLI_ghash_size(operations_map) == 1) {
+ else if (operations_map != NULL && BLI_ghash_len(operations_map) == 1) {
OperationDepsNode *op_node = NULL;
/* TODO(sergey): This is somewhat slow. */
GHASH_FOREACH_BEGIN(OperationDepsNode *, tmp, operations_map)
@@ -344,7 +344,7 @@ OperationDepsNode *ComponentDepsNode::get_exit_operation()
void ComponentDepsNode::finalize_build(Depsgraph * /*graph*/)
{
- operations.reserve(BLI_ghash_size(operations_map));
+ operations.reserve(BLI_ghash_len(operations_map));
GHASH_FOREACH_BEGIN(OperationDepsNode *, op_node, operations_map)
{
operations.push_back(op_node);