Blender V2.61 - r43446
|
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): Blender Foundation 00022 * 00023 * ***** END GPL LICENSE BLOCK ***** 00024 */ 00025 00030 #ifndef ED_ARMATURE_H 00031 #define ED_ARMATURE_H 00032 00033 #ifdef __cplusplus 00034 extern "C" { 00035 #endif 00036 00037 struct bArmature; 00038 struct Base; 00039 struct bContext; 00040 struct Bone; 00041 struct bPoseChannel; 00042 struct DerivedMesh; 00043 struct IDProperty; 00044 struct ListBase; 00045 struct MeshDeformModifierData; 00046 struct Object; 00047 struct RegionView3D; 00048 struct ReportList; 00049 struct Scene; 00050 struct SK_Sketch; 00051 struct View3D; 00052 struct ViewContext; 00053 struct wmKeyConfig; 00054 struct wmOperator; 00055 00056 typedef struct EditBone 00057 { 00058 struct EditBone *next, *prev; 00059 struct IDProperty *prop; /* User-Defined Properties on this Bone */ 00060 struct EditBone *parent;/* Editbones have a one-way link (i.e. children refer 00061 to parents. This is converted to a two-way link for 00062 normal bones when leaving editmode. */ 00063 void *temp; /* Used to store temporary data */ 00064 00065 char name[64]; /* MAX_NAME */ 00066 float roll; /* Roll along axis. We'll ultimately use the axis/angle method 00067 for determining the transformation matrix of the bone. The axis 00068 is tail-head while roll provides the angle. Refer to Graphics 00069 Gems 1 p. 466 (section IX.6) if it's not already in here somewhere*/ 00070 00071 float head[3]; /* Orientation and length is implicit during editing */ 00072 float tail[3]; 00073 /* All joints are considered to have zero rotation with respect to 00074 their parents. Therefore any rotations specified during the 00075 animation are automatically relative to the bones' rest positions*/ 00076 int flag; 00077 int layer; 00078 00079 float dist, weight; 00080 float xwidth, length, zwidth; /* put them in order! transform uses this as scale */ 00081 float ease1, ease2; 00082 float rad_head, rad_tail; 00083 00084 float oldlength; /* for envelope scaling */ 00085 00086 short segments; 00087 } EditBone; 00088 00089 #define BONESEL_ROOT (1<<28) 00090 #define BONESEL_TIP (1<<29) 00091 #define BONESEL_BONE (1<<30) 00092 #define BONESEL_ANY (BONESEL_TIP|BONESEL_ROOT|BONESEL_BONE) 00093 00094 #define BONESEL_NOSEL (1<<31) /* Indicates a negative number */ 00095 00096 /* useful macros */ 00097 #define EBONE_VISIBLE(arm, ebone) (((arm)->layer & (ebone)->layer) && !((ebone)->flag & BONE_HIDDEN_A)) 00098 #define EBONE_EDITABLE(ebone) (((ebone)->flag & BONE_SELECTED) && !((ebone)->flag & BONE_EDITMODE_LOCKED)) 00099 00100 /* used in bone_select_hierachy() */ 00101 #define BONE_SELECT_PARENT 0 00102 #define BONE_SELECT_CHILD 1 00103 00104 /* armature_ops.c */ 00105 void ED_operatortypes_armature(void); 00106 void ED_operatormacros_armature(void); 00107 void ED_keymap_armature(struct wmKeyConfig *keyconf); 00108 00109 /* editarmature.c */ 00110 void ED_armature_from_edit(struct Object *obedit); 00111 void ED_armature_to_edit(struct Object *ob); 00112 void ED_armature_edit_free(struct Object *ob); 00113 void ED_armature_deselect_all(struct Object *obedit, int toggle); 00114 void ED_armature_deselect_all_visible(struct Object *obedit); 00115 00116 int ED_do_pose_selectbuffer(struct Scene *scene, struct Base *base, unsigned int *buffer, 00117 short hits, short extend); 00118 int mouse_armature(struct bContext *C, const int mval[2], int extend); 00119 int join_armature_exec(struct bContext *C, struct wmOperator *op); 00120 struct Bone *get_indexed_bone (struct Object *ob, int index); 00121 float ED_rollBoneToVector(EditBone *bone, const float new_up_axis[3], const short axis_only); 00122 EditBone *ED_armature_bone_get_mirrored(struct ListBase *edbo, EditBone *ebo); // XXX this is needed for populating the context iterators 00123 void ED_armature_sync_selection(struct ListBase *edbo); 00124 void ED_armature_validate_active(struct bArmature *arm); 00125 00126 void add_primitive_bone(struct Scene *scene, struct View3D *v3d, struct RegionView3D *rv3d); 00127 struct EditBone *ED_armature_edit_bone_add(struct bArmature *arm, const char *name); 00128 void ED_armature_edit_bone_remove(struct bArmature *arm, EditBone *exBone); 00129 00130 void transform_armature_mirror_update(struct Object *obedit); 00131 void clear_armature(struct Scene *scene, struct Object *ob, char mode); 00132 void docenter_armature (struct Scene *scene, struct Object *ob, float cursor[3], int centermode, int around); 00133 00134 void ED_armature_apply_transform(struct Object *ob, float mat[4][4]); 00135 00136 #define ARM_GROUPS_NAME 1 00137 #define ARM_GROUPS_ENVELOPE 2 00138 #define ARM_GROUPS_AUTO 3 00139 00140 void create_vgroups_from_armature(struct ReportList *reports, struct Scene *scene, struct Object *ob, struct Object *par, int mode, int mirror); 00141 00142 void auto_align_armature(struct Scene *scene, struct View3D *v3d, short mode); 00143 void unique_editbone_name(struct ListBase *ebones, char *name, EditBone *bone); /* if bone is already in list, pass it as param to ignore it */ 00144 void ED_armature_bone_rename(struct bArmature *arm, const char *oldnamep, const char *newnamep); 00145 00146 void undo_push_armature(struct bContext *C, const char *name); 00147 00148 /* poseobject.c */ 00149 void ED_armature_exit_posemode(struct bContext *C, struct Base *base); 00150 void ED_armature_enter_posemode(struct bContext *C, struct Base *base); 00151 int ED_pose_channel_in_IK_chain(struct Object *ob, struct bPoseChannel *pchan); 00152 void ED_pose_deselectall(struct Object *ob, int test); 00153 void ED_pose_recalculate_paths(struct Scene *scene, struct Object *ob); 00154 00155 /* sketch */ 00156 00157 int ED_operator_sketch_mode_active_stroke(struct bContext *C); 00158 int ED_operator_sketch_full_mode(struct bContext *C); 00159 int ED_operator_sketch_mode(const struct bContext *C); 00160 00161 void BIF_convertSketch(struct bContext *C); 00162 void BIF_deleteSketch(struct bContext *C); 00163 void BIF_selectAllSketch(struct bContext *C, int mode); /* -1: deselect, 0: select, 1: toggle */ 00164 00165 void BIF_makeListTemplates(const struct bContext *C); 00166 const char *BIF_listTemplates(const struct bContext *C); 00167 int BIF_currentTemplate(const struct bContext *C); 00168 void BIF_freeTemplates(struct bContext *C); 00169 void BIF_setTemplate(struct bContext *C, int index); 00170 int BIF_nbJointsTemplate(const struct bContext *C); 00171 const char * BIF_nameBoneTemplate(const struct bContext *C); 00172 00173 void BDR_drawSketch(const struct bContext *vc); 00174 int BDR_drawSketchNames(struct ViewContext *vc); 00175 00176 /* meshlaplacian.c */ 00177 void mesh_deform_bind(struct Scene *scene, 00178 struct MeshDeformModifierData *mmd, 00179 float *vertexcos, int totvert, float cagemat[][4]); 00180 00181 #ifdef __cplusplus 00182 } 00183 #endif 00184 00185 #endif /* ED_ARMATURE_H */ 00186 00187 00188