diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2016-05-02 12:00:34 +0300 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2016-05-02 12:00:34 +0300 |
commit | b4a721af694817fa921b119df83d33ede7d7fed0 (patch) | |
tree | 374b233e748d1c2e012f1a8fb480e85da4ed7927 /source/blender/editors/space_time | |
parent | 5aa19be91263a249ffae75573e3b32f24269d890 (diff) | |
parent | 735727e2b84b64a64aa6abc26f1115af37ff55ba (diff) |
Merge branch 'temp_remove_pointcache' into blender2.8
Diffstat (limited to 'source/blender/editors/space_time')
-rw-r--r-- | source/blender/editors/space_time/space_time.c | 154 |
1 files changed, 0 insertions, 154 deletions
diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c index 9872ffad043..ff9136f3554 100644 --- a/source/blender/editors/space_time/space_time.c +++ b/source/blender/editors/space_time/space_time.c @@ -44,7 +44,6 @@ #include "BKE_context.h" #include "BKE_screen.h" -#include "BKE_pointcache.h" #include "ED_anim_api.h" #include "ED_keyframes_draw.h" @@ -91,155 +90,6 @@ static void time_draw_sfra_efra(Scene *scene, View2D *v2d) fdrawline((float)PEFRA, v2d->cur.ymin, (float)PEFRA, v2d->cur.ymax); } -static void time_draw_cache(SpaceTime *stime, Object *ob, Scene *scene) -{ - PTCacheID *pid; - ListBase pidlist; - SpaceTimeCache *stc = stime->caches.first; - const float cache_draw_height = (4.0f * UI_DPI_FAC * U.pixelsize); - float yoffs = 0.f; - - if (!(stime->cache_display & TIME_CACHE_DISPLAY) || (!ob)) - return; - - BKE_ptcache_ids_from_object(&pidlist, ob, scene, 0); - - /* iterate over pointcaches on the active object, - * add spacetimecache and vertex array for each */ - for (pid = pidlist.first; pid; pid = pid->next) { - float col[4], *fp; - int i, sta = pid->cache->startframe, end = pid->cache->endframe; - int len = (end - sta + 1) * 4; - - switch (pid->type) { - case PTCACHE_TYPE_SOFTBODY: - if (!(stime->cache_display & TIME_CACHE_SOFTBODY)) continue; - break; - case PTCACHE_TYPE_CLOTH: - if (!(stime->cache_display & TIME_CACHE_CLOTH)) continue; - break; - case PTCACHE_TYPE_SMOKE_DOMAIN: - case PTCACHE_TYPE_SMOKE_HIGHRES: - if (!(stime->cache_display & TIME_CACHE_SMOKE)) continue; - break; - 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) - continue; - - /* make sure we have stc with correct array length */ - if (stc == NULL || MEM_allocN_len(stc->array) != len * 2 * sizeof(float)) { - if (stc) { - MEM_freeN(stc->array); - } - else { - stc = MEM_callocN(sizeof(SpaceTimeCache), "spacetimecache"); - BLI_addtail(&stime->caches, stc); - } - - stc->array = MEM_callocN(len * 2 * sizeof(float), "SpaceTimeCache array"); - } - - /* fill the vertex array with a quad for each cached frame */ - for (i = sta, fp = stc->array; i <= end; i++) { - if (pid->cache->cached_frames[i - sta]) { - fp[0] = (float)i - 0.5f; - fp[1] = 0.0; - fp += 2; - - fp[0] = (float)i - 0.5f; - fp[1] = 1.0; - fp += 2; - - fp[0] = (float)i + 0.5f; - fp[1] = 1.0; - fp += 2; - - fp[0] = (float)i + 0.5f; - fp[1] = 0.0; - fp += 2; - } - } - - glPushMatrix(); - glTranslatef(0.0, (float)V2D_SCROLL_HEIGHT + yoffs, 0.0); - glScalef(1.0, cache_draw_height, 0.0); - - switch (pid->type) { - case PTCACHE_TYPE_SOFTBODY: - col[0] = 1.0; col[1] = 0.4; col[2] = 0.02; - col[3] = 0.1; - break; - case PTCACHE_TYPE_CLOTH: - col[0] = 0.1; col[1] = 0.1; col[2] = 0.75; - col[3] = 0.1; - break; - case PTCACHE_TYPE_SMOKE_DOMAIN: - case PTCACHE_TYPE_SMOKE_HIGHRES: - col[0] = 0.2; col[1] = 0.2; col[2] = 0.2; - col[3] = 0.1; - break; - case PTCACHE_TYPE_DYNAMICPAINT: - 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: - col[0] = 1.0; col[1] = 0.0; col[2] = 1.0; - col[3] = 0.1; - BLI_assert(0); - break; - } - glColor4fv(col); - - glEnable(GL_BLEND); - - glRectf((float)sta, 0.0, (float)end, 1.0); - - col[3] = 0.4f; - if (pid->cache->flag & PTCACHE_BAKED) { - col[0] -= 0.4f; col[1] -= 0.4f; col[2] -= 0.4f; - } - else if (pid->cache->flag & PTCACHE_OUTDATED) { - col[0] += 0.4f; col[1] += 0.4f; col[2] += 0.4f; - } - glColor4fv(col); - - glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(2, GL_FLOAT, 0, stc->array); - glDrawArrays(GL_QUADS, 0, (fp - stc->array) / 2); - glDisableClientState(GL_VERTEX_ARRAY); - - glDisable(GL_BLEND); - - glPopMatrix(); - - yoffs += cache_draw_height; - - stc = stc->next; - } - - BLI_freelistN(&pidlist); - - /* free excessive caches */ - while (stc) { - SpaceTimeCache *tmp = stc->next; - BLI_remlink(&stime->caches, stc); - MEM_freeN(stc->array); - MEM_freeN(stc); - stc = tmp; - } -} - static void time_cache_free(SpaceTime *stime) { SpaceTimeCache *stc; @@ -498,7 +348,6 @@ static void time_main_region_draw(const bContext *C, ARegion *ar) /* draw entirely, view changes should be handled here */ Scene *scene = CTX_data_scene(C); SpaceTime *stime = CTX_wm_space_time(C); - Object *obact = CTX_data_active_object(C); View2D *v2d = &ar->v2d; View2DGrid *grid; View2DScrollers *scrollers; @@ -536,9 +385,6 @@ static void time_main_region_draw(const bContext *C, ARegion *ar) UI_view2d_view_orthoSpecial(ar, v2d, 1); ED_markers_draw(C, 0); - /* caches */ - time_draw_cache(stime, obact, scene); - /* callback */ UI_view2d_view_ortho(v2d); ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW); |