Merging r58362 through r58463 from trunk into soc-2013-depsgraph_mt
[blender.git] / source / blender / editors / space_view3d / drawarmature.c
index fb20f0820855efaf1e3bd4080137908cde6c0276..9e4ab652b444c68cf19d31b2fdd980c22c732772 100644 (file)
@@ -34,6 +34,7 @@
 #include <string.h>
 #include <math.h>
 
+#include "MEM_guardedalloc.h"
 
 #include "DNA_anim_types.h"
 #include "DNA_armature_types.h"
@@ -1099,12 +1100,14 @@ static void draw_b_bone_boxes(const short dt, bPoseChannel *pchan, float xwidth,
        
        if ((segments > 1) && (pchan)) {
                float dlen = length / (float)segments;
-               Mat4 *bbone = b_bone_spline_setup(pchan, 0);
+               Mat4 bbone[MAX_BBONE_SUBDIV];
                int a;
-               
-               for (a = 0; a < segments; a++, bbone++) {
+
+               b_bone_spline_setup(pchan, 0, bbone);
+
+               for (a = 0; a < segments; a++) {
                        glPushMatrix();
-                       glMultMatrixf(bbone->mat);
+                       glMultMatrixf(bbone[a].mat);
                        if (dt == OB_SOLID) drawsolidcube_size(xwidth, dlen, zwidth);
                        else drawcube_size(xwidth, dlen, zwidth);
                        glPopMatrix();
@@ -1235,6 +1238,7 @@ static void draw_wire_bone_segments(bPoseChannel *pchan, Mat4 *bbones, float len
 static void draw_wire_bone(const short dt, int armflag, int boneflag, short constflag, unsigned int id,
                            bPoseChannel *pchan, EditBone *ebone)
 {
+       Mat4 bbones_array[MAX_BBONE_SUBDIV];
        Mat4 *bbones = NULL;
        int segments = 0;
        float length;
@@ -1243,8 +1247,10 @@ static void draw_wire_bone(const short dt, int armflag, int boneflag, short cons
                segments = pchan->bone->segments;
                length = pchan->bone->length;
                
-               if (segments > 1)
-                       bbones = b_bone_spline_setup(pchan, 0);
+               if (segments > 1) {
+                       b_bone_spline_setup(pchan, 0, bbones_array);
+                       bbones = bbones_array;
+               }
        }
        else 
                length = ebone->length;