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 void make_boneList(struct ListBase *list, struct ListBase *bones, EditBone *parent);
72 void editbones_to_armature (struct ListBase *list, struct Object *ob);
74 void adduplicate_armature(void);
75 void addvert_armature(void);
76 void add_primitiveArmature(int type);
77 void apply_rot_armature (struct Object *ob, float mat[3][3]);
78 void docenter_armature (struct Object *ob, int centermode);
80 void clear_armature(struct Object *ob, char mode);
82 void delete_armature(void);
83 void deselectall_armature(int toggle, int doundo);
84 void deselectall_posearmature (struct Object *ob, int test, int doundo);
85 int draw_armature(struct Base *base, int dt, int flag);
87 void extrude_armature(int forked);
88 void subdivide_armature(int numcuts);
89 void fill_bones_armature(void);
90 void merge_armature(void);
92 void free_editArmature(void);
94 int join_armature(void);
95 void separate_armature(void);
96 void apply_armature_pose2bones(void);
97 void load_editArmature(void);
99 void make_bone_parent(void);
100 void clear_bone_parent(void);
101 struct Bone *get_indexed_bone (struct Object *ob, int index);
103 void make_editArmature(void);
104 void make_trans_bones (char mode);
105 void remake_editArmature(void);
106 void editbones_to_armature(struct ListBase *list, struct Object *ob);
108 int do_pose_selectbuffer(struct Base *base, unsigned int *buffer, short hits);
110 void generateSkeleton(void);
112 void mouse_armature(void);
113 void selectconnected_armature(void);
114 void selectconnected_posearmature(void);
115 void armature_select_hierarchy(short direction, short add_to_sel);
117 void setflag_armature(short mode);
118 void unique_editbone_name (struct ListBase *ebones, char *name);
120 void auto_align_armature(short mode);
121 void switch_direction_armature(void);
123 void create_vgroups_from_armature(struct Object *ob, struct Object *par);
124 void add_verts_to_dgroups(struct Object *ob, struct Object *par, int heat, int mirror);
126 void hide_selected_pose_bones(void);
127 void hide_unselected_pose_bones(void);
128 void show_all_pose_bones(void);
130 int bone_looper(struct Object *ob, struct Bone *bone, void *data,
131 int (*bone_func)(struct Object *, struct Bone *, void *));
133 void undo_push_armature(char *name);
134 void armature_bone_rename(struct bArmature *arm, char *oldname, char *newname);
135 void armature_flip_names(void);
136 void armature_autoside_names(short axis);
137 EditBone *armature_bone_get_mirrored(EditBone *ebo);
138 void transform_armature_mirror_update(void);
140 void hide_selected_armature_bones(void);
141 void hide_unselected_armature_bones(void);
142 void show_all_armature_bones(void);
144 void align_selected_bones(void);
146 #define BONESEL_ROOT 0x10000000
147 #define BONESEL_TIP 0x20000000
148 #define BONESEL_BONE 0x40000000
149 #define BONESEL_ANY (BONESEL_TIP|BONESEL_ROOT|BONESEL_BONE)
151 #define BONESEL_NOSEL 0x80000000 /* Indicates a negative number */
153 /* from autoarmature */
154 void BIF_retargetArmature();
155 void BIF_adjustRetarget();
156 void BIF_freeRetarget();
159 float calcVariance(struct ReebArc *arc, int start, int end, float v0[3], float n[3]);
160 float calcDistance(struct ReebArc *arc, int start, int end, float head[3], float tail[3]);
163 #define EBONE_VISIBLE(arm, ebone) ((arm->layer & ebone->layer) && !(ebone->flag & BONE_HIDDEN_A))
164 #define EBONE_EDITABLE(ebone) ((ebone->flag & BONE_SELECTED) && !(ebone->flag & BONE_EDITMODE_LOCKED))
166 /* used in bone_select_hierachy() */
167 #define BONE_SELECT_PARENT 0
168 #define BONE_SELECT_CHILD 1