~siretart/ubuntu/utopic/blender/libav10

« back to all changes in this revision

Viewing changes to source/blender/editors/space_time/space_time.c

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2012-07-23 08:54:18 UTC
  • mfrom: (14.2.16 sid)
  • mto: (14.2.19 sid)
  • mto: This revision was merged to the branch mainline in revision 42.
  • Revision ID: package-import@ubuntu.com-20120723085418-9foz30v6afaf5ffs
Tags: 2.63a-2
* debian/: Cycles support added (Closes: #658075)
  For now, this top feature has been enabled only
  on [any-amd64 any-i386] architectures because
  of OpenImageIO failing on all others
* debian/: scripts installation path changed
  from /usr/lib to /usr/share:
  + debian/patches/: patchset re-worked for path changing
  + debian/control: "Breaks" field added on yafaray-exporter

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**
2
 
 * $Id: space_time.c 30189 2010-07-10 21:09:38Z campbellbarton $
3
 
 *
 
1
/*
4
2
 * ***** BEGIN GPL LICENSE BLOCK *****
5
3
 *
6
4
 * This program is free software; you can redistribute it and/or
26
24
 * ***** END GPL LICENSE BLOCK *****
27
25
 */
28
26
 
 
27
/** \file blender/editors/space_time/space_time.c
 
28
 *  \ingroup sptime
 
29
 */
 
30
 
 
31
 
29
32
#include <string.h>
30
33
#include <stdio.h>
31
34
 
32
35
#include "DNA_object_types.h"
33
36
#include "DNA_scene_types.h"
34
 
#include "DNA_particle_types.h"
35
37
 
36
38
#include "MEM_guardedalloc.h"
37
39
 
38
40
#include "BLI_blenlib.h"
39
41
#include "BLI_dlrbTree.h"
 
42
#include "BLI_utildefines.h"
40
43
 
41
44
#include "BKE_context.h"
42
45
#include "BKE_global.h"
43
46
#include "BKE_screen.h"
44
47
#include "BKE_pointcache.h"
45
 
#include "BKE_utildefines.h"
46
48
 
47
49
#include "ED_anim_api.h"
48
50
#include "ED_keyframes_draw.h"
57
59
#include "UI_resources.h"
58
60
#include "UI_view2d.h"
59
61
 
 
62
#include "ED_space_api.h"
60
63
#include "ED_markers.h"
61
64
 
62
65
#include "time_intern.h"
63
66
 
64
67
/* ************************ main time area region *********************** */
65
68
 
66
 
static void time_draw_sfra_efra(const bContext *C, SpaceTime *stime, ARegion *ar)
67
 
{
68
 
        View2D *v2d= UI_view2d_fromcontext(C);
69
 
        Scene *scene= CTX_data_scene(C);
70
 
        
 
69
static void time_draw_sfra_efra(Scene *scene, View2D *v2d)
 
70
{       
71
71
        /* draw darkened area outside of active timeline 
72
 
         * frame range used is preview range or scene range */
73
 
        UI_ThemeColorShade(TH_BACK, -25);
74
 
 
75
 
        if (PSFRA < PEFRA) {
76
 
                glRectf(v2d->cur.xmin, v2d->cur.ymin, (float)PSFRA, v2d->cur.ymax);
77
 
                glRectf((float)PEFRA, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax);
78
 
        }
79
 
        else {
80
 
                glRectf(v2d->cur.xmin, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax);
81
 
        }
 
72
         * frame range used is preview range or scene range 
 
73
         */
 
74
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 
75
        glEnable(GL_BLEND);
 
76
                glColor4f(0.0f, 0.0f, 0.0f, 0.4f);
 
77
                
 
78
                if (PSFRA < PEFRA) {
 
79
                        glRectf(v2d->cur.xmin, v2d->cur.ymin, (float)PSFRA, v2d->cur.ymax);
 
80
                        glRectf((float)PEFRA, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax);
 
81
                }
 
82
                else {
 
83
                        glRectf(v2d->cur.xmin, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax);
 
84
                }
 
85
        glDisable(GL_BLEND);
82
86
 
83
87
        UI_ThemeColorShade(TH_BACK, -60);
84
88
        /* thin lines where the actual frames are */
88
92
 
89
93
#define CACHE_DRAW_HEIGHT       3.0f
90
94
 
91
 
static void time_draw_cache(const bContext *C, SpaceTime *stime, ARegion *ar)
 
95
static void time_draw_cache(SpaceTime *stime, Object *ob)
92
96
{
93
 
        SpaceTimeCache *stc;
 
97
        PTCacheID *pid;
 
98
        ListBase pidlist;
 
99
        SpaceTimeCache *stc = stime->caches.first;
94
100
        float yoffs=0.f;
95
101
        
96
 
        if (!(stime->cache_display & TIME_CACHE_DISPLAY))
 
102
        if (!(stime->cache_display & TIME_CACHE_DISPLAY) || (!ob))
97
103
                return;
98
 
        
99
 
        for (stc= stime->caches.first; stc; stc=stc->next) {
100
 
                float col[4];
101
 
                
102
 
                if (!stc->array || !stc->ok)
 
104
 
 
105
        BKE_ptcache_ids_from_object(&pidlist, ob, NULL, 0);
 
106
 
 
107
        /* iterate over pointcaches on the active object, 
 
108
         * add spacetimecache and vertex array for each */
 
109
        for (pid=pidlist.first; pid; pid=pid->next) {
 
110
                float col[4], *fp;
 
111
                int i, sta = pid->cache->startframe, end = pid->cache->endframe;
 
112
                int len = (end - sta + 1)*4;
 
113
 
 
114
                switch(pid->type) {
 
115
                        case PTCACHE_TYPE_SOFTBODY:
 
116
                                if (!(stime->cache_display & TIME_CACHE_SOFTBODY)) continue;
 
117
                                break;
 
118
                        case PTCACHE_TYPE_PARTICLES:
 
119
                                if (!(stime->cache_display & TIME_CACHE_PARTICLES))     continue;
 
120
                                break;
 
121
                        case PTCACHE_TYPE_CLOTH:
 
122
                                if (!(stime->cache_display & TIME_CACHE_CLOTH)) continue;
 
123
                                break;
 
124
                        case PTCACHE_TYPE_SMOKE_DOMAIN:
 
125
                        case PTCACHE_TYPE_SMOKE_HIGHRES:
 
126
                                if (!(stime->cache_display & TIME_CACHE_SMOKE)) continue;
 
127
                                break;
 
128
                        case PTCACHE_TYPE_DYNAMICPAINT:
 
129
                                if (!(stime->cache_display & TIME_CACHE_DYNAMICPAINT))  continue;
 
130
                                break;
 
131
                }
 
132
 
 
133
                if (pid->cache->cached_frames == NULL)
103
134
                        continue;
 
135
 
 
136
                /* make sure we have stc with correct array length */
 
137
                if (stc == NULL || MEM_allocN_len(stc->array) != len*2*sizeof(float)) {
 
138
                        if (stc) {
 
139
                                MEM_freeN(stc->array);
 
140
                        }
 
141
                        else {
 
142
                                stc = MEM_callocN(sizeof(SpaceTimeCache), "spacetimecache");
 
143
                                BLI_addtail(&stime->caches, stc);
 
144
                        }
 
145
 
 
146
                        stc->array = MEM_callocN(len*2*sizeof(float), "SpaceTimeCache array");
 
147
                }
 
148
 
 
149
                /* fill the vertex array with a quad for each cached frame */
 
150
                for (i=sta, fp=stc->array; i<=end; i++) {
 
151
                        if (pid->cache->cached_frames[i-sta]) {
 
152
                                fp[0] = (float)i-0.5f;
 
153
                                fp[1] = 0.0;
 
154
                                fp+=2;
 
155
                                
 
156
                                fp[0] = (float)i-0.5f;
 
157
                                fp[1] = 1.0;
 
158
                                fp+=2;
 
159
                                
 
160
                                fp[0] = (float)i+0.5f;
 
161
                                fp[1] = 1.0;
 
162
                                fp+=2;
 
163
                                
 
164
                                fp[0] = (float)i+0.5f;
 
165
                                fp[1] = 0.0;
 
166
                                fp+=2;
 
167
                        }
 
168
                }
104
169
                
105
170
                glPushMatrix();
106
171
                glTranslatef(0.0, (float)V2D_SCROLL_HEIGHT+yoffs, 0.0);
107
172
                glScalef(1.0, CACHE_DRAW_HEIGHT, 0.0);
108
173
                
109
 
                switch(stc->type) {
 
174
                switch(pid->type) {
110
175
                        case PTCACHE_TYPE_SOFTBODY:
111
176
                                col[0] = 1.0;   col[1] = 0.4;   col[2] = 0.02;
112
177
                                col[3] = 0.1;
124
189
                                col[0] = 0.2;   col[1] = 0.2;   col[2] = 0.2;
125
190
                                col[3] = 0.1;
126
191
                                break;
 
192
                        case PTCACHE_TYPE_DYNAMICPAINT:
 
193
                                col[0] = 1.0;   col[1] = 0.1;   col[2] = 0.75;
 
194
                                col[3] = 0.1;
 
195
                                break;
 
196
                        default:
 
197
                                BLI_assert(0);
 
198
                                col[0] = 1.0;   col[1] = 0.0;   col[2] = 1.0;
 
199
                                col[3] = 0.1;
127
200
                }
128
201
                glColor4fv(col);
129
202
                
130
203
                glEnable(GL_BLEND);
131
204
                
132
 
                glRectf((float)stc->startframe, 0.0, (float)stc->endframe, 1.0);
 
205
                glRectf((float)sta, 0.0, (float)end, 1.0);
133
206
                
134
 
                col[3] = 0.4;
135
 
                if (stc->flag & PTCACHE_BAKED) {
136
 
                        col[0] -= 0.4;  col[1] -= 0.4;  col[2] -= 0.4;
 
207
                col[3] = 0.4f;
 
208
                if (pid->cache->flag & PTCACHE_BAKED) {
 
209
                        col[0] -= 0.4f; col[1] -= 0.4f; col[2] -= 0.4f;
137
210
                }
138
211
                glColor4fv(col);
139
212
                
140
213
                glEnableClientState(GL_VERTEX_ARRAY);
141
214
                glVertexPointer(2, GL_FLOAT, 0, stc->array);
142
 
                glDrawArrays(GL_QUADS, 0, stc->len);
 
215
                glDrawArrays(GL_QUADS, 0, (fp-stc->array)/2);
143
216
                glDisableClientState(GL_VERTEX_ARRAY);
144
217
                
145
218
                glDisable(GL_BLEND);
147
220
                glPopMatrix();
148
221
                
149
222
                yoffs += CACHE_DRAW_HEIGHT;
 
223
 
 
224
                stc = stc->next;
 
225
        }
 
226
 
 
227
        BLI_freelistN(&pidlist);
 
228
 
 
229
        /* free excessive caches */
 
230
        while (stc) {
 
231
                SpaceTimeCache *tmp = stc->next;
 
232
                BLI_remlink(&stime->caches, stc);
 
233
                MEM_freeN(stc->array);
 
234
                MEM_freeN(stc);
 
235
                stc = tmp;
150
236
        }
151
237
}
152
238
 
164
250
        BLI_freelistN(&stime->caches);
165
251
}
166
252
 
167
 
static void time_cache_refresh(const bContext *C, SpaceTime *stime, ARegion *ar)
 
253
static void time_cache_refresh(SpaceTime *stime)
168
254
{
169
 
        Object *ob = CTX_data_active_object(C);
170
 
        PTCacheID *pid;
171
 
        ListBase pidlist;
172
 
        
 
255
        /* Free previous caches to indicate full refresh */
173
256
        time_cache_free(stime);
174
 
        
175
 
        if (!(stime->cache_display & TIME_CACHE_DISPLAY) || (!ob))
176
 
                return;
177
 
        
178
 
        BKE_ptcache_ids_from_object(&pidlist, ob, NULL, 0);
179
 
        
180
 
        /* iterate over pointcaches on the active object, 
181
 
         * add spacetimecache and vertex array for each */
182
 
        for(pid=pidlist.first; pid; pid=pid->next) {
183
 
                SpaceTimeCache *stc;
184
 
                float *fp, *array;
185
 
                int i, len;
186
 
                
187
 
                switch(pid->type) {
188
 
                        case PTCACHE_TYPE_SOFTBODY:
189
 
                                if (!(stime->cache_display & TIME_CACHE_SOFTBODY)) continue;
190
 
                                break;
191
 
                        case PTCACHE_TYPE_PARTICLES:
192
 
                                if (!(stime->cache_display & TIME_CACHE_PARTICLES))     continue;
193
 
                                break;
194
 
                        case PTCACHE_TYPE_CLOTH:
195
 
                                if (!(stime->cache_display & TIME_CACHE_CLOTH)) continue;
196
 
                                break;
197
 
                        case PTCACHE_TYPE_SMOKE_DOMAIN:
198
 
                        case PTCACHE_TYPE_SMOKE_HIGHRES:
199
 
                                if (!(stime->cache_display & TIME_CACHE_SMOKE)) continue;
200
 
                                break;
201
 
                }
202
 
                
203
 
                stc= MEM_callocN(sizeof(SpaceTimeCache), "spacetimecache");
204
 
                
205
 
                stc->type = pid->type;
206
 
                
207
 
                if (pid->cache->flag & PTCACHE_BAKED)
208
 
                        stc->flag |= PTCACHE_BAKED;
209
 
                if (pid->cache->flag & PTCACHE_DISK_CACHE)
210
 
                        stc->flag |= PTCACHE_DISK_CACHE;
211
 
                
212
 
                /* first allocate with maximum number of frames needed */
213
 
                BKE_ptcache_id_time(pid, CTX_data_scene(C), 0, &stc->startframe, &stc->endframe, NULL);
214
 
                len = (stc->endframe - stc->startframe + 1)*4;
215
 
                fp = array = MEM_callocN(len*2*sizeof(float), "temporary timeline cache array");
216
 
                
217
 
                /* fill the vertex array with a quad for each cached frame */
218
 
                for (i=stc->startframe; i<=stc->endframe; i++) {
219
 
                        
220
 
                        if (BKE_ptcache_id_exist(pid, i)) {
221
 
                                fp[0] = (float)i;
222
 
                                fp[1] = 0.0;
223
 
                                fp+=2;
224
 
                                
225
 
                                fp[0] = (float)i;
226
 
                                fp[1] = 1.0;
227
 
                                fp+=2;
228
 
                                
229
 
                                fp[0] = (float)(i+1);
230
 
                                fp[1] = 1.0;
231
 
                                fp+=2;
232
 
                                
233
 
                                fp[0] = (float)(i+1);
234
 
                                fp[1] = 0.0;
235
 
                                fp+=2;
236
 
                        }
237
 
                }
238
 
                /* update with final number of frames */
239
 
                stc->len = (i-stc->startframe)*4;
240
 
                stc->array = MEM_mallocN(stc->len*2*sizeof(float), "SpaceTimeCache array");
241
 
                memcpy(stc->array, array, stc->len*2*sizeof(float));
242
 
                
243
 
                MEM_freeN(array);
244
 
                array = NULL;
245
 
                
246
 
                stc->ok = 1;
247
 
                
248
 
                BLI_addtail(&stime->caches, stc);
249
 
        }
250
 
        
251
 
        /* todo: sort time->caches list for consistent order */
252
 
        // ...
253
 
        
254
 
        BLI_freelistN(&pidlist);
255
257
}
256
258
 
257
259
/* helper function - find actkeycolumn that occurs on cframe, or the nearest one if not found */
279
281
/* helper for time_draw_keyframes() */
280
282
static void time_draw_idblock_keyframes(View2D *v2d, ID *id, short onlysel)
281
283
{
282
 
        bDopeSheet ads;
 
284
        bDopeSheet ads= {NULL};
283
285
        DLRBT_Tree keys;
284
286
        ActKeyColumn *ak;
285
287
        
287
289
        BLI_dlrbTree_init(&keys);
288
290
        
289
291
        /* init dopesheet settings */
290
 
        // FIXME: the ob_to_keylist function currently doesn't take this into account...
291
 
        memset(&ads, 0, sizeof(bDopeSheet));
292
292
        if (onlysel)
293
293
                ads.filterflag |= ADS_FILTER_ONLYSEL;
294
294
        
315
315
                         (ak) && (ak->cfra <= v2d->cur.xmax); 
316
316
                          ak=ak->next ) 
317
317
                {
318
 
                        glVertex2f(ak->cfra, v2d->cur.ymin);
319
 
                        glVertex2f(ak->cfra, v2d->cur.ymax);
 
318
                        glVertex2f(ak->cfra, v2d->tot.ymin);
 
319
                        glVertex2f(ak->cfra, v2d->tot.ymax);
320
320
                }
321
321
        glEnd(); // GL_LINES
322
322
                
376
376
 
377
377
/* ---------------- */
378
378
 
379
 
static void time_refresh(const bContext *C, ScrArea *sa)
 
379
static void time_refresh(const bContext *UNUSED(C), ScrArea *sa)
380
380
{
381
 
        SpaceTime *stime = (SpaceTime *)sa->spacedata.first;
382
 
        ARegion *ar;
383
 
        
384
381
        /* find the main timeline region and refresh cache display*/
385
 
        for (ar= sa->regionbase.first; ar; ar= ar->next) {
386
 
                if (ar->regiontype==RGN_TYPE_WINDOW) {
387
 
                        time_cache_refresh(C, stime, ar);
388
 
                        break;
389
 
                }
 
382
        ARegion *ar= BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
 
383
        if (ar) {
 
384
                SpaceTime *stime = (SpaceTime *)sa->spacedata.first;
 
385
                time_cache_refresh(stime);
390
386
        }
391
387
}
392
388
 
398
394
        switch (wmn->category) {
399
395
                case NC_OBJECT:
400
396
                        switch (wmn->data) {
 
397
                                case ND_BONE_ACTIVE:
401
398
                                case ND_POINTCACHE:
 
399
                                case ND_MODIFIER:
 
400
                                case ND_PARTICLE:
402
401
                                        ED_area_tag_refresh(sa);
403
402
                                        ED_area_tag_redraw(sa);
404
403
                                        break;
405
404
                        }
406
405
                        break;
407
406
                case NC_SCENE:
408
 
                        switch (wmn->data) {    
 
407
                        switch (wmn->data) {
409
408
                                case ND_OB_ACTIVE:
410
409
                                case ND_FRAME:
411
410
                                        ED_area_tag_refresh(sa);
417
416
 
418
417
                                                for (ar= sa->regionbase.first; ar; ar= ar->next) {
419
418
                                                        if (ar->regiontype==RGN_TYPE_WINDOW) {
420
 
                                                                ar->v2d.tot.xmin= (float)(SFRA - 4);
421
 
                                                                ar->v2d.tot.xmax= (float)(EFRA + 4);
 
419
                                                                ar->v2d.tot.xmin = (float)(SFRA - 4);
 
420
                                                                ar->v2d.tot.xmax = (float)(EFRA + 4);
422
421
                                                                break;
423
422
                                                        }
424
423
                                                }
426
425
                                        break;
427
426
                        }
428
427
                case NC_SPACE:
429
 
                        switch (wmn->data) {    
 
428
                        switch (wmn->data) {
430
429
                                case ND_SPACE_CHANGED:
431
430
                                        ED_area_tag_refresh(sa);
432
431
                                        break;
433
432
                        }
 
433
                case NC_WM:
 
434
                        switch (wmn->data) {
 
435
                                case ND_FILEREAD:
 
436
                                        ED_area_tag_refresh(sa);
 
437
                                        break;
 
438
                        }
434
439
        }
435
440
}
436
441
 
444
449
        UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
445
450
        
446
451
        /* own keymap */
447
 
        keymap= WM_keymap_find(wm->defaultconf, "Timeline", SPACE_TIME, 0);
 
452
        keymap = WM_keymap_find(wm->defaultconf, "Timeline", SPACE_TIME, 0);
448
453
        WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
449
454
}
450
455
 
451
456
static void time_main_area_draw(const bContext *C, ARegion *ar)
452
457
{
453
458
        /* draw entirely, view changes should be handled here */
 
459
        Scene *scene= CTX_data_scene(C);
454
460
        SpaceTime *stime= CTX_wm_space_time(C);
 
461
        Object *obact = CTX_data_active_object(C);
455
462
        View2D *v2d= &ar->v2d;
456
463
        View2DGrid *grid;
457
464
        View2DScrollers *scrollers;
461
468
        UI_ThemeClearColor(TH_BACK);
462
469
        glClear(GL_COLOR_BUFFER_BIT);
463
470
        
464
 
        UI_view2d_view_ortho(C, v2d);
465
 
 
466
 
        /* start and end frame */
467
 
        time_draw_sfra_efra(C, stime, ar);
 
471
        UI_view2d_view_ortho(v2d);
468
472
        
469
473
        /* grid */
470
474
        unit= (stime->flag & TIME_DRAWFRAMES)? V2D_UNIT_FRAMES: V2D_UNIT_SECONDS;
471
 
        grid= UI_view2d_grid_calc(C, v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY, ar->winx, ar->winy);
472
 
        UI_view2d_grid_draw(C, v2d, grid, (V2D_VERTICAL_LINES|V2D_VERTICAL_AXIS));
 
475
        grid= UI_view2d_grid_calc(scene, v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY, ar->winx, ar->winy);
 
476
        UI_view2d_grid_draw(v2d, grid, (V2D_VERTICAL_LINES|V2D_VERTICAL_AXIS));
473
477
        UI_view2d_grid_free(grid);
474
478
        
475
 
        /* keyframes */
476
 
        if(!G.rendering) /* ANIM_nla_mapping_apply_fcurve() modifies curve data while rendering, possible race condition */
477
 
                time_draw_keyframes(C, stime, ar);
 
479
        /* start and end frame */
 
480
        time_draw_sfra_efra(scene, v2d);
478
481
        
479
482
        /* current frame */
 
483
        flag = DRAWCFRA_WIDE; /* this is only really needed on frames where there's a keyframe, but this will do... */
480
484
        if ((stime->flag & TIME_DRAWFRAMES)==0)         flag |= DRAWCFRA_UNIT_SECONDS;
481
485
        if (stime->flag & TIME_CFRA_NUM)                        flag |= DRAWCFRA_SHOW_NUMBOX;
482
486
        ANIM_draw_cfra(C, v2d, flag);
483
487
        
 
488
        UI_view2d_view_ortho(v2d);
 
489
        
 
490
        /* keyframes */
 
491
        time_draw_keyframes(C, stime, ar);
 
492
        
484
493
        /* markers */
485
 
        UI_view2d_view_orthoSpecial(C, v2d, 1);
 
494
        UI_view2d_view_orthoSpecial(ar, v2d, 1);
486
495
        draw_markers_time(C, 0);
487
496
        
488
497
        /* caches */
489
 
        time_draw_cache(C, stime, ar);
 
498
        time_draw_cache(stime, obact);
490
499
        
491
500
        /* reset view matrix */
492
501
        UI_view2d_view_restore(C);
502
511
        /* context changes */
503
512
        switch(wmn->category) {
504
513
                case NC_SPACE:
505
 
                        if(wmn->data == ND_SPACE_TIME)
 
514
                        if (wmn->data == ND_SPACE_TIME)
506
515
                                ED_region_tag_redraw(ar);
507
516
                        break;
508
517
 
511
520
                        break;
512
521
                
513
522
                case NC_SCENE:
514
 
                        ED_region_tag_redraw(ar);
515
 
                        break;
516
 
                
 
523
                        switch (wmn->data) {
 
524
                                case ND_OB_SELECT:
 
525
                                case ND_OB_ACTIVE:
 
526
                                case ND_FRAME:
 
527
                                case ND_FRAME_RANGE:
 
528
                                case ND_KEYINGSET:
 
529
                                case ND_RENDER_OPTIONS:
 
530
                                        ED_region_tag_redraw(ar);
 
531
                                break;
 
532
                        }
517
533
        }
518
534
}
519
535
 
520
536
/* ************************ header time area region *********************** */
521
537
 
522
538
/* add handlers, stuff you only do once or on area/region changes */
523
 
static void time_header_area_init(wmWindowManager *wm, ARegion *ar)
 
539
static void time_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar)
524
540
{
525
541
        ED_region_header_init(ar);
526
542
}
535
551
        /* context changes */
536
552
        switch(wmn->category) {
537
553
                case NC_SCREEN:
538
 
                        if(wmn->data==ND_ANIMPLAY)
 
554
                        if (wmn->data==ND_ANIMPLAY)
539
555
                                ED_region_tag_redraw(ar);
540
556
                        break;
541
557
 
542
558
                case NC_SCENE:
543
559
                        switch (wmn->data) {
 
560
                                case ND_OB_SELECT:
544
561
                                case ND_FRAME:
 
562
                                case ND_FRAME_RANGE:
545
563
                                case ND_KEYINGSET:
546
564
                                case ND_RENDER_OPTIONS:
547
565
                                        ED_region_tag_redraw(ar);
549
567
                        }
550
568
 
551
569
                case NC_SPACE:
552
 
                        if(wmn->data == ND_SPACE_TIME)
 
570
                        if (wmn->data == ND_SPACE_TIME)
553
571
                                ED_region_tag_redraw(ar);
554
572
                        break;
555
573
        }
566
584
        stime= MEM_callocN(sizeof(SpaceTime), "inittime");
567
585
 
568
586
        stime->spacetype= SPACE_TIME;
569
 
        stime->redraws= TIME_ALL_3D_WIN|TIME_ALL_ANIM_WIN;
570
587
        stime->flag |= TIME_DRAWFRAMES;
571
588
 
572
589
        /* header */
582
599
        BLI_addtail(&stime->regionbase, ar);
583
600
        ar->regiontype= RGN_TYPE_WINDOW;
584
601
        
585
 
        ar->v2d.tot.xmin= (float)(SFRA - 4);
586
 
        ar->v2d.tot.ymin= 0.0f;
587
 
        ar->v2d.tot.xmax= (float)(EFRA + 4);
588
 
        ar->v2d.tot.ymax= 50.0f;
 
602
        ar->v2d.tot.xmin = (float)(SFRA - 4);
 
603
        ar->v2d.tot.ymin = 0.0f;
 
604
        ar->v2d.tot.xmax = (float)(EFRA + 4);
 
605
        ar->v2d.tot.ymax = 50.0f;
589
606
        
590
607
        ar->v2d.cur= ar->v2d.tot;
591
608
 
617
634
/* spacetype; init callback in ED_area_initialize() */
618
635
/* init is called to (re)initialize an existing editor (file read, screen changes) */
619
636
/* validate spacedata, add own area level handlers */
620
 
static void time_init(wmWindowManager *wm, ScrArea *sa)
 
637
static void time_init(wmWindowManager *UNUSED(wm), ScrArea *sa)
621
638
{
622
639
        SpaceTime *stime= (SpaceTime *)sa->spacedata.first;
623
640
        
626
643
        /* enable all cache display */
627
644
        stime->cache_display |= TIME_CACHE_DISPLAY;
628
645
        stime->cache_display |= (TIME_CACHE_SOFTBODY|TIME_CACHE_PARTICLES);
629
 
        stime->cache_display |= (TIME_CACHE_CLOTH|TIME_CACHE_SMOKE);
 
646
        stime->cache_display |= (TIME_CACHE_CLOTH|TIME_CACHE_SMOKE|TIME_CACHE_DYNAMICPAINT);
630
647
}
631
648
 
632
649
static SpaceLink *time_duplicate(SpaceLink *sl)
634
651
        SpaceTime *stime= (SpaceTime *)sl;
635
652
        SpaceTime *stimen= MEM_dupallocN(stime);
636
653
        
637
 
        time_cache_free(stimen);
 
654
        stimen->caches.first = stimen->caches.last = NULL;
638
655
        
639
656
        return (SpaceLink *)stimen;
640
657
}