2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU General Public License
4 * as published by the Free Software Foundation; either version 2
5 * of the License, or (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software Foundation,
14 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * The Original Code is Copyright (C) 2013 Blender Foundation.
17 * All rights reserved.
19 * Original Author: Joshua Leung
22 /** \file blender/depsgraph/intern/builder/deg_builder_nodes.cc
25 * Methods for constructing depsgraph's nodes
28 #include "intern/builder/deg_builder_nodes.h"
33 #include "MEM_guardedalloc.h"
35 #include "BLI_blenlib.h"
36 #include "BLI_string.h"
37 #include "BLI_utildefines.h"
40 #include "DNA_action_types.h"
41 #include "DNA_anim_types.h"
42 #include "DNA_armature_types.h"
43 #include "DNA_cachefile_types.h"
44 #include "DNA_camera_types.h"
45 #include "DNA_collection_types.h"
46 #include "DNA_constraint_types.h"
47 #include "DNA_curve_types.h"
48 #include "DNA_effect_types.h"
49 #include "DNA_gpencil_types.h"
50 #include "DNA_key_types.h"
51 #include "DNA_lamp_types.h"
52 #include "DNA_material_types.h"
53 #include "DNA_mask_types.h"
54 #include "DNA_mesh_types.h"
55 #include "DNA_meta_types.h"
56 #include "DNA_movieclip_types.h"
57 #include "DNA_node_types.h"
58 #include "DNA_particle_types.h"
59 #include "DNA_object_types.h"
60 #include "DNA_lightprobe_types.h"
61 #include "DNA_rigidbody_types.h"
62 #include "DNA_scene_types.h"
63 #include "DNA_speaker_types.h"
64 #include "DNA_texture_types.h"
65 #include "DNA_world_types.h"
67 #include "BKE_action.h"
68 #include "BKE_armature.h"
69 #include "BKE_animsys.h"
70 #include "BKE_collection.h"
71 #include "BKE_constraint.h"
72 #include "BKE_curve.h"
73 #include "BKE_effect.h"
74 #include "BKE_fcurve.h"
75 #include "BKE_gpencil.h"
76 #include "BKE_gpencil_modifier.h"
77 #include "BKE_idcode.h"
79 #include "BKE_lattice.h"
81 #include "BKE_material.h"
83 #include "BKE_mball.h"
84 #include "BKE_modifier.h"
85 #include "BKE_movieclip.h"
87 #include "BKE_object.h"
88 #include "BKE_particle.h"
89 #include "BKE_pointcache.h"
90 #include "BKE_rigidbody.h"
91 #include "BKE_shader_fx.h"
92 #include "BKE_sound.h"
93 #include "BKE_tracking.h"
94 #include "BKE_world.h"
96 #include "RNA_access.h"
97 #include "RNA_types.h"
100 #include "DEG_depsgraph.h"
101 #include "DEG_depsgraph_build.h"
103 #include "intern/builder/deg_builder.h"
104 #include "intern/depsgraph.h"
105 #include "intern/eval/deg_eval_copy_on_write.h"
106 #include "intern/node/deg_node.h"
107 #include "intern/node/deg_node_component.h"
108 #include "intern/node/deg_node_id.h"
109 #include "intern/node/deg_node_operation.h"
110 #include "intern/depsgraph_type.h"
116 void free_copy_on_write_datablock(void *id_info_v)
118 DepsgraphNodeBuilder::IDInfo *id_info =
119 (DepsgraphNodeBuilder::IDInfo *)id_info_v;
120 if (id_info->id_cow != NULL) {
121 deg_free_copy_on_write_datablock(id_info->id_cow);
122 MEM_freeN(id_info->id_cow);
132 /* **** General purpose functions **** */
134 DepsgraphNodeBuilder::DepsgraphNodeBuilder(Main *bmain, Depsgraph *graph)
139 view_layer_index_(-1),
141 is_parent_collection_visible_(true),
146 DepsgraphNodeBuilder::~DepsgraphNodeBuilder()
148 if (id_info_hash_ != NULL) {
149 BLI_ghash_free(id_info_hash_, NULL, free_copy_on_write_datablock);
153 IDNode *DepsgraphNodeBuilder::add_id_node(ID *id)
155 IDNode *id_node = NULL;
157 IDComponentsMask previously_visible_components_mask = 0;
158 uint32_t previous_eval_flags = 0;
159 uint64_t previous_customdata_mask = 0;
160 IDInfo *id_info = (IDInfo *)BLI_ghash_lookup(id_info_hash_, id);
161 if (id_info != NULL) {
162 id_cow = id_info->id_cow;
163 previously_visible_components_mask =
164 id_info->previously_visible_components_mask;
165 previous_eval_flags = id_info->previous_eval_flags;
166 previous_customdata_mask = id_info->previous_customdata_mask;
167 /* Tag ID info to not free the CoW ID pointer. */
168 id_info->id_cow = NULL;
170 id_node = graph_->add_id_node(id, id_cow);
171 id_node->previously_visible_components_mask =
172 previously_visible_components_mask;
173 id_node->previous_eval_flags = previous_eval_flags;
174 id_node->previous_customdata_mask = previous_customdata_mask;
175 /* Currently all ID nodes are supposed to have copy-on-write logic.
177 * NOTE: Zero number of components indicates that ID node was just created. */
178 if (BLI_ghash_len(id_node->components) == 0) {
179 ComponentNode *comp_cow =
180 id_node->add_component(NodeType::COPY_ON_WRITE);
181 OperationNode *op_cow = comp_cow->add_operation(
182 function_bind(deg_evaluate_copy_on_write, _1, id_node),
183 OperationCode::COPY_ON_WRITE,
185 graph_->operations.push_back(op_cow);
190 IDNode *DepsgraphNodeBuilder::find_id_node(ID *id)
192 return graph_->find_id_node(id);
195 TimeSourceNode *DepsgraphNodeBuilder::add_time_source()
197 return graph_->add_time_source();
200 ComponentNode *DepsgraphNodeBuilder::add_component_node(
203 const char *comp_name)
205 IDNode *id_node = add_id_node(id);
206 ComponentNode *comp_node = id_node->add_component(comp_type, comp_name);
207 comp_node->owner = id_node;
211 OperationNode *DepsgraphNodeBuilder::add_operation_node(
212 ComponentNode *comp_node,
213 const DepsEvalOperationCb& op,
214 OperationCode opcode,
218 OperationNode *op_node = comp_node->find_operation(opcode,
221 if (op_node == NULL) {
222 op_node = comp_node->add_operation(op, opcode, name, name_tag);
223 graph_->operations.push_back(op_node);
227 "add_operation: Operation already exists - %s has %s at %p\n",
228 comp_node->identifier().c_str(),
229 op_node->identifier().c_str(),
231 BLI_assert(!"Should not happen!");
236 OperationNode *DepsgraphNodeBuilder::add_operation_node(
239 const char *comp_name,
240 const DepsEvalOperationCb& op,
241 OperationCode opcode,
245 ComponentNode *comp_node = add_component_node(id, comp_type, comp_name);
246 return add_operation_node(comp_node, op, opcode, name, name_tag);
249 OperationNode *DepsgraphNodeBuilder::add_operation_node(
252 const DepsEvalOperationCb& op,
253 OperationCode opcode,
257 return add_operation_node(id,
266 OperationNode *DepsgraphNodeBuilder::ensure_operation_node(
269 const DepsEvalOperationCb& op,
270 OperationCode opcode,
274 OperationNode *operation =
275 find_operation_node(id, comp_type, opcode, name, name_tag);
276 if (operation != NULL) {
279 return add_operation_node(id, comp_type, op, opcode, name, name_tag);
282 bool DepsgraphNodeBuilder::has_operation_node(ID *id,
284 const char *comp_name,
285 OperationCode opcode,
289 return find_operation_node(id,
297 OperationNode *DepsgraphNodeBuilder::find_operation_node(
300 const char *comp_name,
301 OperationCode opcode,
305 ComponentNode *comp_node = add_component_node(id, comp_type, comp_name);
306 return comp_node->find_operation(opcode, name, name_tag);
309 OperationNode *DepsgraphNodeBuilder::find_operation_node(
312 OperationCode opcode,
316 return find_operation_node(id, comp_type, "", opcode, name, name_tag);
319 ID *DepsgraphNodeBuilder::get_cow_id(const ID *id_orig) const
321 return graph_->get_cow_id(id_orig);
324 ID *DepsgraphNodeBuilder::ensure_cow_id(ID *id_orig)
326 if (id_orig->tag & LIB_TAG_COPIED_ON_WRITE) {
327 /* ID is already remapped to copy-on-write. */
330 IDNode *id_node = add_id_node(id_orig);
331 return id_node->id_cow;
334 /* **** Build functions for entity nodes **** */
336 void DepsgraphNodeBuilder::begin_build()
338 /* Store existing copy-on-write versions of datablock, so we can re-use
339 * them for new ID nodes. */
340 id_info_hash_ = BLI_ghash_ptr_new("Depsgraph id hash");
341 for (IDNode *id_node : graph_->id_nodes) {
342 IDInfo *id_info = (IDInfo *)MEM_mallocN(
343 sizeof(IDInfo), "depsgraph id info");
344 if (deg_copy_on_write_is_expanded(id_node->id_cow) &&
345 id_node->id_orig != id_node->id_cow)
347 id_info->id_cow = id_node->id_cow;
350 id_info->id_cow = NULL;
352 id_info->previously_visible_components_mask =
353 id_node->visible_components_mask;
354 id_info->previous_eval_flags = id_node->eval_flags;
355 id_info->previous_customdata_mask = id_node->customdata_mask;
356 BLI_ghash_insert(id_info_hash_, id_node->id_orig, id_info);
357 id_node->id_cow = NULL;
360 GSET_FOREACH_BEGIN(OperationNode *, op_node, graph_->entry_tags)
362 ComponentNode *comp_node = op_node->owner;
363 IDNode *id_node = comp_node->owner;
365 SavedEntryTag entry_tag;
366 entry_tag.id_orig = id_node->id_orig;
367 entry_tag.component_type = comp_node->type;
368 entry_tag.opcode = op_node->opcode;
369 entry_tag.name = op_node->name;
370 entry_tag.name_tag = op_node->name_tag;
371 saved_entry_tags_.push_back(entry_tag);
375 /* Make sure graph has no nodes left from previous state. */
376 graph_->clear_all_nodes();
377 graph_->operations.clear();
378 BLI_gset_clear(graph_->entry_tags, NULL);
381 void DepsgraphNodeBuilder::end_build()
383 for (const SavedEntryTag& entry_tag : saved_entry_tags_) {
384 IDNode *id_node = find_id_node(entry_tag.id_orig);
385 if (id_node == NULL) {
388 ComponentNode *comp_node =
389 id_node->find_component(entry_tag.component_type);
390 if (comp_node == NULL) {
393 OperationNode *op_node = comp_node->find_operation(entry_tag.opcode, entry_tag.name, entry_tag.name_tag);
394 if (op_node == NULL) {
397 /* Since the tag is coming from a saved copy of entry tags, this means
398 * that originally node was explicitly tagged for user update. */
399 op_node->tag_update(graph_, DEG_UPDATE_SOURCE_USER_EDIT);
403 void DepsgraphNodeBuilder::build_id(ID *id)
408 switch (GS(id->name)) {
410 build_action((bAction *)id);
413 build_armature((bArmature *)id);
416 build_camera((Camera *)id);
419 build_collection(NULL, (Collection *)id);
422 /* TODO(sergey): Get visibility from a "parent" somehow.
424 * NOTE: Using `false` visibility here should be fine, since if this
425 * driver affects on something invisible we don't really care if the
426 * driver gets evaluated (and even don't want this to force object
427 * to become visible).
429 * If this happened to be affecting visible object, then it is up to
430 * deg_graph_build_flush_visibility() to ensure visibility of the
432 build_object(-1, (Object *)id, DEG_ID_LINKED_INDIRECTLY, false);
435 build_shapekeys((Key *)id);
438 build_lamp((Lamp *)id);
441 build_lightprobe((LightProbe *)id);
444 build_nodetree((bNodeTree *)id);
447 build_material((Material *)id);
450 build_texture((Tex *)id);
453 build_image((Image *)id);
456 build_world((World *)id);
459 build_mask((Mask *)id);
462 build_movieclip((MovieClip *)id);
468 /* TODO(sergey): Get visibility from a "parent" somehow.
470 * NOTE: Similarly to above, we don't want false-positives on
472 build_object_data_geometry_datablock(id, false);
475 build_speaker((Speaker *)id);
478 /* Not a part of dependency graph. */
481 build_cachefile((CacheFile *)id);
484 fprintf(stderr, "Unhandled ID %s\n", id->name);
485 BLI_assert(!"Should never happen");
490 void DepsgraphNodeBuilder::build_collection(
491 LayerCollection *from_layer_collection,
492 Collection *collection)
494 const int restrict_flag = (graph_->mode == DAG_EVAL_VIEWPORT)
495 ? COLLECTION_RESTRICT_VIEW
496 : COLLECTION_RESTRICT_RENDER;
497 const bool is_collection_restricted = (collection->flag & restrict_flag);
498 const bool is_collection_visible =
499 !is_collection_restricted && is_parent_collection_visible_;
501 if (built_map_.checkIsBuiltAndTag(collection)) {
502 id_node = find_id_node(&collection->id);
503 if (is_collection_visible &&
504 id_node->is_directly_visible == false &&
505 id_node->is_collection_fully_expanded == true)
507 /* Collection became visible, make sure nested collections and
508 * objects are poked with the new visibility flag, since they
509 * might become visible too. */
516 /* Collection itself. */
517 id_node = add_id_node(&collection->id);
518 id_node->is_directly_visible = is_collection_visible;
520 if (from_layer_collection != NULL) {
521 /* If we came from layer collection we don't go deeper, view layer
522 * builder takes care of going deeper. */
526 Collection *current_state_collection = collection_;
527 const bool is_current_parent_collection_visible =
528 is_parent_collection_visible_;
529 /* Modify state as we've entered new collection/ */
530 collection_ = collection;
531 is_parent_collection_visible_ = is_collection_visible;
532 /* Build collection objects. */
533 LISTBASE_FOREACH (CollectionObject *, cob, &collection->gobject) {
535 -1, cob->ob, DEG_ID_LINKED_INDIRECTLY, is_collection_visible);
537 /* Build child collections. */
538 LISTBASE_FOREACH (CollectionChild *, child, &collection->children) {
539 build_collection(NULL, child->collection);
542 collection_ = current_state_collection;
543 is_parent_collection_visible_ = is_current_parent_collection_visible;
544 id_node->is_collection_fully_expanded = true;
547 void DepsgraphNodeBuilder::build_object(int base_index,
549 eDepsNode_LinkedState_Type linked_state,
552 const bool has_object = built_map_.checkIsBuiltAndTag(object);
553 /* Skip rest of components if the ID node was already there. */
555 IDNode *id_node = find_id_node(&object->id);
556 /* We need to build some extra stuff if object becomes linked
558 if (id_node->linked_state == DEG_ID_LINKED_INDIRECTLY) {
559 build_object_flags(base_index, object, linked_state);
561 id_node->linked_state = max(id_node->linked_state, linked_state);
562 if (id_node->linked_state == DEG_ID_LINKED_DIRECTLY) {
563 id_node->is_directly_visible |= is_visible;
567 /* Create ID node for object and begin init. */
568 IDNode *id_node = add_id_node(&object->id);
569 Object *object_cow = get_cow_datablock(object);
570 id_node->linked_state = linked_state;
571 if (object == scene_->camera) {
572 id_node->is_directly_visible = true;
575 id_node->is_directly_visible = is_visible;
577 /* Various flags, flushing from bases/collections. */
578 build_object_flags(base_index, object, linked_state);
580 build_object_transform(object);
582 if (object->parent != NULL) {
584 -1, object->parent, DEG_ID_LINKED_INDIRECTLY, is_visible);
587 if (object->modifiers.first != NULL) {
588 BuilderWalkUserData data;
590 data.is_parent_visible = is_visible;
591 modifiers_foreachIDLink(object, modifier_walk, &data);
593 /* Grease Pencil Modifiers. */
594 if (object->greasepencil_modifiers.first != NULL) {
595 BuilderWalkUserData data;
597 data.is_parent_visible = is_visible;
598 BKE_gpencil_modifiers_foreachIDLink(object, modifier_walk, &data);
601 if (object->shader_fx.first != NULL) {
602 BuilderWalkUserData data;
604 data.is_parent_visible = is_visible;
605 BKE_shaderfx_foreachIDLink(object, modifier_walk, &data);
608 if (object->constraints.first != NULL) {
609 BuilderWalkUserData data;
611 data.is_parent_visible = is_visible;
612 BKE_constraints_id_loop(&object->constraints, constraint_walk, &data);
615 build_object_data(object, is_visible);
616 /* Build animation data,
618 * Do it now because it's possible object data will affect
619 * on object's level animation, for example in case of rebuilding
621 OperationNode *op_node = add_operation_node(&object->id,
622 NodeType::PARAMETERS,
624 OperationCode::PARAMETERS_EVAL);
625 op_node->set_as_exit();
626 build_animdata(&object->id);
627 /* Particle systems. */
628 if (object->particlesystem.first != NULL) {
629 build_particle_systems(object, is_visible);
631 /* Proxy object to copy from. */
632 if (object->proxy_from != NULL) {
634 -1, object->proxy_from, DEG_ID_LINKED_INDIRECTLY, is_visible);
636 if (object->proxy_group != NULL) {
638 -1, object->proxy_group, DEG_ID_LINKED_INDIRECTLY, is_visible);
640 /* Object dupligroup. */
641 if (object->dup_group != NULL) {
642 const bool is_current_parent_collection_visible =
643 is_parent_collection_visible_;
644 is_parent_collection_visible_ = is_visible;
645 build_collection(NULL, object->dup_group);
646 is_parent_collection_visible_ = is_current_parent_collection_visible;
647 add_operation_node(&object->id,
650 OperationCode::DUPLI);
652 /* Syncronization back to original object. */
653 add_operation_node(&object->id,
654 NodeType::SYNCHRONIZATION,
655 function_bind(BKE_object_synchronize_to_original,
658 OperationCode::SYNCHRONIZE_TO_ORIGINAL);
661 void DepsgraphNodeBuilder::build_object_flags(
664 eDepsNode_LinkedState_Type linked_state)
666 if (base_index == -1) {
669 Scene *scene_cow = get_cow_datablock(scene_);
670 Object *object_cow = get_cow_datablock(object);
671 const bool is_from_set = (linked_state == DEG_ID_LINKED_VIA_SET);
672 /* TODO(sergey): Is this really best component to be used? */
673 add_operation_node(&object->id,
674 NodeType::OBJECT_FROM_LAYER,
675 function_bind(BKE_object_eval_flush_base_flags,
679 object_cow, base_index,
681 OperationCode::OBJECT_BASE_FLAGS);
684 void DepsgraphNodeBuilder::build_object_data(
685 Object *object, bool is_object_visible)
687 if (object->data == NULL) {
690 /* type-specific data. */
691 switch (object->type) {
699 build_object_data_geometry(object, is_object_visible);
702 if (ID_IS_LINKED(object) && object->proxy_from != NULL) {
703 build_proxy_rig(object);
706 build_rig(object, is_object_visible);
710 build_object_data_lamp(object);
713 build_object_data_camera(object);
716 build_object_data_lightprobe(object);
719 build_object_data_speaker(object);
723 ID *obdata = (ID *)object->data;
724 if (built_map_.checkIsBuilt(obdata) == 0) {
725 build_animdata(obdata);
732 void DepsgraphNodeBuilder::build_object_data_camera(Object *object)
734 Camera *camera = (Camera *)object->data;
735 build_camera(camera);
738 void DepsgraphNodeBuilder::build_object_data_lamp(Object *object)
740 Lamp *lamp = (Lamp *)object->data;
744 void DepsgraphNodeBuilder::build_object_data_lightprobe(Object *object)
746 LightProbe *probe = (LightProbe *)object->data;
747 build_lightprobe(probe);
748 add_operation_node(&object->id,
749 NodeType::PARAMETERS,
751 OperationCode::LIGHT_PROBE_EVAL);
754 void DepsgraphNodeBuilder::build_object_data_speaker(Object *object)
756 Speaker *speaker = (Speaker *)object->data;
757 build_speaker(speaker);
758 add_operation_node(&object->id,
759 NodeType::PARAMETERS,
761 OperationCode::SPEAKER_EVAL);
764 void DepsgraphNodeBuilder::build_object_transform(Object *object)
766 OperationNode *op_node;
767 Object *ob_cow = get_cow_datablock(object);
769 /* local transforms (from transform channels - loc/rot/scale + deltas) */
770 op_node = add_operation_node(&object->id, NodeType::TRANSFORM,
771 function_bind(BKE_object_eval_local_transform,
774 OperationCode::TRANSFORM_LOCAL);
775 op_node->set_as_entry();
778 if (object->parent != NULL) {
779 add_operation_node(&object->id, NodeType::TRANSFORM,
780 function_bind(BKE_object_eval_parent,
783 OperationCode::TRANSFORM_PARENT);
786 /* object constraints */
787 if (object->constraints.first != NULL) {
788 build_object_constraints(object);
791 /* Rest of transformation update. */
792 add_operation_node(&object->id, NodeType::TRANSFORM,
793 function_bind(BKE_object_eval_uber_transform,
796 OperationCode::TRANSFORM_OBJECT_UBEREVAL);
798 /* object transform is done */
799 op_node = add_operation_node(&object->id, NodeType::TRANSFORM,
800 function_bind(BKE_object_eval_transform_final,
803 OperationCode::TRANSFORM_FINAL);
804 op_node->set_as_exit();
808 * Constraints Graph Notes
810 * For constraints, we currently only add a operation node to the Transform
811 * or Bone components (depending on whichever type of owner we have).
812 * This represents the entire constraints stack, which is for now just
813 * executed as a single monolithic block. At least initially, this should
814 * be sufficient for ensuring that the porting/refactoring process remains
817 * However, when the time comes for developing "node-based" constraints,
818 * we'll need to split this up into pre/post nodes for "constraint stack
819 * evaluation" + operation nodes for each constraint (i.e. the contents
820 * of the loop body used in the current "solve_constraints()" operation).
822 * -- Aligorith, August 2013
824 void DepsgraphNodeBuilder::build_object_constraints(Object *object)
826 /* create node for constraint stack */
827 add_operation_node(&object->id, NodeType::TRANSFORM,
828 function_bind(BKE_object_eval_constraints,
830 get_cow_datablock(scene_),
831 get_cow_datablock(object)),
832 OperationCode::TRANSFORM_CONSTRAINTS);
835 void DepsgraphNodeBuilder::build_object_pointcache(Object *object)
837 if (!BKE_ptcache_object_has(scene_, object, 0)) {
840 Scene *scene_cow = get_cow_datablock(scene_);
841 Object *object_cow = get_cow_datablock(object);
842 add_operation_node(&object->id,
843 NodeType::POINT_CACHE,
844 function_bind(BKE_object_eval_ptcache_reset,
848 OperationCode::POINT_CACHE_RESET);
852 * Build graph nodes for AnimData block
853 * \param id: ID-Block which hosts the AnimData
855 void DepsgraphNodeBuilder::build_animdata(ID *id)
857 AnimData *adt = BKE_animdata_from_id(id);
861 if (adt->action != NULL) {
862 build_action(adt->action);
865 if (adt->action || adt->nla_tracks.first || adt->drivers.first) {
866 (void) add_id_node(id);
867 ID *id_cow = get_cow_id(id);
869 // XXX: Hook up specific update callbacks for special properties which
872 /* actions and NLA - as a single unit for now, as it gets complicated to
873 * schedule otherwise. */
874 if ((adt->action) || (adt->nla_tracks.first)) {
875 /* create the node */
876 add_operation_node(id, NodeType::ANIMATION,
877 function_bind(BKE_animsys_eval_animdata,
880 OperationCode::ANIMATION,
883 /* TODO: for each channel affected, we might also want to add some
884 * support for running RNA update callbacks on them
885 * (which will be needed for proper handling of drivers later) */
888 /* NLA strips contain actions */
889 LISTBASE_FOREACH (NlaTrack *, nlt, &adt->nla_tracks) {
890 build_animdata_nlastrip_targets(&nlt->strips);
894 int driver_index = 0;
895 LISTBASE_FOREACH (FCurve *, fcu, &adt->drivers) {
897 build_driver(id, fcu, driver_index++);
902 void DepsgraphNodeBuilder::build_animdata_nlastrip_targets(ListBase *strips)
904 LISTBASE_FOREACH (NlaStrip *, strip, strips) {
905 if (strip->act != NULL) {
906 build_action(strip->act);
908 else if (strip->strips.first != NULL) {
909 build_animdata_nlastrip_targets(&strip->strips);
914 void DepsgraphNodeBuilder::build_action(bAction *action)
916 if (built_map_.checkIsBuiltAndTag(action)) {
919 add_operation_node(&action->id,
922 OperationCode::ANIMATION);
926 * Build graph node(s) for Driver
927 * \param id: ID-Block that driver is attached to
928 * \param fcu: Driver-FCurve
929 * \param driver_index: Index in animation data drivers list
931 void DepsgraphNodeBuilder::build_driver(ID *id, FCurve *fcurve, int driver_index)
933 /* Create data node for this driver */
934 ID *id_cow = get_cow_id(id);
935 ChannelDriver *driver_orig = fcurve->driver;
937 /* TODO(sergey): ideally we could pass the COW of fcu, but since it
938 * has not yet been allocated at this point we can't. As a workaround
939 * the animation systems allocates an array so we can do a fast lookup
940 * with the driver index. */
941 ensure_operation_node(id,
942 NodeType::PARAMETERS,
943 function_bind(BKE_animsys_eval_driver, _1, id_cow, driver_index, driver_orig),
944 OperationCode::DRIVER,
945 fcurve->rna_path ? fcurve->rna_path : "",
946 fcurve->array_index);
947 build_driver_variables(id, fcurve);
950 void DepsgraphNodeBuilder::build_driver_variables(ID * id, FCurve *fcurve)
952 build_driver_id_property(id, fcurve->rna_path);
953 LISTBASE_FOREACH (DriverVar *, dvar, &fcurve->driver->variables) {
954 DRIVER_TARGETS_USED_LOOPER_BEGIN(dvar)
956 if (dtar->id == NULL) {
960 build_driver_id_property(dtar->id, dtar->rna_path);
961 /* Corresponds to dtar_id_ensure_proxy_from(). */
962 if ((GS(dtar->id->name) == ID_OB) &&
963 (((Object *)dtar->id)->proxy_from != NULL))
965 Object *proxy_from = ((Object *)dtar->id)->proxy_from;
966 build_id(&proxy_from->id);
967 build_driver_id_property(&proxy_from->id, dtar->rna_path);
970 DRIVER_TARGETS_LOOPER_END;
974 void DepsgraphNodeBuilder::build_driver_id_property(ID *id,
975 const char *rna_path)
977 if (id == NULL || rna_path == NULL) {
980 PointerRNA id_ptr, ptr;
982 RNA_id_pointer_create(id, &id_ptr);
983 if (!RNA_path_resolve_full(&id_ptr, rna_path, &ptr, &prop, NULL)) {
989 if (!RNA_property_is_idprop(prop)) {
992 const char *prop_identifier = RNA_property_identifier((PropertyRNA *)prop);
993 ensure_operation_node(id,
994 NodeType::PARAMETERS,
996 OperationCode::ID_PROPERTY,
1000 /* Recursively build graph for world */
1001 void DepsgraphNodeBuilder::build_world(World *world)
1003 if (built_map_.checkIsBuiltAndTag(world)) {
1007 add_id_node(&world->id);
1008 World *world_cow = get_cow_datablock(world);
1009 /* Shading update. */
1010 add_operation_node(&world->id,
1012 function_bind(BKE_world_eval,
1015 OperationCode::WORLD_UPDATE);
1017 build_animdata(&world->id);
1018 /* World's nodetree. */
1019 build_nodetree(world->nodetree);
1022 /* Rigidbody Simulation - Scene Level */
1023 void DepsgraphNodeBuilder::build_rigidbody(Scene *scene)
1025 RigidBodyWorld *rbw = scene->rigidbody_world;
1026 Scene *scene_cow = get_cow_datablock(scene);
1029 * Rigidbody Simulation Nodes
1030 * ==========================
1032 * There are 3 nodes related to Rigidbody Simulation:
1033 * 1) "Initialize/Rebuild World" - this is called sparingly, only when the
1034 * simulation needs to be rebuilt (mainly after file reload, or moving
1035 * back to start frame)
1036 * 2) "Do Simulation" - perform a simulation step - interleaved between the
1037 * evaluation steps for clusters of objects (i.e. between those affected
1038 * and/or not affected by the sim for instance).
1040 * 3) "Pull Results" - grab the specific transforms applied for a specific
1041 * object - performed as part of object's transform-stack building. */
1043 /* Create nodes --------------------------------------------------------- */
1045 /* XXX: is this the right component, or do we want to use another one
1048 /* Init/rebuild operation. */
1049 add_operation_node(&scene->id, NodeType::TRANSFORM,
1050 function_bind(BKE_rigidbody_rebuild_sim, _1, scene_cow),
1051 OperationCode::RIGIDBODY_REBUILD);
1052 /* Do-sim operation. */
1053 OperationNode *sim_node = add_operation_node(
1054 &scene->id, NodeType::TRANSFORM,
1055 function_bind(BKE_rigidbody_eval_simulation, _1, scene_cow),
1056 OperationCode::RIGIDBODY_SIM);
1057 sim_node->set_as_entry();
1058 sim_node->set_as_exit();
1059 sim_node->owner->entry_operation = sim_node;
1060 /* Objects - simulation participants. */
1061 if (rbw->group != NULL) {
1062 build_collection(NULL, rbw->group);
1063 FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(rbw->group, object)
1065 if (object->type != OB_MESH) {
1068 /* 2) create operation for flushing results */
1069 /* object's transform component - where the rigidbody operation
1071 add_operation_node(&object->id, NodeType::TRANSFORM,
1073 BKE_rigidbody_object_sync_transforms,
1076 get_cow_datablock(object)),
1077 OperationCode::RIGIDBODY_TRANSFORM_COPY);
1079 FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
1082 if (rbw->constraints != NULL) {
1083 FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(rbw->constraints, object)
1085 RigidBodyCon *rbc = object->rigidbody_constraint;
1086 if (rbc == NULL || rbc->ob1 == NULL || rbc->ob2 == NULL) {
1087 /* When either ob1 or ob2 is NULL, the constraint doesn't work. */
1090 /* Make sure indirectly linked objects are fully built. */
1091 build_object(-1, object, DEG_ID_LINKED_INDIRECTLY, false);
1092 build_object(-1, rbc->ob1, DEG_ID_LINKED_INDIRECTLY, false);
1093 build_object(-1, rbc->ob2, DEG_ID_LINKED_INDIRECTLY, false);
1095 FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
1099 void DepsgraphNodeBuilder::build_particle_systems(Object *object,
1100 bool is_object_visible)
1103 * Particle Systems Nodes
1104 * ======================
1106 * There are two types of nodes associated with representing
1108 * 1) Component (EVAL_PARTICLES) - This is the particle-system
1109 * evaluation context for an object. It acts as the container
1110 * for all the nodes associated with a particular set of particle
1112 * 2) Particle System Eval Operation - This operation node acts as a
1113 * blackbox evaluation step for one particle system referenced by
1114 * the particle systems stack. All dependencies link to this operation. */
1115 /* Component for all particle systems. */
1116 ComponentNode *psys_comp =
1117 add_component_node(&object->id, NodeType::PARTICLE_SYSTEM);
1119 Object *ob_cow = get_cow_datablock(object);
1120 OperationNode *op_node;
1121 op_node = add_operation_node(psys_comp,
1122 function_bind(BKE_particle_system_eval_init,
1125 OperationCode::PARTICLE_SYSTEM_INIT);
1126 op_node->set_as_entry();
1127 /* Build all particle systems. */
1128 LISTBASE_FOREACH (ParticleSystem *, psys, &object->particlesystem) {
1129 ParticleSettings *part = psys->part;
1130 /* Build particle settings operations.
1132 * NOTE: The call itself ensures settings are only build once. */
1133 build_particle_settings(part);
1134 /* Particle system evaluation. */
1135 add_operation_node(psys_comp,
1137 OperationCode::PARTICLE_SYSTEM_EVAL,
1139 /* Keyed particle targets. */
1140 if (part->phystype == PART_PHYS_KEYED) {
1141 LISTBASE_FOREACH (ParticleTarget *, particle_target, &psys->targets) {
1142 if (particle_target->ob == NULL ||
1143 particle_target->ob == object)
1148 particle_target->ob,
1149 DEG_ID_LINKED_INDIRECTLY,
1153 /* Visualization of particle system. */
1154 switch (part->ren_as) {
1156 if (part->dup_ob != NULL) {
1159 DEG_ID_LINKED_INDIRECTLY,
1164 if (part->dup_group != NULL) {
1165 build_collection(NULL, part->dup_group);
1170 op_node = add_operation_node(psys_comp,
1172 OperationCode::PARTICLE_SYSTEM_DONE);
1173 op_node->set_as_exit();
1176 void DepsgraphNodeBuilder::build_particle_settings(
1177 ParticleSettings *particle_settings) {
1178 if (built_map_.checkIsBuiltAndTag(particle_settings)) {
1181 /* Make sure we've got proper copied ID pointer. */
1182 add_id_node(&particle_settings->id);
1183 ParticleSettings *particle_settings_cow =
1184 get_cow_datablock(particle_settings);
1185 /* Animation data. */
1186 build_animdata(&particle_settings->id);
1187 /* Parameters change. */
1188 OperationNode *op_node;
1189 op_node = add_operation_node(&particle_settings->id,
1190 NodeType::PARTICLE_SETTINGS,
1192 OperationCode::PARTICLE_SETTINGS_INIT);
1193 op_node->set_as_entry();
1194 add_operation_node(&particle_settings->id,
1195 NodeType::PARTICLE_SETTINGS,
1196 function_bind(BKE_particle_settings_eval_reset,
1198 particle_settings_cow),
1199 OperationCode::PARTICLE_SETTINGS_RESET);
1200 op_node = add_operation_node(&particle_settings->id,
1201 NodeType::PARTICLE_SETTINGS,
1203 OperationCode::PARTICLE_SETTINGS_EVAL);
1204 op_node->set_as_exit();
1205 /* Texture slots. */
1206 for (int mtex_index = 0; mtex_index < MAX_MTEX; ++mtex_index) {
1207 MTex *mtex = particle_settings->mtex[mtex_index];
1208 if (mtex == NULL || mtex->tex == NULL) {
1211 build_texture(mtex->tex);
1216 void DepsgraphNodeBuilder::build_shapekeys(Key *key)
1218 if (built_map_.checkIsBuiltAndTag(key)) {
1221 build_animdata(&key->id);
1222 /* This is an exit operation for the entire key datablock, is what is used
1223 * as dependency for modifiers evaluation. */
1224 add_operation_node(&key->id,
1227 OperationCode::GEOMETRY_SHAPEKEY);
1228 /* Create per-key block properties, allowing tricky inter-dependnecies for
1229 * drivers evaluation. */
1230 LISTBASE_FOREACH (KeyBlock *, key_block, &key->block) {
1231 add_operation_node(&key->id,
1232 NodeType::PARAMETERS,
1234 OperationCode::PARAMETERS_EVAL,
1239 /* ObData Geometry Evaluation */
1240 // XXX: what happens if the datablock is shared!
1241 void DepsgraphNodeBuilder::build_object_data_geometry(
1243 bool is_object_visible)
1245 OperationNode *op_node;
1246 Scene *scene_cow = get_cow_datablock(scene_);
1247 Object *object_cow = get_cow_datablock(object);
1248 /* Entry operation, takes care of initialization, and some other
1249 * relations which needs to be run prior actual geometry evaluation. */
1250 op_node = add_operation_node(&object->id,
1253 OperationCode::GEOMETRY_EVAL_INIT);
1254 op_node->set_as_entry();
1255 /* Geometry evaluation. */
1256 op_node = add_operation_node(&object->id,
1258 function_bind(BKE_object_eval_uber_data,
1262 OperationCode::GEOMETRY_EVAL);
1263 op_node->set_as_exit();
1265 if (object->totcol != 0) {
1266 if (object->type == OB_MESH) {
1267 add_operation_node(&object->id,
1269 function_bind(BKE_object_eval_update_shading,
1272 OperationCode::SHADING);
1274 for (int a = 1; a <= object->totcol; a++) {
1275 Material *ma = give_current_material(object, a);
1282 build_object_pointcache(object);
1284 build_object_data_geometry_datablock((ID *)object->data, is_object_visible);
1287 void DepsgraphNodeBuilder::build_object_data_geometry_datablock(
1289 bool is_object_visible)
1291 if (built_map_.checkIsBuiltAndTag(obdata)) {
1294 OperationNode *op_node;
1295 /* Make sure we've got an ID node before requesting CoW pointer. */
1296 (void) add_id_node((ID *)obdata);
1297 ID *obdata_cow = get_cow_id(obdata);
1299 build_animdata(obdata);
1301 Key *key = BKE_key_from_id(obdata);
1303 build_shapekeys(key);
1305 /* Nodes for result of obdata's evaluation, and geometry
1306 * evaluation on object. */
1307 const ID_Type id_type = GS(obdata->name);
1311 op_node = add_operation_node(obdata,
1313 function_bind(BKE_mesh_eval_geometry,
1315 (Mesh *)obdata_cow),
1316 OperationCode::GEOMETRY_EVAL);
1317 op_node->set_as_entry();
1322 op_node = add_operation_node(obdata,
1325 OperationCode::GEOMETRY_EVAL);
1326 op_node->set_as_entry();
1331 op_node = add_operation_node(obdata,
1333 function_bind(BKE_curve_eval_geometry,
1335 (Curve *)obdata_cow),
1336 OperationCode::GEOMETRY_EVAL);
1337 op_node->set_as_entry();
1338 /* Make sure objects used for bevel.taper are in the graph.
1339 * NOTE: This objects might be not linked to the scene. */
1340 Curve *cu = (Curve *)obdata;
1341 if (cu->bevobj != NULL) {
1344 DEG_ID_LINKED_INDIRECTLY,
1347 if (cu->taperobj != NULL) {
1350 DEG_ID_LINKED_INDIRECTLY,
1353 if (cu->textoncurve != NULL) {
1356 DEG_ID_LINKED_INDIRECTLY,
1363 op_node = add_operation_node(obdata,
1365 function_bind(BKE_lattice_eval_geometry,
1367 (Lattice *)obdata_cow),
1368 OperationCode::GEOMETRY_EVAL);
1369 op_node->set_as_entry();
1375 /* GPencil evaluation operations. */
1376 op_node = add_operation_node(obdata,
1378 function_bind(BKE_gpencil_eval_geometry,
1380 (bGPdata *)obdata_cow),
1381 OperationCode::GEOMETRY_EVAL);
1382 op_node->set_as_entry();
1386 BLI_assert(!"Should not happen");
1389 op_node = add_operation_node(obdata,
1392 OperationCode::GEOMETRY_EVAL_DONE);
1393 op_node->set_as_exit();
1394 /* Parameters for driver sources. */
1395 add_operation_node(obdata,
1396 NodeType::PARAMETERS,
1398 OperationCode::PARAMETERS_EVAL);
1400 add_operation_node(obdata,
1401 NodeType::BATCH_CACHE,
1402 function_bind(BKE_object_data_select_update,
1405 OperationCode::GEOMETRY_SELECT_UPDATE);
1408 void DepsgraphNodeBuilder::build_armature(bArmature *armature)
1410 if (built_map_.checkIsBuiltAndTag(armature)) {
1413 build_animdata(&armature->id);
1414 /* Make sure pose is up-to-date with armature updates. */
1415 add_operation_node(&armature->id,
1416 NodeType::PARAMETERS,
1418 OperationCode::PLACEHOLDER,
1422 void DepsgraphNodeBuilder::build_camera(Camera *camera)
1424 if (built_map_.checkIsBuiltAndTag(camera)) {
1427 OperationNode *op_node;
1428 build_animdata(&camera->id);
1429 op_node = add_operation_node(&camera->id,
1430 NodeType::PARAMETERS,
1432 OperationCode::PARAMETERS_EVAL);
1433 op_node->set_as_exit();
1436 void DepsgraphNodeBuilder::build_lamp(Lamp *lamp)
1438 if (built_map_.checkIsBuiltAndTag(lamp)) {
1441 OperationNode *op_node;
1442 build_animdata(&lamp->id);
1443 op_node = add_operation_node(&lamp->id,
1444 NodeType::PARAMETERS,
1446 OperationCode::PARAMETERS_EVAL);
1447 /* NOTE: We mark this node as both entry and exit. This way we have a
1448 * node to link all dependencies for shading (which includes relation to the
1449 * lamp object, and incldues relation from node tree) without adding a
1450 * dedicated component type. */
1451 op_node->set_as_entry();
1452 op_node->set_as_exit();
1453 /* lamp's nodetree */
1454 build_nodetree(lamp->nodetree);
1457 void DepsgraphNodeBuilder::build_nodetree(bNodeTree *ntree)
1459 if (ntree == NULL) {
1462 if (built_map_.checkIsBuiltAndTag(ntree)) {
1465 /* nodetree itself */
1466 add_id_node(&ntree->id);
1467 bNodeTree *ntree_cow = get_cow_datablock(ntree);
1469 build_animdata(&ntree->id);
1470 /* Shading update. */
1471 add_operation_node(&ntree->id,
1474 OperationCode::MATERIAL_UPDATE);
1475 /* NOTE: We really pass original and CoW node trees here, this is how the
1476 * callback works. Ideally we need to find a better way for that. */
1477 add_operation_node(&ntree->id,
1478 NodeType::SHADING_PARAMETERS,
1479 function_bind(BKE_nodetree_shading_params_eval,
1483 OperationCode::MATERIAL_UPDATE);
1484 /* nodetree's nodes... */
1485 LISTBASE_FOREACH (bNode *, bnode, &ntree->nodes) {
1490 ID_Type id_type = GS(id->name);
1491 if (id_type == ID_MA) {
1492 build_material((Material *)id);
1494 else if (id_type == ID_TE) {
1495 build_texture((Tex *)id);
1497 else if (id_type == ID_IM) {
1498 build_image((Image *)id);
1500 else if (id_type == ID_OB) {
1501 /* TODO(sergey): Use visibility of owner of the node tree. */
1502 build_object(-1, (Object *)id, DEG_ID_LINKED_INDIRECTLY, true);
1504 else if (id_type == ID_SCE) {
1505 /* Scenes are used by compositor trees, and handled by render
1506 * pipeline. No need to build dependencies for them here. */
1508 else if (id_type == ID_TXT) {
1509 /* Ignore script nodes. */
1511 else if (id_type == ID_MSK) {
1512 build_mask((Mask *)id);
1514 else if (id_type == ID_MC) {
1515 build_movieclip((MovieClip *)id);
1517 else if (bnode->type == NODE_GROUP) {
1518 bNodeTree *group_ntree = (bNodeTree *)id;
1519 build_nodetree(group_ntree);
1522 BLI_assert(!"Unknown ID type used for node");
1526 // TODO: link from nodetree to owner_component?
1529 /* Recursively build graph for material */
1530 void DepsgraphNodeBuilder::build_material(Material *material)
1532 if (built_map_.checkIsBuiltAndTag(material)) {
1535 /* Material itself. */
1536 add_id_node(&material->id);
1537 Material *material_cow = get_cow_datablock(material);
1538 /* Shading update. */
1539 add_operation_node(&material->id,
1541 function_bind(BKE_material_eval,
1544 OperationCode::MATERIAL_UPDATE);
1545 /* Material animation. */
1546 build_animdata(&material->id);
1547 /* Material's nodetree. */
1548 build_nodetree(material->nodetree);
1551 /* Recursively build graph for texture */
1552 void DepsgraphNodeBuilder::build_texture(Tex *texture)
1554 if (built_map_.checkIsBuiltAndTag(texture)) {
1557 /* Texture itself. */
1558 build_animdata(&texture->id);
1559 /* Texture's nodetree. */
1560 build_nodetree(texture->nodetree);
1561 /* Special cases for different IDs which texture uses. */
1562 if (texture->type == TEX_IMAGE) {
1563 if (texture->ima != NULL) {
1564 build_image(texture->ima);
1567 add_operation_node(&texture->id,
1568 NodeType::GENERIC_DATABLOCK,
1570 OperationCode::GENERIC_DATABLOCK_UPDATE);
1573 void DepsgraphNodeBuilder::build_image(Image *image) {
1574 if (built_map_.checkIsBuiltAndTag(image)) {
1577 add_operation_node(&image->id,
1578 NodeType::GENERIC_DATABLOCK,
1580 OperationCode::GENERIC_DATABLOCK_UPDATE);
1583 void DepsgraphNodeBuilder::build_compositor(Scene *scene)
1585 /* For now, just a plain wrapper? */
1586 // TODO: create compositing component?
1587 // XXX: component type undefined!
1588 //graph->get_node(&scene->id, NULL, NodeType::COMPOSITING, NULL);
1590 /* for now, nodetrees are just parameters; compositing occurs in internals
1592 add_component_node(&scene->id, NodeType::PARAMETERS);
1593 build_nodetree(scene->nodetree);
1596 void DepsgraphNodeBuilder::build_gpencil(bGPdata *gpd)
1598 if (built_map_.checkIsBuiltAndTag(gpd)) {
1601 ID *gpd_id = &gpd->id;
1603 /* TODO(sergey): what about multiple users of same datablock? This should
1604 * only get added once. */
1606 /* The main reason Grease Pencil is included here is because the animation
1607 * (and drivers) need to be hosted somewhere. */
1608 build_animdata(gpd_id);
1611 void DepsgraphNodeBuilder::build_cachefile(CacheFile *cache_file)
1613 if (built_map_.checkIsBuiltAndTag(cache_file)) {
1616 ID *cache_file_id = &cache_file->id;
1618 build_animdata(cache_file_id);
1619 /* Cache evaluation itself. */
1620 add_operation_node(cache_file_id, NodeType::CACHE, NULL,
1621 OperationCode::PLACEHOLDER, "Cache File Update");
1624 void DepsgraphNodeBuilder::build_mask(Mask *mask)
1626 if (built_map_.checkIsBuiltAndTag(mask)) {
1629 ID *mask_id = &mask->id;
1630 Mask *mask_cow = get_cow_datablock(mask);
1631 /* F-Curve based animation. */
1632 build_animdata(mask_id);
1633 /* Animation based on mask's shapes. */
1634 add_operation_node(mask_id,
1635 NodeType::ANIMATION,
1636 function_bind(BKE_mask_eval_animation, _1, mask_cow),
1637 OperationCode::MASK_ANIMATION);
1638 /* Final mask evaluation. */
1639 add_operation_node(mask_id,
1640 NodeType::PARAMETERS,
1641 function_bind(BKE_mask_eval_update, _1, mask_cow),
1642 OperationCode::MASK_EVAL);
1645 void DepsgraphNodeBuilder::build_movieclip(MovieClip *clip)
1647 if (built_map_.checkIsBuiltAndTag(clip)) {
1650 ID *clip_id = &clip->id;
1651 MovieClip *clip_cow = (MovieClip *)ensure_cow_id(clip_id);
1653 build_animdata(clip_id);
1654 /* Movie clip evaluation. */
1655 add_operation_node(clip_id,
1656 NodeType::PARAMETERS,
1657 function_bind(BKE_movieclip_eval_update, _1, clip_cow),
1658 OperationCode::MOVIECLIP_EVAL);
1660 add_operation_node(clip_id,
1661 NodeType::BATCH_CACHE,
1662 function_bind(BKE_movieclip_eval_selection_update, _1, clip_cow),
1663 OperationCode::MOVIECLIP_SELECT_UPDATE);
1666 void DepsgraphNodeBuilder::build_lightprobe(LightProbe *probe)
1668 if (built_map_.checkIsBuiltAndTag(probe)) {
1671 /* Placeholder so we can add relations and tag ID node for update. */
1672 add_operation_node(&probe->id,
1673 NodeType::PARAMETERS,
1675 OperationCode::LIGHT_PROBE_EVAL);
1677 build_animdata(&probe->id);
1680 void DepsgraphNodeBuilder::build_speaker(Speaker *speaker)
1682 if (built_map_.checkIsBuiltAndTag(speaker)) {
1685 /* Placeholder so we can add relations and tag ID node for update. */
1686 add_operation_node(&speaker->id,
1687 NodeType::PARAMETERS,
1689 OperationCode::SPEAKER_EVAL);
1690 build_animdata(&speaker->id);
1693 /* **** ID traversal callbacks functions **** */
1695 void DepsgraphNodeBuilder::modifier_walk(void *user_data,
1696 struct Object * /*object*/,
1700 BuilderWalkUserData *data = (BuilderWalkUserData *)user_data;
1705 switch (GS(id->name)) {
1707 /* Special case for object, so we take owner visibility into
1709 data->builder->build_object(-1,
1711 DEG_ID_LINKED_INDIRECTLY,
1712 data->is_parent_visible);
1715 data->builder->build_id(id);
1720 void DepsgraphNodeBuilder::constraint_walk(bConstraint * /*con*/,
1722 bool /*is_reference*/,
1725 BuilderWalkUserData *data = (BuilderWalkUserData *)user_data;
1730 switch (GS(id->name)) {
1732 /* Special case for object, so we take owner visibility into
1734 data->builder->build_object(-1,
1736 DEG_ID_LINKED_INDIRECTLY,
1737 data->is_parent_visible);
1740 data->builder->build_id(id);