fix [#34169] dynamic paint bake from python + command line = segfault
authorCampbell Barton <ideasman42@gmail.com>
Mon, 11 Feb 2013 15:48:43 +0000 (15:48 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 11 Feb 2013 15:48:43 +0000 (15:48 +0000)
source/blender/editors/physics/dynamicpaint_ops.c

index c51b3ca4c43485f77ebf08fe8d6d2cb05cb8b7fb..ecc7ea4ae005841eb0ced422e8f4f4d0a119bc0e 100644 (file)
@@ -304,7 +304,9 @@ static int dynamicPaint_bakeImageSequence(bContext *C, DynamicPaintSurface *surf
                if (blender_test_break()) return 0;
 
                /* Update progress bar cursor */
-               WM_cursor_time(win, (int)progress);
+               if (!G.background) {
+                       WM_cursor_time(win, (int)progress);
+               }
 
                /* calculate a frame */
                scene->r.cfra = (int)frame;
@@ -346,6 +348,7 @@ static int dynamicPaint_bakeImageSequence(bContext *C, DynamicPaintSurface *surf
  */
 static int dynamicPaint_initBake(struct bContext *C, struct wmOperator *op)
 {
+       wmWindow *win = CTX_wm_window(C);
        DynamicPaintModifierData *pmd = NULL;
        DynamicPaintCanvasSettings *canvas;
        Object *ob = ED_object_context(C);
@@ -379,7 +382,9 @@ static int dynamicPaint_initBake(struct bContext *C, struct wmOperator *op)
        status = dynamicPaint_bakeImageSequence(C, surface, ob);
        /* Clear bake */
        canvas->flags &= ~MOD_DPAINT_BAKING;
-       WM_cursor_restore(CTX_wm_window(C));
+       if (!G.background) {
+               WM_cursor_restore(win);
+       }
        dynamicPaint_freeSurfaceData(surface);
 
        /* Bake was successful: