Merge branch 'master' into blender2.8
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 6 Dec 2017 11:27:44 +0000 (12:27 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 6 Dec 2017 11:27:44 +0000 (12:27 +0100)
1  2 
source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc

index b947e3e01a007205b7c9fffa7415a4c2914f7080,9868a8d2208838b25179f1960640b8b60d5dd7b3..531ea55cf5c854f6e67ed93e6afa928ea0d742e8
@@@ -319,54 -255,35 +319,54 @@@ void DepsgraphNodeBuilder::build_rig(Ob
  
  void DepsgraphNodeBuilder::build_proxy_rig(Object *object)
  {
-       ID *obdata = (ID *)object->data;
+       bArmature *arm = (bArmature *)object->data;
        OperationDepsNode *op_node;
 -
 -      build_animdata(&arm->id);
 -
 +      Object *object_cow;
 +      if (DEG_depsgraph_use_copy_on_write()) {
 +              /* NOTE: We need to expand both object and armature, so this way we can
 +               * safely create object level pose.
 +               */
 +              object_cow = expand_cow_datablock(object);
 +      }
 +      else {
 +              object_cow = object;
 +      }
 +      /* Sanity check. */
        BLI_assert(object->pose != NULL);
 -
 +      /* Animation. */
-       build_animdata(obdata);
++      build_animdata(&arm->id);
        /* speed optimization for animation lookups */
        BKE_pose_channels_hash_make(object->pose);
 -      if (object->pose->flag & POSE_CONSTRAINTS_NEED_UPDATE_FLAGS) {
 -              BKE_pose_update_constraint_flags(object->pose);
 +      if (object_cow->pose->flag & POSE_CONSTRAINTS_NEED_UPDATE_FLAGS) {
 +              BKE_pose_update_constraint_flags(object_cow->pose);
        }
 -
        op_node = add_operation_node(&object->id,
                                     DEG_NODE_TYPE_EVAL_POSE,
 -                                   function_bind(BKE_pose_eval_proxy_copy, _1, object),
 +                                   function_bind(BKE_pose_eval_proxy_copy,
 +                                                 _1,
 +                                                 object_cow),
                                     DEG_OPCODE_POSE_INIT);
        op_node->set_as_entry();
 -
 -      LINKLIST_FOREACH (bPoseChannel *, pchan, &object->pose->chanbase) {
 -              op_node = add_operation_node(&object->id, DEG_NODE_TYPE_BONE, pchan->name,
 -                                           NULL, DEG_OPCODE_BONE_LOCAL);
 +      LINKLIST_FOREACH (bPoseChannel *, pchan, &object_cow->pose->chanbase) {
 +              /* Local bone transform. */
 +              op_node = add_operation_node(&object->id,
 +                                           DEG_NODE_TYPE_BONE,
 +                                           pchan->name,
 +                                           NULL,
 +                                           DEG_OPCODE_BONE_LOCAL);
                op_node->set_as_entry();
 -
 -              add_operation_node(&object->id, DEG_NODE_TYPE_BONE, pchan->name,
 -                                 NULL, DEG_OPCODE_BONE_READY);
 -
 -              op_node = add_operation_node(&object->id, DEG_NODE_TYPE_BONE, pchan->name,
 -                                           NULL, DEG_OPCODE_BONE_DONE);
 +              /* Bone is ready for solvers. */
 +              add_operation_node(&object->id,
 +                                 DEG_NODE_TYPE_BONE,
 +                                 pchan->name,
 +                                 NULL,
 +                                 DEG_OPCODE_BONE_READY);
 +              /* Bone is fully evaluated. */
 +              op_node = add_operation_node(&object->id,
 +                                           DEG_NODE_TYPE_BONE,
 +                                           pchan->name,
 +                                           NULL,
 +                                           DEG_OPCODE_BONE_DONE);
                op_node->set_as_exit();
  
                /* Custom properties. */