Blender V4.5
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"
20
21#include "RNA_path.hh"
22#include "RNA_types.hh"
23
24struct ID;
25struct Main;
26struct Scene;
27
30
31namespace blender::animrig {
32
43 /* TODO: remove `UNKNOWN_FAILURE` and replace all usages with proper, specific
44 * cases. This is needed right now as a stop-gap while progressively moving
45 * the keyframing code over to propagate errors properly. */
57 /* Make sure to always keep this at the end of the enum. */
59};
60
66 private:
67 /* The index to the array maps a `SingleKeyingResult` to the number of times this result has
68 * occurred. */
69 std::array<int, size_t(SingleKeyingResult::_KEYING_RESULT_MAX)> result_counter;
70
71 public:
73
77 void add(SingleKeyingResult result, int count = 1);
78
79 /* Add values of the given result to this result. */
80 void merge(const CombinedKeyingResult &other);
81
82 int get_count(const SingleKeyingResult result) const;
83
84 bool has_errors() const;
85
87};
88
96std::optional<StringRefNull> default_channel_group_for_path(const PointerRNA *animated_struct,
97 StringRef prop_rna_path);
98
99/* -------------------------------------------------------------------- */
100
109
110/* -------------------------------------------------------------------- */
113
116
152 PointerRNA *struct_pointer,
153 std::optional<StringRefNull> channel_group,
154 const blender::Span<RNAPath> rna_paths,
155 std::optional<float> scene_frame,
156 const AnimationEvalContext &anim_eval_context,
158 eInsertKeyFlags insert_key_flags);
159
178 PropertyRNA *prop,
179 FCurve *fcu,
180 const AnimationEvalContext *anim_eval_context,
182 NlaKeyframingContext *nla_context,
184
192int delete_keyframe(Main *bmain, ReportList *reports, ID *id, const RNAPath &rna_path, float cfra);
193
201int clear_keyframe(Main *bmain, ReportList *reports, ID *id, const RNAPath &rna_path);
202
204bool is_keying_flag(const Scene *scene, eKeying_Flag flag);
205
212bool id_frame_has_keyframe(ID *id, float frame);
213
218
220
221/* -------------------------------------------------------------------- */
230
232bool is_autokey_on(const Scene *scene);
233
235bool is_autokey_mode(const Scene *scene, eAutokey_Mode mode);
236
240bool autokeyframe_cfra_can_key(const Scene *scene, ID *id);
241
247void autokeyframe_object(bContext *C, const Scene *scene, Object *ob, Span<RNAPath> rna_paths);
254bool autokeyframe_object(bContext *C, Scene *scene, Object *ob, KeyingSet *ks);
255bool autokeyframe_pchan(bContext *C, Scene *scene, Object *ob, bPoseChannel *pchan, KeyingSet *ks);
266 Scene *scene,
267 Object *ob,
268 bPoseChannel *pose_channel,
269 Span<RNAPath> rna_paths,
270 short targetless_ik);
278 Scene *scene,
280 PropertyRNA *prop,
281 int rnaindex,
282 float cfra,
283 bool only_if_property_keyed);
284
286
287} // namespace blender::animrig
eInsertKeyFlags
eBezTriple_KeyframeType
eAutokey_Mode
PropertyType
Definition RNA_types.hh:149
#define C
Definition RandGen.cpp:29
ReportList * reports
Definition WM_types.hh:1025
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)
int count
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)
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)
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 autokeyframe_pchan(bContext *C, Scene *scene, Object *ob, bPoseChannel *pchan, KeyingSet *ks)
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 insert_keyframe_direct(ReportList *reports, PointerRNA ptr, PropertyRNA *prop, FCurve *fcu, const AnimationEvalContext *anim_eval_context, eBezTriple_KeyframeType keytype, NlaKeyframingContext *nla_context, eInsertKeyFlags flag)
Secondary Insert Key-framing API call.
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)
eInsertKeyFlags get_keyframing_flags(Scene *scene)
Definition DNA_ID.h:404
PointerRNA * ptr
Definition wm_files.cc:4226
uint8_t flag
Definition wm_window.cc:139