Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-06-10 03:31:53 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-06-10 03:31:53 +0400
commite7a487d1e9e79176a0ca99cda3882aac4ea16a99 (patch)
tree2d624a11f3954033cfe7c2f4c51142701a8d586b
parente70476db4b63f1720f24ff93aa15441de7740fd6 (diff)
code cleanup: group python reset functions in BPY_python_reset()
-rw-r--r--source/blender/python/BPY_extern.h1
-rw-r--r--source/blender/python/intern/bpy_interface.c7
-rw-r--r--source/blender/windowmanager/intern/wm_files.c8
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c5
-rw-r--r--source/creator/creator.c4
5 files changed, 12 insertions, 13 deletions
diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h
index 0f5be095e0f..e61b4847e2c 100644
--- a/source/blender/python/BPY_extern.h
+++ b/source/blender/python/BPY_extern.h
@@ -63,6 +63,7 @@ int BPY_is_pyconstraint(struct Text *text);
void BPY_python_start(int argc, const char **argv);
void BPY_python_end(void);
+void BPY_python_reset(struct bContext *C);
/* 2.5 UI Scripts */
int BPY_filepath_exec(struct bContext *C, const char *filepath, struct ReportList *reports);
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index f71ea02a510..75827ce8bbf 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -396,6 +396,13 @@ void BPY_python_end(void)
}
+void BPY_python_reset(bContext *C)
+{
+ BPY_driver_reset();
+ BPY_app_handlers_reset(false);
+ BPY_modules_load_user(C);
+}
+
static void python_script_error_jump_text(struct Text *text)
{
int lineno;
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 7a528e41995..c372e2d1ce6 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -437,9 +437,7 @@ void WM_file_read(bContext *C, const char *filepath, ReportList *reports)
#ifdef WITH_PYTHON
/* run any texts that were loaded in and flagged as modules */
- BPY_driver_reset();
- BPY_app_handlers_reset(FALSE);
- BPY_modules_load_user(C);
+ BPY_python_reset(C);
#endif
/* important to do before NULL'ing the context */
@@ -590,9 +588,7 @@ int wm_homefile_read(bContext *C, ReportList *UNUSED(reports), short from_memory
/* sync addons, these may have changed from the defaults */
BPY_string_exec(C, "__import__('addon_utils').reset_all()");
- BPY_driver_reset();
- BPY_app_handlers_reset(FALSE);
- BPY_modules_load_user(C);
+ BPY_python_reset(C);
}
#endif
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index 31f2b412a7f..8115779a7c6 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -174,10 +174,7 @@ void WM_init(bContext *C, int argc, const char **argv)
BPY_context_set(C); /* necessary evil */
BPY_python_start(argc, argv);
- BPY_driver_reset();
- BPY_app_handlers_reset(FALSE); /* causes addon callbacks to be freed [#28068],
- * but this is actually what we want. */
- BPY_modules_load_user(C);
+ BPY_python_reset(C);
#else
(void)argc; /* unused */
(void)argv; /* unused */
diff --git a/source/creator/creator.c b/source/creator/creator.c
index fdd01691232..1451a525694 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -1250,9 +1250,7 @@ static int load_file(int UNUSED(argc), const char **argv, void *data)
/* WM_file_read() runs normally but since we're in background mode do here */
#ifdef WITH_PYTHON
/* run any texts that were loaded in and flagged as modules */
- BPY_driver_reset();
- BPY_app_handlers_reset(FALSE);
- BPY_modules_load_user(C);
+ BPY_python_reset(C);
#endif
/* happens for the UI on file reading too (huh? (ton))*/