Blender  V3.3
bpy_rna_anim.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
9 #include <Python.h>
10 #include <float.h> /* FLT_MAX */
11 
12 #include "MEM_guardedalloc.h"
13 
14 #include "BLI_string.h"
15 #include "BLI_string_utils.h"
16 #include "BLI_utildefines.h"
17 
18 #include "DNA_anim_types.h"
19 #include "DNA_scene_types.h"
20 
21 #include "ED_keyframes_edit.h"
22 #include "ED_keyframing.h"
23 
24 #include "BKE_anim_data.h"
25 #include "BKE_animsys.h"
26 #include "BKE_context.h"
27 #include "BKE_fcurve.h"
28 #include "BKE_global.h"
29 #include "BKE_idtype.h"
30 #include "BKE_lib_id.h"
31 #include "BKE_report.h"
32 
33 #include "RNA_access.h"
34 #include "RNA_enum_types.h"
35 #include "RNA_path.h"
36 #include "RNA_prototypes.h"
37 
38 #include "WM_api.h"
39 #include "WM_types.h"
40 
41 #include "bpy_capi_utils.h"
42 #include "bpy_rna.h"
43 #include "bpy_rna_anim.h"
44 
45 #include "../generic/py_capi_rna.h"
46 #include "../generic/python_utildefines.h"
47 
48 #include "DEG_depsgraph_build.h"
49 
50 /* for keyframes and drivers */
52  const char *error_prefix,
53  const char *path,
54  const char **r_path_full,
55  int *r_index,
56  bool *r_path_no_validate)
57 {
58  const bool is_idbase = RNA_struct_is_ID(ptr->type);
59  PropertyRNA *prop;
60  PointerRNA r_ptr;
61 
62  if (ptr->data == NULL) {
63  PyErr_Format(
64  PyExc_TypeError, "%.200s this struct has no data, can't be animated", error_prefix);
65  return -1;
66  }
67 
68  /* full paths can only be given from ID base */
69  if (is_idbase) {
70  int path_index = -1;
71  if (RNA_path_resolve_property_full(ptr, path, &r_ptr, &prop, &path_index) == false) {
72  prop = NULL;
73  }
74  else if (path_index != -1) {
75  PyErr_Format(PyExc_ValueError,
76  "%.200s path includes index, must be a separate argument",
77  error_prefix,
78  path);
79  return -1;
80  }
81  else if (ptr->owner_id != r_ptr.owner_id) {
82  PyErr_Format(PyExc_ValueError, "%.200s path spans ID blocks", error_prefix, path);
83  return -1;
84  }
85  }
86  else {
87  prop = RNA_struct_find_property(ptr, path);
88  r_ptr = *ptr;
89  }
90 
91  if (prop == NULL) {
92  if (r_path_no_validate) {
93  *r_path_no_validate = true;
94  return -1;
95  }
96  PyErr_Format(PyExc_TypeError, "%.200s property \"%s\" not found", error_prefix, path);
97  return -1;
98  }
99 
100  if (r_path_no_validate) {
101  /* Don't touch the index. */
102  }
103  else {
104  if (!RNA_property_animateable(&r_ptr, prop)) {
105  PyErr_Format(PyExc_TypeError, "%.200s property \"%s\" not animatable", error_prefix, path);
106  return -1;
107  }
108 
109  if (RNA_property_array_check(prop) == 0) {
110  if ((*r_index) == -1) {
111  *r_index = 0;
112  }
113  else {
114  PyErr_Format(PyExc_TypeError,
115  "%.200s index %d was given while property \"%s\" is not an array",
116  error_prefix,
117  *r_index,
118  path);
119  return -1;
120  }
121  }
122  else {
123  const int array_len = RNA_property_array_length(&r_ptr, prop);
124  if ((*r_index) < -1 || (*r_index) >= array_len) {
125  PyErr_Format(PyExc_TypeError,
126  "%.200s index out of range \"%s\", given %d, array length is %d",
127  error_prefix,
128  path,
129  *r_index,
130  array_len);
131  return -1;
132  }
133  }
134  }
135 
136  if (is_idbase) {
137  *r_path_full = BLI_strdup(path);
138  }
139  else {
140  *r_path_full = RNA_path_from_ID_to_property(&r_ptr, prop);
141 
142  if (*r_path_full == NULL) {
143  PyErr_Format(PyExc_TypeError, "%.200s could not make path to \"%s\"", error_prefix, path);
144  return -1;
145  }
146  }
147 
148  return 0;
149 }
150 
152  const char *error_prefix,
153  const char *path,
154  const char **r_path_full,
155  int *r_index)
156 {
157  return pyrna_struct_anim_args_parse_ex(ptr, error_prefix, path, r_path_full, r_index, NULL);
158 }
159 
164  const char *error_prefix,
165  const char *path,
166  const char **r_path_full)
167 {
168  const bool is_idbase = RNA_struct_is_ID(ptr->type);
169  if (is_idbase) {
170  *r_path_full = path;
171  return 0;
172  }
173 
174  char *path_prefix = RNA_path_from_ID_to_struct(ptr);
175  if (path_prefix == NULL) {
176  PyErr_Format(PyExc_TypeError,
177  "%.200s could not make path for type %s",
178  error_prefix,
180  return -1;
181  }
182 
183  if (*path == '[') {
184  *r_path_full = BLI_string_joinN(path_prefix, path);
185  }
186  else {
187  *r_path_full = BLI_string_join_by_sep_charN('.', path_prefix, path);
188  }
189  MEM_freeN(path_prefix);
190 
191  return 0;
192 }
193 
195  const char *error_prefix,
196  const char *path,
197  const char **r_path_full,
198  int *r_index)
199 {
200  bool path_unresolved = false;
202  ptr, error_prefix, path, r_path_full, r_index, &path_unresolved) == -1) {
203  if (path_unresolved == true) {
204  if (pyrna_struct_anim_args_parse_no_resolve(ptr, error_prefix, path, r_path_full) == -1) {
205  return -1;
206  }
207  }
208  else {
209  return -1;
210  }
211  }
212  return 0;
213 }
214 
215 /* internal use for insert and delete */
217  PyObject *args,
218  PyObject *kw,
219  const char *parse_str,
220  const char *error_prefix,
221  /* return values */
222  const char **r_path_full,
223  int *r_index,
224  float *r_cfra,
225  const char **r_group_name,
226  int *r_options)
227 {
228  static const char *kwlist[] = {"data_path", "index", "frame", "group", "options", NULL};
229  PyObject *pyoptions = NULL;
230  const char *path;
231 
232  /* NOTE: `parse_str` MUST start with `s|ifsO!`. */
233  if (!PyArg_ParseTupleAndKeywords(args,
234  kw,
235  parse_str,
236  (char **)kwlist,
237  &path,
238  r_index,
239  r_cfra,
240  r_group_name,
241  &PySet_Type,
242  &pyoptions)) {
243  return -1;
244  }
245 
246  if (pyrna_struct_anim_args_parse(ptr, error_prefix, path, r_path_full, r_index) == -1) {
247  return -1;
248  }
249 
250  if (*r_cfra == FLT_MAX) {
251  *r_cfra = CTX_data_scene(BPY_context_get())->r.cfra;
252  }
253 
254  /* flag may be null (no option currently for remove keyframes e.g.). */
255  if (r_options) {
256  if (pyoptions &&
258  rna_enum_keying_flag_items_api, pyoptions, r_options, error_prefix) == -1)) {
259  return -1;
260  }
261 
262  *r_options |= INSERTKEY_NO_USERPREF;
263  }
264 
265  return 0; /* success */
266 }
267 
269  ".. method:: keyframe_insert(data_path, index=-1, frame=bpy.context.scene.frame_current, "
270  "group=\"\", options=set())\n"
271  "\n"
272  " Insert a keyframe on the property given, adding fcurves and animation data when "
273  "necessary.\n"
274  "\n"
275  " :arg data_path: path to the property to key, analogous to the fcurve's data path.\n"
276  " :type data_path: string\n"
277  " :arg index: array index of the property to key.\n"
278  " Defaults to -1 which will key all indices or a single channel if the property is not "
279  "an array.\n"
280  " :type index: int\n"
281  " :arg frame: The frame on which the keyframe is inserted, defaulting to the current "
282  "frame.\n"
283  " :type frame: float\n"
284  " :arg group: The name of the group the F-Curve should be added to if it doesn't exist "
285  "yet.\n"
286  " :type group: str\n"
287  " :arg options: Optional set of flags:\n"
288  "\n"
289  " - ``INSERTKEY_NEEDED`` Only insert keyframes where they're needed in the relevant "
290  "F-Curves.\n"
291  " - ``INSERTKEY_VISUAL`` Insert keyframes based on 'visual transforms'.\n"
292  " - ``INSERTKEY_XYZ_TO_RGB`` Color for newly added transformation F-Curves (Location, "
293  "Rotation, Scale) is based on the transform axis.\n"
294  " - ``INSERTKEY_REPLACE`` Only replace already existing keyframes.\n"
295  " - ``INSERTKEY_AVAILABLE`` Only insert into already existing F-Curves.\n"
296  " - ``INSERTKEY_CYCLE_AWARE`` Take cyclic extrapolation into account "
297  "(Cycle-Aware Keying option).\n"
298  " :type flag: set\n"
299  " :return: Success of keyframe insertion.\n"
300  " :rtype: boolean\n";
301 PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyObject *kw)
302 {
303  /* args, pyrna_struct_keyframe_parse handles these */
304  const char *path_full = NULL;
305  int index = -1;
306  float cfra = FLT_MAX;
307  const char *group_name = NULL;
308  const char keytype = BEZT_KEYTYPE_KEYFRAME; /* XXX: Expose this as a one-off option... */
309  int options = 0;
310 
312 
314  args,
315  kw,
316  "s|$ifsO!:bpy_struct.keyframe_insert()",
317  "bpy_struct.keyframe_insert()",
318  &path_full,
319  &index,
320  &cfra,
321  &group_name,
322  &options) == -1) {
323  return NULL;
324  }
325 
326  ReportList reports;
327  bool result = false;
328 
329  BKE_reports_init(&reports, RPT_STORE);
330 
331  /* This assumes that keyframes are only added on original data & using the active depsgraph. If
332  * it turns out to be necessary for some reason to insert keyframes on evaluated objects, we can
333  * revisit this and add an explicit `depsgraph` keyword argument to the function call.
334  *
335  * It is unlikely that driver code (which is the reason this depsgraph pointer is obtained) will
336  * be executed from this function call, as this only happens when `options` has
337  * `INSERTKEY_DRIVER`, which is not exposed to Python. */
341  cfra);
342 
343  if (self->ptr.type == &RNA_NlaStrip) {
344  /* Handle special properties for NLA Strips, whose F-Curves are stored on the
345  * strips themselves. These are stored separately or else the properties will
346  * not have any effect.
347  */
348 
349  PointerRNA ptr = self->ptr;
350  PropertyRNA *prop = NULL;
351  const char *prop_name;
352 
353  /* Retrieve the property identifier from the full path, since we can't get it any other way */
354  prop_name = strrchr(path_full, '.');
355  if ((prop_name >= path_full) && (prop_name + 1 < path_full + strlen(path_full))) {
356  prop = RNA_struct_find_property(&ptr, prop_name + 1);
357  }
358 
359  if (prop) {
360  NlaStrip *strip = ptr.data;
361  FCurve *fcu = BKE_fcurve_find(&strip->fcurves, RNA_property_identifier(prop), index);
363  &reports, ptr, prop, fcu, &anim_eval_context, keytype, NULL, options);
364  }
365  else {
366  BKE_reportf(&reports, RPT_ERROR, "Could not resolve path (%s)", path_full);
367  }
368  }
369  else {
370  ID *id = self->ptr.owner_id;
371 
374  &reports,
375  id,
376  NULL,
377  group_name,
378  path_full,
379  index,
380  &anim_eval_context,
381  keytype,
382  NULL,
383  options) != 0);
384  }
385 
386  MEM_freeN((void *)path_full);
387 
388  if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1) {
389  return NULL;
390  }
391 
392  if (result) {
394  }
395 
396  return PyBool_FromLong(result);
397 }
398 
400  ".. method:: keyframe_delete(data_path, index=-1, frame=bpy.context.scene.frame_current, "
401  "group=\"\")\n"
402  "\n"
403  " Remove a keyframe from this properties fcurve.\n"
404  "\n"
405  " :arg data_path: path to the property to remove a key, analogous to the fcurve's data "
406  "path.\n"
407  " :type data_path: string\n"
408  " :arg index: array index of the property to remove a key. Defaults to -1 removing all "
409  "indices or a single channel if the property is not an array.\n"
410  " :type index: int\n"
411  " :arg frame: The frame on which the keyframe is deleted, defaulting to the current frame.\n"
412  " :type frame: float\n"
413  " :arg group: The name of the group the F-Curve should be added to if it doesn't exist "
414  "yet.\n"
415  " :type group: str\n"
416  " :return: Success of keyframe deletion.\n"
417  " :rtype: boolean\n";
418 PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyObject *kw)
419 {
420  /* args, pyrna_struct_keyframe_parse handles these */
421  const char *path_full = NULL;
422  int index = -1;
423  float cfra = FLT_MAX;
424  const char *group_name = NULL;
425 
427 
429  args,
430  kw,
431  "s|$ifsO!:bpy_struct.keyframe_delete()",
432  "bpy_struct.keyframe_insert()",
433  &path_full,
434  &index,
435  &cfra,
436  &group_name,
437  NULL) == -1) {
438  return NULL;
439  }
440 
441  ReportList reports;
442  bool result = false;
443 
444  BKE_reports_init(&reports, RPT_STORE);
445 
446  if (self->ptr.type == &RNA_NlaStrip) {
447  /* Handle special properties for NLA Strips, whose F-Curves are stored on the
448  * strips themselves. These are stored separately or else the properties will
449  * not have any effect.
450  */
451 
452  PointerRNA ptr = self->ptr;
453  PropertyRNA *prop = NULL;
454  const char *prop_name;
455 
456  /* Retrieve the property identifier from the full path, since we can't get it any other way */
457  prop_name = strrchr(path_full, '.');
458  if ((prop_name >= path_full) && (prop_name + 1 < path_full + strlen(path_full))) {
459  prop = RNA_struct_find_property(&ptr, prop_name + 1);
460  }
461 
462  if (prop) {
463  ID *id = ptr.owner_id;
464  NlaStrip *strip = ptr.data;
465  FCurve *fcu = BKE_fcurve_find(&strip->fcurves, RNA_property_identifier(prop), index);
466 
467  /* NOTE: This should be true, or else we wouldn't be able to get here. */
468  BLI_assert(fcu != NULL);
469 
470  if (BKE_fcurve_is_protected(fcu)) {
471  BKE_reportf(
472  &reports,
473  RPT_WARNING,
474  "Not deleting keyframe for locked F-Curve for NLA Strip influence on %s - %s '%s'",
475  strip->name,
477  id->name + 2);
478  }
479  else {
480  /* remove the keyframe directly
481  * NOTE: cannot use delete_keyframe_fcurve(), as that will free the curve,
482  * and delete_keyframe() expects the FCurve to be part of an action
483  */
484  bool found = false;
485  int i;
486 
487  /* try to find index of beztriple to get rid of */
488  i = BKE_fcurve_bezt_binarysearch_index(fcu->bezt, cfra, fcu->totvert, &found);
489  if (found) {
490  /* delete the key at the index (will sanity check + do recalc afterwards) */
491  BKE_fcurve_delete_key(fcu, i);
493  result = true;
494  }
495  }
496  }
497  else {
498  BKE_reportf(&reports, RPT_ERROR, "Could not resolve path (%s)", path_full);
499  }
500  }
501  else {
503  G.main, &reports, self->ptr.owner_id, NULL, path_full, index, cfra) != 0);
504  }
505 
506  MEM_freeN((void *)path_full);
507 
508  if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1) {
509  return NULL;
510  }
511 
512  return PyBool_FromLong(result);
513 }
514 
516  ".. method:: driver_add(path, index=-1)\n"
517  "\n"
518  " Adds driver(s) to the given property\n"
519  "\n"
520  " :arg path: path to the property to drive, analogous to the fcurve's data path.\n"
521  " :type path: string\n"
522  " :arg index: array index of the property drive. Defaults to -1 for all indices or a single "
523  "channel if the property is not an array.\n"
524  " :type index: int\n"
525  " :return: The driver(s) added.\n"
526  " :rtype: :class:`bpy.types.FCurve` or list if index is -1 with an array property.\n";
527 PyObject *pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args)
528 {
529  const char *path, *path_full;
530  int index = -1;
531 
533 
534  if (!PyArg_ParseTuple(args, "s|i:driver_add", &path, &index)) {
535  return NULL;
536  }
537 
539  &self->ptr, "bpy_struct.driver_add():", path, &path_full, &index) == -1) {
540  return NULL;
541  }
542 
543  PyObject *ret = NULL;
544  ReportList reports;
545  int result;
546 
547  BKE_reports_init(&reports, RPT_STORE);
548 
549  result = ANIM_add_driver(&reports,
550  (ID *)self->ptr.owner_id,
551  path_full,
552  index,
555 
556  if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1) {
557  return NULL;
558  }
559 
560  if (result) {
561  ID *id = self->ptr.owner_id;
562  AnimData *adt = BKE_animdata_from_id(id);
563  FCurve *fcu;
564 
565  PointerRNA tptr;
566 
567  if (index == -1) { /* all, use a list */
568  int i = 0;
569  ret = PyList_New(0);
570  while ((fcu = BKE_fcurve_find(&adt->drivers, path_full, i++))) {
571  RNA_pointer_create(id, &RNA_FCurve, fcu, &tptr);
572  PyList_APPEND(ret, pyrna_struct_CreatePyObject(&tptr));
573  }
574  }
575  else {
576  fcu = BKE_fcurve_find(&adt->drivers, path_full, index);
577  RNA_pointer_create(id, &RNA_FCurve, fcu, &tptr);
579  }
580 
584  }
585  else {
586  /* XXX: should be handled by reports. */
587  PyErr_SetString(PyExc_TypeError,
588  "bpy_struct.driver_add(): failed because of an internal error");
589  return NULL;
590  }
591 
592  MEM_freeN((void *)path_full);
593 
594  return ret;
595 }
596 
598  ".. method:: driver_remove(path, index=-1)\n"
599  "\n"
600  " Remove driver(s) from the given property\n"
601  "\n"
602  " :arg path: path to the property to drive, analogous to the fcurve's data path.\n"
603  " :type path: string\n"
604  " :arg index: array index of the property drive. Defaults to -1 for all indices or a single "
605  "channel if the property is not an array.\n"
606  " :type index: int\n"
607  " :return: Success of driver removal.\n"
608  " :rtype: boolean\n";
609 PyObject *pyrna_struct_driver_remove(BPy_StructRNA *self, PyObject *args)
610 {
611  const char *path, *path_full;
612  int index = -1;
613 
615 
616  if (!PyArg_ParseTuple(args, "s|i:driver_remove", &path, &index)) {
617  return NULL;
618  }
619 
621  &self->ptr, "bpy_struct.driver_remove():", path, &path_full, &index) == -1) {
622  return NULL;
623  }
624 
625  short result;
626  ReportList reports;
627 
628  BKE_reports_init(&reports, RPT_STORE);
629 
630  result = ANIM_remove_driver(&reports, (ID *)self->ptr.owner_id, path_full, index, 0);
631 
632  if (path != path_full) {
633  MEM_freeN((void *)path_full);
634  }
635 
636  if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1) {
637  return NULL;
638  }
639 
643 
644  return PyBool_FromLong(result);
645 }
struct AnimData * BKE_animdata_from_id(const struct ID *id)
AnimationEvalContext BKE_animsys_eval_context_construct(struct Depsgraph *depsgraph, float eval_time)
Definition: anim_sys.c:761
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1090
struct Depsgraph * CTX_data_depsgraph_pointer(const bContext *C)
Definition: context.c:1505
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1074
int BKE_fcurve_bezt_binarysearch_index(const struct BezTriple array[], float frame, int arraylen, bool *r_replace)
Definition: fcurve.c:561
bool BKE_fcurve_is_protected(struct FCurve *fcu)
Definition: fcurve.c:963
void BKE_fcurve_handles_recalc(struct FCurve *fcu)
Definition: fcurve.c:1303
void BKE_fcurve_delete_key(struct FCurve *fcu, int index)
Definition: fcurve.c:1661
struct FCurve * BKE_fcurve_find(ListBase *list, const char rna_path[], int array_index)
Definition: fcurve.c:249
#define G_MAIN
Definition: BKE_global.h:267
const char * BKE_idtype_idcode_to_name(short idcode)
Definition: idtype.c:142
bool BKE_id_is_in_global_main(struct ID *id)
Definition: lib_id.c:1902
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_reports_init(ReportList *reports, int flag)
Definition: report.c:50
#define BLI_assert(a)
Definition: BLI_assert.h:46
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL() ATTR_MALLOC
Definition: string.c:42
#define BLI_string_joinN(...)
#define BLI_string_join_by_sep_charN(sep,...)
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:35
void DEG_relations_tag_update(struct Main *bmain)
@ DRIVER_TYPE_PYTHON
@ INSERTKEY_NO_USERPREF
@ BEZT_KEYTYPE_KEYFRAME
@ CREATEDRIVER_WITH_FMODIFIER
Read Guarded memory(de)allocation.
#define C
Definition: RandGen.cpp:25
#define NC_ANIMATION
Definition: WM_types.h:338
#define NA_EDITED
Definition: WM_types.h:523
#define ND_FCURVES_ORDER
Definition: WM_types.h:447
#define ND_ANIMCHAN
Definition: WM_types.h:444
short BPy_reports_to_error(ReportList *reports, PyObject *exception, const bool clear)
struct bContext * BPY_context_get(void)
PyObject * self
Definition: bpy_driver.c:165
PyObject * pyrna_struct_CreatePyObject(PointerRNA *ptr)
Definition: bpy_rna.c:7505
#define PYRNA_STRUCT_CHECK_OBJ(obj)
Definition: bpy_rna.h:71
PyObject * pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyObject *kw)
Definition: bpy_rna_anim.c:301
char pyrna_struct_driver_add_doc[]
Definition: bpy_rna_anim.c:515
char pyrna_struct_keyframe_insert_doc[]
Definition: bpy_rna_anim.c:268
static int pyrna_struct_anim_args_parse_no_resolve(PointerRNA *ptr, const char *error_prefix, const char *path, const char **r_path_full)
Definition: bpy_rna_anim.c:163
PyObject * pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyObject *kw)
Definition: bpy_rna_anim.c:418
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)
Definition: bpy_rna_anim.c:51
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)
Definition: bpy_rna_anim.c:216
char pyrna_struct_driver_remove_doc[]
Definition: bpy_rna_anim.c:597
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)
Definition: bpy_rna_anim.c:194
char pyrna_struct_keyframe_delete_doc[]
Definition: bpy_rna_anim.c:399
PyObject * pyrna_struct_driver_remove(BPy_StructRNA *self, PyObject *args)
Definition: bpy_rna_anim.c:609
static int pyrna_struct_anim_args_parse(PointerRNA *ptr, const char *error_prefix, const char *path, const char **r_path_full, int *r_index)
Definition: bpy_rna_anim.c:151
PyObject * pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args)
Definition: bpy_rna_anim.c:527
CCL_NAMESPACE_BEGIN struct Options options
const Depsgraph * depsgraph
bool ANIM_remove_driver(ReportList *UNUSED(reports), ID *id, const char rna_path[], int array_index, short UNUSED(flag))
Definition: drivers.c:517
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.c:395
#define GS(x)
Definition: iris.c:225
int delete_keyframe(Main *bmain, ReportList *reports, ID *id, bAction *act, const char rna_path[], int array_index, float cfra)
Main Delete Key-Framing API call.
Definition: keyframing.c:1723
bool insert_keyframe_direct(ReportList *reports, PointerRNA ptr, PropertyRNA *prop, FCurve *fcu, const AnimationEvalContext *anim_eval_context, eBezTriple_KeyframeType keytype, struct NlaKeyframingContext *nla_context, eInsertKeyFlags flag)
Definition: keyframing.c:1303
int insert_keyframe(Main *bmain, ReportList *reports, ID *id, bAction *act, const char group[], const char rna_path[], int array_index, const AnimationEvalContext *anim_eval_context, eBezTriple_KeyframeType keytype, ListBase *nla_cache, eInsertKeyFlags flag)
Definition: keyframing.c:1476
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
#define G(x, y, z)
int pyrna_enum_bitfield_from_set(const EnumPropertyItem *items, PyObject *value, int *r_value, const char *error_prefix)
Definition: py_capi_rna.c:133
return ret
const char * RNA_struct_identifier(const StructRNA *type)
Definition: rna_access.c:586
bool RNA_property_array_check(PropertyRNA *prop)
Definition: rna_access.c:1080
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
Definition: rna_access.c:136
bool RNA_struct_is_ID(const StructRNA *type)
Definition: rna_access.c:655
const char * RNA_property_identifier(const PropertyRNA *prop)
Definition: rna_access.c:1000
bool RNA_property_animateable(const PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:1993
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
Definition: rna_access.c:717
int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:1075
const EnumPropertyItem rna_enum_keying_flag_items_api[]
Definition: rna_animation.c:62
char * RNA_path_from_ID_to_struct(const PointerRNA *ptr)
Definition: rna_path.cc:981
char * RNA_path_from_ID_to_property(const PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_path.cc:1127
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:543
ListBase drivers
BezTriple * bezt
unsigned int totvert
Definition: DNA_ID.h:368
char name[66]
Definition: DNA_ID.h:378
ListBase fcurves
char name[64]
struct StructRNA * type
Definition: RNA_types.h:37
void * data
Definition: RNA_types.h:38
struct ID * owner_id
Definition: RNA_types.h:36
struct RenderData r
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
PointerRNA * ptr
Definition: wm_files.c:3480