Blender  V2.93
Macros | Functions | Variables
action.c File Reference
#include <math.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include "MEM_guardedalloc.h"
#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
#include "DNA_constraint_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "BLI_blenlib.h"
#include "BLI_ghash.h"
#include "BLI_math.h"
#include "BLI_session_uuid.h"
#include "BLI_string_utils.h"
#include "BLI_utildefines.h"
#include "BLT_translation.h"
#include "BKE_action.h"
#include "BKE_anim_data.h"
#include "BKE_anim_visualization.h"
#include "BKE_animsys.h"
#include "BKE_armature.h"
#include "BKE_constraint.h"
#include "BKE_deform.h"
#include "BKE_fcurve.h"
#include "BKE_icons.h"
#include "BKE_idprop.h"
#include "BKE_idtype.h"
#include "BKE_lib_id.h"
#include "BKE_lib_query.h"
#include "BKE_main.h"
#include "BKE_object.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h"
#include "BIK_api.h"
#include "RNA_access.h"
#include "BLO_read_write.h"
#include "CLG_log.h"

Go to the source code of this file.

Macros

#define DNA_DEPRECATED_ALLOW
 

Functions

static void action_copy_data (Main *UNUSED(bmain), ID *id_dst, const ID *id_src, const int flag)
 
static void action_free_data (struct ID *id)
 
static void action_foreach_id (ID *id, LibraryForeachIDData *data)
 
static void action_blend_write (BlendWriter *writer, ID *id, const void *id_address)
 
static void action_blend_read_data (BlendDataReader *reader, ID *id)
 
static void blend_read_lib_constraint_channels (BlendLibReader *reader, ID *id, ListBase *chanbase)
 
static void action_blend_read_lib (BlendLibReader *reader, ID *id)
 
static void blend_read_expand_constraint_channels (BlendExpander *expander, ListBase *chanbase)
 
static void action_blend_read_expand (BlendExpander *expander, ID *id)
 
bActionBKE_action_add (Main *bmain, const char name[])
 
bActionGroupget_active_actiongroup (bAction *act)
 
void set_active_action_group (bAction *act, bActionGroup *agrp, short select)
 
void action_group_colors_sync (bActionGroup *grp, const bActionGroup *ref_grp)
 
bActionGroupaction_groups_add_new (bAction *act, const char name[])
 
void action_groups_add_channel (bAction *act, bActionGroup *agrp, FCurve *fcurve)
 
void BKE_action_groups_reconstruct (bAction *act)
 
void action_groups_remove_channel (bAction *act, FCurve *fcu)
 
bActionGroupBKE_action_group_find_name (bAction *act, const char name[])
 
void action_groups_clear_tempflags (bAction *act)
 
void BKE_pose_channel_session_uuid_generate (bPoseChannel *pchan)
 
bPoseChannelBKE_pose_channel_find_name (const bPose *pose, const char *name)
 
bPoseChannelBKE_pose_channel_verify (bPose *pose, const char *name)
 
bool BKE_pose_channels_is_valid (const bPose *pose)
 
bPoseChannelBKE_pose_channel_active (Object *ob)
 
bPoseChannelBKE_pose_channel_active_or_first_selected (struct Object *ob)
 
bPoseChannelBKE_pose_channel_get_mirrored (const bPose *pose, const char *name)
 
const char * BKE_pose_ikparam_get_name (bPose *pose)
 
void BKE_pose_copy_data_ex (bPose **dst, const bPose *src, const int flag, const bool copy_constraints)
 
void BKE_pose_copy_data (bPose **dst, const bPose *src, const bool copy_constraints)
 
void BKE_pose_itasc_init (bItasc *itasc)
 
void BKE_pose_ikparam_init (bPose *pose)
 
static bool pose_channel_in_IK_chain (Object *ob, bPoseChannel *pchan, int level)
 
bool BKE_pose_channel_in_IK_chain (Object *ob, bPoseChannel *pchan)
 
void BKE_pose_channels_hash_make (bPose *pose)
 
void BKE_pose_channels_hash_free (bPose *pose)
 
