Blender V4.3
keyframing.cc File Reference
#include <cstddef>
#include <cstdio>
#include <fmt/format.h>
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLT_translation.hh"
#include "DNA_ID.h"
#include "DNA_action_types.h"
#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "BKE_action.hh"
#include "BKE_anim_data.hh"
#include "BKE_animsys.h"
#include "BKE_armature.hh"
#include "BKE_context.hh"
#include "BKE_fcurve.hh"
#include "BKE_global.hh"
#include "BKE_idtype.hh"
#include "BKE_lib_id.hh"
#include "BKE_nla.hh"
#include "BKE_report.hh"
#include "BKE_scene.hh"
#include "DEG_depsgraph.hh"
#include "DEG_depsgraph_query.hh"
#include "ED_anim_api.hh"
#include "ED_keyframing.hh"
#include "ED_object.hh"
#include "ED_screen.hh"
#include "ANIM_action.hh"
#include "ANIM_action_iterators.hh"
#include "ANIM_action_legacy.hh"
#include "ANIM_animdata.hh"
#include "ANIM_bone_collections.hh"
#include "ANIM_driver.hh"
#include "ANIM_fcurve.hh"
#include "ANIM_keyframing.hh"
#include "ANIM_keyingsets.hh"
#include "ANIM_rna.hh"
#include "UI_interface.hh"
#include "UI_resources.hh"
#include "WM_api.hh"
#include "WM_types.hh"
#include "RNA_access.hh"
#include "RNA_define.hh"
#include "RNA_enum_types.hh"
#include "RNA_path.hh"
#include "RNA_prototypes.hh"
#include "anim_intern.hh"

Go to the source code of this file.

Enumerations

enum  { COMMONKEY_MODE_INSERT = 0 , COMMONKEY_MODE_DELETE }
 

Functions

static int delete_key_using_keying_set (bContext *C, wmOperator *op, KeyingSet *ks)
 
void update_autoflags_fcurve (FCurve *fcu, bContext *C, ReportList *reports, PointerRNA *ptr)
 Lesser Key-framing API call.
 
void ED_keyframes_add (FCurve *fcu, int num_keys_to_add)
 
static bool modify_key_op_poll (bContext *C)
 
static int insert_key_with_keyingset (bContext *C, wmOperator *op, KeyingSet *ks)
 
static bool is_idproperty_keyable (IDProperty *id_prop, PointerRNA *ptr, PropertyRNA *prop)
 
static blender::Vector< RNAPathconstruct_rna_paths (PointerRNA *ptr)
 
static bool get_selection (bContext *C, blender::Vector< PointerRNA > *r_selection)
 
static int insert_key (bContext *C, wmOperator *op)
 
static int insert_key_exec (bContext *C, wmOperator *op)
 
static int insert_key_invoke (bContext *C, wmOperator *op, const wmEvent *)
 
void ANIM_OT_keyframe_insert (wmOperatorType *ot)
 
static int keyframe_insert_with_keyingset_exec (bContext *C, wmOperator *op)
 
void ANIM_OT_keyframe_insert_by_name (wmOperatorType *ot)
 
static int insert_key_menu_invoke (bContext *C, wmOperator *op, const wmEvent *)
 
void ANIM_OT_keyframe_insert_menu (wmOperatorType *ot)
 
static int delete_key_exec (bContext *C, wmOperator *op)
 
void ANIM_OT_keyframe_delete (wmOperatorType *ot)
 
void ANIM_OT_keyframe_delete_by_name (wmOperatorType *ot)
 
static bool can_delete_fcurve (FCurve *fcu, Object *ob)
 
static int clear_anim_v3d_exec (bContext *C, wmOperator *)
 
static int clear_anim_v3d_invoke (bContext *C, wmOperator *op, const wmEvent *)
 
void ANIM_OT_keyframe_clear_v3d (wmOperatorType *ot)
 
static bool can_delete_key (FCurve *fcu, Object *ob, ReportList *reports)
 
static int delete_key_v3d_without_keying_set (bContext *C, wmOperator *op)
 
static int delete_key_v3d_exec (bContext *C, wmOperator *op)
 
static int delete_key_v3d_invoke (bContext *C, wmOperator *op, const wmEvent *)
 
