Blender V2.61 - r43446

DNA_armature_types.h

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00019  * All rights reserved.
00020  *
00021  * Contributor(s): Full recode, Ton Roosendaal, Crete 2005
00022  *
00023  * ***** END GPL LICENSE BLOCK *****
00024  */
00025 
00030 #ifndef DNA_ARMATURE_TYPES_H
00031 #define DNA_ARMATURE_TYPES_H
00032 
00033 #include "DNA_listBase.h"
00034 #include "DNA_ID.h"
00035 
00036 struct AnimData;
00037 
00038 /* this system works on different transformation space levels;
00039 
00040 1) Bone Space;      with each Bone having own (0,0,0) origin
00041 2) Armature Space;  the rest position, in Object space, Bones Spaces are applied hierarchical
00042 3) Pose Space;      the animation position, in Object space
00043 4) World Space;     Object matrix applied to Pose or Armature space
00044 
00045 */
00046 
00047 typedef struct Bone {
00048     struct Bone     *next, *prev;   /*  Next/prev elements within this list */
00049     IDProperty      *prop;          /* User-Defined Properties on this Bone */
00050     struct Bone     *parent;        /*  Parent (ik parent if appropriate flag is set        */
00051     ListBase        childbase;      /*  Children    */
00052     char            name[64];       /*  Name of the bone - must be unique within the armature, MAXBONENAME */
00053 
00054     float           roll;   /*  roll is input for editmode, length calculated */
00055     float           head[3];        
00056     float           tail[3];        /*  head/tail and roll in Bone Space    */
00057     float           bone_mat[3][3]; /*  rotation derived from head/tail/roll */
00058     
00059     int             flag;
00060     
00061     float           arm_head[3];        
00062     float           arm_tail[3];    /*  head/tail in Armature Space (rest pos) */
00063     float           arm_mat[4][4];  /*  matrix: (bonemat(b)+head(b))*arm_mat(b-1), rest pos*/
00064     float           arm_roll;        /* roll in Armature Space (rest pos) */
00065     
00066     float           dist, weight;           /*  dist, weight: for non-deformgroup deforms */
00067     float           xwidth, length, zwidth; /*  width: for block bones. keep in this order, transform! */
00068     float           ease1, ease2;           /*  length of bezier handles */
00069     float           rad_head, rad_tail; /* radius for head/tail sphere, defining deform as well, parent->rad_tip overrides rad_head*/
00070     
00071     float           size[3];        /*  patch for upward compat, UNUSED! */
00072     int             layer;          /* layers that bone appears on */
00073     short           segments;       /*  for B-bones */
00074     short           pad[1];
00075 } Bone;
00076 
00077 typedef struct bArmature {
00078     ID          id;
00079     struct AnimData *adt;
00080     
00081     ListBase    bonebase;
00082     ListBase    chainbase;
00083     ListBase    *edbo;                  /* editbone listbase, we use pointer so we can check state */
00084     
00085     /* active bones should work like active object where possible
00086      * - active and selection are unrelated
00087      * - active & hidden is not allowed 
00088      * - from the user perspective active == last selected
00089      * - active should be ignored when not visible (hidden layer) */
00090 
00091     Bone        *act_bone;              /* active bone (when not in editmode) */
00092     void        *act_edbone;            /* active editbone (in editmode) */
00093 
00094     void        *sketch;                /* sketch struct for etch-a-ton */
00095     
00096     int         flag;
00097     int         drawtype;
00098     int         gevertdeformer;         /* how vertex deformation is handled in the ge */
00099     int         pad;
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     ARM_WIRE
00141 } eArmature_Drawtype;
00142 
00143 /* armature->gevertdeformer */
00144 typedef enum eArmature_VertDeformer {
00145     ARM_VDEF_BLENDER,
00146     ARM_VDEF_BGE_CPU
00147 } eArmature_VertDeformer;
00148 
00149 /* armature->deformflag */
00150 typedef enum eArmature_DeformFlag {
00151     ARM_DEF_VGROUP          = (1<<0),
00152     ARM_DEF_ENVELOPE        = (1<<1),
00153     ARM_DEF_QUATERNION      = (1<<2),
00154     ARM_DEF_B_BONE_REST     = (1<<3),   /* deprecated */
00155     ARM_DEF_INVERT_VGROUP   = (1<<4)
00156 } eArmature_DeformFlag;
00157 
00158 /* armature->pathflag */
00159 // XXX depreceated... old animation system (armature only viz)
00160 typedef enum eArmature_PathFlag {
00161     ARM_PATH_FNUMS      = (1<<0),
00162     ARM_PATH_KFRAS      = (1<<1),
00163     ARM_PATH_HEADS      = (1<<2),
00164     ARM_PATH_ACFRA      = (1<<3),
00165     ARM_PATH_KFNOS      = (1<<4)
00166 } eArmature_PathFlag;
00167 
00168 /* armature->ghosttype */
00169 // XXX depreceated... old animation system (armature only viz)
00170 typedef enum eArmature_GhostType {
00171     ARM_GHOST_CUR = 0,
00172     ARM_GHOST_RANGE,
00173     ARM_GHOST_KEYS
00174 } eArmature_GhostType;
00175 
00176 /* bone->flag */
00177 typedef enum eBone_Flag {
00178     BONE_SELECTED               = (1<<0),
00179     BONE_ROOTSEL                = (1<<1),
00180     BONE_TIPSEL                 = (1<<2),
00181     BONE_TRANSFORM              = (1<<3),   /* Used instead of BONE_SELECTED during transform */
00182     BONE_CONNECTED              = (1<<4),   /* when bone has a parent, connect head of bone to parent's tail*/
00183     /* 32 used to be quatrot, was always set in files, do not reuse unless you clear it always */   
00184     BONE_HIDDEN_P               = (1<<6),   /* hidden Bones when drawing PoseChannels */    
00185     BONE_DONE                   = (1<<7),   /* For detecting cyclic dependancies */
00186     BONE_DRAW_ACTIVE            = (1<<8),   /* active is on mouse clicks only - deprecated, ONLY USE FOR DRAWING */
00187     BONE_HINGE                  = (1<<9),   /* No parent rotation or scale */
00188     BONE_HIDDEN_A               = (1<<10),  /* hidden Bones when drawing Armature Editmode */
00189     BONE_MULT_VG_ENV            = (1<<11),  /* multiplies vgroup with envelope */
00190     BONE_NO_DEFORM              = (1<<12),  /* bone doesn't deform geometry */
00191     BONE_UNKEYED                = (1<<13),  /* set to prevent destruction of its unkeyframed pose (after transform) */      
00192     BONE_HINGE_CHILD_TRANSFORM  = (1<<14),  /* set to prevent hinge child bones from influencing the transform center */
00193     BONE_NO_SCALE               = (1<<15),  /* No parent scale */
00194     BONE_HIDDEN_PG              = (1<<16),  /* hidden bone when drawing PoseChannels (for ghost drawing) */
00195     BONE_DRAWWIRE               = (1<<17),  /* bone should be drawn as OB_WIRE, regardless of draw-types of view+armature */
00196     BONE_NO_CYCLICOFFSET        = (1<<18),  /* when no parent, bone will not get cyclic offset */
00197     BONE_EDITMODE_LOCKED        = (1<<19),  /* bone transforms are locked in EditMode */
00198     BONE_TRANSFORM_CHILD        = (1<<20),  /* Indicates that a parent is also being transformed */
00199     BONE_UNSELECTABLE           = (1<<21),  /* bone cannot be selected */
00200     BONE_NO_LOCAL_LOCATION      = (1<<22)   /* bone location is in armature space */
00201 } eBone_Flag;
00202 
00203 #define MAXBONENAME 64
00204 
00205 #endif