|
Blender
V2.59
|
00001 /* 00002 * $Id: BKE_armature.h 34962 2011-02-18 13:05:18Z 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 * The Original Code is: all of this file. 00024 * 00025 * Contributor(s): none yet. 00026 * 00027 * ***** END GPL LICENSE BLOCK ***** 00028 */ 00029 #ifndef BKE_ARMATURE_H 00030 #define BKE_ARMATURE_H 00031 00038 struct Bone; 00039 struct Main; 00040 struct bArmature; 00041 struct bPose; 00042 struct bPoseChannel; 00043 struct bConstraint; 00044 struct Scene; 00045 struct Object; 00046 struct MDeformVert; 00047 struct Mesh; 00048 struct PoseTree; 00049 struct ListBase; 00050 00051 typedef struct PoseTarget 00052 { 00053 struct PoseTarget *next, *prev; 00054 00055 struct bConstraint *con; /* the constrait of this target */ 00056 int tip; /* index of tip pchan in PoseTree */ 00057 } PoseTarget; 00058 00059 typedef struct PoseTree 00060 { 00061 struct PoseTree *next, *prev; 00062 00063 int type; /* type of IK that this serves (CONSTRAINT_TYPE_KINEMATIC or ..._SPLINEIK) */ 00064 int totchannel; /* number of pose channels */ 00065 00066 struct ListBase targets; /* list of targets of the tree */ 00067 struct bPoseChannel **pchan; /* array of pose channels */ 00068 int *parent; /* and their parents */ 00069 00070 float (*basis_change)[3][3]; /* basis change result from solver */ 00071 int iterations; /* iterations from the constraint */ 00072 int stretch; /* disable stretching */ 00073 } PoseTree; 00074 00075 /* Core armature functionality */ 00076 #ifdef __cplusplus 00077 extern "C" { 00078 #endif 00079 00080 struct bArmature *add_armature(const char *name); 00081 struct bArmature *get_armature(struct Object *ob); 00082 void free_bonelist (struct ListBase *lb); 00083 void free_armature(struct bArmature *arm); 00084 void make_local_armature(struct bArmature *arm); 00085 struct bArmature *copy_armature(struct bArmature *arm); 00086 00087 int bone_autoside_name (char name[32], int strip_number, short axis, float head, float tail); 00088 00089 struct Bone *get_named_bone (struct bArmature *arm, const char *name); 00090 00091 float distfactor_to_bone (float vec[3], float b1[3], float b2[3], float rad1, float rad2, float rdist); 00092 00093 void where_is_armature (struct bArmature *arm); 00094 void where_is_armature_bone(struct Bone *bone, struct Bone *prevbone); 00095 void armature_rebuild_pose(struct Object *ob, struct bArmature *arm); 00096 void where_is_pose (struct Scene *scene, struct Object *ob); 00097 void where_is_pose_bone(struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan, float ctime, int do_extra); 00098 void where_is_pose_bone_tail(struct bPoseChannel *pchan); 00099 00100 /* get_objectspace_bone_matrix has to be removed still */ 00101 void get_objectspace_bone_matrix (struct Bone* bone, float M_accumulatedMatrix[][4], int root, int posed); 00102 void vec_roll_to_mat3(float *vec, float roll, float mat[][3]); 00103 void mat3_to_vec_roll(float mat[][3], float *vec, float *roll); 00104 00105 /* Common Conversions Between Co-ordinate Spaces */ 00106 void armature_mat_world_to_pose(struct Object *ob, float inmat[][4], float outmat[][4]); 00107 void armature_loc_world_to_pose(struct Object *ob, float *inloc, float *outloc); 00108 void armature_mat_pose_to_bone(struct bPoseChannel *pchan, float inmat[][4], float outmat[][4]); 00109 void armature_loc_pose_to_bone(struct bPoseChannel *pchan, float *inloc, float *outloc); 00110 void armature_mat_pose_to_delta(float delta_mat[][4], float pose_mat[][4], float arm_mat[][4]); 00111 00112 void pchan_mat3_to_rot(struct bPoseChannel *pchan, float mat[][3], short use_compat); 00113 void pchan_apply_mat4(struct bPoseChannel *pchan, float mat[][4], short use_comat); 00114 void pchan_to_mat4(struct bPoseChannel *pchan, float chan_mat[4][4]); 00115 void pchan_calc_mat(struct bPoseChannel *pchan); 00116 00117 /* Rotation Mode Conversions - Used for PoseChannels + Objects... */ 00118 void BKE_rotMode_change_values(float quat[4], float eul[3], float axis[3], float *angle, short oldMode, short newMode); 00119 00120 /* B-Bone support */ 00121 typedef struct Mat4 { 00122 float mat[4][4]; 00123 } Mat4; 00124 00125 Mat4 *b_bone_spline_setup(struct bPoseChannel *pchan, int rest); 00126 00127 /* like EBONE_VISIBLE */ 00128 #define PBONE_VISIBLE(arm, bone) (((bone)->layer & (arm)->layer) && !((bone)->flag & BONE_HIDDEN_P)) 00129 #define _BONE_VISIBLE(arm, bone) (((bone)->layer & (arm)->layer) && !((bone)->flag & BONE_HIDDEN_P)) 00130 00131 #ifdef __cplusplus 00132 } 00133 #endif 00134 00135 #endif 00136