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) 2009 Blender Foundation, Joshua Leung 00019 * All rights reserved. 00020 * 00021 * Contributor(s): Joshua Leung (original author) 00022 * 00023 * ***** END GPL LICENSE BLOCK ***** 00024 */ 00025 00026 #ifndef BKE_ANIM_SYS_H 00027 #define BKE_ANIM_SYS_H 00028 00034 struct ID; 00035 struct ListBase; 00036 struct Main; 00037 struct AnimData; 00038 struct KeyingSet; 00039 struct KS_Path; 00040 00041 struct PointerRNA; 00042 struct ReportList; 00043 struct bAction; 00044 struct bActionGroup; 00045 struct AnimMapper; 00046 00047 /* ************************************* */ 00048 /* AnimData API */ 00049 00050 /* Check if the given ID-block can have AnimData */ 00051 short id_type_can_have_animdata(struct ID *id); 00052 00053 /* Get AnimData from the given ID-block */ 00054 struct AnimData *BKE_animdata_from_id(struct ID *id); 00055 00056 /* Add AnimData to the given ID-block */ 00057 struct AnimData *BKE_id_add_animdata(struct ID *id); 00058 00059 /* Set active action used by AnimData from the given ID-block */ 00060 short BKE_animdata_set_action(struct ReportList *reports, struct ID *id, struct bAction *act); 00061 00062 /* Free AnimData */ 00063 void BKE_free_animdata(struct ID *id); 00064 00065 /* Copy AnimData */ 00066 struct AnimData *BKE_copy_animdata(struct AnimData *adt, const short do_action); 00067 00068 /* Copy AnimData */ 00069 int BKE_copy_animdata_id(struct ID *id_to, struct ID *id_from, const short do_action); 00070 00071 /* Copy AnimData Actions */ 00072 void BKE_copy_animdata_id_action(struct ID *id); 00073 00074 /* Make Local */ 00075 void BKE_animdata_make_local(struct AnimData *adt); 00076 00077 /* Re-Assign ID's */ 00078 void BKE_relink_animdata(struct AnimData *adt); 00079 00080 /* ************************************* */ 00081 /* KeyingSets API */ 00082 00083 /* Used to create a new 'custom' KeyingSet for the user, that will be automatically added to the stack */ 00084 struct KeyingSet *BKE_keyingset_add(struct ListBase *list, const char name[], short flag, short keyingflag); 00085 00086 /* Add a path to a KeyingSet */ 00087 struct KS_Path *BKE_keyingset_add_path(struct KeyingSet *ks, struct ID *id, const char group_name[], const char rna_path[], int array_index, short flag, short groupmode); 00088 00089 /* Find the destination matching the criteria given */ 00090 struct KS_Path *BKE_keyingset_find_path(struct KeyingSet *ks, struct ID *id, const char group_name[], const char rna_path[], int array_index, int group_mode); 00091 00092 /* Copy all KeyingSets in the given list */ 00093 void BKE_keyingsets_copy(struct ListBase *newlist, struct ListBase *list); 00094 00095 /* Free the given Keying Set path */ 00096 void BKE_keyingset_free_path(struct KeyingSet *ks, struct KS_Path *ksp); 00097 00098 /* Free data for KeyingSet but not set itself */ 00099 void BKE_keyingset_free(struct KeyingSet *ks); 00100 00101 /* Free all the KeyingSets in the given list */ 00102 void BKE_keyingsets_free(struct ListBase *list); 00103 00104 /* ************************************* */ 00105 /* Path Fixing API */ 00106 00107 /* Fix all the paths for the given ID+AnimData */ 00108 void BKE_animdata_fix_paths_rename(struct ID *owner_id, struct AnimData *adt, const char *prefix, const char *oldName, const char *newName, int oldSubscript, int newSubscript, int verify_paths); 00109 00110 /* Fix all the paths for the entire database... */ 00111 void BKE_all_animdata_fix_paths_rename(const char *prefix, const char *oldName, const char *newName); 00112 00113 /* -------------------------------------- */ 00114 00115 /* Move animation data from src to destination if it's paths are based on basepaths */ 00116 void BKE_animdata_separate_by_basepath(struct ID *srcID, struct ID *dstID, struct ListBase *basepaths); 00117 00118 /* Move F-Curves from src to destination if it's path is based on basepath */ 00119 void action_move_fcurves_by_basepath(struct bAction *srcAct, struct bAction *dstAct, const char basepath[]); 00120 00121 /* ************************************* */ 00122 /* Batch AnimData API */ 00123 00124 /* Define for callback looper used in BKE_animdata_main_cb */ 00125 typedef void (*ID_AnimData_Edit_Callback)(struct ID *id, struct AnimData *adt, void *user_data); 00126 00127 00128 /* Loop over all datablocks applying callback */ 00129 void BKE_animdata_main_cb(struct Main *main, ID_AnimData_Edit_Callback func, void *user_data); 00130 00131 /* ************************************* */ 00132 // TODO: overrides, remapping, and path-finding api's 00133 00134 /* ************************************* */ 00135 /* Evaluation API */ 00136 00137 /* ------------- Main API -------------------- */ 00138 /* In general, these ones should be called to do all animation evaluation */ 00139 00140 /* Evaluation loop for evaluating animation data */ 00141 void BKE_animsys_evaluate_animdata(struct Scene *scene, struct ID *id, struct AnimData *adt, float ctime, short recalc); 00142 00143 /* Evaluation of all ID-blocks with Animation Data blocks - Animation Data Only */ 00144 void BKE_animsys_evaluate_all_animation(struct Main *main, struct Scene *scene, float ctime); 00145 00146 00147 /* ------------ Specialized API --------------- */ 00148 /* There are a few special tools which require these following functions. They are NOT to be used 00149 * for standard animation evaluation UNDER ANY CIRCUMSTANCES! 00150 * 00151 * i.e. Pose Library (PoseLib) uses some of these for selectively applying poses, but 00152 * Particles/Sequencer performing funky time manipulation is not ok. 00153 */ 00154 00155 /* Evaluate Action (F-Curve Bag) */ 00156 void animsys_evaluate_action(struct PointerRNA *ptr, struct bAction *act, struct AnimMapper *remap, float ctime); 00157 00158 /* Evaluate Action Group */ 00159 void animsys_evaluate_action_group(struct PointerRNA *ptr, struct bAction *act, struct bActionGroup *agrp, struct AnimMapper *remap, float ctime); 00160 00161 /* ************************************* */ 00162 00163 #endif /* BKE_ANIM_SYS_H*/