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 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. 00019 * All rights reserved. 00020 * 00021 * Contributor(s): Full recode, Ton Roosendaal, Crete 2005 00022 * Full recode, Joshua Leung, 2009 00023 * 00024 * ***** END GPL LICENSE BLOCK ***** 00025 */ 00026 00027 #ifndef BKE_ACTION_H 00028 #define BKE_ACTION_H 00029 00038 #include "DNA_listBase.h" 00039 00040 /* The following structures are defined in DNA_action_types.h, and DNA_anim_types.h */ 00041 struct bAction; 00042 struct bActionGroup; 00043 struct FCurve; 00044 struct bPose; 00045 struct bItasc; 00046 struct bPoseChannel; 00047 struct Object; 00048 struct Scene; 00049 struct ID; 00050 00051 /* Kernel prototypes */ 00052 #ifdef __cplusplus 00053 extern "C" { 00054 #endif 00055 00056 /* Action Lib Stuff ----------------- */ 00057 00058 /* Allocate a new bAction with the given name */ 00059 struct bAction *add_empty_action(const char name[]); 00060 00061 /* Allocate a copy of the given Action and all its data */ 00062 struct bAction *copy_action(struct bAction *src); 00063 00064 /* Deallocate all of the Action's data, but not the Action itself */ 00065 void free_action(struct bAction *act); 00066 00067 // XXX is this needed? 00068 void make_local_action(struct bAction *act); 00069 00070 00071 /* Action API ----------------- */ 00072 00073 /* types of transforms applied to the given item 00074 * - these are the return falgs for action_get_item_transforms() 00075 */ 00076 typedef enum eAction_TransformFlags { 00077 /* location */ 00078 ACT_TRANS_LOC = (1<<0), 00079 /* rotation */ 00080 ACT_TRANS_ROT = (1<<1), 00081 /* scaling */ 00082 ACT_TRANS_SCALE = (1<<2), 00083 00084 /* strictly not a transform, but custom properties are also 00085 * quite often used in modern rigs 00086 */ 00087 ACT_TRANS_PROP = (1<<3), 00088 00089 /* all flags */ 00090 ACT_TRANS_ONLY = (ACT_TRANS_LOC|ACT_TRANS_ROT|ACT_TRANS_SCALE), 00091 ACT_TRANS_ALL = (ACT_TRANS_ONLY|ACT_TRANS_PROP) 00092 } eAction_TransformFlags; 00093 00094 /* Return flags indicating which transforms the given object/posechannel has 00095 * - if 'curves' is provided, a list of links to these curves are also returned 00096 * whose nodes WILL NEED FREEING 00097 */ 00098 short action_get_item_transforms(struct bAction *act, struct Object *ob, struct bPoseChannel *pchan, ListBase *curves); 00099 00100 00101 /* Some kind of bounding box operation on the action */ 00102 void calc_action_range(const struct bAction *act, float *start, float *end, short incl_modifiers); 00103 00104 /* Does action have any motion data at all? */ 00105 short action_has_motion(const struct bAction *act); 00106 00107 /* Action Groups API ----------------- */ 00108 00109 /* Get the active action-group for an Action */ 00110 struct bActionGroup *get_active_actiongroup(struct bAction *act); 00111 00112 /* Make the given Action Group the active one */ 00113 void set_active_action_group(struct bAction *act, struct bActionGroup *agrp, short select); 00114 00115 /* Add a new action group with the given name to the action */ 00116 struct bActionGroup *action_groups_add_new(struct bAction *act, const char name[]); 00117 00118 /* Add given channel into (active) group */ 00119 void action_groups_add_channel(struct bAction *act, struct bActionGroup *agrp, struct FCurve *fcurve); 00120 00121 /* Remove the given channel from all groups */ 00122 void action_groups_remove_channel(struct bAction *act, struct FCurve *fcu); 00123 00124 /* Find a group with the given name */ 00125 struct bActionGroup *action_groups_find_named(struct bAction *act, const char name[]); 00126 00127 /* Clear all 'temp' flags on all groups */ 00128 void action_groups_clear_tempflags(struct bAction *act); 00129 00130 /* Pose API ----------------- */ 00131 00136 void free_pose_channel(struct bPoseChannel *pchan); 00137 00142 void free_pose_channels(struct bPose *pose); 00143 00148 void make_pose_channels_hash(struct bPose *pose); 00149 void free_pose_channels_hash(struct bPose *pose); 00150 00154 void free_pose(struct bPose *pose); 00155 00160 void copy_pose(struct bPose **dst, struct bPose *src, int copyconstraints); 00161 00166 void duplicate_pose_channel_data(struct bPoseChannel *pchan, const struct bPoseChannel *pchan_from); 00167 00172 struct bPoseChannel *get_pose_channel(const struct bPose *pose, const char *name); 00173 00178 struct bPoseChannel *get_active_posechannel(struct Object *ob); 00179 00185 struct bPoseChannel *verify_pose_channel(struct bPose* pose, const char* name); 00186 00187 /* Copy the data from the action-pose (src) into the pose */ 00188 void extract_pose_from_pose(struct bPose *pose, const struct bPose *src); 00189 00190 /* sets constraint flags */ 00191 void update_pose_constraint_flags(struct bPose *pose); 00192 00193 /* return the name of structure pointed by pose->ikparam */ 00194 const char *get_ikparam_name(struct bPose *pose); 00195 00196 /* allocate and initialize pose->ikparam according to pose->iksolver */ 00197 void init_pose_ikparam(struct bPose *pose); 00198 00199 /* initialize a bItasc structure with default value */ 00200 void init_pose_itasc(struct bItasc *itasc); 00201 00202 /* clears BONE_UNKEYED flags for frame changing */ 00203 // XXX to be depreceated for a more general solution in animsys... 00204 void framechange_poses_clear_unkeyed(void); 00205 00206 /* Bone Groups API --------------------- */ 00207 00208 /* Adds a new bone-group */ 00209 void pose_add_group(struct Object *ob); 00210 00211 /* Remove the active bone-group */ 00212 void pose_remove_group(struct Object *ob); 00213 00214 /* Assorted Evaluation ----------------- */ 00215 00216 /* Used for the Action Constraint */ 00217 void what_does_obaction(struct Object *ob, struct Object *workob, struct bPose *pose, struct bAction *act, char groupname[], float cframe); 00218 00219 /* for proxy */ 00220 void copy_pose_result(struct bPose *to, struct bPose *from); 00221 /* clear all transforms */ 00222 void rest_pose(struct bPose *pose); 00223 00224 #ifdef __cplusplus 00225 }; 00226 #endif 00227 00228 #endif 00229