Changeset View
Changeset View
Standalone View
Standalone View
source/blender/depsgraph/intern/builder/deg_builder_relations.cc
| Show First 20 Lines • Show All 304 Lines • ▼ Show 20 Lines | else { | ||||
| transform_operation_node = transform_component->get_operation( | transform_operation_node = transform_component->get_operation( | ||||
| OperationCode::TRANSFORM_EVAL); | OperationCode::TRANSFORM_EVAL); | ||||
| } | } | ||||
| /* Wire up the actual relation. */ | /* Wire up the actual relation. */ | ||||
| add_operation_relation( | add_operation_relation( | ||||
| transform_operation_node, geometry_operation_node, description); | transform_operation_node, geometry_operation_node, description); | ||||
| } | } | ||||
| void DepsgraphRelationBuilder::add_customdata_mask(Object *object, uint64_t mask) | void DepsgraphRelationBuilder::add_customdata_mask( | ||||
| Object *object, | |||||
| uint64_t vmask, | |||||
| uint64_t emask, | |||||
| uint64_t fmask, | |||||
| uint64_t lmask, | |||||
| uint64_t pmask) | |||||
| { | { | ||||
| if (mask != 0 && object != NULL && object->type == OB_MESH) { | if ((vmask | emask | fmask | lmask | pmask) != 0 && object != NULL && object->type == OB_MESH) { | ||||
sergey: `DEG_CustomData_MeshMasks()` ? | |||||
| DEG::IDNode *id_node = graph_->find_id_node(&object->id); | DEG::IDNode *id_node = graph_->find_id_node(&object->id); | ||||
| if (id_node == NULL) { | if (id_node == NULL) { | ||||
| BLI_assert(!"ID should always be valid"); | BLI_assert(!"ID should always be valid"); | ||||
| } | } | ||||
| else { | else { | ||||
| id_node->customdata_mask |= mask; | id_node->customdata_vmask |= vmask; | ||||
| id_node->customdata_emask |= emask; | |||||
| id_node->customdata_fmask |= fmask; | |||||
| id_node->customdata_lmask |= lmask; | |||||
| id_node->customdata_pmask |= pmask; | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| void DepsgraphRelationBuilder::add_special_eval_flag(ID *id, uint32_t flag) | void DepsgraphRelationBuilder::add_special_eval_flag(ID *id, uint32_t flag) | ||||
| { | { | ||||
| DEG::IDNode *id_node = graph_->find_id_node(id); | DEG::IDNode *id_node = graph_->find_id_node(id); | ||||
| if (id_node == NULL) { | if (id_node == NULL) { | ||||
| ▲ Show 20 Lines • Show All 529 Lines • ▼ Show 20 Lines | switch (object->partype) { | ||||
| { | { | ||||
| ComponentKey parent_key(parent_id, NodeType::GEOMETRY); | ComponentKey parent_key(parent_id, NodeType::GEOMETRY); | ||||
| add_relation(parent_key, ob_key, "Vertex Parent"); | add_relation(parent_key, ob_key, "Vertex Parent"); | ||||
| /* Original index is used for optimizations of lookups for subdiv | /* Original index is used for optimizations of lookups for subdiv | ||||
| * only meshes. | * only meshes. | ||||
| * TODO(sergey): This optimization got lost at 2.8, so either verify | * TODO(sergey): This optimization got lost at 2.8, so either verify | ||||
| * we can get rid of this mask here, or bring the optimization | * we can get rid of this mask here, or bring the optimization | ||||
| * back. */ | * back. */ | ||||
| add_customdata_mask(object->parent, CD_MASK_ORIGINDEX); | add_customdata_mask(object->parent, CD_MASK_ORIGINDEX, CD_MASK_ORIGINDEX, CD_MASK_ORIGINDEX, 0, CD_MASK_ORIGINDEX); | ||||
| ComponentKey transform_key(parent_id, NodeType::TRANSFORM); | ComponentKey transform_key(parent_id, NodeType::TRANSFORM); | ||||
| add_relation(transform_key, ob_key, "Vertex Parent TFM"); | add_relation(transform_key, ob_key, "Vertex Parent TFM"); | ||||
| break; | break; | ||||
| } | } | ||||
| /* Bone Parent */ | /* Bone Parent */ | ||||
| case PARBONE: | case PARBONE: | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 237 Lines • ▼ Show 20 Lines | else if (cti->get_constraint_targets) { | ||||
| ComponentKey target_transform_key( | ComponentKey target_transform_key( | ||||
| &ct->tar->id, NodeType::TRANSFORM); | &ct->tar->id, NodeType::TRANSFORM); | ||||
| ComponentKey target_geometry_key( | ComponentKey target_geometry_key( | ||||
| &ct->tar->id, NodeType::GEOMETRY); | &ct->tar->id, NodeType::GEOMETRY); | ||||
| add_relation( | add_relation( | ||||
| target_transform_key, constraint_op_key, cti->name); | target_transform_key, constraint_op_key, cti->name); | ||||
| add_relation( | add_relation( | ||||
| target_geometry_key, constraint_op_key, cti->name); | target_geometry_key, constraint_op_key, cti->name); | ||||
| add_customdata_mask(ct->tar, CD_MASK_MDEFORMVERT); | add_customdata_mask(ct->tar, CD_MASK_MDEFORMVERT, 0, 0, 0, 0); | ||||
| } | } | ||||
| else if (con->type == CONSTRAINT_TYPE_SHRINKWRAP) { | else if (con->type == CONSTRAINT_TYPE_SHRINKWRAP) { | ||||
| bShrinkwrapConstraint *scon = (bShrinkwrapConstraint *) con->data; | bShrinkwrapConstraint *scon = (bShrinkwrapConstraint *) con->data; | ||||
| /* Constraints which requires the target object surface. */ | /* Constraints which requires the target object surface. */ | ||||
| ComponentKey target_key(&ct->tar->id, NodeType::GEOMETRY); | ComponentKey target_key(&ct->tar->id, NodeType::GEOMETRY); | ||||
| add_relation(target_key, constraint_op_key, cti->name); | add_relation(target_key, constraint_op_key, cti->name); | ||||
| /* Add dependency on normal layers if necessary. */ | /* Add dependency on normal layers if necessary. */ | ||||
| if (ct->tar->type == OB_MESH && scon->shrinkType != MOD_SHRINKWRAP_NEAREST_VERTEX) { | if (ct->tar->type == OB_MESH && scon->shrinkType != MOD_SHRINKWRAP_NEAREST_VERTEX) { | ||||
| bool track = (scon->flag & CON_SHRINKWRAP_TRACK_NORMAL) != 0; | bool track = (scon->flag & CON_SHRINKWRAP_TRACK_NORMAL) != 0; | ||||
| if (track || BKE_shrinkwrap_needs_normals(scon->shrinkType, scon->shrinkMode)) { | if (track || BKE_shrinkwrap_needs_normals(scon->shrinkType, scon->shrinkMode)) { | ||||
| add_customdata_mask(ct->tar, CD_MASK_NORMAL | CD_MASK_CUSTOMLOOPNORMAL); | add_customdata_mask(ct->tar, CD_MASK_NORMAL, 0, 0, CD_MASK_CUSTOMLOOPNORMAL, 0); | ||||
sergeyUnsubmitted Done Inline ActionsYou can easily think of a cleaner way of calling this. Idea one: add_customdata_mask(ct->tar, LayerSource::VERTEX, CD_MASK_NORMAL); add_customdata_mask(ct->tar, LayerSource::LOOP, CD_MASK_CUSTOMLOOPNORMAL); Idea two: add_customdata_mask(ct->tar, CDMaskVertex(CD_MASK_NORMAL)); add_customdata_mask(ct->tar, CDMaskLoop(CD_MASK_CUSTOMLOOPNORMAL)); Idea three: add_customdata_mask(ct->tar, CDMaskVertex(CD_MASK_NORMAL) | CDMaskLoop(CD_MASK_CUSTOMLOOPNORMAL)); sergey: You can easily think of a cleaner way of calling this.
Idea one:
add_customdata_mask(ct->tar… | |||||
| } | } | ||||
| if (scon->shrinkType == MOD_SHRINKWRAP_TARGET_PROJECT) { | if (scon->shrinkType == MOD_SHRINKWRAP_TARGET_PROJECT) { | ||||
| add_special_eval_flag(&ct->tar->id, DAG_EVAL_NEED_SHRINKWRAP_BOUNDARY); | add_special_eval_flag(&ct->tar->id, DAG_EVAL_NEED_SHRINKWRAP_BOUNDARY); | ||||
| } | } | ||||
| } | } | ||||
| /* NOTE: obdata eval now doesn't necessarily depend on the | /* NOTE: obdata eval now doesn't necessarily depend on the | ||||
| * object's transform. */ | * object's transform. */ | ||||
| ▲ Show 20 Lines • Show All 1,580 Lines • Show Last 20 Lines | |||||
DEG_CustomData_MeshMasks() ?