Blender  V3.3
BKE_action.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2001-2002 NaN Holding BV. All rights reserved. */
3 
4 #pragma once
5 
11 #include "DNA_listBase.h"
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 struct BlendDataReader;
18 struct BlendExpander;
19 struct BlendLibReader;
20 struct BlendWriter;
21 struct bArmature;
22 
23 /* The following structures are defined in DNA_action_types.h, and DNA_anim_types.h */
25 struct FCurve;
26 struct Main;
27 struct Object;
28 struct bAction;
29 struct bActionGroup;
30 struct bItasc;
31 struct bPose;
32 struct bPoseChannel;
34 
35 /* Action Lib Stuff ----------------- */
36 
37 /* Allocate a new bAction with the given name */
38 struct bAction *BKE_action_add(struct Main *bmain, const char name[]);
39 
40 /* Action API ----------------- */
41 
42 /* types of transforms applied to the given item
43  * - these are the return flags for action_get_item_transforms()
44  */
45 typedef enum eAction_TransformFlags {
46  /* location */
47  ACT_TRANS_LOC = (1 << 0),
48  /* rotation */
49  ACT_TRANS_ROT = (1 << 1),
50  /* scaling */
51  ACT_TRANS_SCALE = (1 << 2),
52 
53  /* bbone shape - for all the parameters, provided one is set */
54  ACT_TRANS_BBONE = (1 << 3),
55 
56  /* strictly not a transform, but custom properties are also
57  * quite often used in modern rigs
58  */
59  ACT_TRANS_PROP = (1 << 4),
60 
61  /* all flags */
65 
71 short action_get_item_transforms(struct bAction *act,
72  struct Object *ob,
73  struct bPoseChannel *pchan,
74  ListBase *curves);
75 
79 void calc_action_range(const struct bAction *act, float *start, float *end, short incl_modifiers);
80 
81 /* Retrieve the intended playback frame range, using the manually set range if available,
82  * or falling back to scanning F-Curves for their first & last frames otherwise. */
83 void BKE_action_get_frame_range(const struct bAction *act, float *r_start, float *r_end);
84 
88 bool action_has_motion(const struct bAction *act);
89 
93 bool BKE_action_is_cyclic(const struct bAction *act);
94 
98 void BKE_action_fcurves_clear(struct bAction *act);
99 
100 /* Action Groups API ----------------- */
101 
105 struct bActionGroup *get_active_actiongroup(struct bAction *act);
106 
110 void set_active_action_group(struct bAction *act, struct bActionGroup *agrp, short select);
111 
115 void action_group_colors_sync(struct bActionGroup *grp, const struct bActionGroup *ref_grp);
116 
120 struct bActionGroup *action_groups_add_new(struct bAction *act, const char name[]);
121 
127 void action_groups_add_channel(struct bAction *act,
128  struct bActionGroup *agrp,
129  struct FCurve *fcurve);
130 
134 void action_groups_remove_channel(struct bAction *act, struct FCurve *fcu);
135 
141 void BKE_action_groups_reconstruct(struct bAction *act);
142 
146 struct bActionGroup *BKE_action_group_find_name(struct bAction *act, const char name[]);
147 
151 void action_groups_clear_tempflags(struct bAction *act);
152 
162 bool BKE_action_has_single_frame(const struct bAction *act);
163 
164 /* Pose API ----------------- */
165 
166 void BKE_pose_channel_free(struct bPoseChannel *pchan);
171 void BKE_pose_channel_free_ex(struct bPoseChannel *pchan, bool do_id_user);
172 
181 
186 
191 
192 void BKE_pose_channels_free(struct bPose *pose);
197 void BKE_pose_channels_free_ex(struct bPose *pose, bool do_id_user);
198 
202 void BKE_pose_channels_hash_ensure(struct bPose *pose);
203 void BKE_pose_channels_hash_free(struct bPose *pose);
204 
208 void BKE_pose_channels_remove(struct Object *ob,
209  bool (*filter_fn)(const char *bone_name, void *user_data),
210  void *user_data);
211 
212 void BKE_pose_free_data_ex(struct bPose *pose, bool do_id_user);
213 void BKE_pose_free_data(struct bPose *pose);
214 void BKE_pose_free(struct bPose *pose);
218 void BKE_pose_free_ex(struct bPose *pose, bool do_id_user);
225 void BKE_pose_copy_data_ex(struct bPose **dst,
226  const struct bPose *src,
227  int flag,
228  bool copy_constraints);
229 void BKE_pose_copy_data(struct bPose **dst, const struct bPose *src, bool copy_constraints);
237 void BKE_pose_channel_copy_data(struct bPoseChannel *pchan, const struct bPoseChannel *pchan_from);
243 struct bPoseChannel *BKE_pose_channel_find_name(const struct bPose *pose, const char *name);
249 bool BKE_pose_is_layer_visible(const struct bArmature *arm, const struct bPoseChannel *pchan);
258 struct bPoseChannel *BKE_pose_channel_active(struct Object *ob, bool check_arm_layer);
284 struct bPoseChannel *BKE_pose_channel_ensure(struct bPose *pose, const char *name);
288 struct bPoseChannel *BKE_pose_channel_get_mirrored(const struct bPose *pose, const char *name);
289 
291 
292 #ifndef NDEBUG
293 bool BKE_pose_channels_is_valid(const struct bPose *pose);
294 #endif
295 
300 void BKE_pose_update_constraint_flags(struct bPose *pose);
301 
306 
310 const char *BKE_pose_ikparam_get_name(struct bPose *pose);
311 
315 void BKE_pose_ikparam_init(struct bPose *pose);
316 
320 void BKE_pose_itasc_init(struct bItasc *itasc);
321 
325 bool BKE_pose_channel_in_IK_chain(struct Object *ob, struct bPoseChannel *pchan);
326 
327 /* Bone Groups API --------------------- */
328 
332 struct bActionGroup *BKE_pose_add_group(struct bPose *pose, const char *name);
333 
338 void BKE_pose_remove_group(struct bPose *pose, struct bActionGroup *grp, int index);
342 void BKE_pose_remove_group_index(struct bPose *pose, int index);
343 
344 /* Assorted Evaluation ----------------- */
345 
350 void what_does_obaction(struct Object *ob,
351  struct Object *workob,
352  struct bPose *pose,
353  struct bAction *act,
354  char groupname[],
355  const struct AnimationEvalContext *anim_eval_context);
356 
358  const struct bPoseChannel *pchanfrom);
362 bool BKE_pose_copy_result(struct bPose *to, struct bPose *from);
366 void BKE_pose_rest(struct bPose *pose, bool selected_bones_only);
367 
371 void BKE_pose_tag_recalc(struct Main *bmain, struct bPose *pose);
372 
373 void BKE_pose_blend_write(struct BlendWriter *writer, struct bPose *pose, struct bArmature *arm);
374 void BKE_pose_blend_read_data(struct BlendDataReader *reader, struct bPose *pose);
375 void BKE_pose_blend_read_lib(struct BlendLibReader *reader, struct Object *ob, struct bPose *pose);
376 void BKE_pose_blend_read_expand(struct BlendExpander *expander, struct bPose *pose);
377 
378 /* action_mirror.c */
379 
380 void BKE_action_flip_with_pose(struct bAction *act, struct Object *ob_arm);
381 
382 #ifdef __cplusplus
383 };
384 #endif
eAction_TransformFlags
Definition: BKE_action.h:45
@ ACT_TRANS_ALL
Definition: BKE_action.h:63
@ ACT_TRANS_PROP
Definition: BKE_action.h:59
@ ACT_TRANS_SCALE
Definition: BKE_action.h:51
@ ACT_TRANS_BBONE
Definition: BKE_action.h:54
@ ACT_TRANS_ROT
Definition: BKE_action.h:49
@ ACT_TRANS_LOC
Definition: BKE_action.h:47
@ ACT_TRANS_ONLY
Definition: BKE_action.h:62
void BKE_pose_channels_remove(struct Object *ob, bool(*filter_fn)(const char *bone_name, void *user_data), void *user_data)
Definition: action.c:960
void BKE_pose_tag_recalc(struct Main *bmain, struct bPose *pose)
Definition: action.c:1719
void BKE_action_groups_reconstruct(struct bAction *act)
Definition: action.c:503
struct bActionGroup * action_groups_add_new(struct bAction *act, const char name[])
Definition: action.c:410
void BKE_pose_copy_data(struct bPose **dst, const struct bPose *src, bool copy_constraints)
struct bActionGroup * BKE_pose_add_group(struct bPose *pose, const char *name)
Definition: action.c:1266
void BKE_pose_channels_hash_free(struct bPose *pose)
Definition: action.c:937
void BKE_pose_channel_runtime_reset(struct bPoseChannel_Runtime *runtime)
Definition: action.c:1052
void BKE_pose_channel_runtime_reset_on_copy(struct bPoseChannel_Runtime *runtime)
Definition: action.c:1057
struct bPoseChannel * BKE_pose_channel_find_name(const struct bPose *pose, const char *name)
struct bPoseChannel * BKE_pose_channel_active_or_first_selected(struct Object *ob)
Definition: action.c:725
void BKE_action_get_frame_range(const struct bAction *act, float *r_start, float *r_end)
Definition: action.c:1480
void BKE_pose_check_uuids_unique_and_report(const struct bPose *pose)
void set_active_action_group(struct bAction *act, struct bActionGroup *agrp, short select)
Definition: action.c:360
void BKE_pose_channel_runtime_free(struct bPoseChannel_Runtime *runtime)
Definition: action.c:1064
void BKE_pose_blend_read_expand(struct BlendExpander *expander, struct bPose *pose)
Definition: action.c:1975
void BKE_pose_channel_copy_data(struct bPoseChannel *pchan, const struct bPoseChannel *pchan_from)
void BKE_pose_free_ex(struct bPose *pose, bool do_id_user)
Definition: action.c:1129
bool BKE_action_has_single_frame(const struct bAction *act)
Definition: action.c:1352
void BKE_pose_free(struct bPose *pose)
Definition: action.c:1138
void action_groups_remove_channel(struct bAction *act, struct FCurve *fcu)
Definition: action.c:542
void BKE_pose_ikparam_init(struct bPose *pose)
Definition: action.c:877
void BKE_pose_copy_pchan_result(struct bPoseChannel *pchanto, const struct bPoseChannel *pchanfrom)
void BKE_action_flip_with_pose(struct bAction *act, struct Object *ob_arm)
void BKE_pose_remove_group(struct bPose *pose, struct bActionGroup *grp, int index)
Definition: action.c:1284
void BKE_pose_itasc_init(struct bItasc *itasc)
Definition: action.c:860
void action_groups_clear_tempflags(struct bAction *act)
Definition: action.c:593
struct bPoseChannel * BKE_pose_channel_active_if_layer_visible(struct Object *ob)
Definition: action.c:720
void calc_action_range(const struct bAction *act, float *start, float *end, short incl_modifiers)
void action_group_colors_sync(struct bActionGroup *grp, const struct bActionGroup *ref_grp)
void BKE_pose_channel_free(struct bPoseChannel *pchan)
Definition: action.c:1078
const char * BKE_pose_ikparam_get_name(struct bPose *pose)
Definition: action.c:761
struct bActionGroup * BKE_action_group_find_name(struct bAction *act, const char name[])
Definition: action.c:582
bool action_has_motion(const struct bAction *act)
struct bActionGroup * get_active_actiongroup(struct bAction *act)
Definition: action.c:345
void what_does_obaction(struct Object *ob, struct Object *workob, struct bPose *pose, struct bAction *act, char groupname[], const struct AnimationEvalContext *anim_eval_context)
struct bPoseChannel * BKE_pose_channel_get_mirrored(const struct bPose *pose, const char *name)
void BKE_pose_channel_session_uuid_generate(struct bPoseChannel *pchan)
Definition: action.c:610
void BKE_pose_tag_update_constraint_flags(struct bPose *pose)
Definition: action.c:1259
void BKE_pose_blend_write(struct BlendWriter *writer, struct bPose *pose, struct bArmature *arm)
Definition: action.c:1832
void BKE_pose_channels_free_ex(struct bPose *pose, bool do_id_user)
Definition: action.c:1083
bool BKE_pose_copy_result(struct bPose *to, struct bPose *from)
Definition: action.c:1695
short action_get_item_transforms(struct bAction *act, struct Object *ob, struct bPoseChannel *pchan, ListBase *curves)
Definition: action.c:1501
bool BKE_pose_is_layer_visible(const struct bArmature *arm, const struct bPoseChannel *pchan)
struct bPoseChannel * BKE_pose_channel_ensure(struct bPose *pose, const char *name)
Definition: action.c:628
void BKE_pose_blend_read_data(struct BlendDataReader *reader, struct bPose *pose)
Definition: action.c:1884
void BKE_pose_channel_free_ex(struct bPoseChannel *pchan, bool do_id_user)
Definition: action.c:1024
void BKE_pose_channels_hash_ensure(struct bPose *pose)
Definition: action.c:925
void BKE_pose_copy_data_ex(struct bPose **dst, const struct bPose *src, int flag, bool copy_constraints)
void BKE_pose_channels_free(struct bPose *pose)
Definition: action.c:1100
bool BKE_pose_channels_is_valid(const struct bPose *pose)
void BKE_pose_free_data(struct bPose *pose)
Definition: action.c:1124
void BKE_pose_update_constraint_flags(struct bPose *pose)
Definition: action.c:1192
bool BKE_pose_channel_in_IK_chain(struct Object *ob, struct bPoseChannel *pchan)
Definition: action.c:920
struct bPoseChannel * BKE_pose_channel_active(struct Object *ob, bool check_arm_layer)
Definition: action.c:699
void BKE_pose_remove_group_index(struct bPose *pose, int index)
Definition: action.c:1322
struct bAction * BKE_action_add(struct Main *bmain, const char name[])
Definition: action.c:332
bool BKE_action_is_cyclic(const struct bAction *act)
Definition: action.c:1496
void BKE_action_fcurves_clear(struct bAction *act)
Definition: action.c:1988
void action_groups_add_channel(struct bAction *act, struct bActionGroup *agrp, struct FCurve *fcurve)
Definition: action.c:435
void BKE_pose_free_data_ex(struct bPose *pose, bool do_id_user)
Definition: action.c:1105
void BKE_pose_blend_read_lib(struct BlendLibReader *reader, struct Object *ob, struct bPose *pose)
Definition: action.c:1932
void BKE_pose_channel_free_bbone_cache(struct bPoseChannel_Runtime *runtime)
Definition: action.c:1069
void BKE_pose_rest(struct bPose *pose, bool selected_bones_only)
Definition: action.c:1631
These structs are the foundation for all linked lists in the library system.
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to curves
__forceinline const avxb select(const avxb &m, const avxb &t, const avxb &f)
Definition: avxb.h:154
StackEntry * from
void * user_data
SyclQueue void void * src
Definition: BKE_main.h:121