Blender  V3.3
Classes | Macros | Typedefs | Functions | Variables
keyingsets.c File Reference
#include <float.h>
#include <math.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
#include "DNA_anim_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "BKE_animsys.h"
#include "BKE_context.h"
#include "BKE_main.h"
#include "BKE_report.h"
#include "DEG_depsgraph.h"
#include "ED_keyframing.h"
#include "ED_screen.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "WM_api.h"
#include "WM_types.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "RNA_enum_types.h"
#include "RNA_path.h"
#include "anim_intern.h"

Go to the source code of this file.

Classes

struct  tRKS_DSource
 

Macros

#define APPLY_KEYINGFLAG_OVERRIDE(kflag)
 

Typedefs

typedef struct tRKS_DSource tRKS_DSource
 

Functions

static bool keyingset_poll_default_add (bContext *C)
 
static bool keyingset_poll_active_edit (bContext *C)
 
static bool keyingset_poll_activePath_edit (bContext *C)
 
static int add_default_keyingset_exec (bContext *C, wmOperator *UNUSED(op))
 
void ANIM_OT_keying_set_add (wmOperatorType *ot)
 
static int remove_active_keyingset_exec (bContext *C, wmOperator *op)
 
void ANIM_OT_keying_set_remove (wmOperatorType *ot)
 
static int add_empty_ks_path_exec (bContext *C, wmOperator *op)
 
void ANIM_OT_keying_set_path_add (wmOperatorType *ot)
 
static int remove_active_ks_path_exec (bContext *C, wmOperator *op)
 
void ANIM_OT_keying_set_path_remove (wmOperatorType *ot)
 
static int add_keyingset_button_exec (bContext *C, wmOperator *op)
 
void ANIM_OT_keyingset_button_add (wmOperatorType *ot)
 
static int remove_keyingset_button_exec (bContext *C, wmOperator *op)
 
void ANIM_OT_keyingset_button_remove (wmOperatorType *ot)
 
static int keyingset_active_menu_invoke (bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
 
static int keyingset_active_menu_exec (bContext *C, wmOperator *op)
 
void ANIM_OT_keying_set_active_set (wmOperatorType *ot)
 
KeyingSetInfoANIM_keyingset_info_find_name (const char name[])
 
KeyingSetANIM_builtin_keyingset_get_named (KeyingSet *prevKS, const char name[])
 
void ANIM_keyingset_info_register (KeyingSetInfo *ksi)
 
void ANIM_keyingset_info_unregister (Main *bmain, KeyingSetInfo *ksi)
 
void ANIM_keyingset_infos_exit (void)
 
bool ANIM_keyingset_find_id (KeyingSet *ks, ID *id)
 
KeyingSetANIM_scene_get_active_keyingset (const Scene *scene)
 
int ANIM_scene_get_keyingset_index (Scene *scene, KeyingSet *ks)
 
KeyingSetANIM_get_keyingset_for_autokeying (const Scene *scene, const char *transformKSName)
 
static void anim_keyingset_visit_for_search_impl (const bContext *C, StringPropertySearchVisitFunc visit_fn, void *visit_user_data, const bool use_poll)
 
void ANIM_keyingset_visit_for_search (const bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), const char *UNUSED(edit_text), StringPropertySearchVisitFunc visit_fn, void *visit_user_data)
 
void ANIM_keyingset_visit_for_search_no_poll (const bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), const char *UNUSED(edit_text), StringPropertySearchVisitFunc visit_fn, void *visit_user_data)
 
