diff options
author | Martin Poirier <theeth@yahoo.com> | 2009-12-04 01:48:00 +0300 |
---|---|---|
committer | Martin Poirier <theeth@yahoo.com> | 2009-12-04 01:48:00 +0300 |
commit | 1757b06e8861272e394e3def7cdd90d3c5d87a7d (patch) | |
tree | d5416c07cdc40395f45dd691bd57710c1f9b4ca9 /source | |
parent | ab1290d62ed6cbdf05b5b999f2b657f70804b07f (diff) |
Only set baking progress function to cursor when a window is present.
This enables baking in background mode (instead of just crashing).
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/physics/physics_pointcache.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/source/blender/editors/physics/physics_pointcache.c b/source/blender/editors/physics/physics_pointcache.c index 78728ae9eb0..784bc1ca30c 100644 --- a/source/blender/editors/physics/physics_pointcache.c +++ b/source/blender/editors/physics/physics_pointcache.c @@ -83,6 +83,7 @@ static int ptcache_poll(bContext *C) static int ptcache_bake_all_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); + wmWindow *win = CTX_wm_window(C); PTCacheBaker baker; @@ -94,8 +95,14 @@ static int ptcache_bake_all_exec(bContext *C, wmOperator *op) baker.quick_step = 1; baker.break_test = cache_break_test; baker.break_data = NULL; - baker.progressbar = (void (*)(void *, int))WM_timecursor; - baker.progresscontext = CTX_wm_window(C); + + if (win) { + baker.progressbar = (void (*)(void *, int))WM_timecursor; + baker.progresscontext = win; + } else { + baker.progressbar = NULL; + baker.progresscontext = NULL; + } BKE_ptcache_make_cache(&baker); @@ -156,6 +163,7 @@ void PTCACHE_OT_free_bake_all(wmOperatorType *ot) static int ptcache_bake_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); + wmWindow *win = CTX_wm_window(C); PointerRNA ptr= CTX_data_pointer_get_type(C, "PointCache", &RNA_PointCache); Object *ob= ptr.id.data; PointCache *cache= ptr.data; @@ -178,8 +186,14 @@ static int ptcache_bake_exec(bContext *C, wmOperator *op) baker.quick_step = 1; baker.break_test = cache_break_test; baker.break_data = NULL; - baker.progressbar = (void (*)(void *, int))WM_timecursor; - baker.progresscontext = CTX_wm_window(C); + + if (win) { + baker.progressbar = (void (*)(void *, int))WM_timecursor; + baker.progresscontext = win; + } else { + baker.progressbar = NULL; + baker.progresscontext = NULL; + } BKE_ptcache_make_cache(&baker); |