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 * ***** END GPL LICENSE BLOCK ***** 00019 */ 00020 00026 #ifndef BIF_RETARGET_H 00027 #define BIF_RETARGET_H 00028 00029 #include "DNA_listBase.h" 00030 00031 #include "BLI_graph.h" 00032 #include "BLI_ghash.h" 00033 #include "BLI_threads.h" 00034 00035 #include "reeb.h" 00036 00037 struct Object; 00038 struct bArmature; 00039 struct bContext; 00040 00041 struct EditBone; 00042 00043 struct RigJoint; 00044 struct RigGraph; 00045 struct RigNode; 00046 struct RigArc; 00047 struct RigEdge; 00048 00049 #define USE_THREADS 00050 00051 typedef struct RigGraph { 00052 ListBase arcs; 00053 ListBase nodes; 00054 00055 float length; 00056 00057 FreeArc free_arc; 00058 FreeNode free_node; 00059 RadialSymmetry radial_symmetry; 00060 AxialSymmetry axial_symmetry; 00061 /*********************************/ 00062 00063 int flag; 00064 00065 ListBase controls; 00066 ListBase* editbones; 00067 00068 struct RigNode *head; 00069 ReebGraph *link_mesh; 00070 00071 00072 struct ThreadedWorker *worker; 00073 00074 GHash *bones_map; /* map of editbones by name */ 00075 GHash *controls_map; /* map of rigcontrols by bone pointer */ 00076 00077 struct Object *ob; 00078 } RigGraph; 00079 00080 typedef struct RigNode { 00081 void *next, *prev; 00082 float p[3]; 00083 int flag; 00084 00085 int degree; 00086 struct BArc **arcs; 00087 00088 int subgraph_index; 00089 00090 int symmetry_level; 00091 int symmetry_flag; 00092 float symmetry_axis[3]; 00093 /*********************************/ 00094 00095 ReebNode *link_mesh; 00096 } RigNode; 00097 00098 typedef struct RigArc { 00099 void *next, *prev; 00100 RigNode *head, *tail; 00101 int flag; 00102 00103 float length; 00104 00105 int symmetry_level; 00106 int symmetry_group; 00107 int symmetry_flag; 00108 /*********************************/ 00109 00110 ListBase edges; 00111 int count; 00112 ReebArc *link_mesh; 00113 } RigArc; 00114 00115 typedef struct RigEdge { 00116 struct RigEdge *next, *prev; 00117 float head[3], tail[3]; 00118 float length; 00119 float angle; /* angle to next edge */ 00120 float up_angle; /* angle between up_axis and the joint normal (defined as Previous edge CrossProduct Current edge */ 00121 struct EditBone *bone; 00122 float up_axis[3]; 00123 } RigEdge; 00124 00125 /* Graph flags */ 00126 #define RIG_FREE_BONELIST 1 00127 00128 /* Control flags */ 00129 #define RIG_CTRL_HEAD_DONE 1 00130 #define RIG_CTRL_TAIL_DONE 2 00131 #define RIG_CTRL_PARENT_DEFORM 4 00132 #define RIG_CTRL_FIT_ROOT 8 00133 #define RIG_CTRL_FIT_BONE 16 00134 00135 #define RIG_CTRL_DONE (RIG_CTRL_HEAD_DONE|RIG_CTRL_TAIL_DONE) 00136 00137 /* Control tail flags */ 00138 typedef enum { 00139 TL_NONE = 0, 00140 TL_TAIL, 00141 TL_HEAD 00142 } LinkTailMode; 00143 00144 typedef struct RigControl { 00145 struct RigControl *next, *prev; 00146 float head[3], tail[3]; 00147 struct EditBone *bone; 00148 struct EditBone *link; 00149 struct EditBone *link_tail; 00150 float up_axis[3]; 00151 float offset[3]; 00152 float qrot[4]; /* for dual linked bones, store the rotation of the linked bone for the finalization */ 00153 int flag; 00154 LinkTailMode tail_mode; 00155 } RigControl; 00156 00157 void BIF_retargetArc(struct bContext *C, ReebArc *earc, RigGraph *template_rigg); 00158 RigGraph *RIG_graphFromArmature(const struct bContext *C, struct Object *ob, struct bArmature *arm); 00159 int RIG_nbJoints(RigGraph *rg); 00160 const char *RIG_nameBone(RigGraph *rg, int arc_index, int bone_index); 00161 void RIG_freeRigGraph(BGraph *rg); 00162 00163 /* UNUSED */ 00164 void BIF_retargetArmature(bContext *C); 00165 void BIF_adjustRetarget(bContext *C); 00166 /* UNUSED / print funcs */ 00167 void RIG_printArc(struct RigGraph *rg, struct RigArc *arc); 00168 void RIG_printGraph(struct RigGraph *rg); 00169 void RIG_printArcBones(struct RigArc *arc); 00170 00171 #endif /* BIF_RETARGET_H */