Blender  V2.93
bpy_driver.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
25 /* ****************************************** */
26 /* Drivers - PyExpression Evaluation */
27 
28 #include <Python.h>
29 
30 #include "DNA_anim_types.h"
31 
32 #include "BLI_listbase.h"
33 #include "BLI_math_base.h"
34 #include "BLI_string.h"
35 
36 #include "BKE_animsys.h"
37 #include "BKE_fcurve_driver.h"
38 #include "BKE_global.h"
39 
40 #include "RNA_access.h"
41 #include "RNA_types.h"
42 
43 #include "bpy_rna_driver.h" /* for pyrna_driver_get_variable_value */
44 
45 #include "bpy_intern_string.h"
46 
47 #include "bpy_driver.h"
48 #include "bpy_rna.h"
49 
50 #include "BPY_extern.h"
51 
52 #define USE_RNA_AS_PYOBJECT
53 
54 #define USE_BYTECODE_WHITELIST
55 
56 #ifdef USE_BYTECODE_WHITELIST
57 # include <opcode.h>
58 #endif
59 
64 PyObject *bpy_pydriver_Dict = NULL;
65 
66 #ifdef USE_BYTECODE_WHITELIST
68 #endif
69 
70 /* For faster execution we keep a special dictionary for pydrivers, with
71  * the needed modules and aliases.
72  */
74 {
75  PyObject *d, *mod;
76 
77  /* validate namespace for driver evaluation */
78  if (bpy_pydriver_Dict) {
79  return -1;
80  }
81 
82  d = PyDict_New();
83  if (d == NULL) {
84  return -1;
85  }
86 
88 
89  /* import some modules: builtins, bpy, math, (Blender.noise)*/
90  PyDict_SetItemString(d, "__builtins__", PyEval_GetBuiltins());
91 
92  mod = PyImport_ImportModule("math");
93  if (mod) {
94  PyDict_Merge(d, PyModule_GetDict(mod), 0); /* 0 - don't overwrite existing values */
95  Py_DECREF(mod);
96  }
97 #ifdef USE_BYTECODE_WHITELIST
98  PyObject *mod_math = mod;
99 #endif
100 
101  /* add bpy to global namespace */
102  mod = PyImport_ImportModuleLevel("bpy", NULL, NULL, NULL, 0);
103  if (mod) {
104  PyDict_SetItemString(bpy_pydriver_Dict, "bpy", mod);
105  Py_DECREF(mod);
106  }
107 
108  /* add noise to global namespace */
109  mod = PyImport_ImportModuleLevel("mathutils", NULL, NULL, NULL, 0);
110  if (mod) {
111  PyObject *modsub = PyDict_GetItemString(PyModule_GetDict(mod), "noise");
112  PyDict_SetItemString(bpy_pydriver_Dict, "noise", modsub);
113  Py_DECREF(mod);
114  }
115 
116  /* Add math utility functions. */
117  mod = PyImport_ImportModuleLevel("bl_math", NULL, NULL, NULL, 0);
118  if (mod) {
119  static const char *names[] = {"clamp", "lerp", "smoothstep", NULL};
120 
121  for (const char **pname = names; *pname; ++pname) {
122  PyObject *func = PyDict_GetItemString(PyModule_GetDict(mod), *pname);
123  PyDict_SetItemString(bpy_pydriver_Dict, *pname, func);
124  }
125 
126  Py_DECREF(mod);
127  }
128 
129 #ifdef USE_BYTECODE_WHITELIST
130  /* setup the whitelist */
131  {
132  bpy_pydriver_Dict__whitelist = PyDict_New();
133  const char *whitelist[] = {
134  /* builtins (basic) */
135  "all",
136  "any",
137  "len",
138  /* builtins (numeric) */
139  "max",
140  "min",
141  "pow",
142  "round",
143  "sum",
144  /* types */
145  "bool",
146  "float",
147  "int",
148  /* bl_math */
149  "clamp",
150  "lerp",
151  "smoothstep",
152 
153  NULL,
154  };
155 
156  for (int i = 0; whitelist[i]; i++) {
157  PyDict_SetItemString(bpy_pydriver_Dict__whitelist, whitelist[i], Py_None);
158  }
159 
160  /* Add all of 'math' functions. */
161  if (mod_math != NULL) {
162  PyObject *mod_math_dict = PyModule_GetDict(mod_math);
163  PyObject *arg_key, *arg_value;
164  Py_ssize_t arg_pos = 0;
165  while (PyDict_Next(mod_math_dict, &arg_pos, &arg_key, &arg_value)) {
166  const char *arg_str = PyUnicode_AsUTF8(arg_key);
167  if (arg_str[0] && arg_str[1] != '_') {
168  PyDict_SetItem(bpy_pydriver_Dict__whitelist, arg_key, Py_None);
169  }
170  }
171  }
172  }
173 #endif /* USE_BYTECODE_WHITELIST */
174 
175  return 0;
176 }
177 
178 /* note, this function should do nothing most runs, only when changing frame */
179 /* not thread safe but neither is python */
180 static struct {
181  float evaltime;
182 
183  /* borrowed reference to the 'self' in 'bpy_pydriver_Dict'
184  * keep for as long as the same self is used. */
185  PyObject *self;
187  .evaltime = FLT_MAX,
188  .self = NULL,
189 };
190 
192 {
193  if (g_pydriver_state_prev.evaltime != evaltime) {
194  PyObject *item = PyFloat_FromDouble(evaltime);
195  PyDict_SetItem(bpy_pydriver_Dict, bpy_intern_str_frame, item);
196  Py_DECREF(item);
197 
198  g_pydriver_state_prev.evaltime = evaltime;
199  }
200 }
201 
203 {
204  if ((g_pydriver_state_prev.self == NULL) ||
205  (pyrna_driver_is_equal_anim_rna(anim_rna, g_pydriver_state_prev.self) == false)) {
206  PyObject *item = pyrna_driver_self_from_anim_rna(anim_rna);
207  PyDict_SetItem(bpy_pydriver_Dict, bpy_intern_str_self, item);
208  Py_DECREF(item);
209 
210  g_pydriver_state_prev.self = item;
211  }
212 }
213 
215 {
216  if (g_pydriver_state_prev.self) {
217  PyDict_DelItem(bpy_pydriver_Dict, bpy_intern_str_self);
218 
220  }
221 }
222 
223 /* Update function, it gets rid of pydrivers global dictionary, forcing
224  * BPY_driver_exec to recreate it. This function is used to force
225  * reloading the Blender text module "pydrivers.py", if available, so
226  * updates in it reach pydriver evaluation.
227  */
229 {
230  PyGILState_STATE gilstate;
231  const bool use_gil = true; /* !PyC_IsInterpreterActive(); */
232 
233  if (use_gil) {
234  gilstate = PyGILState_Ensure();
235  }
236 
237  if (bpy_pydriver_Dict) { /* free the global dict used by pydrivers */
238  PyDict_Clear(bpy_pydriver_Dict);
239  Py_DECREF(bpy_pydriver_Dict);
241  }
242 
243 #ifdef USE_BYTECODE_WHITELIST
245  PyDict_Clear(bpy_pydriver_Dict__whitelist);
246  Py_DECREF(bpy_pydriver_Dict__whitelist);
248  }
249 #endif
250 
251  g_pydriver_state_prev.evaltime = FLT_MAX;
252 
253  /* freed when clearing driver dict */
255 
256  if (use_gil) {
257  PyGILState_Release(gilstate);
258  }
259 }
260 
261 /* error return function for BPY_eval_pydriver */
262 static void pydriver_error(ChannelDriver *driver)
263 {
264  driver->flag |= DRIVER_FLAG_INVALID; /* py expression failed */
265  fprintf(stderr,
266  "\nError in Driver: The following Python expression failed:\n\t'%s'\n\n",
267  driver->expression);
268 
269  // BPy_errors_to_report(NULL); /* TODO - reports */
270  PyErr_Print();
271  PyErr_Clear();
272 }
273 
274 #ifdef USE_BYTECODE_WHITELIST
275 
276 # define OK_OP(op) [op] = 1
277 
278 static const char secure_opcodes[255] = {
279  OK_OP(POP_TOP),
280  OK_OP(ROT_TWO),
281  OK_OP(ROT_THREE),
282  OK_OP(DUP_TOP),
283  OK_OP(DUP_TOP_TWO),
284  OK_OP(NOP),
285  OK_OP(UNARY_POSITIVE),
286  OK_OP(UNARY_NEGATIVE),
287  OK_OP(UNARY_NOT),
288  OK_OP(UNARY_INVERT),
289  OK_OP(BINARY_MATRIX_MULTIPLY),
290  OK_OP(INPLACE_MATRIX_MULTIPLY),
291  OK_OP(BINARY_POWER),
292  OK_OP(BINARY_MULTIPLY),
293  OK_OP(BINARY_MODULO),
294  OK_OP(BINARY_ADD),
295  OK_OP(BINARY_SUBTRACT),
296  OK_OP(BINARY_SUBSCR),
297  OK_OP(BINARY_FLOOR_DIVIDE),
298  OK_OP(BINARY_TRUE_DIVIDE),
299  OK_OP(INPLACE_FLOOR_DIVIDE),
300  OK_OP(INPLACE_TRUE_DIVIDE),
301  OK_OP(INPLACE_ADD),
302  OK_OP(INPLACE_SUBTRACT),
303  OK_OP(INPLACE_MULTIPLY),
304  OK_OP(INPLACE_MODULO),
305  OK_OP(BINARY_LSHIFT),
306  OK_OP(BINARY_RSHIFT),
307  OK_OP(BINARY_AND),
308  OK_OP(BINARY_XOR),
309  OK_OP(BINARY_OR),
310  OK_OP(INPLACE_POWER),
311  OK_OP(INPLACE_LSHIFT),
312  OK_OP(INPLACE_RSHIFT),
313  OK_OP(INPLACE_AND),
314  OK_OP(INPLACE_XOR),
315  OK_OP(INPLACE_OR),
316  OK_OP(RETURN_VALUE),
317  OK_OP(BUILD_TUPLE),
318  OK_OP(BUILD_LIST),
319  OK_OP(BUILD_SET),
320  OK_OP(BUILD_MAP),
321  OK_OP(COMPARE_OP),
322  OK_OP(JUMP_FORWARD),
323  OK_OP(JUMP_IF_FALSE_OR_POP),
324  OK_OP(JUMP_IF_TRUE_OR_POP),
325  OK_OP(JUMP_ABSOLUTE),
326  OK_OP(POP_JUMP_IF_FALSE),
327  OK_OP(POP_JUMP_IF_TRUE),
328  OK_OP(LOAD_GLOBAL),
329  OK_OP(LOAD_FAST),
330  OK_OP(STORE_FAST),
331  OK_OP(DELETE_FAST),
332  OK_OP(LOAD_DEREF),
333  OK_OP(STORE_DEREF),
334 
335  /* special cases */
336  OK_OP(LOAD_CONST), /* ok because constants are accepted */
337  OK_OP(LOAD_NAME), /* ok, because PyCodeObject.names is checked */
338  OK_OP(CALL_FUNCTION), /* ok, because we check its 'name' before calling */
339  OK_OP(CALL_FUNCTION_KW),
340  OK_OP(CALL_FUNCTION_EX),
341 };
342 
343 # undef OK_OP
344 
345 static bool bpy_driver_secure_bytecode_validate(PyObject *expr_code, PyObject *dict_arr[])
346 {
347  PyCodeObject *py_code = (PyCodeObject *)expr_code;
348 
349  /* Check names. */
350  {
351  for (int i = 0; i < PyTuple_GET_SIZE(py_code->co_names); i++) {
352  PyObject *name = PyTuple_GET_ITEM(py_code->co_names, i);
353  const char *name_str = PyUnicode_AsUTF8(name);
354 
355  bool contains_name = false;
356  for (int j = 0; dict_arr[j]; j++) {
357  if (PyDict_Contains(dict_arr[j], name)) {
358  contains_name = true;
359  break;
360  }
361  }
362 
363  if ((contains_name == false) || (name_str[0] == '_')) {
364  fprintf(stderr,
365  "\tBPY_driver_eval() - restricted access disallows name '%s', "
366  "enable auto-execution to support\n",
367  name_str);
368  return false;
369  }
370  }
371  }
372 
373  /* Check opcodes. */
374  {
375  const _Py_CODEUNIT *codestr;
376  Py_ssize_t code_len;
377 
378  PyBytes_AsStringAndSize(py_code->co_code, (char **)&codestr, &code_len);
379  code_len /= sizeof(*codestr);
380 
381  for (Py_ssize_t i = 0; i < code_len; i++) {
382  const int opcode = _Py_OPCODE(codestr[i]);
383  if (secure_opcodes[opcode] == 0) {
384  fprintf(stderr,
385  "\tBPY_driver_eval() - restricted access disallows opcode '%d', "
386  "enable auto-execution to support\n",
387  opcode);
388  return false;
389  }
390  }
391 
392 # undef CODESIZE
393  }
394 
395  return true;
396 }
397 
398 #endif /* USE_BYTECODE_WHITELIST */
399 
401 {
402  /* This should never happen, but it's probably better to have None in Python
403  * than a NULL-wrapping Depsgraph py struct. */
405  if (depsgraph == NULL) {
406  Py_RETURN_NONE;
407  }
408 
409  struct PointerRNA depsgraph_ptr;
410  RNA_pointer_create(NULL, &RNA_Depsgraph, depsgraph, &depsgraph_ptr);
411  return pyrna_struct_CreatePyObject(&depsgraph_ptr);
412 }
413 
418 static void bpy_pydriver_namespace_add_depsgraph(PyObject *driver_vars,
419  struct Depsgraph *depsgraph)
420 {
421  PyObject *py_depsgraph = bpy_pydriver_depsgraph_as_pyobject(depsgraph);
422  const char *depsgraph_variable_name = "depsgraph";
423 
424  if (PyDict_SetItemString(driver_vars, depsgraph_variable_name, py_depsgraph) == -1) {
425  fprintf(stderr,
426  "\tBPY_driver_eval() - couldn't add variable '%s' to namespace\n",
427  depsgraph_variable_name);
428  PyErr_Print();
429  PyErr_Clear();
430  }
431  Py_DECREF(py_depsgraph);
432 }
433 
451 float BPY_driver_exec(struct PathResolvedRNA *anim_rna,
452  ChannelDriver *driver,
453  ChannelDriver *driver_orig,
454  const AnimationEvalContext *anim_eval_context)
455 {
456  PyObject *driver_vars = NULL;
457  PyObject *retval = NULL;
458 
459  /* Speed up by pre-hashing string & avoids re-converting unicode strings for every execution. */
460  PyObject *expr_vars;
461 
462  PyObject *expr_code;
463  PyGILState_STATE gilstate;
464  bool use_gil;
465 
466  DriverVar *dvar;
467  double result = 0.0; /* default return */
468  const char *expr;
469  short targets_ok = 1;
470  int i;
471 
472  /* get the py expression to be evaluated */
473  expr = driver_orig->expression;
474  if (expr[0] == '\0') {
475  return 0.0f;
476  }
477 
478 #ifndef USE_BYTECODE_WHITELIST
479  if (!(G.f & G_FLAG_SCRIPT_AUTOEXEC)) {
482  BLI_snprintf(G.autoexec_fail, sizeof(G.autoexec_fail), "Driver '%s'", expr);
483 
484  printf("skipping driver '%s', automatic scripts are disabled\n", expr);
485  }
486  return 0.0f;
487  }
488 #else
489  bool is_recompile = false;
490 #endif
491 
492  use_gil = true; /* !PyC_IsInterpreterActive(); */
493 
494  if (use_gil) {
495  gilstate = PyGILState_Ensure();
496  }
497 
498  /* needed since drivers are updated directly after undo where 'main' is
499  * re-allocated T28807. */
501 
502  /* init global dictionary for py-driver evaluation settings */
503  if (!bpy_pydriver_Dict) {
504  if (bpy_pydriver_create_dict() != 0) {
505  fprintf(stderr, "PyDriver error: couldn't create Python dictionary\n");
506  if (use_gil) {
507  PyGILState_Release(gilstate);
508  }
509  return 0.0f;
510  }
511  }
512 
513  /* update global namespace */
515 
516  if (driver_orig->flag & DRIVER_FLAG_USE_SELF) {
518  }
519  else {
521  }
522 
523  if (driver_orig->expr_comp == NULL) {
524  driver_orig->flag |= DRIVER_FLAG_RECOMPILE;
525  }
526 
527  /* compile the expression first if it hasn't been compiled or needs to be rebuilt */
528  if (driver_orig->flag & DRIVER_FLAG_RECOMPILE) {
529  Py_XDECREF(driver_orig->expr_comp);
530  driver_orig->expr_comp = PyTuple_New(2);
531 
532  expr_code = Py_CompileString(expr, "<bpy driver>", Py_eval_input);
533  PyTuple_SET_ITEM(((PyObject *)driver_orig->expr_comp), 0, expr_code);
534 
535  driver_orig->flag &= ~DRIVER_FLAG_RECOMPILE;
536 
537  /* Maybe this can be removed but for now best keep until were sure. */
538  driver_orig->flag |= DRIVER_FLAG_RENAMEVAR;
539 #ifdef USE_BYTECODE_WHITELIST
540  is_recompile = true;
541 #endif
542  }
543  else {
544  expr_code = PyTuple_GET_ITEM(((PyObject *)driver_orig->expr_comp), 0);
545  }
546 
547  if (driver_orig->flag & DRIVER_FLAG_RENAMEVAR) {
548  /* may not be set */
549  expr_vars = PyTuple_GET_ITEM(((PyObject *)driver_orig->expr_comp), 1);
550  Py_XDECREF(expr_vars);
551 
552  expr_vars = PyTuple_New(BLI_listbase_count(&driver_orig->variables));
553  PyTuple_SET_ITEM(((PyObject *)driver_orig->expr_comp), 1, expr_vars);
554 
555  for (dvar = driver_orig->variables.first, i = 0; dvar; dvar = dvar->next) {
556  PyTuple_SET_ITEM(expr_vars, i++, PyUnicode_FromString(dvar->name));
557  }
558 
559  driver_orig->flag &= ~DRIVER_FLAG_RENAMEVAR;
560  }
561  else {
562  expr_vars = PyTuple_GET_ITEM(((PyObject *)driver_orig->expr_comp), 1);
563  }
564 
565  /* add target values to a dict that will be used as '__locals__' dict */
566  driver_vars = _PyDict_NewPresized(PyTuple_GET_SIZE(expr_vars));
567  for (dvar = driver->variables.first, i = 0; dvar; dvar = dvar->next) {
568  PyObject *driver_arg = NULL;
569 
570  /* support for any RNA data */
571 #ifdef USE_RNA_AS_PYOBJECT
572  if (dvar->type == DVAR_TYPE_SINGLE_PROP) {
573  driver_arg = pyrna_driver_get_variable_value(driver, &dvar->targets[0]);
574 
575  if (driver_arg == NULL) {
576  driver_arg = PyFloat_FromDouble(0.0);
577  dvar->curval = 0.0f;
578  }
579  else {
580  /* no need to worry about overflow here, values from RNA are within limits. */
581  if (PyFloat_CheckExact(driver_arg)) {
582  dvar->curval = (float)PyFloat_AsDouble(driver_arg);
583  }
584  else if (PyLong_CheckExact(driver_arg)) {
585  dvar->curval = (float)PyLong_AsLong(driver_arg);
586  }
587  else if (PyBool_Check(driver_arg)) {
588  dvar->curval = (driver_arg == Py_True);
589  }
590  else {
591  dvar->curval = 0.0f;
592  }
593  }
594  }
595  else
596 #endif
597  {
598  /* try to get variable value */
599  const float tval = driver_get_variable_value(driver, dvar);
600  driver_arg = PyFloat_FromDouble((double)tval);
601  }
602 
603  /* try to add to dictionary */
604  /* if (PyDict_SetItemString(driver_vars, dvar->name, driver_arg)) { */
605  if (PyDict_SetItem(driver_vars, PyTuple_GET_ITEM(expr_vars, i++), driver_arg) != -1) {
606  Py_DECREF(driver_arg);
607  }
608  else {
609  /* this target failed - bad name */
610  if (targets_ok) {
611  /* first one - print some extra info for easier identification */
612  fprintf(stderr, "\nBPY_driver_eval() - Error while evaluating PyDriver:\n");
613  targets_ok = 0;
614  }
615 
616  fprintf(
617  stderr, "\tBPY_driver_eval() - couldn't add variable '%s' to namespace\n", dvar->name);
618  // BPy_errors_to_report(NULL); /* TODO - reports */
619  PyErr_Print();
620  PyErr_Clear();
621  }
622  }
623 
624 #ifdef USE_BYTECODE_WHITELIST
625  if (is_recompile && expr_code) {
626  if (!(G.f & G_FLAG_SCRIPT_AUTOEXEC)) {
628  (PyObject *[]){
631  driver_vars,
632  NULL,
633  })) {
636  BLI_snprintf(G.autoexec_fail, sizeof(G.autoexec_fail), "Driver '%s'", expr);
637  }
638 
639  Py_DECREF(expr_code);
640  expr_code = NULL;
641  PyTuple_SET_ITEM(((PyObject *)driver_orig->expr_comp), 0, NULL);
642  }
643  }
644  }
645 #endif /* USE_BYTECODE_WHITELIST */
646 
647  bpy_pydriver_namespace_add_depsgraph(driver_vars, anim_eval_context->depsgraph);
648 
649 #if 0 /* slow, with this can avoid all Py_CompileString above. */
650  /* execute expression to get a value */
651  retval = PyRun_String(expr, Py_eval_input, bpy_pydriver_Dict, driver_vars);
652 #else
653  /* evaluate the compiled expression */
654  if (expr_code) {
655  retval = PyEval_EvalCode((void *)expr_code, bpy_pydriver_Dict, driver_vars);
656  }
657 #endif
658 
659  /* decref the driver vars first... */
660  Py_DECREF(driver_vars);
661 
662  /* process the result */
663  if (retval == NULL) {
664  pydriver_error(driver);
665  }
666  else if ((result = PyFloat_AsDouble(retval)) == -1.0 && PyErr_Occurred()) {
667  pydriver_error(driver);
668  Py_DECREF(retval);
669  result = 0.0;
670  }
671  else {
672  /* all fine, make sure the "invalid expression" flag is cleared */
673  driver->flag &= ~DRIVER_FLAG_INVALID;
674  Py_DECREF(retval);
675  }
676 
677  if (use_gil) {
678  PyGILState_Release(gilstate);
679  }
680 
681  if (isfinite(result)) {
682  return (float)result;
683  }
684 
685  fprintf(
686  stderr, "\tBPY_driver_eval() - driver '%s' evaluates to '%f'\n", driver->expression, result);
687  return 0.0f;
688 }
typedef float(TangentPoint)[2]
float driver_get_variable_value(struct ChannelDriver *driver, struct DriverVar *dvar)
@ G_FLAG_SCRIPT_AUTOEXEC_FAIL_QUIET
Definition: BKE_global.h:120
@ G_FLAG_SCRIPT_AUTOEXEC_FAIL
Definition: BKE_global.h:119
@ G_FLAG_SCRIPT_AUTOEXEC
Definition: BKE_global.h:116
#define BLI_assert(a)
Definition: BLI_assert.h:58
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:51
@ DVAR_TYPE_SINGLE_PROP
@ DRIVER_FLAG_INVALID
@ DRIVER_FLAG_RECOMPILE
@ DRIVER_FLAG_USE_SELF
@ DRIVER_FLAG_RENAMEVAR
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum pname
StructRNA RNA_Depsgraph
#define arg_str(...)
Definition: bgl.c:379
static PyObject * bpy_pydriver_Dict__whitelist
Definition: bpy_driver.c:67
static const char secure_opcodes[255]
Definition: bpy_driver.c:278
static bool bpy_driver_secure_bytecode_validate(PyObject *expr_code, PyObject *dict_arr[])
Definition: bpy_driver.c:345
PyObject * bpy_pydriver_Dict
Definition: bpy_driver.c:64
float evaltime
Definition: bpy_driver.c:181
static void pydriver_error(ChannelDriver *driver)
Definition: bpy_driver.c:262
static void bpy_pydriver_namespace_update_frame(const float evaltime)
Definition: bpy_driver.c:191
static void bpy_pydriver_namespace_clear_self(void)
Definition: bpy_driver.c:214
void BPY_driver_reset(void)
Definition: bpy_driver.c:228
#define OK_OP(op)
Definition: bpy_driver.c:276
static PyObject * bpy_pydriver_depsgraph_as_pyobject(struct Depsgraph *depsgraph)
Definition: bpy_driver.c:400
static struct @1121 g_pydriver_state_prev
int bpy_pydriver_create_dict(void)
Definition: bpy_driver.c:73
static void bpy_pydriver_namespace_add_depsgraph(PyObject *driver_vars, struct Depsgraph *depsgraph)
Definition: bpy_driver.c:418
static void bpy_pydriver_namespace_update_self(struct PathResolvedRNA *anim_rna)
Definition: bpy_driver.c:202
float BPY_driver_exec(struct PathResolvedRNA *anim_rna, ChannelDriver *driver, ChannelDriver *driver_orig, const AnimationEvalContext *anim_eval_context)
Definition: bpy_driver.c:451
PyObject * bpy_intern_str_self
PyObject * bpy_intern_str_frame
PyObject * pyrna_struct_CreatePyObject(PointerRNA *ptr)
Definition: bpy_rna.c:7469
void BPY_update_rna_module(void)
Definition: bpy_rna.c:7701
PyObject * pyrna_driver_self_from_anim_rna(PathResolvedRNA *anim_rna)
PyObject * pyrna_driver_get_variable_value(struct ChannelDriver *driver, struct DriverTarget *dtar)
bool pyrna_driver_is_equal_anim_rna(const PathResolvedRNA *anim_rna, const PyObject *py_anim_rna)
const Depsgraph * depsgraph
static char ** names
Definition: makesdna.c:162
bool isfinite(uchar)
Definition: image.cpp:44
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
Definition: rna_access.c:146
struct Depsgraph * depsgraph
Definition: BKE_animsys.h:57
ListBase variables
char expression[256]
struct DriverVar * next
DriverTarget targets[8]
char name[64]
void * first
Definition: DNA_listBase.h:47
ccl_device_inline int mod(int x, int m)
Definition: util_math.h:405
#define G(x, y, z)