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