1 /* 2 * This program is free software; you can redistribute it and/or 3 * modify it under the terms of the GNU General Public License 4 * as published by the Free Software Foundation; either version 2 5 * of the License, or (at your option) any later version. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * GNU General Public License for more details. 11 * 12 * You should have received a copy of the GNU General Public License 13 * along with this program; if not, write to the Free Software Foundation, 14 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 15 * 16 * The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung 17 * All rights reserved. 18 */ 19 20 #pragma once 21 22 /** \file 23 * \ingroup bke 24 */ 25 26 #ifdef __cplusplus 27 extern "C" { 28 #endif 29 30 struct AnimData; 31 struct LibraryForeachIDData; 32 struct Main; 33 struct NlaStrip; 34 struct NlaTrack; 35 struct Scene; 36 struct Speaker; 37 struct bAction; 38 39 struct BlendDataReader; 40 struct BlendExpander; 41 struct BlendLibReader; 42 struct BlendWriter; 43 struct PointerRNA; 44 struct PropertyRNA; 45 46 /* ----------------------------- */ 47 /* Data Management */ 48 49 void BKE_nlastrip_free(ListBase *strips, struct NlaStrip *strip, bool do_id_user); 50 void BKE_nlatrack_free(ListBase *tracks, struct NlaTrack *nlt, bool do_id_user); 51 void BKE_nla_tracks_free(ListBase *tracks, bool do_id_user); 52 53 struct NlaStrip *BKE_nlastrip_copy(struct Main *bmain, 54 struct NlaStrip *strip, 55 const bool use_same_action, 56 const int flag); 57 struct NlaTrack *BKE_nlatrack_copy(struct Main *bmain, 58 struct NlaTrack *nlt, 59 const bool use_same_actions, 60 const int flag); 61 void BKE_nla_tracks_copy(struct Main *bmain, ListBase *dst, ListBase *src, const int flag); 62 63 struct NlaTrack *BKE_nlatrack_add(struct AnimData *adt, struct NlaTrack *prev); 64 struct NlaStrip *BKE_nlastrip_new(struct bAction *act); 65 struct NlaStrip *BKE_nlastack_add_strip(struct AnimData *adt, struct bAction *act); 66 struct NlaStrip *BKE_nla_add_soundstrip(struct Main *bmain, 67 struct Scene *scene, 68 struct Speaker *speaker); 69 70 void BKE_nla_strip_foreach_id(struct NlaStrip *strip, struct LibraryForeachIDData *data); 71 72 /* ----------------------------- */ 73 /* API */ 74 75 bool BKE_nlastrips_has_space(ListBase *strips, float start, float end); 76 void BKE_nlastrips_sort_strips(ListBase *strips); 77 78 bool BKE_nlastrips_add_strip(ListBase *strips, struct NlaStrip *strip); 79 80 void BKE_nlastrips_make_metas(ListBase *strips, bool is_temp); 81 void BKE_nlastrips_clear_metas(ListBase *strips, bool only_sel, bool only_temp); 82 void BKE_nlastrips_clear_metastrip(ListBase *strips, struct NlaStrip *strip); 83 bool BKE_nlameta_add_strip(struct NlaStrip *mstrip, struct NlaStrip *strip); 84 void BKE_nlameta_flush_transforms(struct NlaStrip *mstrip); 85 86 /* ............ */ 87 88 struct NlaTrack *BKE_nlatrack_find_active(ListBase *tracks); 89 void BKE_nlatrack_set_active(ListBase *tracks, struct NlaTrack *nlt); 90 91 struct NlaTrack *BKE_nlatrack_find_tweaked(struct AnimData *adt); 92 93 void BKE_nlatrack_solo_toggle(struct AnimData *adt, struct NlaTrack *nlt); 94 95 bool BKE_nlatrack_has_space(struct NlaTrack *nlt, float start, float end); 96 void BKE_nlatrack_sort_strips(struct NlaTrack *nlt); 97 98 bool BKE_nlatrack_add_strip(struct NlaTrack *nlt, struct NlaStrip *strip); 99 100 bool BKE_nlatrack_get_bounds(struct NlaTrack *nlt, float bounds[2]); 101 102 /* ............ */ 103 104 struct NlaStrip *BKE_nlastrip_find_active(struct NlaTrack *nlt); 105 void BKE_nlastrip_set_active(struct AnimData *adt, struct NlaStrip *strip); 106 107 bool BKE_nlastrip_within_bounds(struct NlaStrip *strip, float min, float max); 108 void BKE_nlastrip_recalculate_bounds(struct NlaStrip *strip); 109 void BKE_nlastrip_recalculate_bounds_sync_action(struct NlaStrip *strip); 110 111 void BKE_nlastrip_validate_name(struct AnimData *adt, struct NlaStrip *strip); 112 113 /* ............ */ 114 115 bool BKE_nlatrack_has_animated_strips(struct NlaTrack *nlt); 116 bool BKE_nlatracks_have_animated_strips(ListBase *tracks); 117 void BKE_nlastrip_validate_fcurves(struct NlaStrip *strip); 118 119 bool BKE_nlastrip_has_curves_for_property(const struct PointerRNA *ptr, 120 const struct PropertyRNA *prop); 121 122 void BKE_nla_validate_state(struct AnimData *adt); 123 124 /* ............ */ 125 126 bool BKE_nla_action_is_stashed(struct AnimData *adt, struct bAction *act); 127 bool BKE_nla_action_stash(struct AnimData *adt); 128 129 /* ............ */ 130 131 void BKE_nla_action_pushdown(struct AnimData *adt); 132 133 bool BKE_nla_tweakmode_enter(struct AnimData *adt); 134 void BKE_nla_tweakmode_exit(struct AnimData *adt); 135 136 /* ----------------------------- */ 137 /* Time Mapping */ 138 139 /* time mapping conversion modes */ 140 enum eNlaTime_ConvertModes { 141 /* convert from global time to strip time - for evaluation */ 142 NLATIME_CONVERT_EVAL = 0, 143 /* convert from global time to strip time - for editing corrections */ 144 // XXX old 0 invert 145 NLATIME_CONVERT_UNMAP, 146 /* convert from strip time to global time */ 147 // xxx old 1 invert 148 NLATIME_CONVERT_MAP, 149 }; 150 151 float BKE_nla_tweakedit_remap(struct AnimData *adt, float cframe, short mode); 152 153 /* ----------------------------- */ 154 /* .blend file API */ 155 156 void BKE_nla_blend_write(struct BlendWriter *writer, struct ListBase *tracks); 157 void BKE_nla_blend_read_data(struct BlendDataReader *reader, struct ListBase *tracks); 158 void BKE_nla_blend_read_lib(struct BlendLibReader *reader, struct ID *id, struct ListBase *tracks); 159 void BKE_nla_blend_read_expand(struct BlendExpander *expander, struct ListBase *tracks); 160 161 #ifdef __cplusplus 162 } 163 #endif 164