4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
21 * All rights reserved.
23 * The Original Code is: all of this file.
25 * Contributor(s): none yet.
27 * ***** END GPL LICENSE BLOCK *****
29 #ifndef BIF_EDITARMATURE_H
30 #define BIF_EDITARMATURE_H
38 typedef struct EditBone
40 struct EditBone *next, *prev;
41 struct EditBone *parent;/* Editbones have a one-way link (i.e. children refer
42 to parents. This is converted to a two-way link for
43 normal bones when leaving editmode. */
44 void *temp; /* Used to store temporary data */
47 float roll; /* Roll along axis. We'll ultimately use the axis/angle method
48 for determining the transformation matrix of the bone. The axis
49 is tail-head while roll provides the angle. Refer to Graphics
50 Gems 1 p. 466 (section IX.6) if it's not already in here somewhere*/
52 float head[3]; /* Orientation and length is implicit during editing */
54 /* All joints are considered to have zero rotation with respect to
55 their parents. Therefore any rotations specified during the
56 animation are automatically relative to the bones' rest positions*/
59 int parNr; /* Used for retrieving values from the menu system */
62 float xwidth, length, zwidth; /* put them in order! transform uses this as scale */
64 float rad_head, rad_tail;
65 short layer, segments;
67 float oldlength; /* for envelope scaling */
71 EditBone *addEditBone(char *name, struct ListBase *ebones, struct bArmature *arm);
73 float rollBoneToVector(EditBone *bone, float new_up_axis[3]);
75 void adduplicate_armature(void);
76 void addvert_armature(void);
77 void add_primitiveArmature(int type);
78 void apply_rot_armature (struct Object *ob, float mat[3][3]);
79 void docenter_armature (struct Object *ob, int centermode);
81 void clear_armature(struct Object *ob, char mode);
83 void delete_armature(void);
84 void deselectall_armature(int toggle, int doundo);
85 void deselectall_posearmature (struct Object *ob, int test, int doundo);
86 int draw_armature(struct Base *base, int dt, int flag);
88 void extrude_armature(int forked);
89 void subdivide_armature(int numcuts);
90 void fill_bones_armature(void);
91 void merge_armature(void);
93 void free_editArmature(void);
95 int join_armature(void);
96 void separate_armature(void);
97 void apply_armature_pose2bones(void);
98 void load_editArmature(void);
100 void make_bone_parent(void);
101 void clear_bone_parent(void);
102 struct Bone *get_indexed_bone (struct Object *ob, int index);
104 void make_editArmature(void);
105 void make_trans_bones (char mode);
106 void remake_editArmature(void);
107 void editbones_to_armature(struct ListBase *list, struct Object *ob);
109 int do_pose_selectbuffer(struct Base *base, unsigned int *buffer, short hits);
111 void generateSkeleton(void);
113 void mouse_armature(void);
114 void selectconnected_armature(void);
115 void selectconnected_posearmature(void);
116 void armature_select_hierarchy(short direction, short add_to_sel);
118 void setflag_armature(short mode);
119 void unique_editbone_name (struct ListBase *ebones, char *name);
121 void auto_align_armature(short mode);
122 void switch_direction_armature(void);
124 void create_vgroups_from_armature(struct Object *ob, struct Object *par);
125 void add_verts_to_dgroups(struct Object *ob, struct Object *par, int heat, int mirror);
127 void hide_selected_pose_bones(void);
128 void hide_unselected_pose_bones(void);
129 void show_all_pose_bones(void);
131 int bone_looper(struct Object *ob, struct Bone *bone, void *data,
132 int (*bone_func)(struct Object *, struct Bone *, void *));
134 void undo_push_armature(char *name);
135 void armature_bone_rename(struct bArmature *arm, char *oldname, char *newname);
136 void armature_flip_names(void);
137 void armature_autoside_names(short axis);
138 EditBone *armature_bone_get_mirrored(EditBone *ebo);
139 void transform_armature_mirror_update(void);
141 void hide_selected_armature_bones(void);
142 void hide_unselected_armature_bones(void);
143 void show_all_armature_bones(void);
145 void align_selected_bones(void);
147 #define BONESEL_ROOT 0x10000000
148 #define BONESEL_TIP 0x20000000
149 #define BONESEL_BONE 0x40000000
150 #define BONESEL_ANY (BONESEL_TIP|BONESEL_ROOT|BONESEL_BONE)
152 #define BONESEL_NOSEL 0x80000000 /* Indicates a negative number */
155 #define EBONE_VISIBLE(arm, ebone) ((arm->layer & ebone->layer) && !(ebone->flag & BONE_HIDDEN_A))
156 #define EBONE_EDITABLE(ebone) ((ebone->flag & BONE_SELECTED) && !(ebone->flag & BONE_EDITMODE_LOCKED))
158 /* used in bone_select_hierachy() */
159 #define BONE_SELECT_PARENT 0
160 #define BONE_SELECT_CHILD 1