Blender  V2.59
DNA_armature_types.h
Go to the documentation of this file.
00001 /*
00002  * $Id: DNA_armature_types.h 34941 2011-02-17 20:48:12Z jesterking $
00003  *
00004  * ***** BEGIN GPL LICENSE BLOCK *****
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software Foundation,
00018  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  *
00020  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00021  * All rights reserved.
00022  *
00023  * Contributor(s): Full recode, Ton Roosendaal, Crete 2005
00024  *
00025  * ***** END GPL LICENSE BLOCK *****
00026  */
00027 
00028 #ifndef DNA_ARMATURE_TYPES_H
00029 #define DNA_ARMATURE_TYPES_H
00030 
00035 #include "DNA_listBase.h"
00036 #include "DNA_ID.h"
00037 
00038 struct AnimData;
00039 
00040 /* this system works on different transformation space levels;
00041 
00042 1) Bone Space;          with each Bone having own (0,0,0) origin
00043 2) Armature Space;  the rest position, in Object space, Bones Spaces are applied hierarchical
00044 3) Pose Space;          the animation position, in Object space
00045 4) World Space;         Object matrix applied to Pose or Armature space
00046 
00047 */
00048 
00049 typedef struct Bone {
00050         struct Bone             *next, *prev;   /*      Next/prev elements within this list     */
00051         IDProperty              *prop;                  /* User-Defined Properties on this Bone */
00052         struct Bone             *parent;                /*      Parent (ik parent if appropriate flag is set            */
00053         ListBase                childbase;              /*      Children        */
00054         char                    name[32];               /*  Name of the bone - must be unique within the armature */
00055 
00056         float                   roll;   /*  roll is input for editmode, length calculated */
00057         float                   head[3];                
00058         float                   tail[3];                /*      head/tail and roll in Bone Space        */
00059         float                   bone_mat[3][3]; /*  rotation derived from head/tail/roll */
00060         
00061         int                             flag;
00062         
00063         float                   arm_head[3];            
00064         float                   arm_tail[3];    /*      head/tail in Armature Space (rest pos) */
00065         float                   arm_mat[4][4];  /*  matrix: (bonemat(b)+head(b))*arm_mat(b-1), rest pos*/
00066         float           arm_roll;        /* roll in Armature Space (rest pos) */
00067         
00068         float                   dist, weight;                   /*  dist, weight: for non-deformgroup deforms */
00069         float                   xwidth, length, zwidth; /*  width: for block bones. keep in this order, transform! */
00070         float                   ease1, ease2;                   /*  length of bezier handles */
00071         float                   rad_head, rad_tail;     /* radius for head/tail sphere, defining deform as well, parent->rad_tip overrides rad_head*/
00072         
00073         float                   size[3];                /*  patch for upward compat, UNUSED! */
00074         int                             layer;                  /* layers that bone appears on */
00075         short                   segments;               /*  for B-bones */
00076         short                   pad[1];
00077 } Bone;
00078 
00079 typedef struct bArmature {
00080         ID                      id;
00081         struct AnimData *adt;
00082         
00083         ListBase        bonebase;
00084         ListBase        chainbase;
00085         ListBase        *edbo;                                  /* editbone listbase, we use pointer so we can check state */
00086         
00087         /* active bones should work like active object where possible
00088          * - active and selection are unrelated
00089          * - active & hidden is not allowed 
00090          * - from the user perspective active == last selected
00091          * - active should be ignored when not visible (hidden layer) */
00092 
00093         Bone            *act_bone;                              /* active bone (when not in editmode) */
00094         void            *act_edbone;                    /* active editbone (in editmode) */
00095 
00096         void            *sketch;                                /* sketch struct for etch-a-ton */
00097         
00098         int                     flag;
00099         int                     drawtype;                       
00100         short           deformflag; 
00101         short           pathflag;
00102         
00103         unsigned int layer_used;                /* for UI, to show which layers are there */
00104         unsigned int layer, layer_protected;            /* for buttons to work, both variables in this order together */
00105         
00106 // XXX depreceated... old animaton system (armature only viz) ---
00107         short           ghostep, ghostsize;             /* number of frames to ghosts to show, and step between them  */
00108         short           ghosttype, pathsize;            /* ghost drawing options and number of frames between points of path */
00109         int                     ghostsf, ghostef;               /* start and end frames of ghost-drawing range */
00110         int             pathsf, pathef;                 /* start and end frames of path-calculation range for all bones */
00111         int                     pathbc, pathac;                 /* number of frames before/after current frame of path-calculation for all bones  */
00112 // XXX end of depreceated code ---------------------------------- 
00113 } bArmature;
00114 
00115 /* armature->flag */
00116 /* dont use bit 7, was saved in files to disable stuff */
00117 typedef enum eArmature_Flag {
00118         ARM_RESTPOS                     = (1<<0),
00119         ARM_DRAWXRAY            = (1<<1),       /* XRAY is here only for backwards converting */
00120         ARM_DRAWAXES            = (1<<2),
00121         ARM_DRAWNAMES           = (1<<3), 
00122         ARM_POSEMODE            = (1<<4), 
00123         ARM_EDITMODE            = (1<<5), 
00124         ARM_DELAYDEFORM         = (1<<6), 
00125         ARM_DONT_USE            = (1<<7),
00126         ARM_MIRROR_EDIT         = (1<<8),
00127         ARM_AUTO_IK                     = (1<<9),
00128         ARM_NO_CUSTOM           = (1<<10),      /* made option negative, for backwards compat */
00129         ARM_COL_CUSTOM          = (1<<11),      /* draw custom colors  */
00130         ARM_GHOST_ONLYSEL       = (1<<12),      /* when ghosting, only show selected bones (this should belong to ghostflag instead) */ // XXX depreceated
00131         ARM_DS_EXPAND           = (1<<13)
00132 } eArmature_Flag;
00133 
00134 /* armature->drawtype */
00135 typedef enum eArmature_Drawtype {
00136         ARM_OCTA = 0,
00137         ARM_LINE,
00138         ARM_B_BONE,
00139         ARM_ENVELOPE
00140 } eArmature_Drawtype;
00141 
00142 /* armature->deformflag */
00143 typedef enum eArmature_DeformFlag {
00144         ARM_DEF_VGROUP                  = (1<<0),
00145         ARM_DEF_ENVELOPE                = (1<<1),
00146         ARM_DEF_QUATERNION              = (1<<2),
00147         ARM_DEF_B_BONE_REST             = (1<<3),       /* deprecated */
00148         ARM_DEF_INVERT_VGROUP   = (1<<4)
00149 } eArmature_DeformFlag;
00150 
00151 /* armature->pathflag */
00152 // XXX depreceated... old animation system (armature only viz)
00153 typedef enum eArmature_PathFlag {
00154         ARM_PATH_FNUMS          = (1<<0),
00155         ARM_PATH_KFRAS          = (1<<1),
00156         ARM_PATH_HEADS          = (1<<2),
00157         ARM_PATH_ACFRA          = (1<<3),
00158         ARM_PATH_KFNOS          = (1<<4)
00159 } eArmature_PathFlag;
00160 
00161 /* armature->ghosttype */
00162 // XXX depreceated... old animation system (armature only viz)
00163 typedef enum eArmature_GhostType {
00164         ARM_GHOST_CUR = 0,
00165         ARM_GHOST_RANGE,
00166         ARM_GHOST_KEYS
00167 } eArmature_GhostType;
00168 
00169 /* bone->flag */
00170 typedef enum eBone_Flag {
00171         BONE_SELECTED                           = (1<<0),
00172         BONE_ROOTSEL                            = (1<<1),
00173         BONE_TIPSEL                                     = (1<<2),
00174         BONE_TRANSFORM                          = (1<<3),       /* Used instead of BONE_SELECTED during transform */
00175         BONE_CONNECTED                          = (1<<4),       /* when bone has a parent, connect head of bone to parent's tail*/
00176         /* 32 used to be quatrot, was always set in files, do not reuse unless you clear it always */   
00177         BONE_HIDDEN_P                           = (1<<6),       /* hidden Bones when drawing PoseChannels */    
00178         BONE_DONE                                       = (1<<7),       /* For detecting cyclic dependancies */
00179         BONE_DRAW_ACTIVE                        = (1<<8),       /* active is on mouse clicks only - deprecated, ONLY USE FOR DRAWING */
00180         BONE_HINGE                                      = (1<<9),       /* No parent rotation or scale */
00181         BONE_HIDDEN_A                           = (1<<10),      /* hidden Bones when drawing Armature Editmode */
00182         BONE_MULT_VG_ENV                        = (1<<11),      /* multiplies vgroup with envelope */
00183         BONE_NO_DEFORM                          = (1<<12),      /* bone doesn't deform geometry */
00184         BONE_UNKEYED                            = (1<<13),      /* set to prevent destruction of its unkeyframed pose (after transform) */              
00185         BONE_HINGE_CHILD_TRANSFORM      = (1<<14),      /* set to prevent hinge child bones from influencing the transform center */
00186         BONE_NO_SCALE                           = (1<<15),      /* No parent scale */
00187         BONE_HIDDEN_PG                          = (1<<16),      /* hidden bone when drawing PoseChannels (for ghost drawing) */
00188         BONE_DRAWWIRE                           = (1<<17),      /* bone should be drawn as OB_WIRE, regardless of draw-types of view+armature */
00189         BONE_NO_CYCLICOFFSET            = (1<<18),      /* when no parent, bone will not get cyclic offset */
00190         BONE_EDITMODE_LOCKED            = (1<<19),      /* bone transforms are locked in EditMode */
00191         BONE_TRANSFORM_CHILD            = (1<<20),      /* Indicates that a parent is also being transformed */
00192         BONE_UNSELECTABLE                       = (1<<21),      /* bone cannot be selected */
00193         BONE_NO_LOCAL_LOCATION          = (1<<22)       /* bone location is in armature space */
00194 } eBone_Flag;
00195 
00196 #define MAXBONENAME 32
00197 
00198 #endif