Blender  V2.93
BKE_anim_data.h
Go to the documentation of this file.
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 
26 #include "BLI_sys_types.h" /* for bool */
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 struct AnimData;
33 struct BlendDataReader;
34 struct BlendExpander;
35 struct BlendLibReader;
36 struct BlendWriter;
37 struct ID;
39 struct Main;
40 struct ReportList;
41 struct bAction;
42 
43 /* ************************************* */
44 /* AnimData API */
45 
46 /* Check if the given ID-block can have AnimData */
47 bool id_type_can_have_animdata(const short id_type);
48 bool id_can_have_animdata(const struct ID *id);
49 
50 /* Get AnimData from the given ID-block */
51 struct AnimData *BKE_animdata_from_id(struct ID *id);
52 
53 /* Add AnimData to the given ID-block */
54 struct AnimData *BKE_animdata_add_id(struct ID *id);
55 
56 /* Set active action used by AnimData from the given ID-block */
57 bool BKE_animdata_set_action(struct ReportList *reports, struct ID *id, struct bAction *act);
58 
59 bool BKE_animdata_action_editable(const struct AnimData *adt);
60 
61 /* Ensure that the action's idroot is set correctly given the ID type of the owner.
62  * Return true if it is, false if it was already set to an incompatible type. */
63 bool BKE_animdata_action_ensure_idroot(const struct ID *owner, struct bAction *action);
64 
65 /* Free AnimData */
66 void BKE_animdata_free(struct ID *id, const bool do_id_user);
67 
68 /* Return true if the ID-block has non-empty AnimData. */
69 bool BKE_animdata_id_is_animated(const struct ID *id);
70 
72 
73 /* Copy AnimData */
74 struct AnimData *BKE_animdata_copy(struct Main *bmain, struct AnimData *adt, const int flag);
75 
76 /* Copy AnimData */
77 bool BKE_animdata_copy_id(struct Main *bmain,
78  struct ID *id_to,
79  struct ID *id_from,
80  const int flag);
81 
82 /* Copy AnimData Actions */
83 void BKE_animdata_copy_id_action(struct Main *bmain, struct ID *id);
84 
86  struct ID *id,
87  const uint duplicate_flags);
88 
89 /* Merge copies of data from source AnimData block */
91  /* Keep destination action */
93 
94  /* Use src action (make a new copy) */
96 
97  /* Use src action (but just reference the existing version) */
100 
101 void BKE_animdata_merge_copy(struct Main *bmain,
102  struct ID *dst_id,
103  struct ID *src_id,
104  eAnimData_MergeCopy_Modes action_mode,
105  bool fix_drivers);
106 
107 void BKE_animdata_blend_write(struct BlendWriter *writer, struct AnimData *adt);
108 void BKE_animdata_blend_read_data(struct BlendDataReader *reader, struct AnimData *adt);
109 void BKE_animdata_blend_read_lib(struct BlendLibReader *reader,
110  struct ID *id,
111  struct AnimData *adt);
112 void BKE_animdata_blend_read_expand(struct BlendExpander *expander, struct AnimData *adt);
113 
114 #ifdef __cplusplus
115 }
116 #endif
bool BKE_animdata_action_editable(const struct AnimData *adt)
void BKE_animdata_copy_id_action(struct Main *bmain, struct ID *id)
Definition: anim_data.c:420
bool BKE_animdata_set_action(struct ReportList *reports, struct ID *id, struct bAction *act)
Definition: anim_data.c:150
void BKE_animdata_blend_read_lib(struct BlendLibReader *reader, struct ID *id, struct AnimData *adt)
Definition: anim_data.c:1603
bool BKE_animdata_action_ensure_idroot(const struct ID *owner, struct bAction *action)
void BKE_animdata_blend_read_expand(struct BlendExpander *expander, struct AnimData *adt)
Definition: anim_data.c:1622
bool id_type_can_have_animdata(const short id_type)
Definition: anim_data.c:73
void BKE_animdata_foreach_id(struct AnimData *adt, struct LibraryForeachIDData *data)
Definition: anim_data.c:294
bool BKE_animdata_copy_id(struct Main *bmain, struct ID *id_to, struct ID *id_from, const int flag)
Definition: anim_data.c:375
eAnimData_MergeCopy_Modes
Definition: BKE_anim_data.h:90
@ ADT_MERGECOPY_KEEP_DST
Definition: BKE_anim_data.h:92
@ ADT_MERGECOPY_SRC_COPY
Definition: BKE_anim_data.h:95
@ ADT_MERGECOPY_SRC_REF
Definition: BKE_anim_data.h:98
bool id_can_have_animdata(const struct ID *id)
bool BKE_animdata_id_is_animated(const struct ID *id)
Definition: anim_data.c:271
struct AnimData * BKE_animdata_from_id(struct ID *id)
Definition: anim_data.c:96
void BKE_animdata_merge_copy(struct Main *bmain, struct ID *dst_id, struct ID *src_id, eAnimData_MergeCopy_Modes action_mode, bool fix_drivers)
Definition: anim_data.c:436
struct AnimData * BKE_animdata_copy(struct Main *bmain, struct AnimData *adt, const int flag)
Definition: anim_data.c:318
void BKE_animdata_free(struct ID *id, const bool do_id_user)
Definition: anim_data.c:230
void BKE_animdata_blend_read_data(struct BlendDataReader *reader, struct AnimData *adt)
Definition: anim_data.c:1574
void BKE_animdata_duplicate_id_action(struct Main *bmain, struct ID *id, const uint duplicate_flags)
void BKE_animdata_blend_write(struct BlendWriter *writer, struct AnimData *adt)
Definition: anim_data.c:1552
struct AnimData * BKE_animdata_add_id(struct ID *id)
Definition: anim_data.c:113
unsigned int uint
Definition: BLI_sys_types.h:83
bAction * action
Definition: DNA_ID.h:273
Definition: BKE_main.h:116