Fix drivers showing "Python restricted for security" when they weren't

Regression from [0], drivers were tagged as being disabled with a flag
that was never cleared. Causing the label to be displayed for files
where the expressions were enabled and in use.

Resolve by clearing this flag on file load and when re-compiling
expressions - since an expressions block flag may be cleared if it
becomes a simple expression.

[0]: 1a8053939b
This commit is contained in:
Campbell Barton
2024-07-22 10:33:35 +10:00
parent 1404a95dde
commit e2bc41598d
2 changed files with 4 additions and 1 deletions
+1 -1
View File
@@ -2671,7 +2671,7 @@ void BKE_fcurve_blend_read_data(BlendDataReader *reader, FCurve *fcu)
/* Give the driver a fresh chance - the operating environment may be different now
* (addons, etc. may be different) so the driver namespace may be sane now #32155. */
driver->flag &= ~DRIVER_FLAG_INVALID;
driver->flag &= ~(DRIVER_FLAG_INVALID | DRIVER_FLAG_PYTHON_BLOCKED);
/* relink variables, targets and their paths */
BLO_read_struct_list(reader, DriverVar, &driver->variables);
@@ -527,6 +527,7 @@ float BPY_driver_exec(PathResolvedRNA *anim_rna,
printf("skipping driver '%s', automatic scripts are disabled\n", expr);
}
driver_orig->flag |= DRIVER_FLAG_PYTHON_BLOCKED;
return 0.0f;
}
#else
@@ -581,6 +582,8 @@ float BPY_driver_exec(PathResolvedRNA *anim_rna,
/* Maybe this can be removed but for now best keep until were sure. */
driver_orig->flag |= DRIVER_FLAG_RENAMEVAR;
driver_orig->flag &= ~DRIVER_FLAG_PYTHON_BLOCKED;
#ifdef USE_BYTECODE_WHITELIST
is_recompile = true;
#endif