Blender V4.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
11#pragma once
12
13#include <array>
14#include <string>
15
16#include "BLI_array.hh"
17#include "BLI_bit_span.hh"
18#include "BLI_string_ref.hh"
19#include "BLI_vector.hh"
20
21#include "DNA_anim_types.h"
23
24#include "RNA_path.hh"
25#include "RNA_types.hh"
26
27struct ID;
28struct Main;
29struct Scene;
30
33
34namespace blender::animrig {
35
45 SUCCESS = 0,
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
69 private:
70 /* The index to the array maps a `SingleKeyingResult` to the number of times this result has
71 * occurred. */
72 std::array<int, size_t(SingleKeyingResult::_KEYING_RESULT_MAX)> result_counter;
73
74 public:
76
80 void add(SingleKeyingResult result, int count = 1);
81
82 /* Add values of the given result to this result. */
83 void merge(const CombinedKeyingResult &other);
84
85 int get_count(const SingleKeyingResult result) const;
86
87 bool has_errors() const;
88
89 void generate_reports(ReportList *reports, eReportType report_level = RPT_ERROR);
90};
91
99const std::optional<StringRefNull> default_channel_group_for_path(
100 const PointerRNA *animated_struct, const StringRef prop_rna_path);
101
102/* -------------------------------------------------------------------- */
103
112
113/* -------------------------------------------------------------------- */
117/* Set the FCurve flag based on the property type of `prop`. */
119
155 PointerRNA *struct_pointer,
156 std::optional<StringRefNull> channel_group,
157 const blender::Span<RNAPath> rna_paths,
158 std::optional<float> scene_frame,
159 const AnimationEvalContext &anim_eval_context,
161 eInsertKeyFlags insert_key_flags);
162
181 PropertyRNA *prop,
182 FCurve *fcu,
183 const AnimationEvalContext *anim_eval_context,
185 NlaKeyframingContext *nla_context,
187
195int delete_keyframe(Main *bmain, ReportList *reports, ID *id, const RNAPath &rna_path, float cfra);
196
204int clear_keyframe(Main *bmain, ReportList *reports, ID *id, const RNAPath &rna_path);
205
207bool is_keying_flag(const Scene *scene, eKeying_Flag flag);
208
213
216/* -------------------------------------------------------------------- */
227bool is_autokey_on(const Scene *scene);
228
230bool is_autokey_mode(const Scene *scene, eAutokey_Mode mode);
231
235bool autokeyframe_cfra_can_key(const Scene *scene, ID *id);
236
242void autokeyframe_object(bContext *C, Scene *scene, Object *ob, Span<RNAPath> rna_paths);
249bool autokeyframe_object(bContext *C, Scene *scene, Object *ob, KeyingSet *ks);
250bool autokeyframe_pchan(bContext *C, Scene *scene, Object *ob, bPoseChannel *pchan, KeyingSet *ks);
261 Scene *scene,
262 Object *ob,
263 bPoseChannel *pose_channel,
264 Span<RNAPath> rna_paths,
265 short targetless_ik);
273 Scene *scene,
275 PropertyRNA *prop,
276 int rnaindex,
277 float cfra,
278 bool only_if_property_keyed);
279
282} // namespace blender::animrig
eInsertKeyFlags
eBezTriple_KeyframeType
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)
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
int count
void autokeyframe_object(bContext *C, Scene *scene, Object *ob, Span< RNAPath > rna_paths)
bool is_autokey_on(const Scene *scene)
bool autokeyframe_cfra_can_key(const Scene *scene, ID *id)
void update_autoflags_fcurve_direct(FCurve *fcu, PropertyRNA *prop)
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.
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)
const std::optional< StringRefNull > default_channel_group_for_path(const PointerRNA *animated_struct, const StringRef prop_rna_path)
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:413
PointerRNA * ptr
Definition wm_files.cc:4126
uint8_t flag
Definition wm_window.cc:138