Python API: restore bpy.app.autoexec_fail variables, some scripts use it.
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Fri, 23 Nov 2018 10:44:57 +0000 (11:44 +0100)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Fri, 23 Nov 2018 11:11:41 +0000 (12:11 +0100)
source/blender/python/intern/bpy_app.c

index aadbb57f932edd7cd84235598dda965bf5821473..d8c74bdf565a6fe6c0ec952876ce7f410bc6b209 100644 (file)
@@ -316,6 +316,12 @@ static int bpy_app_debug_value_set(PyObject *UNUSED(self), PyObject *value, void
        return 0;
 }
 
+static PyObject *bpy_app_global_flag_get(PyObject *UNUSED(self), void *closure)
+{
+       const int flag = POINTER_AS_INT(closure);
+       return PyBool_FromLong(G.f & flag);
+}
+
 PyDoc_STRVAR(bpy_app_tempdir_doc,
 "String, the temp directory used by blender (read-only)"
 );
@@ -347,6 +353,12 @@ static PyObject *bpy_app_preview_render_size_get(PyObject *UNUSED(self), void *c
        return PyLong_FromLong((long)UI_preview_render_size(POINTER_AS_INT(closure)));
 }
 
+static PyObject *bpy_app_autoexec_fail_message_get(PyObject *UNUSED(self), void *UNUSED(closure))
+{
+       return PyC_UnicodeFromByte(G.autoexec_fail);
+}
+
+
 PyDoc_STRVAR(bpy_app_use_static_override_doc,
 "Boolean, whether static override is exposed in UI or not."
 );
@@ -399,6 +411,10 @@ static PyGetSetDef bpy_app_getsets[] = {
        {(char *)"render_icon_size", bpy_app_preview_render_size_get, NULL, (char *)bpy_app_preview_render_size_doc, (void *)ICON_SIZE_ICON},
        {(char *)"render_preview_size", bpy_app_preview_render_size_get, NULL, (char *)bpy_app_preview_render_size_doc, (void *)ICON_SIZE_PREVIEW},
 
+       /* security */
+       {(char *)"autoexec_fail", bpy_app_global_flag_get, NULL, NULL, (void *)G_SCRIPT_AUTOEXEC_FAIL},
+       {(char *)"autoexec_fail_quiet", bpy_app_global_flag_get, NULL, NULL, (void *)G_SCRIPT_AUTOEXEC_FAIL_QUIET},
+       {(char *)"autoexec_fail_message", bpy_app_autoexec_fail_message_get, NULL, NULL, NULL},
        {NULL, NULL, NULL, NULL, NULL}
 };