diff options
Diffstat (limited to 'source/blender/depsgraph/intern/builder')
7 files changed, 136 insertions, 67 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder.cc b/source/blender/depsgraph/intern/builder/deg_builder.cc index 1b2dcd8fcf8..b6256e9ceb0 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder.cc @@ -58,7 +58,7 @@ void deg_graph_build_finalize(Main *bmain, Depsgraph *graph) foreach (IDDepsNode *id_node, graph->id_nodes) { ID *id = id_node->id_orig; id_node->finalize_build(graph); - int flag = DEG_TAG_TRANSFORM | DEG_TAG_GEOMETRY; + int flag = 0; if ((id->recalc & ID_RECALC_ALL)) { AnimData *adt = BKE_animdata_from_id(id); if (adt != NULL && (adt->recalc & ADT_RECALC_ANIM) != 0) { @@ -68,7 +68,9 @@ void deg_graph_build_finalize(Main *bmain, Depsgraph *graph) if (!deg_copy_on_write_is_expanded(id_node->id_cow)) { flag |= DEG_TAG_COPY_ON_WRITE; } - DEG_id_tag_update_ex(bmain, id_node->id_orig, flag); + if (flag != 0) { + DEG_id_tag_update_ex(bmain, id_node->id_orig, flag); + } } } diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index d4a115cfb8b..cfb2f1bc8d6 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -65,6 +65,7 @@ extern "C" { #include "DNA_lightprobe_types.h" #include "DNA_rigidbody_types.h" #include "DNA_scene_types.h" +#include "DNA_speaker_types.h" #include "DNA_texture_types.h" #include "DNA_world_types.h" @@ -431,6 +432,9 @@ void DepsgraphNodeBuilder::build_id(ID *id) { case ID_LT: build_object_data_geometry_datablock(id); break; + case ID_SPK: + build_speaker((Speaker *)id); + break; default: fprintf(stderr, "Unhandled ID %s\n", id->name); BLI_assert(!"Should never happen"); @@ -458,6 +462,15 @@ void DepsgraphNodeBuilder::build_collection( add_id_node(&collection->id); /* Build collection objects. */ LISTBASE_FOREACH (CollectionObject *, cob, &collection->gobject) { + if (allow_restrict_flags) { + const int restrict_flag = ( + (graph_->mode == DAG_EVAL_VIEWPORT) ? + OB_RESTRICT_VIEW : + OB_RESTRICT_RENDER); + if (cob->ob->restrictflag & restrict_flag) { + continue; + } + } build_object(-1, cob->ob, DEG_ID_LINKED_INDIRECTLY); } /* Build child collections. */ @@ -530,9 +543,12 @@ void DepsgraphNodeBuilder::build_object(int base_index, build_gpencil(object->gpd); } /* Proxy object to copy from. */ - if (object->proxy_from) { + if (object->proxy_from != NULL) { build_object(-1, object->proxy_from, DEG_ID_LINKED_INDIRECTLY); } + if (object->proxy_group != NULL) { + build_object(-1, object->proxy_group, DEG_ID_LINKED_INDIRECTLY); + } /* Object dupligroup. */ if (object->dup_group != NULL) { build_collection(DEG_COLLECTION_OWNER_OBJECT, object->dup_group); @@ -604,6 +620,9 @@ void DepsgraphNodeBuilder::build_object_data(Object *object) case OB_LIGHTPROBE: build_object_data_lightprobe(object); break; + case OB_SPEAKER: + build_object_data_speaker(object); + break; default: { ID *obdata = (ID *)object->data; @@ -637,6 +656,16 @@ void DepsgraphNodeBuilder::build_object_data_lightprobe(Object *object) DEG_OPCODE_LIGHT_PROBE_EVAL); } +void DepsgraphNodeBuilder::build_object_data_speaker(Object *object) +{ + Speaker *speaker = (Speaker *)object->data; + build_speaker(speaker); + add_operation_node(&object->id, + DEG_NODE_TYPE_PARAMETERS, + NULL, + DEG_OPCODE_SPEAKER_EVAL); +} + void DepsgraphNodeBuilder::build_object_transform(Object *object) { OperationDepsNode *op_node; @@ -1453,6 +1482,19 @@ void DepsgraphNodeBuilder::build_lightprobe(LightProbe *probe) build_animdata(&probe->id); } +void DepsgraphNodeBuilder::build_speaker(Speaker *speaker) +{ + if (built_map_.checkIsBuiltAndTag(speaker)) { + return; + } + /* Placeholder so we can add relations and tag ID node for update. */ + add_operation_node(&speaker->id, + DEG_NODE_TYPE_PARAMETERS, + NULL, + DEG_OPCODE_SPEAKER_EVAL); + build_animdata(&speaker->id); +} + /* **** ID traversal callbacks functions **** */ void DepsgraphNodeBuilder::modifier_walk(void *user_data, diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h index 72aa5dbe003..487b834bd07 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h @@ -62,6 +62,7 @@ struct Probe; struct bPoseChannel; struct bConstraint; struct Scene; +struct Speaker; struct Tex; struct World; @@ -175,6 +176,7 @@ struct DepsgraphNodeBuilder { void build_object_data_geometry_datablock(ID *obdata); void build_object_data_lamp(Object *object); void build_object_data_lightprobe(Object *object); + void build_object_data_speaker(Object *object); void build_object_transform(Object *object); void build_object_constraints(Object *object); void build_pose_constraints(Object *object, bPoseChannel *pchan, int pchan_index); @@ -209,6 +211,7 @@ struct DepsgraphNodeBuilder { void build_mask(Mask *mask); void build_movieclip(MovieClip *clip); void build_lightprobe(LightProbe *probe); + void build_speaker(Speaker *speaker); protected: struct SavedEntryTag { 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 e2526272570..f1db05b7220 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 @@ -105,7 +105,7 @@ void DepsgraphNodeBuilder::build_view_layer( */ int base_index = 0; const int base_flag = (graph_->mode == DAG_EVAL_VIEWPORT) ? - BASE_VISIBLE_VIEWPORT : BASE_VISIBLE_RENDER; + BASE_ENABLED_VIEWPORT : BASE_ENABLED_RENDER; LISTBASE_FOREACH(Base *, base, &view_layer->object_bases) { /* object itself */ if (base->flag & base_flag) { diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index 861f2dff1d6..e39bf8aaa98 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -65,6 +65,7 @@ extern "C" { #include "DNA_object_types.h" #include "DNA_rigidbody_types.h" #include "DNA_scene_types.h" +#include "DNA_speaker_types.h" #include "DNA_texture_types.h" #include "DNA_world_types.h" #include "DNA_object_force_types.h" @@ -297,87 +298,72 @@ DepsRelation *DepsgraphRelationBuilder::add_operation_relation( void DepsgraphRelationBuilder::add_collision_relations( const OperationKey &key, - Scene *scene, Object *object, Collection *collection, - bool dupli, const char *name) { - unsigned int numcollobj; - Object **collobjs = get_collisionobjects_ext(scene, - object, - collection, - &numcollobj, - eModifierType_Collision, - dupli); - for (unsigned int i = 0; i < numcollobj; i++) { - Object *ob1 = collobjs[i]; + ListBase *relations = deg_build_collision_relations(graph_, collection, eModifierType_Collision); - ComponentKey trf_key(&ob1->id, DEG_NODE_TYPE_TRANSFORM); - add_relation(trf_key, key, name); + LISTBASE_FOREACH (CollisionRelation *, relation, relations) { + if (relation->ob != object) { + ComponentKey trf_key(&relation->ob->id, DEG_NODE_TYPE_TRANSFORM); + add_relation(trf_key, key, name); - ComponentKey coll_key(&ob1->id, DEG_NODE_TYPE_GEOMETRY); - add_relation(coll_key, key, name); - } - if (collobjs != NULL) { - MEM_freeN(collobjs); + ComponentKey coll_key(&relation->ob->id, DEG_NODE_TYPE_GEOMETRY); + add_relation(coll_key, key, name); + } } } void DepsgraphRelationBuilder::add_forcefield_relations( const OperationKey &key, - Scene *scene, Object *object, ParticleSystem *psys, EffectorWeights *eff, bool add_absorption, const char *name) { - ListBase *effectors = pdInitEffectors(NULL, scene, object, psys, eff, false); - if (effectors == NULL) { - return; - } - LISTBASE_FOREACH (EffectorCache *, eff, effectors) { - if (eff->ob != object) { - ComponentKey eff_key(&eff->ob->id, DEG_NODE_TYPE_TRANSFORM); + ListBase *relations = deg_build_effector_relations(graph_, eff->group); + + LISTBASE_FOREACH (EffectorRelation *, relation, relations) { + if (relation->ob != object) { + ComponentKey eff_key(&relation->ob->id, DEG_NODE_TYPE_TRANSFORM); add_relation(eff_key, key, name); + + if (relation->pd->forcefield == PFIELD_SMOKEFLOW && relation->pd->f_source) { + ComponentKey trf_key(&relation->pd->f_source->id, + DEG_NODE_TYPE_TRANSFORM); + add_relation(trf_key, key, "Smoke Force Domain"); + ComponentKey eff_key(&relation->pd->f_source->id, + DEG_NODE_TYPE_GEOMETRY); + add_relation(eff_key, key, "Smoke Force Domain"); + } + if (add_absorption && (relation->pd->flag & PFIELD_VISIBILITY)) { + add_collision_relations(key, + object, + NULL, + "Force Absorption"); + } } - if (eff->psys != NULL) { - if (eff->ob != object) { - ComponentKey eff_key(&eff->ob->id, DEG_NODE_TYPE_EVAL_PARTICLES); + if (relation->psys) { + if (relation->ob != object) { + ComponentKey eff_key(&relation->ob->id, DEG_NODE_TYPE_EVAL_PARTICLES); add_relation(eff_key, key, name); /* TODO: remove this when/if EVAL_PARTICLES is sufficient * for up to date particles. */ - ComponentKey mod_key(&eff->ob->id, DEG_NODE_TYPE_GEOMETRY); + ComponentKey mod_key(&relation->ob->id, DEG_NODE_TYPE_GEOMETRY); add_relation(mod_key, key, name); } - else if (eff->psys != psys) { - OperationKey eff_key(&eff->ob->id, + else if (relation->psys != psys) { + OperationKey eff_key(&relation->ob->id, DEG_NODE_TYPE_EVAL_PARTICLES, DEG_OPCODE_PARTICLE_SYSTEM_EVAL, - eff->psys->name); + relation->psys->name); add_relation(eff_key, key, name); } } - if (eff->pd->forcefield == PFIELD_SMOKEFLOW && eff->pd->f_source) { - ComponentKey trf_key(&eff->pd->f_source->id, - DEG_NODE_TYPE_TRANSFORM); - add_relation(trf_key, key, "Smoke Force Domain"); - ComponentKey eff_key(&eff->pd->f_source->id, - DEG_NODE_TYPE_GEOMETRY); - add_relation(eff_key, key, "Smoke Force Domain"); - } - if (add_absorption && (eff->pd->flag & PFIELD_VISIBILITY)) { - add_collision_relations(key, - scene, - object, - NULL, - true, - "Force Absorption"); - } } - pdEndEffectors(&effectors); } Depsgraph *DepsgraphRelationBuilder::getGraph() @@ -442,6 +428,9 @@ void DepsgraphRelationBuilder::build_id(ID *id) case ID_LT: build_object_data_geometry_datablock(id); break; + case ID_SPK: + build_speaker((Speaker *)id); + break; default: fprintf(stderr, "Unhandled ID %s\n", id->name); BLI_assert(!"Should never happen"); @@ -464,11 +453,19 @@ void DepsgraphRelationBuilder::build_collection( } } const bool group_done = built_map_.checkIsBuiltAndTag(collection); - OperationKey object_local_transform_key(object != NULL ? &object->id : NULL, + OperationKey object_transform_final_key(object != NULL ? &object->id : NULL, DEG_NODE_TYPE_TRANSFORM, - DEG_OPCODE_TRANSFORM_LOCAL); + DEG_OPCODE_TRANSFORM_FINAL); if (!group_done) { LISTBASE_FOREACH (CollectionObject *, cob, &collection->gobject) { + if (allow_restrict_flags) { + const int restrict_flag = (graph_->mode == DAG_EVAL_VIEWPORT) + ? OB_RESTRICT_VIEW + : OB_RESTRICT_RENDER; + if (cob->ob->restrictflag & restrict_flag) { + continue; + } + } build_object(NULL, cob->ob); } LISTBASE_FOREACH (CollectionChild *, child, &collection->children) { @@ -479,7 +476,7 @@ void DepsgraphRelationBuilder::build_collection( FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN(collection, ob, graph_->mode) { ComponentKey dupli_transform_key(&ob->id, DEG_NODE_TYPE_TRANSFORM); - add_relation(dupli_transform_key, object_local_transform_key, "Dupligroup"); + add_relation(dupli_transform_key, object_transform_final_key, "Dupligroup"); } FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_END; } @@ -597,7 +594,13 @@ void DepsgraphRelationBuilder::build_object(Base *base, Object *object) ComponentKey proxy_transform_key(&object->id, DEG_NODE_TYPE_TRANSFORM); add_relation(ob_transform_key, proxy_transform_key, "Proxy Transform"); } - + if (object->proxy_group != NULL) { + build_object(NULL, object->proxy_group); + OperationKey proxy_group_ubereval_key(&object->proxy_group->id, + DEG_NODE_TYPE_TRANSFORM, + DEG_OPCODE_TRANSFORM_OBJECT_UBEREVAL); + add_relation(proxy_group_ubereval_key, final_transform_key, "Proxy Group Transform"); + } /* Object dupligroup. */ if (object->dup_group != NULL) { build_collection(DEG_COLLECTION_OWNER_OBJECT, object, object->dup_group); @@ -657,6 +660,9 @@ void DepsgraphRelationBuilder::build_object_data(Object *object) case OB_LIGHTPROBE: build_object_data_lightprobe(object); break; + case OB_SPEAKER: + build_object_data_speaker(object); + break; } Key *key = BKE_key_from_object(object); if (key != NULL) { @@ -698,6 +704,19 @@ void DepsgraphRelationBuilder::build_object_data_lightprobe(Object *object) add_relation(probe_key, object_key, "LightProbe Update"); } +void DepsgraphRelationBuilder::build_object_data_speaker(Object *object) +{ + Speaker *speaker = (Speaker *)object->data; + build_speaker(speaker); + OperationKey probe_key(&speaker->id, + DEG_NODE_TYPE_PARAMETERS, + DEG_OPCODE_SPEAKER_EVAL); + OperationKey object_key(&object->id, + DEG_NODE_TYPE_PARAMETERS, + DEG_OPCODE_SPEAKER_EVAL); + add_relation(probe_key, object_key, "Speaker Update"); +} + void DepsgraphRelationBuilder::build_object_parent(Object *object) { /* XXX: for now, need to use the component key (not just direct to the parent op), @@ -1563,10 +1582,8 @@ void DepsgraphRelationBuilder::build_particles(Object *object) /* Collisions */ if (part->type != PART_HAIR) { add_collision_relations(psys_key, - scene_, object, part->collision_group, - true, "Particle Collision"); } else if ((psys->flag & PSYS_HAIR_DYNAMICS) && @@ -1574,15 +1591,12 @@ void DepsgraphRelationBuilder::build_particles(Object *object) psys->clmd->coll_parms != NULL) { add_collision_relations(psys_key, - scene_, object, psys->clmd->coll_parms->group, - true, "Hair Collision"); } /* Effectors. */ add_forcefield_relations(psys_key, - scene_, object, psys, part->effector_weights, @@ -2119,6 +2133,14 @@ void DepsgraphRelationBuilder::build_lightprobe(LightProbe *probe) build_animdata(&probe->id); } +void DepsgraphRelationBuilder::build_speaker(Speaker *speaker) +{ + if (built_map_.checkIsBuiltAndTag(speaker)) { + return; + } + build_animdata(&speaker->id); +} + void DepsgraphRelationBuilder::build_copy_on_write_relations() { foreach (IDDepsNode *id_node, graph_->id_nodes) { diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h b/source/blender/depsgraph/intern/builder/deg_builder_relations.h index 3d3a73b6551..9996e420663 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h @@ -75,6 +75,7 @@ struct bConstraint; struct ParticleSystem; struct ParticleSettings; struct Scene; +struct Speaker; struct ViewLayer; struct Tex; struct World; @@ -212,6 +213,7 @@ struct DepsgraphRelationBuilder void build_object_data_geometry_datablock(ID *obdata); void build_object_data_lamp(Object *object); void build_object_data_lightprobe(Object *object); + void build_object_data_speaker(Object *object); void build_object_parent(Object *object); void build_constraints(ID *id, eDepsNode_Type component_type, @@ -263,19 +265,17 @@ struct DepsgraphRelationBuilder void build_mask(Mask *mask); void build_movieclip(MovieClip *clip); void build_lightprobe(LightProbe *probe); + void build_speaker(Speaker *speaker); void build_nested_datablock(ID *owner, ID *id); void build_nested_nodetree(ID *owner, bNodeTree *ntree); void build_nested_shapekey(ID *owner, Key *key); void add_collision_relations(const OperationKey &key, - Scene *scene, Object *object, Collection *collection, - bool dupli, const char *name); void add_forcefield_relations(const OperationKey &key, - Scene *scene, Object *object, ParticleSystem *psys, EffectorWeights *eff, 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 b940fc3035e..f069c63f138 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 @@ -95,7 +95,7 @@ void DepsgraphRelationBuilder::build_view_layer(Scene *scene, ViewLayer *view_la * do NULL-pointer check of the base, so it's fine to pass original one. */ const int base_flag = (graph_->mode == DAG_EVAL_VIEWPORT) ? - BASE_VISIBLE_VIEWPORT : BASE_VISIBLE_RENDER; + BASE_ENABLED_VIEWPORT : BASE_ENABLED_RENDER; LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) { if (base->flag & base_flag) { build_object(base, base->object); |