== Armatures - Bone Paths ==
authorJoshua Leung <aligorith@gmail.com>
Mon, 1 Jan 2007 22:48:09 +0000 (22:48 +0000)
committerJoshua Leung <aligorith@gmail.com>
Mon, 1 Jan 2007 22:48:09 +0000 (22:48 +0000)
* Shuffled a few bone-path buttons in the Armature Visualisation panel.

* Added a new option for bone-paths drawing: Calculate/show the path
travelled by the 'head' (fat end) of bone. By default, this option is off.

* Also, I forgot to mention in last commit that I had added an option which
specified the time-difference between each highlighted point on the curve.

source/blender/makesdna/DNA_armature_types.h
source/blender/src/buttons_editing.c
source/blender/src/poseobject.c

index 6225b018c8b0cc4423be47555bc770158116f55d..b3235fc71f3b61eb22e11481b2c0276e709396f5 100644 (file)
@@ -117,6 +117,7 @@ typedef struct bArmature {
 /* armature->pathflag */
 #define                ARM_PATH_FNUMS  0x001
 #define                ARM_PATH_KFRAS  0x002
+#define                ARM_PATH_HEADS  0x004
 
 /* armature->ghosttype */
 #define        ARM_GHOST_CUR   0
index bde4a809a5ad302eeae065e70de641fe364aeed2..34890a9a48f3360fc598566e2a6c7db5c903c1ff 100644 (file)
@@ -3322,8 +3322,8 @@ static void editing_panel_armature_visuals(Object *ob, bArmature *arm)
 
        /* version patch for older files here (do_versions patch too complicated) */
        if ((arm->ghostsf == 0) || (arm->ghostef == 0)) {
-               arm->ghostsf = CFRA - arm->ghostep;
-               arm->ghostef = CFRA + arm->ghostep;
+               arm->ghostsf = CFRA - (arm->ghostep * arm->ghostsize);
+               arm->ghostef = CFRA + (arm->ghostep * arm->ghostsize);
        }
        if ((arm->pathsf == 0) || (arm->pathef == 0)) {
                arm->pathsf = SFRA;
@@ -3357,13 +3357,14 @@ static void editing_panel_armature_visuals(Object *ob, bArmature *arm)
        
        uiBlockBeginAlign(block);
        uiDefButBitS(block, TOG, ARM_PATH_FNUMS, REDRAWVIEW3D, "Frame Nums", 170, 160, 80, 20, &arm->pathflag, 0, 0, 0, 0, "Show frame numbers on path");
-       uiDefButBitS(block, TOG, ARM_PATH_KFRAS, REDRAWVIEW3D, "Show Keys", 250, 160, 80, 20, &arm->pathflag, 0, 0, 0, 0, "Show key frames on path");
-       uiDefButS(block, NUM, REDRAWVIEW3D, "PStep:",170,140,160,20, &arm->pathsize,1,100, 10, 50, "Frames between highlighted points on bone path");
+       uiDefButS(block, NUM, REDRAWVIEW3D, "PStep:",250,160,80,20, &arm->pathsize,1,100, 10, 50, "Frames between highlighted points on bone path");
+       uiDefButBitS(block, TOG, ARM_PATH_KFRAS, REDRAWVIEW3D, "Show Keys", 170, 140, 160, 20, &arm->pathflag, 0, 0, 0, 0, "Show key frames on path");
        uiBlockEndAlign(block);
        
        uiBlockBeginAlign(block);
-       uiDefButI(block, NUM,REDRAWVIEW3D,"PSta:",170,100,160,20, &arm->pathsf, 1.0, MAXFRAMEF, 0, 0, "The start frame for Bone Path display range");
-       uiDefButI(block, NUM,REDRAWVIEW3D,"PEnd:",170,80,160,20, &arm->pathef, arm->pathsf, MAXFRAMEF, 0, 0, "The end frame for Bone Path display range");      
+       uiDefButI(block, NUM,REDRAWVIEW3D,"PSta:",170,100,80,20, &arm->pathsf, 1.0, MAXFRAMEF, 0, 0, "The start frame for Bone Path display range");
+       uiDefButI(block, NUM,REDRAWVIEW3D,"PEnd:",250,100,80,20, &arm->pathef, arm->pathsf, MAXFRAMEF, 0, 0, "The end frame for Bone Path display range");      
+       uiDefButBitS(block, TOG, ARM_PATH_HEADS, REDRAWVIEW3D, "Bone-Head Path", 170, 80, 160, 20, &arm->pathflag, 0, 0, 0, 0, "Calculate the Path travelled by the Bone's Head instead of Tail");
        uiBlockEndAlign(block);
        
        uiBlockBeginAlign(block);
index 571705968189ae7430b8893982038b7c5a2c2342..862a9517bae5faa6c190d0c500c7a5ac59fd71ff 100644 (file)
@@ -273,7 +273,14 @@ void pose_calculate_path(Object *ob)
                                if(arm->layer & pchan->bone->layer) {
                                        if(pchan->path) {
                                                fp= pchan->path+3*(CFRA-sfra);
-                                               VECCOPY(fp, pchan->pose_tail);
+                                               
+                                               if (arm->pathflag & ARM_PATH_HEADS) { 
+                                                       VECCOPY(fp, pchan->pose_head);
+                                               }
+                                               else {
+                                                       VECCOPY(fp, pchan->pose_tail);
+                                               }
+                                               
                                                Mat4MulVecfl(ob->obmat, fp);
                                        }
                                }