Revision: 47754
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47754
Author:   mont29
Date:     2012-06-11 18:58:34 +0000 (Mon, 11 Jun 2012)
Log Message:
-----------
Fixing first part of [#31760] Assignments not working properly for 
Object.dimensions

Problem was in fact that non-linear-contiguous axis assignement was broken 
(i.e. location.xy would work as expected, but location.xz would only affect .x 
part)... Now all possibilities should work fine.

Did not try to fix the problem specific to obj.dimension (when assigning 
multiple times to this array, only the last one is taken into account - in 
fact, a simple print() shows that assigning to dimension is not taken into 
account immediately), not sure whether this is normal behavior, or if we need a 
specific "update" of some kind for this prop?

Modified Paths:
--------------
    trunk/blender/source/blender/python/mathutils/mathutils_Vector.c

Modified: trunk/blender/source/blender/python/mathutils/mathutils_Vector.c
===================================================================
--- trunk/blender/source/blender/python/mathutils/mathutils_Vector.c    
2012-06-11 18:43:48 UTC (rev 47753)
+++ trunk/blender/source/blender/python/mathutils/mathutils_Vector.c    
2012-06-11 18:58:34 UTC (rev 47754)
@@ -2268,6 +2268,11 @@
        axis_from = 0;
        swizzleClosure = GET_INT_FROM_POINTER(closure);
 
+       /* We must first copy current vec into tvec, else some org values may 
be lost.
+        * See [#31760].
+        * Assuming self->size can't be higher than MAX_DIMENSIONS! */
+       memcpy(tvec, self->vec, self->size * sizeof(float));
+
        while (swizzleClosure & SWIZZLE_VALID_AXIS) {
                axis_to = swizzleClosure & SWIZZLE_AXIS;
                tvec[axis_to] = vec_assign[axis_from];
@@ -2275,7 +2280,9 @@
                axis_from++;
        }
 
-       memcpy(self->vec, tvec, axis_from * sizeof(float));
+       /* We must copy back the whole tvec into vec, else some changes may be 
lost (e.g. xz...).
+        * See [#31760]. */
+       memcpy(self->vec, tvec, self->size * sizeof(float));
        /* continue with BaseMathObject_WriteCallback at the end */
 
        if (BaseMath_WriteCallback(self) == -1)

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to