[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [24472] trunk/blender/source: Background mode in more working conditions.
Martin Poirier
theeth at yahoo.com
Wed Nov 11 05:28:45 CET 2009
While it's limited to the rna api, there's still some fun stuff that can be done, like this:
http://www.pasteall.org/9060
save this to script.py, then run:
blender -b ~/.B25.blend -P script.py -o test -f 1 -P script.py -f 2 -P script.py -f 3
(replace ~/.B25.blend with any file with a cube, if needed).
This will give you 3 images with a randomly placed cube.
Martin
--- On Tue, 11/10/09, Martin Poirier <theeth at yahoo.com> wrote:
> From: Martin Poirier <theeth at yahoo.com>
> Subject: [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [24472] trunk/blender/source: Background mode in more working conditions.
> To: bf-blender-cvs at blender.org
> Received: Tuesday, November 10, 2009, 11:08 PM
> Revision: 24472
> http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24472
> Author: theeth
> Date: 2009-11-11 05:08:09 +0100
> (Wed, 11 Nov 2009)
>
> Log Message:
> -----------
> 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.
>
> Modified Paths:
> --------------
>
> trunk/blender/source/blender/windowmanager/WM_api.h
>
> trunk/blender/source/blender/windowmanager/intern/wm.c
>
> trunk/blender/source/blender/windowmanager/intern/wm_files.c
>
> trunk/blender/source/blender/windowmanager/intern/wm_init_exit.c
>
> trunk/blender/source/blender/windowmanager/intern/wm_window.c
>
> trunk/blender/source/blender/windowmanager/wm.h
> trunk/blender/source/creator/creator.c
>
> Modified:
> trunk/blender/source/blender/windowmanager/WM_api.h
> ===================================================================
> ---
> trunk/blender/source/blender/windowmanager/WM_api.h
> 2009-11-11 03:45:26 UTC (rev 24471)
> +++
> trunk/blender/source/blender/windowmanager/WM_api.h
> 2009-11-11 04:08:09 UTC (rev 24472)
> @@ -52,6 +52,9 @@
> 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 */
>
> Modified:
> trunk/blender/source/blender/windowmanager/intern/wm.c
> ===================================================================
> ---
> trunk/blender/source/blender/windowmanager/intern/wm.c
> 2009-11-11 03:45:26 UTC (rev 24471)
> +++
> trunk/blender/source/blender/windowmanager/intern/wm.c
> 2009-11-11 04:08:09 UTC (rev 24472)
> @@ -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 @@
> WM_keyconfig_userdef(wm);
> }
>
> -void wm_check(bContext *C)
> +void WM_check(bContext *C)
> {
> wmWindowManager *wm=
> CTX_wm_manager(C);
>
> @@ -208,20 +209,22 @@
> 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);
> + 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;
> + }
> }
> -
> - /* 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;
> - }
> }
>
> void wm_clear_default_size(bContext *C)
>
> Modified:
> trunk/blender/source/blender/windowmanager/intern/wm_files.c
> ===================================================================
> ---
> trunk/blender/source/blender/windowmanager/intern/wm_files.c
> 2009-11-11 03:45:26 UTC (rev 24471)
> +++
> trunk/blender/source/blender/windowmanager/intern/wm_files.c
> 2009-11-11 04:08:09 UTC (rev 24472)
> @@ -256,8 +256,8 @@
> 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 @@
>
> /* 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 */
>
>
> Modified:
> trunk/blender/source/blender/windowmanager/intern/wm_init_exit.c
> ===================================================================
> ---
> trunk/blender/source/blender/windowmanager/intern/wm_init_exit.c
> 2009-11-11 03:45:26 UTC (rev 24471)
> +++
> trunk/blender/source/blender/windowmanager/intern/wm_init_exit.c
> 2009-11-11 04:08:09 UTC (rev 24472)
> @@ -108,8 +108,10 @@
> 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,11 +132,13 @@
> 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 */
>
> //
> glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
>
> Modified:
> trunk/blender/source/blender/windowmanager/intern/wm_window.c
> ===================================================================
> ---
> trunk/blender/source/blender/windowmanager/intern/wm_window.c
> 2009-11-11 03:45:26 UTC (rev 24471)
> +++
> trunk/blender/source/blender/windowmanager/intern/wm_window.c
> 2009-11-11 04:08:09 UTC (rev 24472)
> @@ -335,7 +335,7 @@
>
> /* 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 @@
> win->drawmethod= -1;
> win->drawdata= NULL;
>
> - wm_check(C);
> + WM_check(C);
>
> return win;
> }
> @@ -448,7 +448,7 @@
>
> /* 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 @@
> 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;
> }
>
> Modified: trunk/blender/source/blender/windowmanager/wm.h
> ===================================================================
> ---
> trunk/blender/source/blender/windowmanager/wm.h
> 2009-11-11 03:45:26 UTC (rev 24471)
> +++
> trunk/blender/source/blender/windowmanager/wm.h
> 2009-11-11 04:08:09 UTC (rev 24472)
> @@ -44,7 +44,6 @@
> 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 */
>
> Modified: trunk/blender/source/creator/creator.c
> ===================================================================
> ---
> trunk/blender/source/creator/creator.c
> 2009-11-11 03:45:26 UTC (rev 24471)
> +++
> trunk/blender/source/creator/creator.c
> 2009-11-11 04:08:09 UTC (rev 24472)
> @@ -508,6 +508,27 @@
> #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 @@
> */
> 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 @@
>
>
>
> /*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();
>
>
> _______________________________________________
> Bf-blender-cvs mailing list
> Bf-blender-cvs at blender.org
> http://lists.blender.org/mailman/listinfo/bf-blender-cvs
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the Bf-committers
mailing list