Blender V4.5
bpy_rna_anim.cc
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#include <Python.h>
12#include <cfloat> /* FLT_MAX */
13
14#include "MEM_guardedalloc.h"
15
16#include "BLI_string.h"
17#include "BLI_string_utils.hh"
18
19#include "DNA_anim_types.h"
20#include "DNA_scene_types.h"
21
22#include "ED_keyframing.hh"
23
24#include "ANIM_keyframing.hh"
25
26#include "BKE_anim_data.hh"
27#include "BKE_animsys.h"
28#include "BKE_context.hh"
29#include "BKE_fcurve.hh"
30#include "BKE_global.hh"
31#include "BKE_idtype.hh"
32#include "BKE_lib_id.hh"
33#include "BKE_report.hh"
34
35#include "RNA_access.hh"
36#include "RNA_enum_types.hh"
37#include "RNA_path.hh"
38#include "RNA_prototypes.hh"
39
40#include "WM_api.hh"
41#include "WM_types.hh"
42
43#include "bpy_capi_utils.hh"
44#include "bpy_rna.hh"
45#include "bpy_rna_anim.hh"
46
49
50#include "DEG_depsgraph.hh"
52
53/* for keyframes and drivers */
55 const char *error_prefix,
56 const char *path,
57 const char **r_path_full,
58 int *r_index,
59 bool *r_path_no_validate)
60{
61 const bool is_idbase = RNA_struct_is_ID(ptr->type);
62 PropertyRNA *prop;
63 PointerRNA r_ptr;
64
65 if (ptr->data == nullptr) {
66 PyErr_Format(
67 PyExc_TypeError, "%.200s this struct has no data, can't be animated", error_prefix);
68 return -1;
69 }
70
71 /* full paths can only be given from ID base */
72 if (is_idbase) {
73 int path_index = -1;
74 if (RNA_path_resolve_property_full(ptr, path, &r_ptr, &prop, &path_index) == false) {
75 prop = nullptr;
76 }
77 else if (path_index != -1) {
78 PyErr_Format(PyExc_ValueError,
79 "%.200s path includes index, must be a separate argument",
80 error_prefix,
81 path);
82 return -1;
83 }
84 else if (ptr->owner_id != r_ptr.owner_id) {
85 PyErr_Format(PyExc_ValueError, "%.200s path spans ID blocks", error_prefix, path);
86 return -1;
87 }
88 }
89 else {
90 prop = RNA_struct_find_property(ptr, path);
91 r_ptr = *ptr;
92 }
93
94 if (prop == nullptr) {
95 if (r_path_no_validate) {
96 *r_path_no_validate = true;
97 return -1;
98 }
99 PyErr_Format(PyExc_TypeError, "%.200s property \"%s\" not found", error_prefix, path);
100 return -1;
101 }
102
103 if (r_path_no_validate) {
104 /* Don't touch the index. */
105 }
106 else {
107 if (!RNA_property_animateable(&r_ptr, prop)) {
108 PyErr_Format(PyExc_TypeError, "%.200s property \"%s\" not animatable", error_prefix, path);
109 return -1;
110 }
111
112 if (RNA_property_array_check(prop) == 0) {
113 if ((*r_index) == -1) {
114 *r_index = 0;
115 }
116 else {
117 PyErr_Format(PyExc_TypeError,
118 "%.200s index %d was given while property \"%s\" is not an array",
119 error_prefix,
120 *r_index,
121 path);
122 return -1;
123 }
124 }
125 else {
126 const int array_len = RNA_property_array_length(&r_ptr, prop);
127 if ((*r_index) < -1 || (*r_index) >= array_len) {
128 PyErr_Format(PyExc_TypeError,
129 "%.200s index out of range \"%s\", given %d, array length is %d",
130 error_prefix,
131 path,
132 *r_index,
133 array_len);
134 return -1;
135 }
136 }
137 }
138
139 if (is_idbase) {
140 *r_path_full = BLI_strdup(path);
141 }
142 else {
143 const std::optional<std::string> path_full = RNA_path_from_ID_to_property(&r_ptr, prop);
144 *r_path_full = path_full ? BLI_strdup(path_full->c_str()) : nullptr;
145
146 if (*r_path_full == nullptr) {
147 PyErr_Format(PyExc_TypeError, "%.200s could not make path to \"%s\"", error_prefix, path);
148 return -1;
149 }
150 }
151
152 return 0;
153}
154
156 const char *error_prefix,
157 const char *path,
158 const char **r_path_full,
159 int *r_index)
160{
161 return pyrna_struct_anim_args_parse_ex(ptr, error_prefix, path, r_path_full, r_index, nullptr);
162}
163
168 const char *error_prefix,
169 const char *path,
170 const char **r_path_full)
171{
172 const bool is_idbase = RNA_struct_is_ID(ptr->type);
173 if (is_idbase) {
174 *r_path_full = path;
175 return 0;
176 }
177
178 const std::optional<std::string> path_prefix = RNA_path_from_ID_to_struct(ptr);
179 if (!path_prefix) {
180 PyErr_Format(PyExc_TypeError,
181 "%.200s could not make path for type %s",
182 error_prefix,
184 return -1;
185 }
186
187 if (*path == '[') {
188 *r_path_full = BLI_string_joinN(path_prefix->c_str(), path);
189 }
190 else {
191 *r_path_full = BLI_string_join_by_sep_charN('.', path_prefix->c_str(), path);
192 }
193
194 return 0;
195}
196
198 const char *error_prefix,
199 const char *path,
200 const char **r_path_full,
201 int *r_index)
202{
203 bool path_unresolved = false;
205 ptr, error_prefix, path, r_path_full, r_index, &path_unresolved) == -1)
206 {
207 if (path_unresolved == true) {
208 if (pyrna_struct_anim_args_parse_no_resolve(ptr, error_prefix, path, r_path_full) == -1) {
209 return -1;
210 }
211 }
212 else {
213 return -1;
214 }
215 }
216 return 0;
217}
218
219/* internal use for insert and delete */
221 PyObject *args,
222 PyObject *kw,
223 const char *parse_str,
224 const char *error_prefix,
225 /* return values */
226 const char **r_path_full,
227 int *r_index,
228 float *r_cfra,
229 const char **r_group_name,
230 int *r_options,
231 eBezTriple_KeyframeType *r_keytype)
232{
233 static const char *kwlist[] = {
234 "data_path", "index", "frame", "group", "options", "keytype", nullptr};
235 PyObject *pyoptions = nullptr;
236 char *keytype_name = nullptr;
237 const char *path;
238
239 /* NOTE: `parse_str` MUST start with `s|ifsO!`. */
240 if (!PyArg_ParseTupleAndKeywords(args,
241 kw,
242 parse_str,
243 (char **)kwlist,
244 &path,
245 r_index,
246 r_cfra,
247 r_group_name,
248 &PySet_Type,
249 &pyoptions,
250 &keytype_name))
251 {
252 return -1;
253 }
254
255 /* flag may be null (no option currently for remove keyframes e.g.). */
256 if (r_options) {
257 if (pyoptions &&
259 rna_enum_keying_flag_api_items, pyoptions, r_options, error_prefix) == -1))
260 {
261 return -1;
262 }
263
264 *r_options |= INSERTKEY_NO_USERPREF;
265 }
266
267 if (r_keytype) {
268 int keytype_as_int = 0;
270 keytype_name,
271 &keytype_as_int,
272 error_prefix) == -1)
273 {
274 return -1;
275 }
276 *r_keytype = eBezTriple_KeyframeType(keytype_as_int);
277 }
278
279 if (pyrna_struct_anim_args_parse(ptr, error_prefix, path, r_path_full, r_index) == -1) {
280 return -1;
281 }
282
283 if (*r_cfra == FLT_MAX) {
284 *r_cfra = CTX_data_scene(BPY_context_get())->r.cfra;
285 }
286
287 return 0; /* success */
288}
289
291 ".. method:: keyframe_insert(data_path, /, *, index=-1, "
292 "frame=bpy.context.scene.frame_current, "
293 "group=\"\", options=set(), keytype='KEYFRAME')\n"
294 "\n"
295 " Insert a keyframe on the property given, adding fcurves and animation data when "
296 "necessary.\n"
297 "\n"
298 " :arg data_path: path to the property to key, analogous to the fcurve's data path.\n"
299 " :type data_path: str\n"
300 " :arg index: array index of the property to key.\n"
301 " Defaults to -1 which will key all indices or a single channel if the property is not "
302 "an array.\n"
303 " :type index: int\n"
304 " :arg frame: The frame on which the keyframe is inserted, defaulting to the current "
305 "frame.\n"
306 " :type frame: float\n"
307 " :arg group: The name of the group the F-Curve should be added to if it doesn't exist "
308 "yet.\n"
309 " :type group: str\n"
310 " :arg options: Optional set of flags:\n"
311 "\n"
312 " - ``INSERTKEY_NEEDED`` Only insert keyframes where they're needed in the relevant "
313 "F-Curves.\n"
314 " - ``INSERTKEY_VISUAL`` Insert keyframes based on 'visual transforms'.\n"
315 " - ``INSERTKEY_XYZ_TO_RGB`` This flag is no longer in use, and is here so that code "
316 "that uses it doesn't break. The XYZ=RGB coloring is determined by the animation "
317 "preferences.\n"
318 " - ``INSERTKEY_REPLACE`` Only replace already existing keyframes.\n"
319 " - ``INSERTKEY_AVAILABLE`` Only insert into already existing F-Curves.\n"
320 " - ``INSERTKEY_CYCLE_AWARE`` Take cyclic extrapolation into account "
321 "(Cycle-Aware Keying option).\n"
322 " :type options: set[str]\n"
323 " :arg keytype: Type of the key: 'KEYFRAME', 'BREAKDOWN', 'MOVING_HOLD', 'EXTREME', "
324 "'JITTER', or 'GENERATED'\n"
325 " :type keytype: str\n"
326 " :return: Success of keyframe insertion.\n"
327 " :rtype: bool\n";
328PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyObject *kw)
329{
330 using namespace blender::animrig;
331 /* args, pyrna_struct_keyframe_parse handles these */
332 const char *path_full = nullptr;
333 int index = -1;
334 float cfra = FLT_MAX;
335 const char *group_name = nullptr;
337 int options = 0;
338
340
341 if (pyrna_struct_keyframe_parse(&self->ptr.value(),
342 args,
343 kw,
344 "s|$ifsO!s:bpy_struct.keyframe_insert()",
345 "bpy_struct.keyframe_insert()",
346 &path_full,
347 &index,
348 &cfra,
349 &group_name,
350 &options,
351 &keytype) == -1)
352 {
353 return nullptr;
354 }
355
357 bool result = false;
358
360
361 /* This assumes that keyframes are only added on original data & using the active depsgraph. If
362 * it turns out to be necessary for some reason to insert keyframes on evaluated objects, we can
363 * revisit this and add an explicit `depsgraph` keyword argument to the function call.
364 *
365 * The depsgraph is only used for evaluating the NLA so this might not be needed in the future.
366 */
370 cfra);
371
372 if (self->ptr->type == &RNA_NlaStrip) {
373 /* Handle special properties for NLA Strips, whose F-Curves are stored on the
374 * strips themselves. These are stored separately or else the properties will
375 * not have any effect.
376 */
377
378 PointerRNA &ptr = *self->ptr;
379 PropertyRNA *prop = nullptr;
380 const char *prop_name;
381
382 /* Retrieve the property identifier from the full path, since we can't get it any other way */
383 prop_name = strrchr(path_full, '.');
384 if ((prop_name >= path_full) && (prop_name + 1 < path_full + strlen(path_full))) {
385 prop = RNA_struct_find_property(&ptr, prop_name + 1);
386 }
387
388 if (prop) {
389 NlaStrip *strip = static_cast<NlaStrip *>(ptr.data);
390 FCurve *fcu = BKE_fcurve_find(&strip->fcurves, RNA_property_identifier(prop), index);
392 ptr,
393 prop,
394 fcu,
395 &anim_eval_context,
397 nullptr,
399 }
400 else {
401 BKE_reportf(&reports, RPT_ERROR, "Could not resolve path (%s)", path_full);
402 }
403 }
404 else {
406
407 const std::optional<blender::StringRefNull> channel_group = group_name ?
408 std::optional(group_name) :
409 std::nullopt;
410 PointerRNA id_pointer = RNA_id_pointer_create(self->ptr->owner_id);
412 &id_pointer,
413 channel_group,
414 {{path_full, {}, index}},
415 std::nullopt,
416 anim_eval_context,
419 const int success_count = combined_result.get_count(SingleKeyingResult::SUCCESS);
420 if (success_count == 0) {
421 /* Ideally this would use the GUI presentation of RPT_ERROR, as the resulting pop-up has more
422 * vertical space than the single-line warning in the status bar. However, semantically these
423 * may not be errors at all, as skipping the keying of certain properties due to the 'only
424 * insert available' flag is not an error.
425 *
426 * Furthermore, using RPT_ERROR here would cause this function to raise a Python exception,
427 * rather than returning a boolean. */
428 combined_result.generate_reports(&reports, RPT_WARNING);
429 }
430 result = success_count != 0;
431 }
432
433 MEM_freeN(path_full);
434
435 if (BPy_reports_to_error(&reports, PyExc_RuntimeError, false) == -1) {
437 return nullptr;
438 }
442
443 if (result) {
445 }
446
447 return PyBool_FromLong(result);
448}
449
451 ".. method:: keyframe_delete(data_path, /, *, index=-1, "
452 "frame=bpy.context.scene.frame_current, "
453 "group=\"\")\n"
454 "\n"
455 " Remove a keyframe from this properties fcurve.\n"
456 "\n"
457 " :arg data_path: path to the property to remove a key, analogous to the fcurve's data "
458 "path.\n"
459 " :type data_path: str\n"
460 " :arg index: array index of the property to remove a key. Defaults to -1 removing all "
461 "indices or a single channel if the property is not an array.\n"
462 " :type index: int\n"
463 " :arg frame: The frame on which the keyframe is deleted, defaulting to the current frame.\n"
464 " :type frame: float\n"
465 " :arg group: The name of the group the F-Curve should be added to if it doesn't exist "
466 "yet.\n"
467 " :type group: str\n"
468 " :return: Success of keyframe deletion.\n"
469 " :rtype: bool\n";
470PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyObject *kw)
471{
472 /* args, pyrna_struct_keyframe_parse handles these */
473 const char *path_full = nullptr;
474 int index = -1;
475 float cfra = FLT_MAX;
476 const char *group_name = nullptr;
477
479
480 if (pyrna_struct_keyframe_parse(&self->ptr.value(),
481 args,
482 kw,
483 "s|$ifsOs!:bpy_struct.keyframe_delete()",
484 "bpy_struct.keyframe_insert()",
485 &path_full,
486 &index,
487 &cfra,
488 &group_name,
489 nullptr,
490 nullptr) == -1)
491 {
492 return nullptr;
493 }
494
496 bool result = false;
497
499
500 if (self->ptr->type == &RNA_NlaStrip) {
501 /* Handle special properties for NLA Strips, whose F-Curves are stored on the
502 * strips themselves. These are stored separately or else the properties will
503 * not have any effect.
504 */
505
506 PointerRNA ptr = *self->ptr;
507 PropertyRNA *prop = nullptr;
508 const char *prop_name;
509
510 /* Retrieve the property identifier from the full path, since we can't get it any other way */
511 prop_name = strrchr(path_full, '.');
512 if ((prop_name >= path_full) && (prop_name + 1 < path_full + strlen(path_full))) {
513 prop = RNA_struct_find_property(&ptr, prop_name + 1);
514 }
515
516 if (prop) {
517 ID *id = ptr.owner_id;
518 NlaStrip *strip = static_cast<NlaStrip *>(ptr.data);
519 FCurve *fcu = BKE_fcurve_find(&strip->fcurves, RNA_property_identifier(prop), index);
520
521 /* NOTE: This should be true, or else we wouldn't be able to get here. */
522 BLI_assert(fcu != nullptr);
523
524 if (BKE_fcurve_is_protected(fcu)) {
526 &reports,
528 "Not deleting keyframe for locked F-Curve for NLA Strip influence on %s - %s '%s'",
529 strip->name,
531 id->name + 2);
532 }
533 else {
534 /* remove the keyframe directly
535 * NOTE: cannot use delete_keyframe_fcurve(), as that will free the curve,
536 * and delete_keyframe() expects the FCurve to be part of an action
537 */
538 bool found = false;
539 int i;
540
541 /* try to find index of beztriple to get rid of */
542 i = BKE_fcurve_bezt_binarysearch_index(fcu->bezt, cfra, fcu->totvert, &found);
543 if (found) {
544 /* delete the key at the index (will sanity check + do recalc afterwards) */
547 result = true;
548 }
549 }
550 }
551 else {
552 BKE_reportf(&reports, RPT_ERROR, "Could not resolve path (%s)", path_full);
553 }
554 }
555 else {
556 RNAPath rna_path = {path_full, std::nullopt, index};
557 if (index < 0) {
558 rna_path.index = std::nullopt;
559 }
561 G.main, &reports, self->ptr->owner_id, rna_path, cfra) != 0);
562 }
563
564 MEM_freeN(path_full);
565
566 if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1) {
567 return nullptr;
568 }
569
570 return PyBool_FromLong(result);
571}
572
574 ".. method:: driver_add(path, index=-1, /)\n"
575 "\n"
576 " Adds driver(s) to the given property\n"
577 "\n"
578 " :arg path: path to the property to drive, analogous to the fcurve's data path.\n"
579 " :type path: str\n"
580 " :arg index: array index of the property drive. Defaults to -1 for all indices or a single "
581 "channel if the property is not an array.\n"
582 " :type index: int\n"
583 " :return: The driver added or a list of drivers when index is -1.\n"
584 " :rtype: :class:`bpy.types.FCurve` | list[:class:`bpy.types.FCurve`]\n";
585PyObject *pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args)
586{
587 const char *path, *path_full;
588 int index = -1;
589
591
592 if (!PyArg_ParseTuple(args, "s|i:driver_add", &path, &index)) {
593 return nullptr;
594 }
595
597 &self->ptr.value(), "bpy_struct.driver_add():", path, &path_full, &index) == -1)
598 {
599 return nullptr;
600 }
601
602 PyObject *ret = nullptr;
604 int result;
605
607
609 self->ptr->owner_id,
610 path_full,
611 index,
614
615 if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1) {
616 /* Pass. */
617 }
618 else if (result == 0) {
619 /* XXX: should be handled by reports. */
620 PyErr_SetString(PyExc_TypeError,
621 "bpy_struct.driver_add(): failed because of an internal error");
622 }
623 else {
624 ID *id = self->ptr->owner_id;
626 FCurve *fcu;
627
628 PointerRNA tptr;
629
630 if (index == -1) { /* all, use a list */
631 int i = 0;
632 ret = PyList_New(0);
633 while ((fcu = BKE_fcurve_find(&adt->drivers, path_full, i++))) {
634 tptr = RNA_pointer_create_discrete(id, &RNA_FCurve, fcu);
635 PyList_APPEND(ret, pyrna_struct_CreatePyObject(&tptr));
636 }
637 }
638 else {
639 fcu = BKE_fcurve_find(&adt->drivers, path_full, index);
640 tptr = RNA_pointer_create_discrete(id, &RNA_FCurve, fcu);
642 }
643
644 bContext *context = BPY_context_get();
648 }
649
650 MEM_freeN(path_full);
651
652 return ret;
653}
654
656 ".. method:: driver_remove(path, index=-1, /)\n"
657 "\n"
658 " Remove driver(s) from the given property\n"
659 "\n"
660 " :arg path: path to the property to drive, analogous to the fcurve's data path.\n"
661 " :type path: str\n"
662 " :arg index: array index of the property drive. Defaults to -1 for all indices or a single "
663 "channel if the property is not an array.\n"
664 " :type index: int\n"
665 " :return: Success of driver removal.\n"
666 " :rtype: bool\n";
668{
669 const char *path, *path_full;
670 int index = -1;
671
673
674 if (!PyArg_ParseTuple(args, "s|i:driver_remove", &path, &index)) {
675 return nullptr;
676 }
677
679 &self->ptr.value(), "bpy_struct.driver_remove():", path, &path_full, &index) == -1)
680 {
681 return nullptr;
682 }
683
684 short result;
686
688
689 result = ANIM_remove_driver(self->ptr->owner_id, path_full, index);
690
691 if (path != path_full) {
692 MEM_freeN(path_full);
693 }
694
695 if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1) {
696 return nullptr;
697 }
698
699 bContext *context = BPY_context_get();
703
704 return PyBool_FromLong(result);
705}
Functions to insert, delete or modify keyframes.
AnimData * BKE_animdata_from_id(const ID *id)
Definition anim_data.cc:82
AnimationEvalContext BKE_animsys_eval_context_construct(struct Depsgraph *depsgraph, float eval_time) ATTR_WARN_UNUSED_RESULT
Definition anim_sys.cc:735
Depsgraph * CTX_data_depsgraph_pointer(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
Main * CTX_data_main(const bContext *C)
int BKE_fcurve_bezt_binarysearch_index(const BezTriple array[], float frame, int arraylen, bool *r_replace)
void BKE_fcurve_handles_recalc(FCurve *fcu)
FCurve * BKE_fcurve_find(ListBase *list, const char rna_path[], int array_index)
bool BKE_fcurve_is_protected(const FCurve *fcu)
void BKE_fcurve_delete_key(FCurve *fcu, int index)
#define G_MAIN
const char * BKE_idtype_idcode_to_name(short idcode)
Definition idtype.cc:165
bool BKE_id_is_in_global_main(ID *id)
Definition lib_id.cc:2480
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_reports_free(ReportList *reports)
Definition report.cc:70
void BKE_report_print_level_set(ReportList *reports, eReportType level)
Definition report.cc:238
void BKE_reports_init(ReportList *reports, int flag)
Definition report.cc:55
#define BLI_assert(a)
Definition BLI_assert.h:46
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
Definition string.cc:41
#define BLI_string_joinN(...)
#define BLI_string_join_by_sep_charN(...)
void DEG_id_tag_update(ID *id, unsigned int flags)
void DEG_relations_tag_update(Main *bmain)
@ ID_RECALC_SYNC_TO_EVAL
Definition DNA_ID.h:1026
@ ID_RECALC_ANIMATION
Definition DNA_ID.h:985
@ DRIVER_TYPE_PYTHON
eInsertKeyFlags
@ INSERTKEY_NO_USERPREF
eBezTriple_KeyframeType
@ BEZT_KEYTYPE_KEYFRAME
@ CREATEDRIVER_WITH_FMODIFIER
Read Guarded memory(de)allocation.
#define C
Definition RandGen.cpp:29
#define NC_ANIMATION
Definition WM_types.hh:385
#define NA_EDITED
Definition WM_types.hh:581
ReportList * reports
Definition WM_types.hh:1025
#define ND_FCURVES_ORDER
Definition WM_types.hh:496
#define ND_ANIMCHAN
Definition WM_types.hh:493
void BPy_reports_write_stdout(const ReportList *reports, const char *header)
short BPy_reports_to_error(ReportList *reports, PyObject *exception, const bool clear)
struct bContext * BPY_context_get()
PyObject * self
BPy_StructRNA * depsgraph
PyObject * pyrna_struct_CreatePyObject(PointerRNA *ptr)
Definition bpy_rna.cc:8384
#define PYRNA_STRUCT_CHECK_OBJ(obj)
Definition bpy_rna.hh:78
char pyrna_struct_driver_add_doc[]
char pyrna_struct_keyframe_insert_doc[]
PyObject * pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyObject *kw)
PyObject * pyrna_struct_driver_remove(BPy_StructRNA *self, PyObject *args)
PyObject * pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args)
static int pyrna_struct_anim_args_parse_no_resolve(PointerRNA *ptr, const char *error_prefix, const char *path, const char **r_path_full)
static int pyrna_struct_anim_args_parse_ex(PointerRNA *ptr, const char *error_prefix, const char *path, const char **r_path_full, int *r_index, bool *r_path_no_validate)
static int pyrna_struct_keyframe_parse(PointerRNA *ptr, PyObject *args, PyObject *kw, const char *parse_str, const char *error_prefix, const char **r_path_full, int *r_index, float *r_cfra, const char **r_group_name, int *r_options, eBezTriple_KeyframeType *r_keytype)
char pyrna_struct_driver_remove_doc[]
static int pyrna_struct_anim_args_parse_no_resolve_fallback(PointerRNA *ptr, const char *error_prefix, const char *path, const char **r_path_full, int *r_index)
char pyrna_struct_keyframe_delete_doc[]
PyObject * pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyObject *kw)
static int pyrna_struct_anim_args_parse(PointerRNA *ptr, const char *error_prefix, const char *path, const char **r_path_full, int *r_index)
int get_count(const SingleKeyingResult result) const
void generate_reports(ReportList *reports, eReportType report_level=RPT_ERROR)
CCL_NAMESPACE_BEGIN struct Options options
int ANIM_add_driver(ReportList *reports, ID *id, const char rna_path[], int array_index, short flag, int type)
Main Driver Management API calls.
Definition drivers.cc:398
bool ANIM_remove_driver(ID *id, const char rna_path[], int array_index)
Main Driver Management API calls.
Definition drivers.cc:522
#define GS(a)
void MEM_freeN(void *vmemh)
Definition mallocn.cc:113
#define G(x, y, z)
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 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.
int pyrna_enum_value_from_id(const EnumPropertyItem *item, const char *identifier, int *r_value, const char *error_prefix)
int pyrna_enum_bitfield_from_set(const EnumPropertyItem *items, PyObject *value, int *r_value, const char *error_prefix)
header-only utilities
return ret
bool RNA_property_array_check(PropertyRNA *prop)
bool RNA_struct_is_ID(const StructRNA *type)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
bool RNA_property_animateable(const PointerRNA *ptr, PropertyRNA *prop_orig)
const char * RNA_struct_identifier(const StructRNA *type)
int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
const char * RNA_property_identifier(const PropertyRNA *prop)
PointerRNA RNA_id_pointer_create(ID *id)
const EnumPropertyItem rna_enum_keying_flag_api_items[]
const EnumPropertyItem rna_enum_beztriple_keyframe_type_items[]
Definition rna_fcurve.cc:77
std::optional< std::string > RNA_path_from_ID_to_struct(const PointerRNA *ptr)
Definition rna_path.cc:1014
std::optional< std::string > RNA_path_from_ID_to_property(const PointerRNA *ptr, PropertyRNA *prop)
Definition rna_path.cc:1173
bool RNA_path_resolve_property_full(const PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop, int *r_index)
Definition rna_path.cc:572
#define FLT_MAX
Definition stdcycles.h:14
ListBase drivers
BezTriple * bezt
unsigned int totvert
Definition DNA_ID.h:404
char name[66]
Definition DNA_ID.h:415
ListBase fcurves
char name[64]
ID * owner_id
Definition RNA_types.hh:51
std::optional< int > index
Definition RNA_path.hh:66
struct RenderData r
i
Definition text_draw.cc:230
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
PointerRNA * ptr
Definition wm_files.cc:4226