Blender V5.3
ANIM_keyframing.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
10
11#pragma once
12
13#include <array>
14
15#include "BLI_string_ref.hh"
16
17#include "DNA_anim_types.h"
18#include "DNA_userdef_types.h"
19
20#include "BKE_report.hh"
21
22#include "RNA_path.hh"
23#include "RNA_types.hh"
24
25namespace blender {
26
27struct ID;
28struct Main;
29struct Scene;
30
33
34namespace animrig {
35
46 /* TODO: remove `UNKNOWN_FAILURE` and replace all usages with proper, specific
47 * cases. This is needed right now as a stop-gap while progressively moving
48 * the keyframing code over to propagate errors properly. */
60 /* Make sure to always keep this at the end of the enum. */
62};
63
70
76 private:
81 std::array<int, size_t(SingleKeyingResult::_KEYING_RESULT_MAX)> result_counter;
82
83 public:
85
89 void add(SingleKeyingResult result, int count = 1);
90
92 void merge(const CombinedKeyingResult &other);
93
94 int get_count(const SingleKeyingResult result) const;
95
96 bool has_errors() const;
97
98 void generate_reports(ReportList *reports, eReportType report_level = RPT_ERROR);
99};
100
108std::optional<StringRefNull> default_channel_group_for_path(const PointerRNA *animated_struct,
109 StringRef prop_rna_path);
110
111/* -------------------------------------------------------------------- */
112
121
122/* -------------------------------------------------------------------- */
125
128
135Vector<float> get_property_values(PointerRNA *ptr, PropertyRNA *prop, bool visual_key);
136
172 PointerRNA *struct_pointer,
173 std::optional<StringRefNull> channel_group,
174 const Span<RNAPath> rna_paths,
175 std::optional<float> scene_frame,
176 const AnimationEvalContext &anim_eval_context,
178 eInsertKeyFlags insert_key_flags);
179
205 PropertyRNA &prop,
206 FCurve &fcu,
207 float fcurve_frame,
209 eInsertKeyFlags flag);
210
218int delete_keyframe(Main *bmain, ReportList *reports, ID *id, const RNAPath &rna_path, float cfra);
219
227int clear_keyframe(Main *bmain, ReportList *reports, ID *id, const RNAPath &rna_path);
228
230bool is_keying_flag(const Scene *scene, eKeying_Flag flag);
231
238bool id_frame_has_keyframe(ID *id, float frame);
239
244
246
247/* -------------------------------------------------------------------- */
256
258bool is_autokey_on(const Scene *scene);
259
261bool is_autokey_mode(const Scene *scene, eAutokey_Mode mode);
262
266bool autokeyframe_cfra_can_key(const Scene *scene, ID *id);
267
273void autokeyframe_object(bContext *C, const Scene *scene, Object *ob, Span<RNAPath> rna_paths);
280bool autokeyframe_object(bContext *C, Scene *scene, Object *ob, KeyingSet *ks);
281bool autokeyframe_pchan(bContext *C, Scene *scene, Object *ob, bPoseChannel *pchan, KeyingSet *ks);
292 Scene *scene,
293 Object *ob,
294 bPoseChannel *pose_channel,
295 Span<RNAPath> rna_paths,
296 short targetless_ik);
304 Scene *scene,
305 PointerRNA *ptr,
306 PropertyRNA *prop,
307 int rnaindex,
308 float cfra,
309 bool only_if_property_keyed);
310
312
313} // namespace animrig
314} // namespace blender
#define C
Definition RandGen.cpp:29
void merge(const CombinedKeyingResult &other)
int get_count(const SingleKeyingResult result) const
void generate_reports(ReportList *reports, eReportType report_level=RPT_ERROR)
void add(SingleKeyingResult result, int count=1)
std::optional< StringRefNull > default_channel_group_for_path(const PointerRNA *animated_struct, StringRef prop_rna_path)
bool is_autokey_on(const Scene *scene)
bool autokeyframe_cfra_can_key(const Scene *scene, ID *id)
void update_autoflags_fcurve_direct(FCurve *fcu, PropertyType prop_type)
bool is_autokey_mode(const Scene *scene, eAutokey_Mode mode)
Vector< float > get_property_values(PointerRNA *ptr, PropertyRNA *prop, bool visual_key)
int clear_keyframe(Main *bmain, ReportList *reports, ID *id, const RNAPath &rna_path)
int delete_keyframe(Main *bmain, ReportList *reports, ID *id, const RNAPath &rna_path, float cfra)
Main Delete Key-Framing API call.
bool id_frame_has_keyframe(ID *id, float frame)
bool autokeyframe_pchan(bContext *C, Scene *scene, Object *ob, bPoseChannel *pchan, KeyingSet *ks)
SingleKeyingResult insert_keyframe_direct(PointerRNA &ptr, PropertyRNA &prop, FCurve &fcu, float fcurve_frame, eBezTriple_KeyframeType keytype, eInsertKeyFlags flag)
Secondary Insert Key-framing API call.
bool autokeyframe_property(bContext *C, Scene *scene, PointerRNA *ptr, PropertyRNA *prop, int rnaindex, float cfra, bool only_if_property_keyed)
void autokeyframe_object(bContext *C, const Scene *scene, Object *ob, Span< RNAPath > rna_paths)
bool is_keying_flag(const Scene *scene, eKeying_Flag flag)
bool key_insertion_may_create_fcurve(eInsertKeyFlags insert_key_flags)
void autokeyframe_pose_channel(bContext *C, Scene *scene, Object *ob, bPoseChannel *pose_channel, Span< RNAPath > rna_paths, short targetless_ik)
void generate_single_keying_result_report(const SingleKeyingResult result, ReportList *reports)
eInsertKeyFlags get_keyframing_flags(Scene *scene)
CombinedKeyingResult insert_keyframes(Main *bmain, PointerRNA *struct_pointer, std::optional< StringRefNull > channel_group, const 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.
BMesh Iterators.