diff options
author | Sergej Reich <sergej.reich@googlemail.com> | 2013-01-23 09:56:34 +0400 |
---|---|---|
committer | Sergej Reich <sergej.reich@googlemail.com> | 2013-01-23 09:56:34 +0400 |
commit | 089cf12435dfbc4b934a73b73ecd617b27ac678d (patch) | |
tree | e2c8b7b187694ca7ae4640b76634ddcba5644600 /source/blender/editors | |
parent | fc377c17e3d4803ef4db7a72daae629a322ffde8 (diff) |
rigidbody: Add point cache support
Add read/write/interpolate functions.
In order to get rigid body point cache id from object it's now required to pass the
scene to BKE_ptcache_ids_from_object().
Rigid body cache is drawn in the orange color of the bullet logo.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/object/object_edit.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_time/space_time.c | 14 |
2 files changed, 12 insertions, 4 deletions
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index fcc3b5d012e..5e5e38c3e43 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -376,7 +376,7 @@ void ED_object_exit_editmode(bContext *C, int flag) scene->obedit = NULL; // XXX for context /* flag object caches as outdated */ - BKE_ptcache_ids_from_object(&pidlist, obedit, NULL, 0); + BKE_ptcache_ids_from_object(&pidlist, obedit, scene, 0); for (pid = pidlist.first; pid; pid = pid->next) { if (pid->type != PTCACHE_TYPE_PARTICLES) /* particles don't need reset on geometry change */ pid->cache->flag |= PTCACHE_OUTDATED; diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c index 13c1938d77c..e5bd9e62c74 100644 --- a/source/blender/editors/space_time/space_time.c +++ b/source/blender/editors/space_time/space_time.c @@ -92,7 +92,7 @@ static void time_draw_sfra_efra(Scene *scene, View2D *v2d) #define CACHE_DRAW_HEIGHT 3.0f -static void time_draw_cache(SpaceTime *stime, Object *ob) +static void time_draw_cache(SpaceTime *stime, Object *ob, Scene *scene) { PTCacheID *pid; ListBase pidlist; @@ -102,7 +102,7 @@ static void time_draw_cache(SpaceTime *stime, Object *ob) if (!(stime->cache_display & TIME_CACHE_DISPLAY) || (!ob)) return; - BKE_ptcache_ids_from_object(&pidlist, ob, NULL, 0); + BKE_ptcache_ids_from_object(&pidlist, ob, scene, 0); /* iterate over pointcaches on the active object, * add spacetimecache and vertex array for each */ @@ -128,6 +128,9 @@ static void time_draw_cache(SpaceTime *stime, Object *ob) case PTCACHE_TYPE_DYNAMICPAINT: if (!(stime->cache_display & TIME_CACHE_DYNAMICPAINT)) continue; break; + case PTCACHE_TYPE_RIGIDBODY: + if (!(stime->cache_display & TIME_CACHE_RIGIDBODY)) continue; + break; } if (pid->cache->cached_frames == NULL) @@ -193,6 +196,10 @@ static void time_draw_cache(SpaceTime *stime, Object *ob) col[0] = 1.0; col[1] = 0.1; col[2] = 0.75; col[3] = 0.1; break; + case PTCACHE_TYPE_RIGIDBODY: + col[0] = 1.0; col[1] = 0.6; col[2] = 0.0; + col[3] = 0.1; + break; default: BLI_assert(0); col[0] = 1.0; col[1] = 0.0; col[2] = 1.0; @@ -499,7 +506,7 @@ static void time_main_area_draw(const bContext *C, ARegion *ar) draw_markers_time(C, 0); /* caches */ - time_draw_cache(stime, obact); + time_draw_cache(stime, obact, scene); /* reset view matrix */ UI_view2d_view_restore(C); @@ -648,6 +655,7 @@ static void time_init(wmWindowManager *UNUSED(wm), ScrArea *sa) stime->cache_display |= TIME_CACHE_DISPLAY; stime->cache_display |= (TIME_CACHE_SOFTBODY | TIME_CACHE_PARTICLES); stime->cache_display |= (TIME_CACHE_CLOTH | TIME_CACHE_SMOKE | TIME_CACHE_DYNAMICPAINT); + stime->cache_display |= TIME_CACHE_RIGIDBODY; } static SpaceLink *time_duplicate(SpaceLink *sl) |