diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-09-14 15:02:05 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-09-14 15:43:56 +0300 |
commit | d7fdd505dad68323c3d862e5e6713fab676cd231 (patch) | |
tree | 4fccf39e0bb62e15c846f57d96fa9b977bf5e719 /source/blender/depsgraph/intern/builder | |
parent | 95f257395e0f0322ce539671dee1370e5b081cd4 (diff) |
Depsgraph: Respect parent object visibility in more places
Mainly coverts object->parent and pose constraints.
Diffstat (limited to 'source/blender/depsgraph/intern/builder')
3 files changed, 60 insertions, 38 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index a8dbe1325c8..cf5cf5a789f 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -449,7 +449,8 @@ void DepsgraphNodeBuilder::build_id(ID *id) case ID_CU: case ID_MB: case ID_LT: - build_object_data_geometry_datablock(id); + /* TODO(sergey): Get visibility from a "parent" somehow. */ + build_object_data_geometry_datablock(id, true); break; case ID_SPK: build_speaker((Speaker *)id); @@ -533,8 +534,8 @@ void DepsgraphNodeBuilder::build_object(int base_index, build_object_transform(object); /* Parent. */ if (object->parent != NULL) { - /* TODO(sergey): Use own visibility. */ - build_object(-1, object->parent, DEG_ID_LINKED_INDIRECTLY, true); + build_object( + -1, object->parent, DEG_ID_LINKED_INDIRECTLY, is_visible); } /* Modifiers. */ if (object->modifiers.first != NULL) { @@ -565,7 +566,7 @@ void DepsgraphNodeBuilder::build_object(int base_index, BKE_constraints_id_loop(&object->constraints, constraint_walk, &data); } /* Object data. */ - build_object_data(object); + build_object_data(object, is_visible); /* Build animation data, * * Do it now because it's possible object data will affect @@ -580,16 +581,16 @@ void DepsgraphNodeBuilder::build_object(int base_index, build_animdata(&object->id); /* Particle systems. */ if (object->particlesystem.first != NULL) { - build_particles(object); + build_particles(object, is_visible); } /* Proxy object to copy from. */ if (object->proxy_from != NULL) { - /* TODO(sergey): Use own visibility. */ - build_object(-1, object->proxy_from, DEG_ID_LINKED_INDIRECTLY, true); + build_object( + -1, object->proxy_from, DEG_ID_LINKED_INDIRECTLY, is_visible); } if (object->proxy_group != NULL) { - /* TODO(sergey): Use own visibility. */ - build_object(-1, object->proxy_group, DEG_ID_LINKED_INDIRECTLY, true); + build_object( + -1, object->proxy_group, DEG_ID_LINKED_INDIRECTLY, is_visible); } /* Object dupligroup. */ if (object->dup_group != NULL) { @@ -624,7 +625,8 @@ void DepsgraphNodeBuilder::build_object_flags( DEG_OPCODE_OBJECT_BASE_FLAGS); } -void DepsgraphNodeBuilder::build_object_data(Object *object) +void DepsgraphNodeBuilder::build_object_data( + Object *object, bool is_object_visible) { if (object->data == NULL) { return; @@ -639,7 +641,7 @@ void DepsgraphNodeBuilder::build_object_data(Object *object) case OB_MBALL: case OB_LATTICE: case OB_GPENCIL: - build_object_data_geometry(object); + build_object_data_geometry(object, is_object_visible); /* TODO(sergey): Only for until we support granular * update of curves. */ @@ -655,7 +657,7 @@ void DepsgraphNodeBuilder::build_object_data(Object *object) build_proxy_rig(object); } else { - build_rig(object); + build_rig(object, is_object_visible); } break; case OB_LAMP: @@ -1010,7 +1012,8 @@ void DepsgraphNodeBuilder::build_rigidbody(Scene *scene) } } -void DepsgraphNodeBuilder::build_particles(Object *object) +void DepsgraphNodeBuilder::build_particles(Object *object, + bool is_object_visible) { /** * Particle Systems Nodes @@ -1057,11 +1060,10 @@ void DepsgraphNodeBuilder::build_particles(Object *object) switch (part->ren_as) { case PART_DRAW_OB: if (part->dup_ob != NULL) { - /* TODO(sergey): Use own visibility. */ build_object(-1, part->dup_ob, DEG_ID_LINKED_INDIRECTLY, - true); + is_object_visible); } break; case PART_DRAW_GR: @@ -1123,7 +1125,9 @@ void DepsgraphNodeBuilder::build_shapekeys(Key *key) /* ObData Geometry Evaluation */ // XXX: what happens if the datablock is shared! -void DepsgraphNodeBuilder::build_object_data_geometry(Object *object) +void DepsgraphNodeBuilder::build_object_data_geometry( + Object *object, + bool is_object_visible) { OperationDepsNode *op_node; Scene *scene_cow = get_cow_datablock(scene_); @@ -1179,10 +1183,12 @@ void DepsgraphNodeBuilder::build_object_data_geometry(Object *object) if (ELEM(object->type, OB_MESH, OB_CURVE, OB_LATTICE)) { // add geometry collider relations } - build_object_data_geometry_datablock((ID *)object->data); + build_object_data_geometry_datablock((ID *)object->data, is_object_visible); } -void DepsgraphNodeBuilder::build_object_data_geometry_datablock(ID *obdata) +void DepsgraphNodeBuilder::build_object_data_geometry_datablock( + ID *obdata, + bool is_object_visible) { if (built_map_.checkIsBuiltAndTag(obdata)) { return; @@ -1240,16 +1246,22 @@ void DepsgraphNodeBuilder::build_object_data_geometry_datablock(ID *obdata) */ Curve *cu = (Curve *)obdata; if (cu->bevobj != NULL) { - /* TODO(sergey): Use own visibility. */ - build_object(-1, cu->bevobj, DEG_ID_LINKED_INDIRECTLY, true); + build_object(-1, + cu->bevobj, + DEG_ID_LINKED_INDIRECTLY, + is_object_visible); } if (cu->taperobj != NULL) { - /* TODO(sergey): Use own visibility. */ - build_object(-1, cu->taperobj, DEG_ID_LINKED_INDIRECTLY, true); + build_object(-1, + cu->taperobj, + DEG_ID_LINKED_INDIRECTLY, + is_object_visible); } if (cu->textoncurve != NULL) { - /* TODO(sergey): Use own visibility. */ - build_object(-1, cu->textoncurve, DEG_ID_LINKED_INDIRECTLY, true); + build_object(-1, + cu->textoncurve, + DEG_ID_LINKED_INDIRECTLY, + is_object_visible); } break; } diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h index 35e81de8304..8e33dbf4292 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h @@ -171,18 +171,22 @@ struct DepsgraphNodeBuilder { void build_object_flags(int base_index, Object *object, eDepsNode_LinkedState_Type linked_state); - void build_object_data(Object *object); + void build_object_data(Object *object, bool is_object_visible); void build_object_data_camera(Object *object); - void build_object_data_geometry(Object *object); - void build_object_data_geometry_datablock(ID *obdata); + void build_object_data_geometry(Object *object, bool is_object_visible); + void build_object_data_geometry_datablock(ID *obdata, + bool is_object_visible); 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); + void build_pose_constraints(Object *object, + bPoseChannel *pchan, + int pchan_index, + bool is_object_visible); void build_rigidbody(Scene *scene); - void build_particles(Object *object); + void build_particles(Object *object, bool is_object_visible); void build_particle_settings(ParticleSettings *part); void build_cloth(Object *object); void build_animdata(ID *id); @@ -196,7 +200,7 @@ struct DepsgraphNodeBuilder { void build_splineik_pose(Object *object, bPoseChannel *pchan, bConstraint *con); - void build_rig(Object *object); + void build_rig(Object *object, bool is_object_visible); void build_proxy_rig(Object *object); void build_armature(bArmature *armature); void build_shapekeys(Key *key); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc index 71810e5efe8..83ef33e4771 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc @@ -67,15 +67,16 @@ extern "C" { namespace DEG { -void DepsgraphNodeBuilder::build_pose_constraints(Object *object, - bPoseChannel *pchan, - int pchan_index) +void DepsgraphNodeBuilder::build_pose_constraints( + Object *object, + bPoseChannel *pchan, + int pchan_index, + bool is_object_visible) { /* Pull indirect dependencies via constraints. */ BuilderWalkUserData data; data.builder = this; - /* TODO(sergey): Use own visibility. */ - data.is_parent_visible = true; + data.is_parent_visible = is_object_visible; BKE_constraints_id_loop(&pchan->constraints, constraint_walk, &data); /* Create node for constraint stack. */ add_operation_node(&object->id, DEG_NODE_TYPE_BONE, pchan->name, @@ -144,7 +145,7 @@ void DepsgraphNodeBuilder::build_splineik_pose(Object *object, } /* Pose/Armature Bones Graph */ -void DepsgraphNodeBuilder::build_rig(Object *object) +void DepsgraphNodeBuilder::build_rig(Object *object, bool is_object_visible) { bArmature *armature = (bArmature *)object->data; Scene *scene_cow = get_cow_datablock(scene_); @@ -264,7 +265,8 @@ void DepsgraphNodeBuilder::build_rig(Object *object) } /* Build constraints. */ if (pchan->constraints.first != NULL) { - build_pose_constraints(object, pchan, pchan_index); + build_pose_constraints( + object, pchan, pchan_index, is_object_visible); } /** * IK Solvers. @@ -295,7 +297,11 @@ void DepsgraphNodeBuilder::build_rig(Object *object) /* Custom shape. */ if (pchan->custom != NULL) { /* TODO(sergey): Use own visibility. */ - build_object(-1, pchan->custom, DEG_ID_LINKED_INDIRECTLY, true); + build_object( + -1, + pchan->custom, + DEG_ID_LINKED_INDIRECTLY, + is_object_visible); } pchan_index++; } |