Merging r59130 through r59135 from trunk into soc-2013-depsgraph_mt
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 14 Aug 2013 10:42:18 +0000 (10:42 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 14 Aug 2013 10:42:18 +0000 (10:42 +0000)
1  2 
source/blender/blenkernel/intern/armature.c

index 6e712c7572f018747cfe9c6e728572298ae65192,f006710dc21e70b20ebd6fb85e25329bdb4bfa5d..6b2b782717dce626177381b74748aac227ff402e
@@@ -381,6 -381,8 +381,6 @@@ int bone_autoside_name(char name[MAXBON
  
  /* ************* B-Bone support ******************* */
  
 -#define MAX_BBONE_SUBDIV    32
 -
  /* data has MAX_BBONE_SUBDIV+1 interpolated points, will become desired amount with equal distances */
  static void equalize_bezier(float *data, int desired)
  {
  
  /* returns pointer to static array, filled with desired amount of bone->segments elements */
  /* this calculation is done  within unit bone space */
 -Mat4 *b_bone_spline_setup(bPoseChannel *pchan, int rest)
 +void b_bone_spline_setup(bPoseChannel *pchan, int rest, Mat4 result_array[MAX_BBONE_SUBDIV])
  {
 -      static Mat4 bbone_array[MAX_BBONE_SUBDIV];
 -      static Mat4 bbone_rest_array[MAX_BBONE_SUBDIV];
 -      Mat4 *result_array = (rest) ? bbone_rest_array : bbone_array;
        bPoseChannel *next, *prev;
        Bone *bone = pchan->bone;
        float h1[3], h2[3], scale[3], length, hlength1, hlength2, roll1 = 0.0f, roll2;
                        mul_serie_m4(result_array[a].mat, iscalemat, result_array[a].mat, scalemat, NULL, NULL, NULL, NULL, NULL);
                }
        }
 -
 -      return result_array;
  }
  
  /* ************ Armature Deform ******************* */
@@@ -595,15 -602,13 +595,15 @@@ typedef struct bPoseChanDeform 
  static void pchan_b_bone_defmats(bPoseChannel *pchan, bPoseChanDeform *pdef_info, int use_quaternion)
  {
        Bone *bone = pchan->bone;
 -      Mat4 *b_bone = b_bone_spline_setup(pchan, 0);
 -      Mat4 *b_bone_rest = b_bone_spline_setup(pchan, 1);
 +      Mat4 b_bone[MAX_BBONE_SUBDIV], b_bone_rest[MAX_BBONE_SUBDIV];
        Mat4 *b_bone_mats;
        DualQuat *b_bone_dual_quats = NULL;
        float tmat[4][4] = MAT4_UNITY;
        int a;
  
 +      b_bone_spline_setup(pchan, 0, b_bone);
 +      b_bone_spline_setup(pchan, 1, b_bone_rest);
 +
        /* allocate b_bone matrices and dual quats */
        b_bone_mats = MEM_mallocN((1 + bone->segments) * sizeof(Mat4), "BBone defmats");
        pdef_info->b_bone_mats = b_bone_mats;
@@@ -1600,7 -1605,10 +1600,10 @@@ static void pose_proxy_synchronize(Obje
                        pchanw.next = pchan->next;
                        pchanw.parent = pchan->parent;
                        pchanw.child = pchan->child;
-                       
+                       pchanw.mpath = pchan->mpath;
+                       pchan->mpath = NULL;
                        /* this is freed so copy a copy, else undo crashes */
                        if (pchanw.prop) {
                                pchanw.prop = IDP_CopyProperty(pchanw.prop);
@@@ -1818,16 -1826,18 +1821,16 @@@ static void splineik_init_tree_from_pch
         *     - this is a workaround for a depsgraph bug...
         */
        if (ikData->tar) {
 -              Curve *cu = ikData->tar->data;
 -
                /* note: when creating constraints that follow path, the curve gets the CU_PATH set now,
                 *       currently for paths to work it needs to go through the bevlist/displist system (ton)
                 */
  
                /* only happens on reload file, but violates depsgraph still... fix! */
 -              if (ELEM(NULL, cu->path, cu->path->data)) {
 +              if (ELEM3(NULL,  ikData->tar->curve_cache, ikData->tar->curve_cache->path, ikData->tar->curve_cache->path->data)) {
                        BKE_displist_make_curveTypes(scene, ikData->tar, 0);
                        
                        /* path building may fail in EditMode after removing verts [#33268]*/
 -                      if (ELEM(NULL, cu->path, cu->path->data)) {
 +                      if (ELEM(NULL, ikData->tar->curve_cache->path, ikData->tar->curve_cache->path->data)) {
                                /* BLI_assert(cu->path != NULL); */
                                return;
                        }
         * since it's easier to determine the positions of all the joints beforehand this way
         */
        if ((ikData->flag & CONSTRAINT_SPLINEIK_SCALE_LIMITED) && (totLength != 0.0f)) {
 -              Curve *cu = (Curve *)ikData->tar->data;
                float splineLen, maxScale;
                int i;
  
  
                /* get the current length of the curve */
                /* NOTE: this is assumed to be correct even after the curve was resized */
 -              splineLen = cu->path->totdist;
 +              splineLen = ikData->tar->curve_cache->path->totdist;
  
                /* calculate the scale factor to multiply all the path values by so that the
                 * bone chain retains its current length, such that