fix for crash when running WM_OT_read_factory_settings() from a script and then importing.

This commit is contained in:
2011-03-20 07:23:17 +00:00
parent 35cee79a37
commit 790e47768a

View File

@@ -40,6 +40,7 @@
#include "bpy_operator_wrap.h"
#include "bpy_rna.h" /* for setting arg props only - pyrna_py_to_prop() */
#include "bpy_util.h"
#include "../generic/bpy_internal_import.h"
#include "BLI_utildefines.h"
@@ -246,6 +247,8 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
* function corrects bpy.data (internal Main pointer) */
BPY_modules_update(C);
/* needed for when WM_OT_read_factory_settings us called fro within a script */
bpy_import_main_set(CTX_data_main(C));
/* return operator_ret as a bpy enum */
return pyrna_enum_bitfield_to_py(operator_return_items, operator_ret);