static void pose_channels_remove_internal_links (Object *ob, bPoseChannel *unlinked_pchan)
 
void BKE_pose_channels_remove (Object *ob, bool(*filter_fn)(const char *bone_name, void *user_data), void *user_data)
 
void BKE_pose_channel_free_ex (bPoseChannel *pchan, bool do_id_user)
 
void BKE_pose_channel_runtime_reset (bPoseChannel_Runtime *runtime)
 
void BKE_pose_channel_runtime_reset_on_copy (bPoseChannel_Runtime *runtime)
 
void BKE_pose_channel_runtime_free (bPoseChannel_Runtime *runtime)
 
void BKE_pose_channel_free_bbone_cache (bPoseChannel_Runtime *runtime)
 
void BKE_pose_channel_free (bPoseChannel *pchan)
 
void BKE_pose_channels_free_ex (bPose *pose, bool do_id_user)
 
void BKE_pose_channels_free (bPose *pose)
 
void BKE_pose_free_data_ex (bPose *pose, bool do_id_user)
 
void BKE_pose_free_data (bPose *pose)
 
void BKE_pose_free_ex (bPose *pose, bool do_id_user)
 
void BKE_pose_free (bPose *pose)
 
void BKE_pose_channel_copy_data (bPoseChannel *pchan, const bPoseChannel *pchan_from)
 
void BKE_pose_update_constraint_flags (bPose *pose)
 
void BKE_pose_tag_update_constraint_flags (bPose *pose)
 
bActionGroupBKE_pose_add_group (bPose *pose, const char *name)
 
void BKE_pose_remove_group (bPose *pose, bActionGroup *grp, const int index)
 
void BKE_pose_remove_group_index (bPose *pose, const int index)
 
bool action_has_motion (const bAction *act)
 
void calc_action_range (const bAction *act, float *start, float *end, short incl_modifiers)
 
short action_get_item_transforms (bAction *act, Object *ob, bPoseChannel *pchan, ListBase *curves)
 
void BKE_pose_rest (bPose *pose, bool selected_bones_only)
 
void BKE_pose_copy_pchan_result (bPoseChannel *pchanto, const bPoseChannel *pchanfrom)
 
bool BKE_pose_copy_result (bPose *to, bPose *from)
 
void BKE_pose_tag_recalc (Main *bmain, bPose *pose)
 
void what_does_obaction (Object *ob, Object *workob, bPose *pose, bAction *act, char groupname[], const AnimationEvalContext *anim_eval_context)
 
void BKE_pose_check_uuids_unique_and_report (const bPose *pose)
 
void BKE_pose_blend_write (BlendWriter *writer, bPose *pose, bArmature *arm)
 
void BKE_pose_blend_read_data (BlendDataReader *reader, bPose *pose)
 
void BKE_pose_blend_read_lib (BlendLibReader *reader, Object *ob, bPose *pose)
 
void BKE_pose_blend_read_expand (BlendExpander *expander, bPose *pose)
 

Variables

static CLG_LogRef LOG = {"bke.action"}
 
IDTypeInfo IDType_ID_AC
 

Macro Definition Documentation

◆ DNA_DEPRECATED_ALLOW

#define DNA_DEPRECATED_ALLOW

Definition at line 32 of file action.c.

Function Documentation

◆ action_blend_read_data()

static void action_blend_read_data ( BlendDataReader reader,
ID id 
)
static

◆ action_blend_read_expand()

static void action_blend_read_expand ( BlendExpander expander,
ID id 
)
static

◆ action_blend_read_lib()

static void action_blend_read_lib ( BlendLibReader reader,
ID id 
)
static

◆ action_blend_write()

static void action_blend_write ( BlendWriter writer,
ID id,
const void *  id_address 
)
static

◆ action_copy_data()

static void action_copy_data ( Main UNUSEDbmain,
ID id_dst,
const ID id_src,
const int  flag 
)
static

Only copy internal data of Action ID from source to already allocated/initialized destination. You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.

WARNING! This function will not handle ID user count!

