Blender V4.3
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
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#include "BLI_utildefines.h"
19
20#include "DNA_anim_types.h"
21#include "DNA_scene_types.h"
22
23#include "ED_keyframing.hh"
24
25#include "ANIM_keyframing.hh"
26
27#include "BKE_anim_data.hh"
28#include "BKE_animsys.h"
29#include "BKE_context.hh"
30#include "BKE_fcurve.hh"
31#include "BKE_global.hh"
32#include "BKE_idtype.hh"
33#include "BKE_lib_id.hh"
34#include "BKE_report.hh"
35
36#include "RNA_access.hh"
37#include "RNA_enum_types.hh"
38#include "RNA_path.hh"
39#include "RNA_prototypes.hh"
40
41#include "WM_api.hh"
42#include "WM_types.hh"
43
44#include "bpy_capi_utils.hh"
45#include "bpy_rna.hh"
46#include "bpy_rna_anim.hh"
47
50
51#include "DEG_depsgraph.hh"
53
54/* for keyframes and drivers */
56 const char *error_prefix,
57 const char *path,
58 const char **r_path_full,
59 int *r_index,
60 bool *r_path_no_validate)
61{
62 const bool is_idbase = RNA_struct_is_ID(ptr->type);
63 PropertyRNA *prop;
64 PointerRNA r_ptr;
65
66 if (ptr->data == nullptr) {
67 PyErr_Format(
68 PyExc_TypeError, "%.200s this struct has no data, can't be animated", error_prefix);
69 return -1;
70 }
71
72 /* full paths can only be given from ID base */
73 if (is_idbase) {
74 int path_index = -1;
75 if (RNA_path_resolve_property_full(ptr, path, &r_ptr, &prop, &path_index) == false) {
76 prop = nullptr;
77 }
78 else if (path_index != -1) {
79 PyErr_Format(PyExc_ValueError,
80 "%.200s path includes index, must be a separate argument",
81 error_prefix,
82 path);
83 return -1;
84 }
85 else if (ptr->owner_id != r_ptr.owner_id) {
86 PyErr_Format(PyExc_ValueError, "%.200s path spans ID blocks", error_prefix, path);
87 return -1;
88 }
89 }
90 else {
91 prop = RNA_struct_find_property(ptr, path);
92 r_ptr = *ptr;
93 }
94
95 if (prop == nullptr) {
96 if (r_path_no_validate) {
97 *r_path_no_validate = true;
98 return -1;
99 }
100 PyErr_Format(PyExc_TypeError, "%.200s property \"%s\" not found", error_prefix, path);
101 return -1;
102 }
103
104 if (r_path_no_validate) {
105 /* Don't touch the index. */
106 }
107 else {
108 if (!RNA_property_animateable(&r_ptr, prop)) {
109 PyErr_Format(PyExc_TypeError, "%.200s property \"%s\" not animatable", error_prefix, path);
110 return -1;
111 }
112
113 if (RNA_property_array_check(prop) == 0) {
114 if ((*r_index) == -1) {
115 *r_index = 0;
116 }
117 else {
118 PyErr_Format(PyExc_TypeError,
119 "%.200s index %d was given while property \"%s\" is not an array",
120 error_prefix,
121 *r_index,
122 path);
123 return -1;
124 }
125 }
126 else {
127 const int array_len = RNA_property_array_length(&r_ptr, prop);
128 if ((*r_index) < -1 || (*r_index) >= array_len) {
129 PyErr_Format(PyExc_TypeError,
130 "%.200s index out of range \"%s\", given %d, array length is %d",
131 error_prefix,
132 path,
133 *r_index,
134 array_len);
135 return -1;
136 }
137 }
138 }
139
140 if (is_idbase) {
141 *r_path_full = BLI_strdup(path);
142 }
143 else {
144 const std::optional<std::string> path_full = RNA_path_from_ID_to_property(&r_ptr, prop);
145 *r_path_full = path_full ? BLI_strdup(path_full->c_str()) : nullptr;
146
147 if (*r_path_full == nullptr) {
148 PyErr_Format(PyExc_TypeError, "%.200s could not make path to \"%s\"", error_prefix, path);
149 return -1;
150 }
151 }
152
153 return 0;
154}
155
157 const char *error_prefix,
158 const char *path,
159 const char **r_path_full,
160 int *r_index)
161{
162 return pyrna_struct_anim_args_parse_ex(ptr, error_prefix, path, r_path_full, r_index, nullptr);
163}
164
169 const char *error_prefix,
170 const char *path,
171 const char **r_path_full)
172{
173 const bool is_idbase = RNA_struct_is_ID(ptr->type);
174 if (is_idbase) {
175 *r_path_full = path;
176 return 0;
177 }
178
179 const std::optional<std::string> path_prefix = RNA_path_from_ID_to_struct(ptr);
180 if (!path_prefix) {
181 PyErr_Format(PyExc_TypeError,
182 "%.200s could not make path for type %s",
183 error_prefix,
185 return -1;
186 }
187
188 if (*path == '[') {
189 *r_path_full = BLI_string_joinN(path_prefix->c_str(), path);
190 }
191 else {
192 *r_path_full = BLI_string_join_by_sep_charN('.', path_prefix->c_str(), path);
193 }
194
195 return 0;
196}
197
199 const char *error_prefix,
200 const char *path,
201 const char **r_path_full,
202 int *r_index)
203{
204 bool path_unresolved = false;
206 ptr, error_prefix, path, r_path_full, r_index, &path_unresolved) == -1)
207 {
208 if (path_unresolved == true) {
209 if (pyrna_struct_anim_args_parse_no_resolve(ptr, error_prefix, path, r_path_full) == -1) {
210 return -1;
211 }
212 }
213 else {
214 return -1;
215 }
216 }
217 return 0;
218}
219
220/* internal use for insert and delete */
222 PyObject *args,
223 PyObject *kw,
224 const char *parse_str,
225 const char *error_prefix,
226 /* return values */
227 const char **r_path_full,
228 int *r_index,
229 float *r_cfra,
230 const char **r_group_name,
231 int *r_options,
232 eBezTriple_KeyframeType *r_keytype)
233{
234 static const char *kwlist[] = {
235 "data_path", "index", "frame", "group", "options", "keytype", nullptr};
236 PyObject *pyoptions = nullptr;
237 char *keytype_name = nullptr;
238 const char *path;
239
240 /* NOTE: `parse_str` MUST start with `s|ifsO!`. */
241 if (!PyArg_ParseTupleAndKeywords(args,
242 kw,
243 parse_str,
244 (char **)kwlist,
245 &path,
246 r_index,
247 r_cfra,
248 r_group_name,
249 &PySet_Type,
250 &pyoptions,
251 &keytype_name))
252 {
253 return -1;
254 }
255
256 if (pyrna_struct_anim_args_parse(ptr, error_prefix, path, r_path_full, r_index) == -1) {
257 return -1;
258 }
259
260 if (*r_cfra == FLT_MAX) {
261 *r_cfra = CTX_data_scene(BPY_context_get())->r.cfra;
262 }
263
264 /* flag may be null (no option currently for remove keyframes e.g.). */
265 if (r_options) {
266 if (pyoptions &&
268 rna_enum_keying_flag_api_items, pyoptions, r_options, error_prefix) == -1))
269 {
270 return -1;
271 }
272
273 *r_options |= INSERTKEY_NO_USERPREF;
274 }
275
276 if (r_keytype) {
277 int keytype_as_int = 0;
279 keytype_name,
280 &keytype_as_int,
281 error_prefix) == -1)
282 {
283 return -1;
284 }
285 *r_keytype = eBezTriple_KeyframeType(keytype_as_int);
286 }
287
288 return 0; /* success */
289}
290
292 ".. method:: keyframe_insert(data_path, index=-1, 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
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
356 ReportList reports;
357 bool result = false;
358
359 BKE_reports_init(&reports, RPT_STORE);
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);
391 result = insert_keyframe_direct(&reports,
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);
411 CombinedKeyingResult combined_result = insert_keyframes(G_MAIN,
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((void *)path_full);
434
435 if (BPy_reports_to_error(&reports, PyExc_RuntimeError, false) == -1) {
436 BKE_reports_free(&reports);
437 return nullptr;
438 }
440 BPy_reports_write_stdout(&reports, nullptr);
441 BKE_reports_free(&reports);
442
443 if (result) {
445 }
446
447 return PyBool_FromLong(result);
448}
449
451 ".. method:: keyframe_delete(data_path, index=-1, frame=bpy.context.scene.frame_current, "
452 "group=\"\")\n"
453 "\n"
454 " Remove a keyframe from this properties fcurve.\n"
455 "\n"
456 " :arg data_path: path to the property to remove a key, analogous to the fcurve's data "
457 "path.\n"
458 " :type data_path: str\n"
459 " :arg index: array index of the property to remove a key. Defaults to -1 removing all "
460 "indices or a single channel if the property is not an array.\n"
461 " :type index: int\n"
462 " :arg frame: The frame on which the keyframe is deleted, defaulting to the current frame.\n"
463 " :type frame: float\n"
464 " :arg group: The name of the group the F-Curve should be added to if it doesn't exist "
465 "yet.\n"
466 " :type group: str\n"
467 " :return: Success of keyframe deletion.\n"
468 " :rtype: bool\n";
469PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyObject *kw)
470{
471 /* args, pyrna_struct_keyframe_parse handles these */
472 const char *path_full = nullptr;
473 int index = -1;
474 float cfra = FLT_MAX;
475 const char *group_name = nullptr;
476
478
480 args,
481 kw,
482 "s|$ifsOs!:bpy_struct.keyframe_delete()",
483 "bpy_struct.keyframe_insert()",
484 &path_full,
485 &index,
486 &cfra,
487 &group_name,
488 nullptr,
489 nullptr) == -1)
490 {
491 return nullptr;
492 }
493
494 ReportList reports;
495 bool result = false;
496
497 BKE_reports_init(&reports, RPT_STORE);
498
499 if (self->ptr.type == &RNA_NlaStrip) {
500 /* Handle special properties for NLA Strips, whose F-Curves are stored on the
501 * strips themselves. These are stored separately or else the properties will
502 * not have any effect.
503 */
504
505 PointerRNA ptr = self->ptr;
506 PropertyRNA *prop = nullptr;
507 const char *prop_name;
508
509 /* Retrieve the property identifier from the full path, since we can't get it any other way */
510 prop_name = strrchr(path_full, '.');
511 if ((prop_name >= path_full) && (prop_name + 1 < path_full + strlen(path_full))) {
512 prop = RNA_struct_find_property(&ptr, prop_name + 1);
513 }
514
515 if (prop) {
516 ID *id = ptr.owner_id;
517 NlaStrip *strip = static_cast<NlaStrip *>(ptr.data);
518 FCurve *fcu = BKE_fcurve_find(&strip->fcurves, RNA_property_identifier(prop), index);
519
520 /* NOTE: This should be true, or else we wouldn't be able to get here. */
521 BLI_assert(fcu != nullptr);
522
523 if (BKE_fcurve_is_protected(fcu)) {
525 &reports,
527 "Not deleting keyframe for locked F-Curve for NLA Strip influence on %s - %s '%s'",
528 strip->name,
529 BKE_idtype_idcode_to_name(GS(id->name)),
530 id->name + 2);
531 }
532 else {
533 /* remove the keyframe directly
534 * NOTE: cannot use delete_keyframe_fcurve(), as that will free the curve,
535 * and delete_keyframe() expects the FCurve to be part of an action
536 */
537 bool found = false;
538 int i;
539
540 /* try to find index of beztriple to get rid of */
541 i = BKE_fcurve_bezt_binarysearch_index(fcu->bezt, cfra, fcu->totvert, &found);
542 if (found) {
543 /* delete the key at the index (will sanity check + do recalc afterwards) */
544 BKE_fcurve_delete_key(fcu, i);
546 result = true;
547 }
548 }
549 }
550 else {
551 BKE_reportf(&reports, RPT_ERROR, "Could not resolve path (%s)", path_full);
552 }
553 }
554 else {
555 RNAPath rna_path = {path_full, std::nullopt, index};
556 if (index < 0) {
557 rna_path.index = std::nullopt;
558 }
560 G.main, &reports, self->ptr.owner_id, rna_path, cfra) != 0);
561 }
562
563 MEM_freeN((void *)path_full);
564
565 if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1) {
566 return nullptr;
567 }
568
569 return PyBool_FromLong(result);
570}
571
573 ".. method:: driver_add(path, index=-1)\n"
574 "\n"
575 " Adds driver(s) to the given property\n"
576 "\n"
577 " :arg path: path to the property to drive, analogous to the fcurve's data path.\n"
578 " :type path: str\n"
579 " :arg index: array index of the property drive. Defaults to -1 for all indices or a single "
580 "channel if the property is not an array.\n"
581 " :type index: int\n"
582 " :return: The driver added or a list of drivers when index is -1.\n"
583 " :rtype: :class:`bpy.types.FCurve` | list[:class:`bpy.types.FCurve`]\n";
584PyObject *pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args)
585{
586 const char *path, *path_full;
587 int index = -1;
588
590
591 if (!PyArg_ParseTuple(args, "s|i:driver_add", &path, &index)) {
592 return nullptr;
593 }
594
596 &self->ptr, "bpy_struct.driver_add():", path, &path_full, &index) == -1)
597 {
598 return nullptr;
599 }
600
601 PyObject *ret = nullptr;
602 ReportList reports;
603 int result;
604
605 BKE_reports_init(&reports, RPT_STORE);
606
607 result = ANIM_add_driver(&reports,
608 (ID *)self->ptr.owner_id,
609 path_full,
610 index,
613
614 if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1) {
615 return nullptr;
616 }
617
618 if (result) {
619 ID *id = self->ptr.owner_id;
621 FCurve *fcu;
622
623 PointerRNA tptr;
624
625 if (index == -1) { /* all, use a list */
626 int i = 0;
627 ret = PyList_New(0);
628 while ((fcu = BKE_fcurve_find(&adt->drivers, path_full, i++))) {
629 tptr = RNA_pointer_create(id, &RNA_FCurve, fcu);
630 PyList_APPEND(ret, pyrna_struct_CreatePyObject(&tptr));
631 }
632 }
633 else {
634 fcu = BKE_fcurve_find(&adt->drivers, path_full, index);
635 tptr = RNA_pointer_create(id, &RNA_FCurve, fcu);
637 }
638
639 bContext *context = BPY_context_get();
643 }
644 else {
645 /* XXX: should be handled by reports. */
646 PyErr_SetString(PyExc_TypeError,
647 "bpy_struct.driver_add(): failed because of an internal error");
648 return nullptr;
649 }
650
651 MEM_freeN((void *)path_full);
652
653 return ret;
654}
655
657 ".. method:: driver_remove(path, index=-1)\n"
658 "\n"
659 " Remove driver(s) from the given property\n"
660 "\n"
661 " :arg path: path to the property to drive, analogous to the fcurve's data path.\n"
662 " :type path: str\n"
663 " :arg index: array index of the property drive. Defaults to -1 for all indices or a single "
664 "channel if the property is not an array.\n"
665 " :type index: int\n"
666 " :return: Success of driver removal.\n"
667 " :rtype: bool\n";
669{
670 const char *path, *path_full;
671 int index = -1;
672
674
675 if (!PyArg_ParseTuple(args, "s|i:driver_remove", &path, &index)) {
676 return nullptr;
677 }
678
680 &self->ptr, "bpy_struct.driver_remove():", path, &path_full, &index) == -1)
681 {
682 return nullptr;
683 }
684
685 short result;
686 ReportList reports;
687
688 BKE_reports_init(&reports, RPT_STORE);
689
690 result = ANIM_remove_driver(self->ptr.owner_id, path_full, index);
691
692 if (path != path_full) {
693 MEM_freeN((void *)path_full);
694 }
695
696 if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1) {
697 return nullptr;
698 }
699
700 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:89
AnimationEvalContext BKE_animsys_eval_context_construct(struct Depsgraph *depsgraph, float eval_time) ATTR_WARN_UNUSED_RESULT
Definition anim_sys.cc:734
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:168
bool BKE_id_is_in_global_main(ID *id)
Definition lib_id.cc:2433
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_reports_free(ReportList *reports)
Definition report.cc:69
void BKE_report_print_level_set(ReportList *reports, eReportType level)
Definition report.cc:237
void BKE_reports_init(ReportList *reports, int flag)
Definition report.cc:54
#define BLI_assert(a)
Definition BLI_assert.h:50
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
Definition string.c:40
#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:1085
@ DRIVER_TYPE_PYTHON
eInsertKeyFlags
@ INSERTKEY_NO_USERPREF
eBezTriple_KeyframeType
@ BEZT_KEYTYPE_KEYFRAME
@ CREATEDRIVER_WITH_FMODIFIER
Read Guarded memory(de)allocation.
#define NC_ANIMATION
Definition WM_types.hh:355
#define NA_EDITED
Definition WM_types.hh:550
#define ND_FCURVES_ORDER
Definition WM_types.hh:466
#define ND_ANIMCHAN
Definition WM_types.hh:463
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(void)
PyObject * self
PyObject * pyrna_struct_CreatePyObject(PointerRNA *ptr)
Definition bpy_rna.cc:7694
#define PYRNA_STRUCT_CHECK_OBJ(obj)
Definition bpy_rna.hh:74
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
const Depsgraph * depsgraph
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:399
bool ANIM_remove_driver(ID *id, const char rna_path[], int array_index)
Main Driver Management API calls.
Definition drivers.cc:523
#define GS(x)
Definition iris.cc:202
void MEM_freeN(void *vmemh)
Definition mallocn.cc:105
#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.
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(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:86
std::optional< std::string > RNA_path_from_ID_to_struct(const PointerRNA *ptr)
Definition rna_path.cc:1007
std::optional< std::string > RNA_path_from_ID_to_property(const PointerRNA *ptr, PropertyRNA *prop)
Definition rna_path.cc:1166
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:565
#define FLT_MAX
Definition stdcycles.h:14
ListBase drivers
BezTriple * bezt
unsigned int totvert
Definition DNA_ID.h:413
ListBase fcurves
char name[64]
ID * owner_id
Definition RNA_types.hh:40
StructRNA * type
Definition RNA_types.hh:41
void * data
Definition RNA_types.hh:42
std::optional< int > index
Definition RNA_path.hh:66
struct RenderData r
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
PointerRNA * ptr
Definition wm_files.cc:4126