diff options
author | Jens Ole Wund <bjornmose@gmx.net> | 2006-11-21 01:27:05 +0300 |
---|---|---|
committer | Jens Ole Wund <bjornmose@gmx.net> | 2006-11-21 01:27:05 +0300 |
commit | 731e7e3915f35de124ab65b455316e5fd3e60585 (patch) | |
tree | 06a6376c720716088da5f2456d84077888566b16 /source/blender/blenkernel | |
parent | c57d5bca73ce274f41febace72388e9e198d4d35 (diff) |
having a nice break/esc behavior on bake
other occasions like ALT_A needs that too
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_softbody.h | 5 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/softbody.c | 14 |
2 files changed, 19 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_softbody.h b/source/blender/blenkernel/BKE_softbody.h index 3ead7445c03..15200bf46f8 100644 --- a/source/blender/blenkernel/BKE_softbody.h +++ b/source/blender/blenkernel/BKE_softbody.h @@ -49,5 +49,10 @@ extern void sbObjectStep(struct Object *ob, float framnr, float (*vertexCos)[ /* makes totally fresh start situation, resets time */ extern void sbObjectToSoftbody(struct Object *ob); +/* links the softbody module to a 'test for Interrupt' function */ +/* pass NULL to unlink again */ +extern void sbSetInterruptCallBack(int (*f)(void)); + + #endif diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 5ab2efece66..58563104d2f 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -82,6 +82,11 @@ variables on the UI for now #include "BIF_editdeform.h" #include "BIF_graphics.h" #include "PIL_time.h" + +/* callbacks for errors and interrupts and some goo */ +static int (*SB_localInterruptCallBack)(void) = NULL; + + /* ********** soft body engine ******* */ @@ -3060,6 +3065,13 @@ static int object_has_edges(Object *ob) } } +/* SB global visible functions */ +void sbSetInterruptCallBack(int (*f)(void)) +{ + SB_localInterruptCallBack = f; +} + + /* simulates one step. framenr is in frames */ void sbObjectStep(Object *ob, float framenr, float (*vertexCos)[3], int numVerts) { @@ -3271,6 +3283,8 @@ void sbObjectStep(Object *ob, float framenr, float (*vertexCos)[3], int numVerts sct=PIL_check_seconds_timer(); if (sct-sst > 0.5f) printf("%3.0f%% \r",100.0f*timedone); } + if (SB_localInterruptCallBack && SB_localInterruptCallBack()) break; + } /* move snapped to final position */ interpolate_exciter(ob, 2, 2); |