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
path: root/source
diff options
context:
space:
mode:
authorMartin Poirier <theeth@yahoo.com>2009-11-11 07:08:09 +0300
committerMartin Poirier <theeth@yahoo.com>2009-11-11 07:08:09 +0300
commite776ecfddec846b50b6bbd86f2ea56d159b6f237 (patch)
tree2f52be68814102c174e77c2d080061eaa43e2038 /source
parentf7d71499369fabc19ebc46ca723b6437943005de (diff)
Background mode in more working conditions.
What works: The usual command line options for rendering. All python scripts are loaded (which includes custom properties) Render engines are loaded and can be used -P to run scripts works partially: rna api works ok, not operators. What doesn't: Most operator calls in python. This is a problem with poll functions. (Brecht and Campbell are aware of this already) Changes: -d now also applied with -b (it was ignored before) user file (.B25.blend) now also loaded in bg mode. This helps for custom paths and all. wm is also initialized (it's needed for a lot of context calls) Ghost, however, is not initialized.
Diffstat (limited to 'source')
-rw-r--r--source/blender/windowmanager/WM_api.h3
-rw-r--r--source/blender/windowmanager/intern/wm.c31
-rw-r--r--source/blender/windowmanager/intern/wm_files.c6
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c14
-rw-r--r--source/blender/windowmanager/intern/wm_window.c8
-rw-r--r--source/blender/windowmanager/wm.h1
-rw-r--r--source/creator/creator.c33
7 files changed, 64 insertions, 32 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index f9732b9c929..a784a1d560a 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -52,6 +52,9 @@ void WM_init (struct bContext *C);
void WM_exit (struct bContext *C);
void WM_main (struct bContext *C);
+
+void WM_check (struct bContext *C);
+
struct wmWindow *WM_window_open (struct bContext *C, struct rcti *rect);
/* defines for 'type' WM_window_open_temp */
diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c
index 1d173005d85..d455c8b2bc1 100644
--- a/source/blender/windowmanager/intern/wm.c
+++ b/source/blender/windowmanager/intern/wm.c
@@ -43,6 +43,7 @@
#include "BKE_main.h"
#include "BKE_screen.h"
#include "BKE_report.h"
+#include "BKE_global.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -196,7 +197,7 @@ void WM_keymap_init(bContext *C)
WM_keyconfig_userdef(wm);
}
-void wm_check(bContext *C)
+void WM_check(bContext *C)
{
wmWindowManager *wm= CTX_wm_manager(C);
@@ -208,19 +209,21 @@ void wm_check(bContext *C)
if(wm==NULL) return;
if(wm->windows.first==NULL) return;
- /* case: fileread */
- if((wm->initialized & WM_INIT_WINDOW) == 0) {
- WM_keymap_init(C);
- WM_autosave_init(C);
- }
-
- /* case: no open windows at all, for old file reads */
- wm_window_add_ghostwindows(wm);
-
- /* case: fileread */
- if((wm->initialized & WM_INIT_WINDOW) == 0) {
- ED_screens_initialize(wm);
- wm->initialized |= WM_INIT_WINDOW;
+ if (!G.background) {
+ /* case: fileread */
+ if((wm->initialized & WM_INIT_WINDOW) == 0) {
+ WM_keymap_init(C);
+ WM_autosave_init(C);
+ }
+
+ /* case: no open windows at all, for old file reads */
+ wm_window_add_ghostwindows(wm);
+
+ /* case: fileread */
+ if((wm->initialized & WM_INIT_WINDOW) == 0) {
+ ED_screens_initialize(wm);
+ wm->initialized |= WM_INIT_WINDOW;
+ }
}
}
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index b2e55c8532e..79c718ea5d6 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -256,8 +256,8 @@ void WM_read_file(bContext *C, char *name, ReportList *reports)
G.save_over = 1;
/* match the read WM with current WM */
- wm_window_match_do(C, &wmbase);
- wm_check(C); /* opens window(s), checks keymaps */
+ wm_window_match_do(C, &wmbase);
+ WM_check(C); /* opens window(s), checks keymaps */
// XXX mainwindow_set_filename_to_title(G.main->name);
@@ -322,7 +322,7 @@ int WM_read_homefile(bContext *C, wmOperator *op)
/* match the read WM with current WM */
wm_window_match_do(C, &wmbase);
- wm_check(C); /* opens window(s), checks keymaps */
+ WM_check(C); /* opens window(s), checks keymaps */
strcpy(G.sce, scestr); /* restore */
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index 8097822acbc..06227086006 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -108,8 +108,10 @@ static void wm_free_reports(bContext *C)
void WM_init(bContext *C)
{
- wm_ghost_init(C); /* note: it assigns C to ghost! */
- wm_init_cursor_data();
+ if (!G.background) {
+ wm_ghost_init(C); /* note: it assigns C to ghost! */
+ wm_init_cursor_data();
+ }
wm_operatortype_init();
set_free_windowmanager_cb(wm_close_and_free); /* library.c */
@@ -130,10 +132,12 @@ void WM_init(bContext *C)
WM_read_homefile(C, NULL);
wm_init_reports(C); /* reports cant be initialized before the wm */
-
- GPU_extensions_init();
- UI_init();
+ if (!G.background) {
+ GPU_extensions_init();
+
+ UI_init();
+ }
// clear_matcopybuf(); /* XXX */
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index 70d40df4532..ae6d9ddb425 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -335,7 +335,7 @@ static void wm_window_add_ghostwindow(wmWindowManager *wm, char *title, wmWindow
/* for wmWindows without ghostwin, open these and clear */
/* window size is read from window, if 0 it uses prefsize */
-/* called in wm_check, also inits stuff after file read */
+/* called in WM_check, also inits stuff after file read */
void wm_window_add_ghostwindows(wmWindowManager *wm)
{
wmKeyMap *keymap;
@@ -403,7 +403,7 @@ wmWindow *WM_window_open(bContext *C, rcti *rect)
win->drawmethod= -1;
win->drawdata= NULL;
- wm_check(C);
+ WM_check(C);
return win;
}
@@ -448,7 +448,7 @@ void WM_window_open_temp(bContext *C, rcti *position, int type)
/* make window active, and validate/resize */
CTX_wm_window_set(C, win);
- wm_check(C);
+ WM_check(C);
/* ensure it shows the right spacetype editor */
sa= win->screen->areabase.first;
@@ -480,7 +480,7 @@ void WM_window_open_temp(bContext *C, rcti *position, int type)
int wm_window_duplicate_op(bContext *C, wmOperator *op)
{
wm_window_copy(C, CTX_wm_window(C));
- wm_check(C);
+ WM_check(C);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/windowmanager/wm.h b/source/blender/windowmanager/wm.h
index c476b7efa1e..9b888a0e347 100644
--- a/source/blender/windowmanager/wm.h
+++ b/source/blender/windowmanager/wm.h
@@ -44,7 +44,6 @@ extern void wm_close_and_free(bContext *C, wmWindowManager *);
extern void wm_close_and_free_all(bContext *C, ListBase *);
extern void wm_add_default(bContext *C);
-extern void wm_check(bContext *C);
extern void wm_clear_default_size(bContext *C);
/* register to windowmanager for redo or macro */
diff --git a/source/creator/creator.c b/source/creator/creator.c
index 84e6eed9278..b4c962cbfc8 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -508,6 +508,27 @@ int main(int argc, char **argv)
#endif
}
else {
+ for(a=1; a<argc; a++) {
+ if(argv[a][0] == '-') {
+ switch(argv[a][1]) {
+ case 'd':
+ G.f |= G_DEBUG; /* std output printf's */
+ printf ("Blender %d.%02d (sub %d) Build\n", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION);
+ MEM_set_memory_debug();
+#ifdef NAN_BUILDINFO
+ printf("Build: %s %s %s %s\n", build_date, build_time, build_platform, build_type);
+
+#endif // NAN_BUILDINFO
+ for (i = 0; i < argc; i++) {
+ printf("argv[%d] = %s\n", i, argv[i]);
+ }
+ break;
+ }
+ }
+ }
+
+ WM_init(C);
+
#ifndef DISABLE_PYTHON
BPY_start_python(argc, argv);
#endif
@@ -524,13 +545,11 @@ int main(int argc, char **argv)
*/
BPY_post_start_python();
- if(!G.background)
- BPY_run_ui_scripts(C, 0); /* dont need to reload the first time */
+ BPY_run_ui_scripts(C, 0); /* dont need to reload the first time */
#endif
CTX_py_init_set(C, 1);
- if(!G.background)
- WM_keymap_init(C); /* after BPY_run_ui_scripts() */
+ WM_keymap_init(C); /* after BPY_run_ui_scripts() */
#ifdef WITH_QUICKTIME
@@ -843,7 +862,11 @@ int main(int argc, char **argv)
/*we successfully loaded a blend file, get sure that
pointcache works */
- if (retval!=0) G.relbase_valid = 1;
+ if (retval!=0) {
+ CTX_wm_manager_set(C, NULL); /* remove wm to force check */
+ WM_check(C);
+ G.relbase_valid = 1;
+ }
/* happens for the UI on file reading too (huh? (ton))*/
// XXX BKE_reset_undo();