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 * ***** END GPL LICENSE BLOCK *****
23 #ifndef BIF_RETARGET_H
24 #define BIF_RETARGET_H
26 #include "DNA_listBase.h"
28 #include "BLI_graph.h"
29 #include "BLI_ghash.h"
30 #include "BLI_threads.h"
48 typedef struct RigGraph {
56 RadialSymmetry radial_symmetry;
57 AxialSymmetry axial_symmetry;
58 /*********************************/
69 struct ThreadedWorker *worker;
71 GHash *bones_map; /* map of editbones by name */
72 GHash *controls_map; /* map of rigcontrols by bone pointer */
77 typedef struct RigNode {
89 float symmetry_axis[3];
90 /*********************************/
95 typedef struct RigArc {
105 /*********************************/
112 typedef struct RigEdge {
113 struct RigEdge *next, *prev;
114 float head[3], tail[3];
116 float angle; /* angle to next edge */
117 float up_angle; /* angle between up_axis and the joint normal (defined as Previous edge CrossProduct Current edge */
118 struct EditBone *bone;
123 #define RIG_FREE_BONELIST 1
126 #define RIG_CTRL_HEAD_DONE 1
127 #define RIG_CTRL_TAIL_DONE 2
128 #define RIG_CTRL_PARENT_DEFORM 4
129 #define RIG_CTRL_FIT_ROOT 8
130 #define RIG_CTRL_FIT_BONE 16
132 #define RIG_CTRL_DONE (RIG_CTRL_HEAD_DONE|RIG_CTRL_TAIL_DONE)
134 /* Control tail flags */
141 typedef struct RigControl {
142 struct RigControl *next, *prev;
143 float head[3], tail[3];
144 struct EditBone *bone;
145 struct EditBone *link;
146 struct EditBone *link_tail;
149 float qrot[4]; /* for dual linked bones, store the rotation of the linked bone for the finalization */
151 LinkTailMode tail_mode;
154 void BIF_retargetArc(struct bContext *C, ReebArc *earc, RigGraph *template_rigg);
155 RigGraph *RIG_graphFromArmature(struct bContext *C, struct Object *ob, struct bArmature *arm);
156 int RIG_nbJoints(RigGraph *rg);
157 char *RIG_nameBone(RigGraph *rg, int arc_index, int bone_index);
158 void RIG_freeRigGraph(BGraph *rg);
160 #endif /* BIF_RETARGET_H */