|
Blender
V2.59
|
00001 /* 00002 * $Id: BKE_animsys.h 35772 2011-03-25 07:34:44Z campbellbarton $ 00003 * 00004 * ***** BEGIN GPL LICENSE BLOCK ***** 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software Foundation, 00018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 * 00020 * The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung 00021 * All rights reserved. 00022 * 00023 * Contributor(s): Joshua Leung (original author) 00024 * 00025 * ***** END GPL LICENSE BLOCK ***** 00026 */ 00027 00028 #ifndef BKE_ANIM_SYS_H 00029 #define BKE_ANIM_SYS_H 00030 00036 struct ID; 00037 struct ListBase; 00038 struct Main; 00039 struct AnimData; 00040 struct KeyingSet; 00041 struct KS_Path; 00042 00043 struct PointerRNA; 00044 struct bAction; 00045 struct bActionGroup; 00046 struct AnimMapper; 00047 00048 /* ************************************* */ 00049 /* AnimData API */ 00050 00051 /* Check if the given ID-block can have AnimData */ 00052 short id_type_can_have_animdata(struct ID *id); 00053 00054 /* Get AnimData from the given ID-block */ 00055 struct AnimData *BKE_animdata_from_id(struct ID *id); 00056 00057 /* Add AnimData to the given ID-block */ 00058 struct AnimData *BKE_id_add_animdata(struct ID *id); 00059 00060 /* Free AnimData */ 00061 void BKE_free_animdata(struct ID *id); 00062 00063 /* Copy AnimData */ 00064 struct AnimData *BKE_copy_animdata(struct AnimData *adt, const short do_action); 00065 00066 /* Copy AnimData */ 00067 int BKE_copy_animdata_id(struct ID *id_to, struct ID *id_from, const short do_action); 00068 00069 /* Copy AnimData Actions */ 00070 void BKE_copy_animdata_id_action(struct ID *id); 00071 00072 /* Make Local */ 00073 void BKE_animdata_make_local(struct AnimData *adt); 00074 00075 /* Re-Assign ID's */ 00076 void BKE_relink_animdata(struct AnimData *adt); 00077 00078 /* ************************************* */ 00079 /* KeyingSets API */ 00080 00081 /* Used to create a new 'custom' KeyingSet for the user, that will be automatically added to the stack */ 00082 struct KeyingSet *BKE_keyingset_add(struct ListBase *list, const char name[], short flag, short keyingflag); 00083 00084 /* Add a path to a KeyingSet */ 00085 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); 00086 00087 /* Find the destination matching the criteria given */ 00088 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); 00089 00090 /* Copy all KeyingSets in the given list */ 00091 void BKE_keyingsets_copy(struct ListBase *newlist, struct ListBase *list); 00092 00093 /* Free the given Keying Set path */ 00094 void BKE_keyingset_free_path(struct KeyingSet *ks, struct KS_Path *ksp); 00095 00096 /* Free data for KeyingSet but not set itself */ 00097 void BKE_keyingset_free(struct KeyingSet *ks); 00098 00099 /* Free all the KeyingSets in the given list */ 00100 void BKE_keyingsets_free(struct ListBase *list); 00101 00102 /* ************************************* */ 00103 /* Path Fixing API */ 00104 00105 /* Fix all the paths for the given ID+AnimData */ 00106 void BKE_animdata_fix_paths_rename(struct ID *owner_id, struct AnimData *adt, const char *prefix, char *oldName, char *newName, int oldSubscript, int newSubscript, int verify_paths); 00107 00108 /* Fix all the paths for the entire database... */ 00109 void BKE_all_animdata_fix_paths_rename(char *prefix, char *oldName, char *newName); 00110 00111 /* -------------------------------------- */ 00112 00113 /* Move animation data from src to destination if it's paths are based on basepaths */ 00114 void BKE_animdata_separate_by_basepath(struct ID *srcID, struct ID *dstID, struct ListBase *basepaths); 00115 00116 /* Move F-Curves from src to destination if it's path is based on basepath */ 00117 void action_move_fcurves_by_basepath(struct bAction *srcAct, struct bAction *dstAct, const char basepath[]); 00118 00119 /* ************************************* */ 00120 /* Batch AnimData API */ 00121 00122 /* Define for callback looper used in BKE_animdata_main_cb */ 00123 typedef void (*ID_AnimData_Edit_Callback)(struct ID *id, struct AnimData *adt, void *user_data); 00124 00125 00126 /* Loop over all datablocks applying callback */ 00127 void BKE_animdata_main_cb(struct Main *main, ID_AnimData_Edit_Callback func, void *user_data); 00128 00129 /* ************************************* */ 00130 // TODO: overrides, remapping, and path-finding api's 00131 00132 /* ************************************* */ 00133 /* Evaluation API */ 00134 00135 /* ------------- Main API -------------------- */ 00136 /* In general, these ones should be called to do all animation evaluation */ 00137 00138 /* Evaluation loop for evaluating animation data */ 00139 void BKE_animsys_evaluate_animdata(struct ID *id, struct AnimData *adt, float ctime, short recalc); 00140 00141 /* Evaluation of all ID-blocks with Animation Data blocks - Animation Data Only */ 00142 void BKE_animsys_evaluate_all_animation(struct Main *main, float ctime); 00143 00144 00145 /* ------------ Specialised API --------------- */ 00146 /* There are a few special tools which require these following functions. They are NOT to be used 00147 * for standard animation evaluation UNDER ANY CIRCUMSTANCES! 00148 * 00149 * i.e. Pose Library (PoseLib) uses some of these for selectively applying poses, but 00150 * Particles/Sequencer performing funky time manipulation is not ok. 00151 */ 00152 00153 /* Evaluate Action (F-Curve Bag) */ 00154 void animsys_evaluate_action(struct PointerRNA *ptr, struct bAction *act, struct AnimMapper *remap, float ctime); 00155 00156 /* Evaluate Action Group */ 00157 void animsys_evaluate_action_group(struct PointerRNA *ptr, struct bAction *act, struct bActionGroup *agrp, struct AnimMapper *remap, float ctime); 00158 00159 /* ************************************* */ 00160 00161 #endif /* BKE_ANIM_SYS_H*/