const EnumPropertyItemANIM_keying_sets_enum_itemf (bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
 
KeyingSetANIM_keyingset_get_from_enum_type (Scene *scene, int type)
 
KeyingSetANIM_keyingset_get_from_idname (Scene *scene, const char *idname)
 
bool ANIM_keyingset_context_ok_poll (bContext *C, KeyingSet *ks)
 
static void RKS_ITER_overrides_list (KeyingSetInfo *ksi, bContext *C, KeyingSet *ks, ListBase *dsources)
 
void ANIM_relative_keyingset_add_source (ListBase *dsources, ID *id, StructRNA *srna, void *data)
 
eModifyKey_Returns ANIM_validate_keyingset (bContext *C, ListBase *dsources, KeyingSet *ks)
 
static eInsertKeyFlags keyingset_apply_keying_flags (const eInsertKeyFlags base_flags, const eInsertKeyFlags overrides, const eInsertKeyFlags own_flags)
 
int ANIM_apply_keyingset (bContext *C, ListBase *dsources, bAction *act, KeyingSet *ks, short mode, float cfra)
 

Variables

static ListBase keyingset_type_infos = {NULL, NULL}
 
ListBase builtin_keyingsets = {NULL, NULL}
 

Macro Definition Documentation

◆ APPLY_KEYINGFLAG_OVERRIDE

#define APPLY_KEYINGFLAG_OVERRIDE (   kflag)
Value:
if (overrides & kflag) { \
result &= ~kflag; \
result |= (own_flags & kflag); \
}

Typedef Documentation

◆ tRKS_DSource

typedef struct tRKS_DSource tRKS_DSource

Function Documentation

◆ add_default_keyingset_exec()

static int add_default_keyingset_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ add_empty_ks_path_exec()

static int add_empty_ks_path_exec ( bContext C,
wmOperator op 
)
static

◆ add_keyingset_button_exec()

static int add_keyingset_button_exec ( bContext C,
wmOperator op 
)
static

◆ ANIM_apply_keyingset()

int ANIM_apply_keyingset ( struct bContext C,
ListBase dsources,
struct bAction act,
struct KeyingSet ks,
short  mode,
float  cfra 
)

Use the specified KeyingSet and context info (if required) to add/remove various Keyframes on the specified frame.

Modify keyframes for the channels specified by the KeyingSet. This takes into account many of the different combinations of using KeyingSets.

Returns
the number of channels that key-frames were added or an eModifyKey_Returns value (always a negative number).

Definition at line 1038 of file keyingsets.c.

References ANIM_get_keyframing_flags(), ANIM_validate_keyingset(), KS_Path::array_index, BKE_animsys_eval_context_construct(), BKE_animsys_free_nla_keyframing_context_cache(), BKE_reportf(), BLI_assert, C, CTX_data_depsgraph_pointer(), CTX_data_main(), CTX_data_scene(), CTX_wm_reports(), DEG_id_tag_update(), delete_keyframe(), depsgraph, error(), ListBase::first, KS_Path::flag, KS_Path::group, KS_Path::groupmode, GS, KS_Path::id, Object::id, ID_OB, ID_RECALC_ANIMATION_NO_FLUSH, ID_RECALC_GEOMETRY, ID_RECALC_TRANSFORM, insert_keyframe(), ToolSettings::keyframe_type, KS_Path::keyingflag, KeyingSet::keyingflag, KS_Path::keyingoverride, KeyingSet::keyingoverride, keyingset_apply_keying_flags(), KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_KSNAME, KSP_GROUP_NONE, MODIFYKEY_MODE_DELETE, MODIFYKEY_MODE_INSERT, NA_ADDED, KeyingSet::name, ID::name, NC_ANIMATION, ND_KEYFRAME, KS_Path::next, NULL, KeyingSet::paths, ptr, RNA_id_pointer_create(), KS_Path::rna_path, RNA_path_resolve_property(), RNA_property_array_length(), RPT_WARNING, scene, Scene::toolsettings, and WM_main_add_notifier().

Referenced by autokeyframe_object(), autokeyframe_pose(), delete_key_using_keying_set(), ED_autokeyframe_object(), ED_autokeyframe_pchan(), ED_view3d_camera_autokey(), insert_key_exec(), pose_clear_transform_generic_exec(), poseAnim_mapping_autoKeyframe(), poselib_add_exec(), and poselib_keytag_pose().

◆ ANIM_builtin_keyingset_get_named()

KeyingSet* ANIM_builtin_keyingset_get_named ( struct KeyingSet prevKS,
const char  name[] 
)

Find builtin KeyingSet by name.

Returns
The first builtin KeyingSet with the given name, which occurs after the given one (or start of list if none given).

Definition at line 531 of file keyingsets.c.

References builtin_keyingsets, ListBase::first, KeyingSet::idname, KeyingSet::next, NULL, and STREQ.

Referenced by ANIM_get_keyingset_for_autokeying(), autokeyframe_object(), autokeyframe_pose(), pose_flip_quats_exec(), and poselib_add_exec().

◆ ANIM_get_keyingset_for_autokeying()

KeyingSet* ANIM_get_keyingset_for_autokeying ( const Scene scene,
const char *  transformKSName 
)

◆ ANIM_keying_sets_enum_itemf()

const EnumPropertyItem* ANIM_keying_sets_enum_itemf ( bContext C,
PointerRNA UNUSEDptr,
PropertyRNA UNUSEDprop,
bool r_free 
)

◆ ANIM_keyingset_context_ok_poll()

bool ANIM_keyingset_context_ok_poll ( struct bContext C,
struct KeyingSet ks 
)

◆ ANIM_keyingset_find_id()

bool ANIM_keyingset_find_id ( struct KeyingSet ks,
ID id 
)

Check if the ID appears in the paths specified by the KeyingSet.

Definition at line 632 of file keyingsets.c.

References BLI_findptr(), ELEM, NULL, and KeyingSet::paths.

Referenced by insert_key_exec().

◆ ANIM_keyingset_get_from_enum_type()

KeyingSet* ANIM_keyingset_get_from_enum_type ( struct Scene scene,
int  type 
)

Get the keying set from enum values generated in ANIM_keying_sets_enum_itemf.

Type is the Keying Set the user specified to use when calling the operator:

Parameters
type
  • == 0: use scene's active Keying Set.
  • > 0: use a user-defined Keying Set from the active scene.
  • < 0: use a builtin Keying Set.

Definition at line 847 of file keyingsets.c.

References Scene::active_keyingset, BLI_findlink(), builtin_keyingsets, Scene::keyingsets, NULL, scene, and type.

Referenced by keyingset_get_from_op_with_error().

◆ ANIM_keyingset_get_from_idname()

KeyingSet* ANIM_keyingset_get_from_idname ( Scene scene,
const char *  idname 
)

◆ ANIM_keyingset_info_find_name()

KeyingSetInfo* ANIM_keyingset_info_find_name ( const char  name[])

Find KeyingSet type info given a name.

Definition at line 520 of file keyingsets.c.

References BLI_findstring(), keyingset_type_infos, and NULL.

Referenced by ANIM_keyingset_context_ok_poll(), and ANIM_validate_keyingset().

◆ ANIM_keyingset_info_register()

void ANIM_keyingset_info_register ( KeyingSetInfo ksi)

◆ ANIM_keyingset_info_unregister()

void ANIM_keyingset_info_unregister ( struct Main bmain,
KeyingSetInfo ksi 
)

◆ ANIM_keyingset_infos_exit()

void ANIM_keyingset_infos_exit ( void  )

◆ ANIM_keyingset_visit_for_search()

void ANIM_keyingset_visit_for_search ( const bContext C,
PointerRNA UNUSEDptr,
PropertyRNA UNUSEDprop,
const char *  UNUSEDedit_text,
StringPropertySearchVisitFunc  visit_fn,
void visit_user_data 
)

Definition at line 757 of file keyingsets.c.

References anim_keyingset_visit_for_search_impl(), and C.

◆ anim_keyingset_visit_for_search_impl()

static void anim_keyingset_visit_for_search_impl ( const bContext C,
StringPropertySearchVisitFunc  visit_fn,
void visit_user_data,
const bool  use_poll 
)
static

◆ ANIM_keyingset_visit_for_search_no_poll()

void ANIM_keyingset_visit_for_search_no_poll ( const bContext C,
PointerRNA UNUSEDptr,
PropertyRNA UNUSEDprop,
const char *  UNUSEDedit_text,
StringPropertySearchVisitFunc  visit_fn,
void visit_user_data 
)

◆ ANIM_OT_keying_set_active_set()

void ANIM_OT_keying_set_active_set ( wmOperatorType ot)

◆ ANIM_OT_keying_set_add()

void ANIM_OT_keying_set_add ( wmOperatorType ot)

◆ ANIM_OT_keying_set_path_add()

void ANIM_OT_keying_set_path_add ( wmOperatorType ot)

◆ ANIM_OT_keying_set_path_remove()

void ANIM_OT_keying_set_path_remove ( wmOperatorType ot)

◆ ANIM_OT_keying_set_remove()

void ANIM_OT_keying_set_remove ( wmOperatorType ot)

◆ ANIM_OT_keyingset_button_add()

void ANIM_OT_keyingset_button_add ( wmOperatorType ot)

◆ ANIM_OT_keyingset_button_remove()

void ANIM_OT_keyingset_button_remove ( wmOperatorType ot)

◆ ANIM_relative_keyingset_add_source()

void ANIM_relative_keyingset_add_source ( ListBase dsources,
struct ID id,
struct StructRNA srna,
void data 
)

◆ ANIM_scene_get_active_keyingset()

KeyingSet* ANIM_scene_get_active_keyingset ( const Scene scene)

◆ ANIM_scene_get_keyingset_index()

int ANIM_scene_get_keyingset_index ( struct Scene scene,
struct KeyingSet ks 
)

Get the index of the Keying Set provided, for the given Scene.

Definition at line 665 of file keyingsets.c.

References BLI_findindex(), builtin_keyingsets, Scene::keyingsets, NULL, and scene.

◆ ANIM_validate_keyingset()

eModifyKey_Returns ANIM_validate_keyingset ( struct bContext C,
ListBase dsources,
struct KeyingSet ks 
)

Given a KeyingSet and context info, validate Keying Set's paths. This is only really necessary with relative/built-in KeyingSets where their list of paths is dynamically generated based on the current context info.

Returns
0 if succeeded, otherwise an error code: eModifyKey_Returns.

Definition at line 954 of file keyingsets.c.

References ANIM_keyingset_info_find_name(), BKE_keyingset_free(), BLI_listbase_is_empty(), C, KeyingSet::flag, KeyingSetInfo::iter, KEYINGSET_ABSOLUTE, MODIFYKEY_INVALID_CONTEXT, MODIFYKEY_MISSING_TYPEINFO, NULL, KeyingSet::paths, KeyingSetInfo::poll, RKS_ITER_overrides_list(), and KeyingSet::typeinfo.

Referenced by ANIM_apply_keyingset(), pose_select_same_keyingset(), and select_grouped_keyingset().

◆ keyingset_active_menu_exec()

static int keyingset_active_menu_exec ( bContext C,
wmOperator op 
)
static

◆ keyingset_active_menu_invoke()

static int keyingset_active_menu_invoke ( bContext C,
wmOperator op,
const wmEvent UNUSEDevent 
)
static

◆ keyingset_apply_keying_flags()

static eInsertKeyFlags keyingset_apply_keying_flags ( const eInsertKeyFlags  base_flags,
const eInsertKeyFlags  overrides,
const eInsertKeyFlags  own_flags 
)
static

◆ keyingset_poll_active_edit()

static bool keyingset_poll_active_edit ( bContext C)
static

◆ keyingset_poll_activePath_edit()

static bool keyingset_poll_activePath_edit ( bContext C)
static

◆ keyingset_poll_default_add()

static bool keyingset_poll_default_add ( bContext C)
static

Definition at line 53 of file keyingsets.c.

References C, CTX_data_scene(), and NULL.

Referenced by ANIM_OT_keying_set_add().

◆ remove_active_keyingset_exec()

static int remove_active_keyingset_exec ( bContext C,
wmOperator op 
)
static

◆ remove_active_ks_path_exec()

static int remove_active_ks_path_exec ( bContext C,
wmOperator op 
)
static

◆ remove_keyingset_button_exec()

static int remove_keyingset_button_exec ( bContext C,
wmOperator op 
)
static

◆ RKS_ITER_overrides_list()

static void RKS_ITER_overrides_list ( KeyingSetInfo ksi,
bContext C,
KeyingSet ks,
ListBase dsources 
)
static

Variable Documentation

◆ builtin_keyingsets

ListBase builtin_keyingsets = {NULL, NULL}

◆ keyingset_type_infos

ListBase keyingset_type_infos = {NULL, NULL}
static