void ANIM_OT_keyframe_delete_v3d (wmOperatorType *ot)
 
static int insert_key_button_exec (bContext *C, wmOperator *op)
 
void ANIM_OT_keyframe_insert_button (wmOperatorType *ot)
 
static int delete_key_button_exec (bContext *C, wmOperator *op)
 
void ANIM_OT_keyframe_delete_button (wmOperatorType *ot)
 
static int clear_key_button_exec (bContext *C, wmOperator *op)
 
void ANIM_OT_keyframe_clear_button (wmOperatorType *ot)
 
bool fcurve_frame_has_keyframe (const FCurve *fcu, float frame)
 Lesser Keyframe Checking API call.
 
bool fcurve_is_changed (PointerRNA ptr, PropertyRNA *prop, FCurve *fcu, const AnimationEvalContext *anim_eval_context)
 Lesser Keyframe Checking API call.
 
static bool assigned_action_has_keyframe_at (AnimData &adt, float frame)
 
static bool object_frame_has_keyframe (Object *ob, float frame)
 
bool id_frame_has_keyframe (ID *id, float frame)
 Main Keyframe Checking API call.
 
Internal Utilities
static KeyingSetkeyingset_get_from_op_with_error (wmOperator *op, PropertyRNA *prop, Scene *scene)
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
COMMONKEY_MODE_INSERT 
COMMONKEY_MODE_DELETE 

Definition at line 146 of file editors/animation/keyframing.cc.

Function Documentation

◆ ANIM_OT_keyframe_clear_button()

◆ ANIM_OT_keyframe_clear_v3d()

◆ ANIM_OT_keyframe_delete()

◆ ANIM_OT_keyframe_delete_button()

◆ ANIM_OT_keyframe_delete_by_name()

◆ ANIM_OT_keyframe_delete_v3d()

◆ ANIM_OT_keyframe_insert()

◆ ANIM_OT_keyframe_insert_button()

◆ ANIM_OT_keyframe_insert_by_name()

◆ ANIM_OT_keyframe_insert_menu()

◆ assigned_action_has_keyframe_at()

static bool assigned_action_has_keyframe_at ( AnimData & adt,
float frame )
static

Checks whether the Action assigned to adt (if any) has any keyframes at the given frame. Since we're only concerned whether a keyframe exists, we can simply loop until a match is found.

For layered actions, this only checks for keyframes in the assigned slot.

Definition at line 1418 of file editors/animation/keyframing.cc.

References ACT_MUTED, AnimData::action, fcurve_frame_has_keyframe(), blender::animrig::legacy::fcurves_for_assigned_action(), and bAction::flag.

Referenced by id_frame_has_keyframe(), and object_frame_has_keyframe().

◆ can_delete_fcurve()

◆ can_delete_key()

◆ clear_anim_v3d_exec()

◆ clear_anim_v3d_invoke()

◆ clear_key_button_exec()

◆ construct_rna_paths()

◆ delete_key_button_exec()

◆ delete_key_exec()

◆ delete_key_using_keying_set()

◆ delete_key_v3d_exec()

◆ delete_key_v3d_invoke()

static int delete_key_v3d_invoke ( bContext * C,
wmOperator * op,
const wmEvent *  )
static

◆ delete_key_v3d_without_keying_set()

◆ ED_keyframes_add()

void ED_keyframes_add ( FCurve * fcu,
int num_keys_to_add )

Add the given number of keyframes to the FCurve. Their coordinates are uninitialized, so the curve should not be used without further attention.

The newly created keys are selected, existing keys are not touched.

This can be used to allocate all the keys at once, and then update them afterwards.

Definition at line 118 of file editors/animation/keyframing.cc.

References FCurve::bezt, BEZT_IPO_BEZ, BLI_assert_msg, BezTriple::f1, BezTriple::f2, BezTriple::f3, BezTriple::h1, BezTriple::h2, HD_AUTO_ANIM, BezTriple::ipo, MEM_recallocN, SELECT, and FCurve::totvert.

Referenced by blender::bke::tests::testcurve_with_duplicates().

◆ fcurve_frame_has_keyframe()

bool fcurve_frame_has_keyframe ( const FCurve * fcu,
float frame )

