Changeset View
Changeset View
Standalone View
Standalone View
source/blender/depsgraph/intern/builder/deg_builder_relations.cc
| Show First 20 Lines • Show All 320 Lines • ▼ Show 20 Lines | |||||
| void DepsgraphRelationBuilder::add_customdata_mask(Object *object, | void DepsgraphRelationBuilder::add_customdata_mask(Object *object, | ||||
| const DEGCustomDataMeshMasks &customdata_masks) | const DEGCustomDataMeshMasks &customdata_masks) | ||||
| { | { | ||||
| if (customdata_masks != DEGCustomDataMeshMasks() && object != nullptr && | if (customdata_masks != DEGCustomDataMeshMasks() && object != nullptr && | ||||
| object->type == OB_MESH) { | object->type == OB_MESH) { | ||||
| IDNode *id_node = graph_->find_id_node(&object->id); | IDNode *id_node = graph_->find_id_node(&object->id); | ||||
| if (id_node == nullptr) { | if (id_node == nullptr) { | ||||
| BLI_assert(!"ID should always be valid"); | BLI_assert_msg(0, "ID should always be valid"); | ||||
| } | } | ||||
| else { | else { | ||||
| id_node->customdata_masks |= customdata_masks; | id_node->customdata_masks |= customdata_masks; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| void DepsgraphRelationBuilder::add_special_eval_flag(ID *id, uint32_t flag) | void DepsgraphRelationBuilder::add_special_eval_flag(ID *id, uint32_t flag) | ||||
| { | { | ||||
| IDNode *id_node = graph_->find_id_node(id); | IDNode *id_node = graph_->find_id_node(id); | ||||
| if (id_node == nullptr) { | if (id_node == nullptr) { | ||||
| BLI_assert(!"ID should always be valid"); | BLI_assert_msg(0, "ID should always be valid"); | ||||
| } | } | ||||
| else { | else { | ||||
| id_node->eval_flags |= flag; | id_node->eval_flags |= flag; | ||||
| } | } | ||||
| } | } | ||||
| Relation *DepsgraphRelationBuilder::add_time_relation(TimeSourceNode *timesrc, | Relation *DepsgraphRelationBuilder::add_time_relation(TimeSourceNode *timesrc, | ||||
| Node *node_to, | Node *node_to, | ||||
| ▲ Show 20 Lines • Show All 292 Lines • ▼ Show 20 Lines | LISTBASE_FOREACH (CollectionObject *, cob, &collection->gobject) { | ||||
| /* The geometry of a collection depends on the positions of the elements in it. */ | /* The geometry of a collection depends on the positions of the elements in it. */ | ||||
| OperationKey object_transform_key{ | OperationKey object_transform_key{ | ||||
| &cob->ob->id, NodeType::TRANSFORM, OperationCode::TRANSFORM_FINAL}; | &cob->ob->id, NodeType::TRANSFORM, OperationCode::TRANSFORM_FINAL}; | ||||
| add_relation(object_transform_key, collection_geometry_key, "Collection Geometry"); | add_relation(object_transform_key, collection_geometry_key, "Collection Geometry"); | ||||
| /* Only create geometry relations to child objects, if they have a geometry component. */ | /* Only create geometry relations to child objects, if they have a geometry component. */ | ||||
| OperationKey object_geometry_key{ | OperationKey object_geometry_key{ | ||||
| &cob->ob->id, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL_INIT}; | &cob->ob->id, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL}; | ||||
| if (find_node(object_geometry_key) != nullptr) { | if (find_node(object_geometry_key) != nullptr) { | ||||
| add_relation(object_geometry_key, collection_geometry_key, "Collection Geometry"); | add_relation(object_geometry_key, collection_geometry_key, "Collection Geometry"); | ||||
| } | } | ||||
| /* An instance is part of the geometry of the collection. */ | /* An instance is part of the geometry of the collection. */ | ||||
| if (cob->ob->type == OB_EMPTY) { | if (cob->ob->type == OB_EMPTY) { | ||||
| Collection *collection_instance = cob->ob->instance_collection; | Collection *collection_instance = cob->ob->instance_collection; | ||||
| if (collection_instance != nullptr) { | if (collection_instance != nullptr) { | ||||
| ▲ Show 20 Lines • Show All 434 Lines • ▼ Show 20 Lines | if (ptcache_id->type == PTCACHE_TYPE_RIGIDBODY) { | ||||
| &scene_->id, NodeType::TRANSFORM, OperationCode::RIGIDBODY_REBUILD); | &scene_->id, NodeType::TRANSFORM, OperationCode::RIGIDBODY_REBUILD); | ||||
| add_relation(rigidbody_rebuild_key, | add_relation(rigidbody_rebuild_key, | ||||
| point_cache_key, | point_cache_key, | ||||
| "Rigid Body Rebuild -> Point Cache Reset", | "Rigid Body Rebuild -> Point Cache Reset", | ||||
| RELATION_FLAG_FLUSH_USER_EDIT_ONLY); | RELATION_FLAG_FLUSH_USER_EDIT_ONLY); | ||||
| } | } | ||||
| else { | else { | ||||
| flag = FLAG_GEOMETRY; | flag = FLAG_GEOMETRY; | ||||
| OperationKey geometry_key( | OperationKey geometry_key(&object->id, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL); | ||||
| &object->id, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL_INIT); | |||||
| add_relation(point_cache_key, geometry_key, "Point Cache -> Geometry"); | add_relation(point_cache_key, geometry_key, "Point Cache -> Geometry"); | ||||
| } | } | ||||
| BLI_assert(flag != -1); | BLI_assert(flag != -1); | ||||
| /* Tag that we did handle that component. */ | /* Tag that we did handle that component. */ | ||||
| handled_components |= flag; | handled_components |= flag; | ||||
| if (handled_components == FLAG_ALL) { | if (handled_components == FLAG_ALL) { | ||||
| break; | break; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 753 Lines • ▼ Show 20 Lines | if (rbw->group != nullptr) { | ||||
| } | } | ||||
| FOREACH_COLLECTION_OBJECT_RECURSIVE_END; | FOREACH_COLLECTION_OBJECT_RECURSIVE_END; | ||||
| } | } | ||||
| } | } | ||||
| void DepsgraphRelationBuilder::build_particle_systems(Object *object) | void DepsgraphRelationBuilder::build_particle_systems(Object *object) | ||||
| { | { | ||||
| TimeSourceKey time_src_key; | TimeSourceKey time_src_key; | ||||
| OperationKey obdata_ubereval_key( | OperationKey obdata_ubereval_key(&object->id, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL); | ||||
| &object->id, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL_INIT); | |||||
| OperationKey eval_init_key( | OperationKey eval_init_key( | ||||
| &object->id, NodeType::PARTICLE_SYSTEM, OperationCode::PARTICLE_SYSTEM_INIT); | &object->id, NodeType::PARTICLE_SYSTEM, OperationCode::PARTICLE_SYSTEM_INIT); | ||||
| OperationKey eval_done_key( | OperationKey eval_done_key( | ||||
| &object->id, NodeType::PARTICLE_SYSTEM, OperationCode::PARTICLE_SYSTEM_DONE); | &object->id, NodeType::PARTICLE_SYSTEM, OperationCode::PARTICLE_SYSTEM_DONE); | ||||
| ComponentKey eval_key(&object->id, NodeType::PARTICLE_SYSTEM); | ComponentKey eval_key(&object->id, NodeType::PARTICLE_SYSTEM); | ||||
| if (BKE_ptcache_object_has(scene_, object, 0)) { | if (BKE_ptcache_object_has(scene_, object, 0)) { | ||||
| ComponentKey point_cache_key(&object->id, NodeType::POINT_CACHE); | ComponentKey point_cache_key(&object->id, NodeType::POINT_CACHE); | ||||
| add_relation( | add_relation( | ||||
| ▲ Show 20 Lines • Show All 131 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| void DepsgraphRelationBuilder::build_particle_system_visualization_object(Object *object, | void DepsgraphRelationBuilder::build_particle_system_visualization_object(Object *object, | ||||
| ParticleSystem *psys, | ParticleSystem *psys, | ||||
| Object *draw_object) | Object *draw_object) | ||||
| { | { | ||||
| OperationKey psys_key( | OperationKey psys_key( | ||||
| &object->id, NodeType::PARTICLE_SYSTEM, OperationCode::PARTICLE_SYSTEM_EVAL, psys->name); | &object->id, NodeType::PARTICLE_SYSTEM, OperationCode::PARTICLE_SYSTEM_EVAL, psys->name); | ||||
| OperationKey obdata_ubereval_key( | OperationKey obdata_ubereval_key(&object->id, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL); | ||||
| &object->id, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL_INIT); | |||||
| ComponentKey dup_ob_key(&draw_object->id, NodeType::TRANSFORM); | ComponentKey dup_ob_key(&draw_object->id, NodeType::TRANSFORM); | ||||
| add_relation(dup_ob_key, psys_key, "Particle Object Visualization"); | add_relation(dup_ob_key, psys_key, "Particle Object Visualization"); | ||||
| if (draw_object->type == OB_MBALL) { | if (draw_object->type == OB_MBALL) { | ||||
| ComponentKey dup_geometry_key(&draw_object->id, NodeType::GEOMETRY); | ComponentKey dup_geometry_key(&draw_object->id, NodeType::GEOMETRY); | ||||
| add_relation(obdata_ubereval_key, dup_geometry_key, "Particle MBall Visualization"); | add_relation(obdata_ubereval_key, dup_geometry_key, "Particle MBall Visualization"); | ||||
| } | } | ||||
| } | } | ||||
| Show All 40 Lines | |||||
| void DepsgraphRelationBuilder::build_object_data_geometry(Object *object) | void DepsgraphRelationBuilder::build_object_data_geometry(Object *object) | ||||
| { | { | ||||
| ID *obdata = (ID *)object->data; | ID *obdata = (ID *)object->data; | ||||
| /* Init operation of object-level geometry evaluation. */ | /* Init operation of object-level geometry evaluation. */ | ||||
| OperationKey geom_init_key(&object->id, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL_INIT); | OperationKey geom_init_key(&object->id, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL_INIT); | ||||
| /* Get nodes for result of obdata's evaluation, and geometry evaluation | /* Get nodes for result of obdata's evaluation, and geometry evaluation | ||||
| * on object. */ | * on object. */ | ||||
| ComponentKey obdata_geom_key(obdata, NodeType::GEOMETRY); | ComponentKey obdata_geom_key(obdata, NodeType::GEOMETRY); | ||||
| OperationKey obdata_ubereval_key(&object->id, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL); | ComponentKey geom_key(&object->id, NodeType::GEOMETRY); | ||||
| /* Link components to each other. */ | /* Link components to each other. */ | ||||
| add_relation(obdata_geom_key, obdata_ubereval_key, "Object Geometry Base Data"); | add_relation(obdata_geom_key, geom_key, "Object Geometry Base Data"); | ||||
| OperationKey obdata_ubereval_key(&object->id, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL); | |||||
| /* Special case: modifiers evaluation queries scene for various things like | /* Special case: modifiers evaluation queries scene for various things like | ||||
| * data mask to be used. We add relation here to ensure object is never | * data mask to be used. We add relation here to ensure object is never | ||||
| * evaluated prior to Scene's CoW is ready. */ | * evaluated prior to Scene's CoW is ready. */ | ||||
| OperationKey scene_key(&scene_->id, NodeType::PARAMETERS, OperationCode::SCENE_EVAL); | OperationKey scene_key(&scene_->id, NodeType::PARAMETERS, OperationCode::SCENE_EVAL); | ||||
| Relation *rel = add_relation(scene_key, geom_init_key, "CoW Relation"); | Relation *rel = add_relation(scene_key, obdata_ubereval_key, "CoW Relation"); | ||||
| rel->flag |= RELATION_FLAG_NO_FLUSH; | rel->flag |= RELATION_FLAG_NO_FLUSH; | ||||
| /* Modifiers */ | /* Modifiers */ | ||||
| if (object->modifiers.first != nullptr) { | if (object->modifiers.first != nullptr) { | ||||
| ModifierUpdateDepsgraphContext ctx = {}; | ModifierUpdateDepsgraphContext ctx = {}; | ||||
| ctx.scene = scene_; | ctx.scene = scene_; | ||||
| ctx.object = object; | ctx.object = object; | ||||
| LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) { | LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) { | ||||
| const ModifierTypeInfo *mti = BKE_modifier_get_info((ModifierType)md->type); | const ModifierTypeInfo *mti = BKE_modifier_get_info((ModifierType)md->type); | ||||
| if (mti->updateDepsgraph) { | if (mti->updateDepsgraph) { | ||||
| DepsNodeHandle handle = create_node_handle(geom_init_key); | DepsNodeHandle handle = create_node_handle(obdata_ubereval_key); | ||||
| ctx.node = reinterpret_cast<::DepsNodeHandle *>(&handle); | ctx.node = reinterpret_cast<::DepsNodeHandle *>(&handle); | ||||
| mti->updateDepsgraph(md, &ctx); | mti->updateDepsgraph(md, &ctx); | ||||
| } | } | ||||
| if (BKE_object_modifier_use_time(object, md)) { | if (BKE_object_modifier_use_time(object, md)) { | ||||
| TimeSourceKey time_src_key; | TimeSourceKey time_src_key; | ||||
| add_relation(time_src_key, geom_init_key, "Time Source"); | add_relation(time_src_key, obdata_ubereval_key, "Time Source"); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* Grease Pencil Modifiers. */ | /* Grease Pencil Modifiers. */ | ||||
| if (object->greasepencil_modifiers.first != nullptr) { | if (object->greasepencil_modifiers.first != nullptr) { | ||||
| ModifierUpdateDepsgraphContext ctx = {}; | ModifierUpdateDepsgraphContext ctx = {}; | ||||
| ctx.scene = scene_; | ctx.scene = scene_; | ||||
| ctx.object = object; | ctx.object = object; | ||||
| LISTBASE_FOREACH (GpencilModifierData *, md, &object->greasepencil_modifiers) { | LISTBASE_FOREACH (GpencilModifierData *, md, &object->greasepencil_modifiers) { | ||||
| const GpencilModifierTypeInfo *mti = BKE_gpencil_modifier_get_info( | const GpencilModifierTypeInfo *mti = BKE_gpencil_modifier_get_info( | ||||
| (GpencilModifierType)md->type); | (GpencilModifierType)md->type); | ||||
| if (mti->updateDepsgraph) { | if (mti->updateDepsgraph) { | ||||
| DepsNodeHandle handle = create_node_handle(geom_init_key); | DepsNodeHandle handle = create_node_handle(obdata_ubereval_key); | ||||
| ctx.node = reinterpret_cast<::DepsNodeHandle *>(&handle); | ctx.node = reinterpret_cast<::DepsNodeHandle *>(&handle); | ||||
| mti->updateDepsgraph(md, &ctx, graph_->mode); | mti->updateDepsgraph(md, &ctx, graph_->mode); | ||||
| } | } | ||||
| if (BKE_object_modifier_gpencil_use_time(object, md)) { | if (BKE_object_modifier_gpencil_use_time(object, md)) { | ||||
| TimeSourceKey time_src_key; | TimeSourceKey time_src_key; | ||||
| add_relation(time_src_key, geom_init_key, "Time Source"); | add_relation(time_src_key, obdata_ubereval_key, "Time Source"); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* Shader FX. */ | /* Shader FX. */ | ||||
| if (object->shader_fx.first != nullptr) { | if (object->shader_fx.first != nullptr) { | ||||
| ModifierUpdateDepsgraphContext ctx = {}; | ModifierUpdateDepsgraphContext ctx = {}; | ||||
| ctx.scene = scene_; | ctx.scene = scene_; | ||||
| ctx.object = object; | ctx.object = object; | ||||
| LISTBASE_FOREACH (ShaderFxData *, fx, &object->shader_fx) { | LISTBASE_FOREACH (ShaderFxData *, fx, &object->shader_fx) { | ||||
| const ShaderFxTypeInfo *fxi = BKE_shaderfx_get_info((ShaderFxType)fx->type); | const ShaderFxTypeInfo *fxi = BKE_shaderfx_get_info((ShaderFxType)fx->type); | ||||
| if (fxi->updateDepsgraph) { | if (fxi->updateDepsgraph) { | ||||
| DepsNodeHandle handle = create_node_handle(geom_init_key); | DepsNodeHandle handle = create_node_handle(obdata_ubereval_key); | ||||
| ctx.node = reinterpret_cast<::DepsNodeHandle *>(&handle); | ctx.node = reinterpret_cast<::DepsNodeHandle *>(&handle); | ||||
| fxi->updateDepsgraph(fx, &ctx); | fxi->updateDepsgraph(fx, &ctx); | ||||
| } | } | ||||
| if (BKE_object_shaderfx_use_time(object, fx)) { | if (BKE_object_shaderfx_use_time(object, fx)) { | ||||
| TimeSourceKey time_src_key; | TimeSourceKey time_src_key; | ||||
| add_relation(time_src_key, geom_init_key, "Time Source"); | add_relation(time_src_key, obdata_ubereval_key, "Time Source"); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* Materials. */ | /* Materials. */ | ||||
| build_materials(object->mat, object->totcol); | build_materials(object->mat, object->totcol); | ||||
| /* Geometry collision. */ | /* Geometry collision. */ | ||||
| if (ELEM(object->type, OB_MESH, OB_CURVE, OB_LATTICE)) { | if (ELEM(object->type, OB_MESH, OB_CURVE, OB_LATTICE)) { | ||||
| // add geometry collider relations | // add geometry collider relations | ||||
| Show All 9 Lines | if (object->type == OB_MBALL) { | ||||
| Object *mom = BKE_mball_basis_find(scene_, object); | Object *mom = BKE_mball_basis_find(scene_, object); | ||||
| ComponentKey mom_geom_key(&mom->id, NodeType::GEOMETRY); | ComponentKey mom_geom_key(&mom->id, NodeType::GEOMETRY); | ||||
| /* motherball - mom depends on children! */ | /* motherball - mom depends on children! */ | ||||
| if (mom == object) { | if (mom == object) { | ||||
| ComponentKey mom_transform_key(&mom->id, NodeType::TRANSFORM); | ComponentKey mom_transform_key(&mom->id, NodeType::TRANSFORM); | ||||
| add_relation(mom_transform_key, mom_geom_key, "Metaball Motherball Transform -> Geometry"); | add_relation(mom_transform_key, mom_geom_key, "Metaball Motherball Transform -> Geometry"); | ||||
| } | } | ||||
| else { | else { | ||||
| ComponentKey geom_key(&object->id, NodeType::GEOMETRY); | |||||
| ComponentKey transform_key(&object->id, NodeType::TRANSFORM); | ComponentKey transform_key(&object->id, NodeType::TRANSFORM); | ||||
| add_relation(geom_key, mom_geom_key, "Metaball Motherball"); | add_relation(geom_key, mom_geom_key, "Metaball Motherball"); | ||||
| add_relation(transform_key, mom_geom_key, "Metaball Motherball"); | add_relation(transform_key, mom_geom_key, "Metaball Motherball"); | ||||
| } | } | ||||
| } | } | ||||
| /* NOTE: This is compatibility code to support particle systems | /* NOTE: This is compatibility code to support particle systems | ||||
| * | * | ||||
| * for viewport being properly rendered in final render mode. | * for viewport being properly rendered in final render mode. | ||||
| * This relation is similar to what dag_object_time_update_flags() | * This relation is similar to what dag_object_time_update_flags() | ||||
| * was doing for mesh objects with particle system. | * was doing for mesh objects with particle system. | ||||
| * | * | ||||
| * Ideally we need to get rid of this relation. */ | * Ideally we need to get rid of this relation. */ | ||||
| if (object_particles_depends_on_time(object)) { | if (object_particles_depends_on_time(object)) { | ||||
| TimeSourceKey time_key; | TimeSourceKey time_key; | ||||
| add_relation(time_key, geom_init_key, "Legacy particle time"); | OperationKey obdata_ubereval_key( | ||||
| &object->id, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL); | |||||
| add_relation(time_key, obdata_ubereval_key, "Legacy particle time"); | |||||
| } | } | ||||
| /* Object data data-block. */ | /* Object data data-block. */ | ||||
| build_object_data_geometry_datablock((ID *)object->data); | build_object_data_geometry_datablock((ID *)object->data); | ||||
| Key *key = BKE_key_from_object(object); | Key *key = BKE_key_from_object(object); | ||||
| if (key != nullptr) { | if (key != nullptr) { | ||||
| if (key->adt != nullptr) { | if (key->adt != nullptr) { | ||||
| if (key->adt->action || key->adt->nla_tracks.first) { | if (key->adt->action || key->adt->nla_tracks.first) { | ||||
| ComponentKey obdata_key((ID *)object->data, NodeType::GEOMETRY); | ComponentKey obdata_key((ID *)object->data, NodeType::GEOMETRY); | ||||
| ComponentKey adt_key(&key->id, NodeType::ANIMATION); | ComponentKey adt_key(&key->id, NodeType::ANIMATION); | ||||
| add_relation(adt_key, obdata_key, "Animation"); | add_relation(adt_key, obdata_key, "Animation"); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| build_dimensions(object); | build_dimensions(object); | ||||
| /* Synchronization back to original object. */ | /* Synchronization back to original object. */ | ||||
| ComponentKey final_geometry_key(&object->id, NodeType::GEOMETRY); | ComponentKey final_geometry_key(&object->id, NodeType::GEOMETRY); | ||||
| OperationKey synchronize_key( | OperationKey synchronize_key( | ||||
| &object->id, NodeType::SYNCHRONIZATION, OperationCode::SYNCHRONIZE_TO_ORIGINAL); | &object->id, NodeType::SYNCHRONIZATION, OperationCode::SYNCHRONIZE_TO_ORIGINAL); | ||||
| add_relation(final_geometry_key, synchronize_key, "Synchronize to Original"); | add_relation(final_geometry_key, synchronize_key, "Synchronize to Original"); | ||||
| /* Batch cache. */ | /* Batch cache. */ | ||||
| OperationKey object_data_select_key( | OperationKey object_data_select_key( | ||||
| obdata, NodeType::BATCH_CACHE, OperationCode::BATCH_UPDATE_SELECT); | obdata, NodeType::BATCH_CACHE, OperationCode::GEOMETRY_SELECT_UPDATE); | ||||
| OperationKey object_select_key( | OperationKey object_select_key( | ||||
| &object->id, NodeType::BATCH_CACHE, OperationCode::BATCH_UPDATE_SELECT); | &object->id, NodeType::BATCH_CACHE, OperationCode::GEOMETRY_SELECT_UPDATE); | ||||
| add_relation(object_data_select_key, object_select_key, "Data Selection -> Object Selection"); | add_relation(object_data_select_key, object_select_key, "Data Selection -> Object Selection"); | ||||
| add_relation(final_geometry_key, | |||||
| object_select_key, | |||||
| "Object Geometry -> Select Update", | |||||
| RELATION_FLAG_NO_FLUSH); | |||||
| OperationKey object_data_geom_deform_key( | |||||
| obdata, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL_DEFORM); | |||||
| OperationKey object_data_geom_init_key( | |||||
| obdata, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL_INIT); | |||||
| OperationKey object_data_batch_deform_key( | |||||
| obdata, NodeType::BATCH_CACHE, OperationCode::BATCH_UPDATE_DEFORM); | |||||
| OperationKey object_data_batch_all_key( | |||||
| obdata, NodeType::BATCH_CACHE, OperationCode::BATCH_UPDATE_ALL); | |||||
| add_relation(geom_init_key, object_data_batch_all_key, "Object Geometry -> Batch Update All"); | |||||
| add_relation( | add_relation( | ||||
| object_data_geom_init_key, object_data_batch_all_key, "Data Init -> Batch Update All"); | geom_key, object_select_key, "Object Geometry -> Select Update", RELATION_FLAG_NO_FLUSH); | ||||
| add_relation(object_data_geom_deform_key, | |||||
| object_data_batch_deform_key, | |||||
| "Data Deform -> Batch Update Deform"); | |||||
| } | } | ||||
| void DepsgraphRelationBuilder::build_object_data_geometry_datablock(ID *obdata) | void DepsgraphRelationBuilder::build_object_data_geometry_datablock(ID *obdata) | ||||
| { | { | ||||
| if (built_map_.checkIsBuiltAndTag(obdata)) { | if (built_map_.checkIsBuiltAndTag(obdata)) { | ||||
| return; | return; | ||||
| } | } | ||||
| build_idproperties(obdata->properties); | build_idproperties(obdata->properties); | ||||
| /* Animation. */ | /* Animation. */ | ||||
| build_animdata(obdata); | build_animdata(obdata); | ||||
| build_parameters(obdata); | build_parameters(obdata); | ||||
| /* ShapeKeys. */ | /* ShapeKeys. */ | ||||
| Key *key = BKE_key_from_id(obdata); | Key *key = BKE_key_from_id(obdata); | ||||
| if (key != nullptr) { | if (key != nullptr) { | ||||
| build_shapekeys(key); | build_shapekeys(key); | ||||
| } | } | ||||
| /* Link object data evaluation node to exit operation. */ | /* Link object data evaluation node to exit operation. */ | ||||
| OperationKey obdata_geom_deform_key( | |||||
| obdata, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL_DEFORM); | |||||
| OperationKey obdata_geom_init_key(obdata, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL_INIT); | |||||
| OperationKey obdata_geom_eval_key(obdata, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL); | OperationKey obdata_geom_eval_key(obdata, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL); | ||||
| OperationKey obdata_geom_done_key(obdata, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL_DONE); | OperationKey obdata_geom_done_key(obdata, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL_DONE); | ||||
| add_relation(obdata_geom_init_key, obdata_geom_eval_key, "ObData Init -> Geom Eval"); | |||||
| add_relation(obdata_geom_deform_key, obdata_geom_eval_key, "ObData Deform -> Geom Eval"); | |||||
| add_relation(obdata_geom_eval_key, obdata_geom_done_key, "ObData Geom Eval Done"); | add_relation(obdata_geom_eval_key, obdata_geom_done_key, "ObData Geom Eval Done"); | ||||
| /* Type-specific links. */ | /* Type-specific links. */ | ||||
| const ID_Type id_type = GS(obdata->name); | const ID_Type id_type = GS(obdata->name); | ||||
| switch (id_type) { | switch (id_type) { | ||||
| case ID_ME: | case ID_ME: | ||||
| break; | break; | ||||
| case ID_MB: | case ID_MB: | ||||
| break; | break; | ||||
| ▲ Show 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | case ID_VO: { | ||||
| if (volume->is_sequence) { | if (volume->is_sequence) { | ||||
| TimeSourceKey time_key; | TimeSourceKey time_key; | ||||
| ComponentKey geometry_key(obdata, NodeType::GEOMETRY); | ComponentKey geometry_key(obdata, NodeType::GEOMETRY); | ||||
| add_relation(time_key, geometry_key, "Volume sequence time"); | add_relation(time_key, geometry_key, "Volume sequence time"); | ||||
| } | } | ||||
| break; | break; | ||||
| } | } | ||||
| default: | default: | ||||
| BLI_assert(!"Should not happen"); | BLI_assert_msg(0, "Should not happen"); | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| void DepsgraphRelationBuilder::build_armature(bArmature *armature) | void DepsgraphRelationBuilder::build_armature(bArmature *armature) | ||||
| { | { | ||||
| if (built_map_.checkIsBuiltAndTag(armature)) { | if (built_map_.checkIsBuiltAndTag(armature)) { | ||||
| return; | return; | ||||
| ▲ Show 20 Lines • Show All 166 Lines • ▼ Show 20 Lines | LISTBASE_FOREACH (bNode *, bnode, &ntree->nodes) { | ||||
| } | } | ||||
| else if (ELEM(bnode->type, NODE_GROUP, NODE_CUSTOM_GROUP)) { | else if (ELEM(bnode->type, NODE_GROUP, NODE_CUSTOM_GROUP)) { | ||||
| bNodeTree *group_ntree = (bNodeTree *)id; | bNodeTree *group_ntree = (bNodeTree *)id; | ||||
| build_nodetree(group_ntree); | build_nodetree(group_ntree); | ||||
| ComponentKey group_shading_key(&group_ntree->id, NodeType::SHADING); | ComponentKey group_shading_key(&group_ntree->id, NodeType::SHADING); | ||||
| add_relation(group_shading_key, shading_key, "Group Node"); | add_relation(group_shading_key, shading_key, "Group Node"); | ||||
| } | } | ||||
| else { | else { | ||||
| BLI_assert(!"Unknown ID type used for node"); | BLI_assert_msg(0, "Unknown ID type used for node"); | ||||
| } | } | ||||
| } | } | ||||
| LISTBASE_FOREACH (bNodeSocket *, socket, &ntree->inputs) { | LISTBASE_FOREACH (bNodeSocket *, socket, &ntree->inputs) { | ||||
| build_idproperties(socket->prop); | build_idproperties(socket->prop); | ||||
| } | } | ||||
| LISTBASE_FOREACH (bNodeSocket *, socket, &ntree->outputs) { | LISTBASE_FOREACH (bNodeSocket *, socket, &ntree->outputs) { | ||||
| build_idproperties(socket->prop); | build_idproperties(socket->prop); | ||||
| ▲ Show 20 Lines • Show All 527 Lines • Show Last 20 Lines | |||||