Parameters
flagCopying options (see BKE_lib_id.h's LIB_ID_COPY_... flags for more).

Definition at line 105 of file action.c.

References BKE_fcurve_copy(), BKE_previewimg_id_copy(), BLI_addtail(), BLI_duplicatelist(), BLI_listbase_clear(), bActionGroup::channels, bAction::curves, ListBase::first, bAction::groups, FCurve::grp, bAction::id, ListBase::last, LIB_ID_COPY_NO_PREVIEW, bAction::markers, bActionGroup::next, FCurve::next, NULL, and bAction::preview.

◆ action_foreach_id()

static void action_foreach_id ( ID id,
LibraryForeachIDData data 
)
static

◆ action_free_data()

static void action_free_data ( struct ID id)
static

Free (or release) any data used by this action (does not free the action itself).

Definition at line 156 of file action.c.

References BKE_fcurves_free(), BKE_previewimg_free(), BLI_freelistN(), bAction::curves, bAction::groups, bAction::markers, and bAction::preview.

◆ action_get_item_transforms()

short action_get_item_transforms ( bAction act,
Object ob,
bPoseChannel pchan,
ListBase curves 
)

◆ action_group_colors_sync()

void action_group_colors_sync ( bActionGroup grp,
const bActionGroup ref_grp 
)

◆ action_groups_add_channel()

void action_groups_add_channel ( bAction act,
bActionGroup agrp,
FCurve fcurve 
)

◆ action_groups_add_new()

bActionGroup* action_groups_add_new ( bAction act,
const char  name[] 
)

◆ action_groups_clear_tempflags()

void action_groups_clear_tempflags ( bAction act)

◆ action_groups_remove_channel()

void action_groups_remove_channel ( bAction act,
FCurve fcu 
)

◆ action_has_motion()

bool action_has_motion ( const bAction act)

Definition at line 1395 of file action.c.

References bAction::curves, ListBase::first, FCurve::next, and FCurve::totvert.

◆ BKE_action_add()

bAction* BKE_action_add ( Main bmain,
const char  name[] 
)

◆ BKE_action_group_find_name()

bActionGroup* BKE_action_group_find_name ( bAction act,
const char  name[] 
)

◆ BKE_action_groups_reconstruct()

void BKE_action_groups_reconstruct ( bAction act)

◆ BKE_pose_add_group()

bActionGroup* BKE_pose_add_group ( bPose pose,
const char *  name 
)

◆ BKE_pose_blend_read_data()

void BKE_pose_blend_read_data ( BlendDataReader reader,
bPose pose 
)

◆ BKE_pose_blend_read_expand()

void BKE_pose_blend_read_expand ( BlendExpander expander,
bPose pose 
)

◆ BKE_pose_blend_read_lib()

void BKE_pose_blend_read_lib ( BlendLibReader reader,
Object ob,
bPose pose 
)

◆ BKE_pose_blend_write()

void BKE_pose_blend_write ( BlendWriter writer,
bPose pose,
bArmature arm 
)

◆ BKE_pose_channel_active()

bPoseChannel* BKE_pose_channel_active ( Object ob)

◆ BKE_pose_channel_active_or_first_selected()

bPoseChannel* BKE_pose_channel_active_or_first_selected ( struct Object ob)

Use this when detecting the "other selected bone", when we have multiple armatures in pose mode.

In this case the active-selected is an obvious choice when finding the target for a constraint for eg. however from the users perspective the active pose bone of the active object is the real active bone, so any other non-active selected bone is a candidate for being the other selected bone, see: T58447.

Definition at line 736 of file action.c.

References BKE_pose_channel_active(), bPoseChannel::bone, BONE_SELECTED, bPose::chanbase, Object::data, ELEM, ListBase::first, Bone::flag, if(), bPoseChannel::next, NULL, PBONE_VISIBLE, and Object::pose.

Referenced by get_new_constraint_target().

◆ BKE_pose_channel_copy_data()

void BKE_pose_channel_copy_data ( bPoseChannel pchan,
const bPoseChannel pchan_from 
)

Copy the internal members of each pose channel including constraints and ID-Props, used when duplicating bones in editmode. (unlike copy_pose_channel_data which only does posing-related stuff).

Note
use when copying bones in editmode (on returned value from BKE_pose_channel_verify)

Definition at line 1196 of file action.c.

References bPoseChannel::agrp_index, bPoseChannel::bbone_next, bPoseChannel::bbone_prev, BKE_constraints_copy(), bPoseChannel::constraints, copy_v3_v3(), bPoseChannel::custom, bPoseChannel::custom_scale, bPoseChannel::drawflag, Object::id, id_us_plus(), IDP_CopyProperty(), IDP_FreeProperty(), bPoseChannel::ikflag, bPoseChannel::iklinweight, bPoseChannel::ikrotweight, bPoseChannel::ikstretch, bPoseChannel::limitmax, bPoseChannel::limitmin, NULL, bPoseChannel::prop, bPoseChannel::protectflag, bPoseChannel::rotmode, and bPoseChannel::stiffness.

◆ BKE_pose_channel_find_name()

bPoseChannel* BKE_pose_channel_find_name ( const bPose pose,
const char *  name 
)

Return a pointer to the pose channel of the given name from this pose.

Definition at line 617 of file action.c.

References BLI_findstring(), BLI_ghash_lookup(), bPose::chanbase, bPose::chanhash, ELEM, and NULL.

Referenced by BKE_pose_channel_get_mirrored(), BKE_pose_channel_verify(), BKE_pose_copy_data_ex(), BKE_pose_copy_result(), and pose_channel_in_IK_chain().

◆ BKE_pose_channel_free()

void BKE_pose_channel_free ( bPoseChannel pchan)

◆ BKE_pose_channel_free_bbone_cache()

void BKE_pose_channel_free_bbone_cache ( bPoseChannel_Runtime runtime)

◆ BKE_pose_channel_free_ex()

void BKE_pose_channel_free_ex ( bPoseChannel pchan,
bool  do_id_user 
)

◆ BKE_pose_channel_get_mirrored()

bPoseChannel* BKE_pose_channel_get_mirrored ( const bPose pose,
const char *  name 
)
See also
ED_armature_ebone_get_mirrored (edit-mode, matching function)

Definition at line 762 of file action.c.

References BKE_pose_channel_find_name(), BLI_string_flip_side_name(), MAXBONENAME, NULL, and STREQ.

◆ BKE_pose_channel_in_IK_chain()

bool BKE_pose_channel_in_IK_chain ( Object ob,
bPoseChannel pchan 
)

Definition at line 939 of file action.c.

References pose_channel_in_IK_chain().

◆ BKE_pose_channel_runtime_free()

void BKE_pose_channel_runtime_free ( bPoseChannel_Runtime runtime)

Deallocates runtime cache of a pose channel

Definition at line 1102 of file action.c.

References BKE_pose_channel_free_bbone_cache().

Referenced by BKE_pose_channel_free_ex(), and blender::deg::ObjectRuntimeBackup::restore_pose_channel_runtime_data().

◆ BKE_pose_channel_runtime_reset()

void BKE_pose_channel_runtime_reset ( bPoseChannel_Runtime runtime)

Clears the runtime cache of a pose channel without free.

Definition at line 1088 of file action.c.

Referenced by blender::deg::ObjectRuntimeBackup::backup_pose_channel_runtime_data(), and BKE_pose_blend_read_data().

◆ BKE_pose_channel_runtime_reset_on_copy()

void BKE_pose_channel_runtime_reset_on_copy ( bPoseChannel_Runtime runtime)

Definition at line 1094 of file action.c.

References bPoseChannel_Runtime::session_uuid.

Referenced by BKE_pose_copy_data_ex(), and pose_proxy_sync().

◆ BKE_pose_channel_session_uuid_generate()

void BKE_pose_channel_session_uuid_generate ( bPoseChannel pchan)

◆ BKE_pose_channel_verify()

bPoseChannel* BKE_pose_channel_verify ( bPose pose,
const char *  name 
)

◆ BKE_pose_channels_free()

void BKE_pose_channels_free ( bPose pose)

Definition at line 1143 of file action.c.

References BKE_pose_channels_free_ex().

◆ BKE_pose_channels_free_ex()

void BKE_pose_channels_free_ex ( bPose pose,
bool  do_id_user 
)

Removes and deallocates all channels from a pose. Does not free the pose itself.

Definition at line 1126 of file action.c.

References BKE_pose_channel_free_ex(), BKE_pose_channels_hash_free(), BLI_freelistN(), bPose::chan_array, bPose::chanbase, ListBase::first, MEM_SAFE_FREE, and bPoseChannel::next.

Referenced by BKE_pose_channels_free(), and BKE_pose_free_data_ex().

◆ BKE_pose_channels_hash_free()

void BKE_pose_channels_hash_free ( bPose pose)

◆ BKE_pose_channels_hash_make()

void BKE_pose_channels_hash_make ( bPose pose)

◆ BKE_pose_channels_is_valid()

bool BKE_pose_channels_is_valid ( const bPose pose)

◆ BKE_pose_channels_remove()

void BKE_pose_channels_remove ( Object ob,
bool(*)(const char *bone_name, void *user_data filter_fn,
void *  user_data 
)

◆ BKE_pose_check_uuids_unique_and_report()

void BKE_pose_check_uuids_unique_and_report ( const bPose pose)

◆ BKE_pose_copy_data()

void BKE_pose_copy_data ( bPose **  dst,
const bPose src,
const bool  copy_constraints 
)

Definition at line 874 of file action.c.

References BKE_pose_copy_data_ex().

◆ BKE_pose_copy_data_ex()

void BKE_pose_copy_data_ex ( bPose **  dst,
const bPose src,
const int  flag,
const bool  copy_constraints 
)

◆ BKE_pose_copy_pchan_result()

void BKE_pose_copy_pchan_result ( bPoseChannel pchanto,
const bPoseChannel pchanfrom 
)

◆ BKE_pose_copy_result()

bool BKE_pose_copy_result ( bPose to,
bPose from 
)

◆ BKE_pose_free()

void BKE_pose_free ( bPose pose)

Definition at line 1184 of file action.c.

References BKE_pose_free_ex().

Referenced by object_blend_read_lib().

◆ BKE_pose_free_data()

void BKE_pose_free_data ( bPose pose)

Definition at line 1167 of file action.c.

References BKE_pose_free_data_ex().

Referenced by actcon_get_tarmat().

◆ BKE_pose_free_data_ex()

void BKE_pose_free_data_ex ( bPose pose,
bool  do_id_user 
)

◆ BKE_pose_free_ex()

void BKE_pose_free_ex ( bPose pose,
bool  do_id_user 
)

Removes and deallocates all data from a pose, and also frees the pose.

Definition at line 1175 of file action.c.

References BKE_pose_free_data_ex(), and MEM_freeN.

Referenced by BKE_pose_free(), and object_free_data().

◆ BKE_pose_ikparam_get_name()

const char* BKE_pose_ikparam_get_name ( bPose pose)

Definition at line 775 of file action.c.

References bPose::iksolver, IKSOLVER_ITASC, IKSOLVER_STANDARD, and NULL.

Referenced by BKE_pose_blend_write().

◆ BKE_pose_ikparam_init()

void BKE_pose_ikparam_init ( bPose pose)

◆ BKE_pose_itasc_init()

void BKE_pose_itasc_init ( bItasc itasc)

◆ BKE_pose_remove_group()

void BKE_pose_remove_group ( bPose pose,
bActionGroup grp,
const int  index 
)

◆ BKE_pose_remove_group_index()

void BKE_pose_remove_group_index ( bPose pose,
const int  index 
)

Definition at line 1381 of file action.c.

References bPose::agroups, BKE_pose_remove_group(), BLI_findlink(), and NULL.

Referenced by pose_group_remove_exec().

◆ BKE_pose_rest()

void BKE_pose_rest ( bPose pose,
bool  selected_bones_only 
)

◆ BKE_pose_tag_recalc()

void BKE_pose_tag_recalc ( Main bmain,
bPose pose 
)

◆ BKE_pose_tag_update_constraint_flags()

void BKE_pose_tag_update_constraint_flags ( bPose pose)

Definition at line 1314 of file action.c.

References bPose::flag, and POSE_CONSTRAINTS_NEED_UPDATE_FLAGS.

Referenced by ED_object_constraint_tag_update().

◆ BKE_pose_update_constraint_flags()

void BKE_pose_update_constraint_flags ( bPose pose)

◆ blend_read_expand_constraint_channels()

static void blend_read_expand_constraint_channels ( BlendExpander expander,
ListBase chanbase 
)
static

Definition at line 262 of file action.c.

References BLO_expand, and LISTBASE_FOREACH.

Referenced by action_blend_read_expand().

◆ blend_read_lib_constraint_channels()

static void blend_read_lib_constraint_channels ( BlendLibReader reader,
ID id,
ListBase chanbase 
)
static

Definition at line 235 of file action.c.

References BLO_read_id_address, id, ID::lib, and LISTBASE_FOREACH.

Referenced by action_blend_read_lib().

◆ calc_action_range()

void calc_action_range ( const bAction act,
float start,
float end,
short  incl_modifiers 
)

◆ get_active_actiongroup()

bActionGroup* get_active_actiongroup ( bAction act)

◆ pose_channel_in_IK_chain()

static bool pose_channel_in_IK_chain ( Object ob,
bPoseChannel pchan,
int  level 
)
static

◆ pose_channels_remove_internal_links()

static void pose_channels_remove_internal_links ( Object ob,
bPoseChannel unlinked_pchan 
)
static

Definition at line 968 of file action.c.

References bPose::chanbase, LISTBASE_FOREACH, NULL, and Object::pose.

Referenced by BKE_pose_channels_remove().

◆ set_active_action_group()

void set_active_action_group ( bAction act,
bActionGroup agrp,
short  select 
)

◆ what_does_obaction()

void what_does_obaction ( Object ob,
Object workob,
bPose pose,
bAction act,
char  groupname[],
const AnimationEvalContext anim_eval_context 
)

Variable Documentation

◆ IDType_ID_AC

IDTypeInfo IDType_ID_AC
Initial value:
= {
.id_code = ID_AC,
.id_filter = FILTER_ID_AC,
.main_listbase_index = INDEX_ID_AC,
.struct_size = sizeof(bAction),
.name = "Action",
.name_plural = "actions",
.translation_context = BLT_I18NCONTEXT_ID_ACTION,
.copy_data = action_copy_data,
.free_data = action_free_data,
.make_local = NULL,
.foreach_id = action_foreach_id,
.foreach_cache = NULL,
.owner_get = NULL,
.blend_write = action_blend_write,
.blend_read_data = action_blend_read_data,
.blend_read_lib = action_blend_read_lib,
.blend_read_expand = action_blend_read_expand,
.blend_read_undo_preserve = NULL,
.lib_override_apply_post = NULL,
}
@ IDTYPE_FLAGS_NO_ANIMDATA
Definition: BKE_idtype.h:51
#define BLT_I18NCONTEXT_ID_ACTION
#define FILTER_ID_AC
Definition: DNA_ID.h:705
@ INDEX_ID_AC
Definition: DNA_ID.h:785
@ ID_AC
Definition: DNA_ID_enums.h:79
struct bAction bAction
static void init_data(ModifierData *md)
static void action_blend_read_expand(BlendExpander *expander, ID *id)
Definition: action.c:269
static void action_blend_write(BlendWriter *writer, ID *id, const void *id_address)
Definition: action.c:186
static void action_copy_data(Main *UNUSED(bmain), ID *id_dst, const ID *id_src, const int flag)
Definition: action.c:105
static void action_blend_read_data(BlendDataReader *reader, ID *id)
Definition: action.c:207
static void action_foreach_id(ID *id, LibraryForeachIDData *data)
Definition: action.c:173
static void action_blend_read_lib(BlendLibReader *reader, ID *id)
Definition: action.c:242
static void action_free_data(struct ID *id)
Definition: action.c:156

Definition at line 290 of file action.c.

◆ LOG

CLG_LogRef LOG = {"bke.action"}
static

Definition at line 76 of file action.c.

Referenced by BKE_pose_copy_result().