Lesser Keyframe Checking API call.

Checks if some F-Curve has a keyframe for a given frame.

Note
Used for the buttons to check for keyframes.

Definition at line 1367 of file editors/animation/keyframing.cc.

References FCurve::bezt, BKE_fcurve_bezt_binarysearch_index(), ELEM, FCURVE_MUTED, FCurve::flag, and FCurve::totvert.

Referenced by achannel_setting_slider_cb(), achannel_setting_slider_nla_curve_cb(), assigned_action_has_keyframe_at(), and ui_but_anim_flag().

◆ fcurve_is_changed()

bool fcurve_is_changed ( PointerRNA ptr,
PropertyRNA * prop,
FCurve * fcu,
const AnimationEvalContext * anim_eval_context )

Lesser Keyframe Checking API call.

  • Returns whether the current value of a given property differs from the interpolated value.
  • Used for button drawing.

Definition at line 1392 of file editors/animation/keyframing.cc.

References FCurve::array_index, calculate_fcurve(), compare_ff_relative(), blender::animrig::get_rna_values(), PathResolvedRNA::prop, PathResolvedRNA::prop_index, PathResolvedRNA::ptr, and ptr.

Referenced by ui_but_anim_flag().

◆ get_selection()

static bool get_selection ( bContext * C,
blender::Vector< PointerRNA > * r_selection )
static

◆ id_frame_has_keyframe()

bool id_frame_has_keyframe ( ID * id,
float frame )

Main Keyframe Checking API call.

Checks whether a keyframe exists for the given ID-block one the given frame. It is recommended to call this method over the other keyframe-checkers directly, in case some detail of the implementation changes...

Parameters
frameThe value of this is quite often result of BKE_scene_ctime_get()

Definition at line 1472 of file editors/animation/keyframing.cc.

References assigned_action_has_keyframe_at(), BKE_animdata_from_id(), GS, ID_OB, ID_SCE, and object_frame_has_keyframe().

Referenced by blender::animrig::autokeyframe_cfra_can_key(), and draw_selected_name().

◆ insert_key()

◆ insert_key_button_exec()

◆ insert_key_exec()

◆ insert_key_invoke()

static int insert_key_invoke ( bContext * C,
wmOperator * op,
const wmEvent *  )
static

◆ insert_key_menu_invoke()

◆ insert_key_with_keyingset()

◆ is_idproperty_keyable()

static bool is_idproperty_keyable ( IDProperty * id_prop,
PointerRNA * ptr,
PropertyRNA * prop )
static

◆ keyframe_insert_with_keyingset_exec()

◆ keyingset_get_from_op_with_error()

◆ modify_key_op_poll()

static bool modify_key_op_poll ( bContext * C)
static

Polling callback for use with ANIM_*_keyframe() operators This is based on the standard ED_operator_areaactive callback, except that it does special checks for a few space-types too.

Definition at line 156 of file editors/animation/keyframing.cc.

References CTX_data_scene(), CTX_wm_area(), and ELEM.

Referenced by ANIM_OT_keyframe_clear_button(), ANIM_OT_keyframe_delete(), ANIM_OT_keyframe_delete_button(), ANIM_OT_keyframe_delete_by_name(), ANIM_OT_keyframe_insert(), ANIM_OT_keyframe_insert_button(), and ANIM_OT_keyframe_insert_by_name().

◆ object_frame_has_keyframe()

static bool object_frame_has_keyframe ( Object * ob,
float frame )
static

◆ update_autoflags_fcurve()

void update_autoflags_fcurve ( FCurve * fcu,
bContext * C,
ReportList * reports,
PointerRNA * ptr )

Lesser Key-framing API call.

Update integer/discrete flags of the FCurve (used when creating/inserting keyframes, but also through RNA when editing an ID prop, see #37103).

Definition at line 82 of file editors/animation/keyframing.cc.

References BKE_report(), BKE_reportf(), PointerRNA::data, FCurve::flag, NA_EDITED, ID::name, NC_ANIMATION, ND_KEYFRAME, PointerRNA::owner_id, ptr, FCurve::rna_path, RNA_path_resolve_property(), RPT_, RPT_ERROR, blender::animrig::update_autoflags_fcurve_direct(), and WM_event_add_notifier().