== Copy Scale Constraint - Offset ==
authorJoshua Leung <aligorith@gmail.com>
Wed, 31 Oct 2007 10:04:57 +0000 (10:04 +0000)
committerJoshua Leung <aligorith@gmail.com>
Wed, 31 Oct 2007 10:04:57 +0000 (10:04 +0000)
Now the Copy Scale Constraint also has the Offset functionality that Copy Loc/Rot have.

== Copy Rotation Constraint ==

Also, fixed the tooltip for the CopyRot Offset button.

Note: when working with pose-bones, and using offset, setting both owner+target spaces to pose-space should cancel any unwanted rotations visible.

source/blender/blenkernel/intern/constraint.c
source/blender/src/buttons_object.c

index 1e6f7e4d9e3fc224f9e113eb8c6a3a17186642af..f50cb2c6be058a6f50afe2f721af8a5e5add7b50 100644 (file)
@@ -1787,12 +1787,30 @@ static void sizelike_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *t
                Mat4ToSize(ct->matrix, size);
                Mat4ToSize(cob->matrix, obsize);
                
-               if ((data->flag & SIZELIKE_X) && obsize[0] != 0)
-                       VecMulf(cob->matrix[0], size[0] / obsize[0]);
-               if ((data->flag & SIZELIKE_Y) && obsize[1] != 0)
-                       VecMulf(cob->matrix[1], size[1] / obsize[1]);
-               if ((data->flag & SIZELIKE_Z) && obsize[2] != 0)
-                       VecMulf(cob->matrix[2], size[2] / obsize[2]);
+               if ((data->flag & SIZELIKE_X) && (obsize[0] != 0)) {
+                       if (data->flag & SIZELIKE_OFFSET) {
+                               size[0] += (obsize[0] - 1.0f);
+                               VecMulf(cob->matrix[0], size[0] / obsize[0]);
+                       }
+                       else
+                               VecMulf(cob->matrix[0], size[0] / obsize[0]);
+               }
+               if ((data->flag & SIZELIKE_Y) && (obsize[1] != 0)) {
+                       if (data->flag & SIZELIKE_OFFSET) {
+                               size[1] += (obsize[1] - 1.0f);
+                               VecMulf(cob->matrix[1], size[1] / obsize[1]);
+                       }
+                       else
+                               VecMulf(cob->matrix[1], size[1] / obsize[1]);
+               }
+               if ((data->flag & SIZELIKE_Z) && (obsize[2] != 0)) {
+                       if (data->flag & SIZELIKE_OFFSET) {
+                               size[2] += (obsize[2] - 1.0f);
+                               VecMulf(cob->matrix[2], size[2] / obsize[2]);
+                       }
+                       else
+                               VecMulf(cob->matrix[2], size[2] / obsize[2]);
+               }
        }
 }
 
index 52163fa150b34064e2b4b51f6dd4431fe4669f64..98c2914cee437e6d3cd161cec166a4f9da45758b 100644 (file)
@@ -851,7 +851,7 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
                                uiBlockEndAlign(block);
                                
                                /* draw offset toggle */
-                               uiDefButBitI(block, TOG, ROTLIKE_OFFSET, B_CONSTRAINT_TEST, "Offset", *xco, *yco-64, 80, 18, &data->flag, 0, 24, 0, 0, "Copy X component");
+                               uiDefButBitI(block, TOG, ROTLIKE_OFFSET, B_CONSTRAINT_TEST, "Offset", *xco, *yco-64, 80, 18, &data->flag, 0, 24, 0, 0, "Add original rotation onto copied rotation");
                                
                                /* constraint space settings */
                                draw_constraint_spaceselect(block, con, *xco, *yco-94, is_armature_owner(ob), is_armature_target(data->tar));
@@ -891,6 +891,9 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
                                        uiDefButBitI(block, TOG, SIZELIKE_Z, B_CONSTRAINT_TEST, "Z", *xco+((width/2)+16), *yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Copy Z component");
                                uiBlockEndAlign(block);
                                
+                               /* draw offset toggle */
+                               uiDefButBitI(block, TOG, SIZELIKE_OFFSET, B_CONSTRAINT_TEST, "Offset", *xco, *yco-64, 80, 18, &data->flag, 0, 24, 0, 0, "Add original scaling onto copied scaling");
+                               
                                /* constraint space settings */
                                draw_constraint_spaceselect(block, con, *xco, *yco-94, is_armature_owner(ob), is_armature_target(data->tar));
                        }