68 if (scene ==
nullptr) {
81 if (scene ==
nullptr) {
121 ot->name =
"Add Empty Keying Set";
122 ot->idname =
"ANIM_OT_keying_set_add";
123 ot->description =
"Add a new (empty) keying set to the active Scene";
168 ot->name =
"Remove Active Keying Set";
169 ot->idname =
"ANIM_OT_keying_set_remove";
170 ot->description =
"Remove the active keying set";
211 ot->name =
"Add Empty Keying Set Path";
212 ot->idname =
"ANIM_OT_keying_set_path_add";
213 ot->description =
"Add empty path to active keying set";
236 if (!keyingset_path) {
253 ot->name =
"Remove Active Keying Set Path";
254 ot->idname =
"ANIM_OT_keying_set_path_remove";
255 ot->description =
"Remove active Path from active keying set";
271 int index = 0, pflag = 0;
294 &scene->
keyingsets,
"ButtonKeyingSet",
"Button Keying Set",
flag, keyingflag);
309 bool changed =
false;
343 ot->name =
"Add to Keying Set";
344 ot->idname =
"ANIM_OT_keyingset_button_add";
345 ot->description =
"Add current UI-active property to current keying set";
355 RNA_def_boolean(
ot->srna,
"all",
true,
"All",
"Add all elements of the array to a Keying Set");
389 bool changed =
false;
390 if (
ptr.owner_id &&
ptr.data && prop) {
396 if (keyingset_path) {
416 ot->name =
"Remove from Keying Set";
417 ot->idname =
"ANIM_OT_keyingset_button_remove";
418 ot->description =
"Remove current UI-active property from current keying set";
442 uiItemsEnumO(layout,
"ANIM_OT_keying_set_active_set",
"type");
474 keyingset = keyingset->
next, enum_index++)
480 item_tmp.
value = enum_index;
491 keyingset = keyingset->
next, enum_index--)
498 item_tmp.
value = enum_index;
524 item_tmp.identifier =
"__ACTIVE__";
525 item_tmp.name =
"Clear Active Keying Set";
542 ot->name =
"Set Active Keying Set";
543 ot->idname =
"ANIM_OT_keying_set_active_set";
544 ot->description =
"Set a new active keying set";
572 if ((name ==
nullptr) || (name[0] == 0)) {
589 if (
STREQ(name, keyingset->idname)) {
596 printf(
"%s: '%s' not found\n", __func__, name);
612 keyingset_info->
name,
633 if (!
STREQ(keyingset->typeinfo, keyingset_info->
idname)) {
657 if (keyingset_info->rna_ext.free) {
658 keyingset_info->rna_ext.free(keyingset_info->rna_ext.data);
668 if (
ELEM(
nullptr, keyingset,
id)) {
683 if (scene ==
nullptr) {
704 if (keyingset ==
nullptr) {
755 if (use_poll && (
C ==
nullptr)) {
764 visit_params.
text =
"__ACTIVE__";
765 visit_params.
info =
"Active Keying Set";
766 visit_fn(visit_params);
776 visit_params.
text = keyingset->idname;
777 visit_params.
info = keyingset->name;
778 visit_fn(visit_params);
788 visit_params.
text = keyingset->idname;
789 visit_params.
info = keyingset->name;
790 visit_fn(visit_params);
833 item_tmp.identifier =
"__ACTIVE__";
834 item_tmp.name =
"Active Keying Set";
865 if (keyingset ==
nullptr) {
886 if (keyingset_info ==
nullptr) {
892 return keyingset_info->
poll(keyingset_info,
C);
908 keyingset_info->
generate(keyingset_info,
C, keyingset, &
ptr);
917 if (
ELEM(
nullptr, srna,
data,
id)) {
938 if (keyingset ==
nullptr) {
956 if (keyingset_info ==
nullptr) {
962 if (!keyingset_info->
poll(keyingset_info,
C)) {
971 if (sources !=
nullptr) {
975 keyingset_info->
iter(keyingset_info,
C, keyingset);
1002#define APPLY_KEYINGFLAG_OVERRIDE(kflag) \
1003 if (overrides & kflag) { \
1005 result |= (own_flags & kflag); \
1014#undef APPLY_KEYINGFLAG_OVERRIDE
1034 const char *groupname =
nullptr;
1037 groupname =
nullptr;
1040 groupname = keyingset->
name;
1043 groupname = keyingset_path->
group;
1050 int array_length = array_index;
1066 if (array_length == array_index) {
1080 int keyed_channels = 0;
1083 for (; array_index < array_length; array_index++) {
1085 const std::optional<blender::StringRefNull> group = groupname ? std::optional(groupname) :
1087 const std::optional<int> index = array_index >= 0 ? std::optional(array_index) :
1093 {{keyingset_path->
rna_path, {}, index}},
1097 path_insert_key_flags);
1102 RNAPath rna_path = {keyingset_path->
rna_path, std::nullopt, array_index};
1103 if (array_index < 0) {
1104 rna_path.
index = std::nullopt;
1106 keyed_channels +=
delete_keyframe(bmain, reports, keyingset_path->
id, rna_path, frame);
1114 switch (
GS(keyingset_path->
id->
name)) {
1131 return keyed_channels;
1141 if (keyingset ==
nullptr) {
1168 int keyed_channels = 0;
1173 if (keyingset_path->id ==
nullptr) {
1176 "Skipping path in keying set, as it has no ID (KS = '%s', path = '%s[%d]')",
1178 keyingset_path->rna_path,
1179 keyingset_path->array_index);
1184 C, keyingset_path, keyingset, kflag, mode, cfra);
1189 return keyed_channels;
Functions to insert, delete or modify keyframes.
Functionality to interact with keying sets.
struct KS_Path * BKE_keyingset_find_path(struct KeyingSet *ks, struct ID *id, const char group_name[], const char rna_path[], int array_index, int group_mode)
void BKE_keyingsets_free(struct ListBase *list)
AnimationEvalContext BKE_animsys_eval_context_construct(struct Depsgraph *depsgraph, float eval_time) ATTR_WARN_UNUSED_RESULT
void BKE_keyingset_free_paths(struct KeyingSet *ks)
struct KeyingSet * BKE_keyingset_add(struct ListBase *list, const char idname[], const char name[], short flag, short keyingflag)
struct KS_Path * BKE_keyingset_add_path(struct KeyingSet *ks, struct ID *id, const char group_name[], const char rna_path[], int array_index, short flag, short groupmode)
void BKE_keyingset_free_path(struct KeyingSet *ks, struct KS_Path *ksp)
ReportList * CTX_wm_reports(const bContext *C)
Depsgraph * CTX_data_depsgraph_pointer(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
Main * CTX_data_main(const bContext *C)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_report(ReportList *reports, eReportType type, const char *message)
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
void * BLI_findstring(const struct ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define LISTBASE_FOREACH(type, var, list)
void BLI_freelinkN(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
bool BLI_remlink_safe(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void * BLI_findptr(const struct ListBase *listbase, const void *ptr, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define STRNCPY(dst, src)
void DEG_id_tag_update(ID *id, unsigned int flags)
@ ID_RECALC_ANIMATION_NO_FLUSH
Object is a sort of wrapper for general info.
@ AUTOKEY_FLAG_ONLYKEYINGSET
@ AUTOKEY_FLAG_INSERTAVAILABLE
#define ANIM_KS_AVAILABLE_ID
bool ED_operator_areaactive(bContext *C)
Read Guarded memory(de)allocation.
void UI_popup_menu_end(bContext *C, uiPopupMenu *pup)
uiPopupMenu * UI_popup_menu_begin(bContext *C, const char *title, int icon) ATTR_NONNULL()
uiBut * UI_context_active_but_prop_get(const bContext *C, PointerRNA *r_ptr, PropertyRNA **r_prop, int *r_index)
uiLayout * UI_popup_menu_layout(uiPopupMenu *pup)
void uiItemsEnumO(uiLayout *layout, const char *opname, const char *propname)
ListBase builtin_keyingsets
BPy_StructRNA * depsgraph
void append(const T &value)
void merge(const CombinedKeyingResult &other)
int get_count(const SingleKeyingResult result) const
void generate_reports(ReportList *reports, eReportType report_level=RPT_ERROR)
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
void ANIM_keyingset_visit_for_search_no_poll(const bContext *C, PointerRNA *, PropertyRNA *, const char *, blender::FunctionRef< void(StringPropertySearchVisitParams)> visit_fn)
int ANIM_scene_get_keyingset_index(Scene *scene, KeyingSet *keyingset)
KeyingSetInfo * ANIM_keyingset_info_find_name(const char name[])
static ListBase keyingset_type_infos
void ANIM_relative_keyingset_add_source(blender::Vector< PointerRNA > &sources, ID *id, StructRNA *srna, void *data)
void ANIM_OT_keying_set_add(wmOperatorType *ot)
void ANIM_keyingset_infos_exit()
bool ANIM_keyingset_find_id(KeyingSet *keyingset, ID *id)
static int keyingset_active_menu_exec(bContext *C, wmOperator *op)
KeyingSet * ANIM_scene_get_active_keyingset(const Scene *scene)
static int insert_key_to_keying_set_path(bContext *C, KS_Path *keyingset_path, KeyingSet *keyingset, const eInsertKeyFlags insert_key_flags, const blender::animrig::ModifyKeyMode mode, const float frame)
static int remove_keyingset_button_exec(bContext *C, wmOperator *op)
static int remove_active_keyingset_exec(bContext *C, wmOperator *op)
static bool keyingset_poll_active_edit(bContext *C)
KeyingSet * ANIM_keyingset_get_from_idname(Scene *scene, const char *idname)
static eInsertKeyFlags keyingset_apply_keying_flags(const eInsertKeyFlags base_flags, const eInsertKeyFlags overrides, const eInsertKeyFlags own_flags)
void ANIM_OT_keying_set_path_remove(wmOperatorType *ot)
bool ANIM_keyingset_context_ok_poll(bContext *C, KeyingSet *keyingset)
void ANIM_keyingset_visit_for_search(const bContext *C, PointerRNA *, PropertyRNA *, const char *, blender::FunctionRef< void(StringPropertySearchVisitParams)> visit_fn)
static void build_keyingset_enum(bContext *C, EnumPropertyItem **item, int *totitem, bool *r_free)
void ANIM_keyingset_info_unregister(Main *bmain, KeyingSetInfo *keyingset_info)
static bool keyingset_poll_activePath_edit(bContext *C)
void ANIM_OT_keyingset_button_add(wmOperatorType *ot)
static const EnumPropertyItem * keyingset_set_active_enum_itemf(bContext *C, PointerRNA *, PropertyRNA *, bool *r_free)
static void RKS_ITER_overrides_list(KeyingSetInfo *keyingset_info, bContext *C, KeyingSet *keyingset, blender::Vector< PointerRNA > &sources)
void ANIM_OT_keying_set_remove(wmOperatorType *ot)
static bool keyingset_poll_default_add(bContext *C)
static int add_default_keyingset_exec(bContext *C, wmOperator *)
static int add_empty_ks_path_exec(bContext *C, wmOperator *op)
static int add_keyingset_button_exec(bContext *C, wmOperator *op)
static int keyingset_active_menu_invoke(bContext *C, wmOperator *op, const wmEvent *)
void ANIM_OT_keying_set_active_set(wmOperatorType *ot)
void ANIM_keyingset_info_register(KeyingSetInfo *keyingset_info)
blender::animrig::ModifyKeyReturn ANIM_validate_keyingset(bContext *C, blender::Vector< PointerRNA > *sources, KeyingSet *keyingset)
void ANIM_OT_keyingset_button_remove(wmOperatorType *ot)
void ANIM_OT_keying_set_path_add(wmOperatorType *ot)
static void anim_keyingset_visit_for_search_impl(const bContext *C, blender::FunctionRef< void(StringPropertySearchVisitParams)> visit_fn, const bool use_poll)
KeyingSet * ANIM_keyingset_get_from_enum_type(Scene *scene, int type)
#define APPLY_KEYINGFLAG_OVERRIDE(kflag)
KeyingSet * ANIM_get_keyingset_for_autokeying(const Scene *scene, const char *transformKSName)
const EnumPropertyItem * ANIM_keying_sets_enum_itemf(bContext *C, PointerRNA *, PropertyRNA *, bool *r_free)
KeyingSet * ANIM_builtin_keyingset_get_named(const char name[])
static int remove_active_ks_path_exec(bContext *C, wmOperator *op)
int ANIM_apply_keyingset(bContext *C, blender::Vector< PointerRNA > *sources, KeyingSet *keyingset, const blender::animrig::ModifyKeyMode mode, const float cfra)
void MEM_freeN(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
static void error(const char *str)
int delete_keyframe(Main *bmain, ReportList *reports, ID *id, const RNAPath &rna_path, float cfra)
Main Delete Key-Framing API call.
CombinedKeyingResult insert_keyframes(Main *bmain, PointerRNA *struct_pointer, std::optional< StringRefNull > channel_group, const blender::Span< RNAPath > rna_paths, std::optional< float > scene_frame, const AnimationEvalContext &anim_eval_context, eBezTriple_KeyframeType key_type, eInsertKeyFlags insert_key_flags)
Main key-frame insertion API.
bool is_keying_flag(const Scene *scene, eKeying_Flag flag)
eInsertKeyFlags get_keyframing_flags(Scene *scene)
bool RNA_property_anim_editable(const PointerRNA *ptr, PropertyRNA *prop_orig)
int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
PointerRNA RNA_pointer_create(ID *id, StructRNA *type, void *data)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PointerRNA RNA_id_pointer_create(ID *id)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
void RNA_enum_item_end(EnumPropertyItem **items, int *totitem)
void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void RNA_enum_item_add_separator(EnumPropertyItem **items, int *totitem)
void RNA_def_enum_funcs(PropertyRNA *prop, EnumPropertyItemFunc itemfunc)
std::optional< std::string > RNA_path_from_ID_to_property(const PointerRNA *ptr, PropertyRNA *prop)
bool RNA_path_resolve_property(const PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop)
const EnumPropertyItem rna_enum_dummy_DEFAULT_items[]
cbKeyingSet_Generate generate
cbKeyingSet_Iterator iter
std::optional< int > index
struct ToolSettings * toolsettings
std::optional< std::string > info
struct ReportList * reports
struct wmOperatorType * type
void WM_main_add_notifier(uint type, void *reference)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)