diff options
author | Campbell Barton <ideasman42@gmail.com> | 2008-06-01 20:13:04 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2008-06-01 20:13:04 +0400 |
commit | 652ee1e31baa52c8e504bfcf3759ea94c7f5ab66 (patch) | |
tree | 95e322af27b05427a574957cc3302bf6bed2a28c | |
parent | 8937989a911fcc1bc634bbbb00be71fe62197fc4 (diff) |
functionality fix
Originally the only way to run scripts automatically was with scriptlinks, which could be disabled for loading untrusted blend files.
Since then PyDrivers and PyConstraints would run even when G.f&G_DOSCRIPTLINKS was disabled.
Gensher, Theeth and Ianwill agree its acceptable to reuse the flag for other areas python runs automatically.
PyNodes still have no way to be disabled, (todo before 2.46a)
-rw-r--r-- | source/blender/blenkernel/intern/constraint.c | 4 | ||||
-rw-r--r-- | source/blender/python/BPY_interface.c | 4 | ||||
-rw-r--r-- | source/creator/creator.c | 2 |
3 files changed, 6 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index f60e39769a2..068501780bc 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -1882,7 +1882,7 @@ static void pycon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintT { bPythonConstraint *data= con->data; - if (VALID_CONS_TARGET(ct)) { + if ((G.f & G_DOSCRIPTLINKS) && VALID_CONS_TARGET(ct)) { /* special exception for curves - depsgraph issues */ if (ct->tar->type == OB_CURVE) { Curve *cu= ct->tar->data; @@ -1906,6 +1906,8 @@ static void pycon_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targ { bPythonConstraint *data= con->data; + if ((G.f & G_DOSCRIPTLINKS)==0) return; + /* currently removed, until I this can be re-implemented for multiple targets */ #if 0 /* Firstly, run the 'driver' function which has direct access to the objects involved diff --git a/source/blender/python/BPY_interface.c b/source/blender/python/BPY_interface.c index 257203908b1..279c3727442 100644 --- a/source/blender/python/BPY_interface.c +++ b/source/blender/python/BPY_interface.c @@ -1222,7 +1222,7 @@ static int bpy_pydriver_create_dict(void) { PyObject *d, *mod; - if (bpy_pydriver_Dict) return -1; + if (bpy_pydriver_Dict || (G.f&G_DOSCRIPTLINKS)==0) return -1; d = PyDict_New(); if (!d) return -1; @@ -1998,7 +1998,7 @@ float BPY_pydriver_eval(IpoDriver *driver) int setitem_retval; PyGILState_STATE gilstate; - if (!driver) return result; + if (!driver || (G.f&G_DOSCRIPTLINKS)==0) return result; expr = driver->name; /* the py expression to be evaluated */ if (!expr || expr[0]=='\0') return result; diff --git a/source/creator/creator.c b/source/creator/creator.c index a4588bb4597..2e6b5d7353e 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -219,7 +219,7 @@ static void print_help(void) printf (" -d\t\tTurn debugging on\n"); printf (" -noaudio\tDisable audio on systems that support audio\n"); printf (" -h\t\tPrint this help text\n"); - printf (" -y\t\tDisable script links, use -Y to find out why its -y\n"); + printf (" -y\t\tDisable automatic python script execution (scriptlinks, pydrivers, pyconstraints, pynodes)\n"); printf (" -P <filename>\tRun the given Python script (filename or Blender Text)\n"); #ifdef WIN32 printf (" -R\t\tRegister .blend extension\n"); |