~ubuntu-branches/ubuntu/gutsy/blender/gutsy-security

« back to all changes in this revision

Viewing changes to source/blender/src/drawoops.c

  • Committer: Bazaar Package Importer
  • Author(s): Florian Ernst
  • Date: 2005-11-06 12:40:03 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051106124003-3pgs7tcg5rox96xg
Tags: 2.37a-1.1
* Non-maintainer upload.
* Split out parts of 01_SConstruct_debian.dpatch again: root_build_dir
  really needs to get adjusted before the clean target runs - closes: #333958,
  see #288882 for reference

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**
2
 
 * $Id: drawoops.c,v 1.13 2004/03/14 16:59:46 zuster Exp $
 
2
 * $Id: drawoops.c,v 1.20 2005/04/30 21:27:05 ton Exp $
3
3
 *
4
4
 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
5
5
 *
38
38
#include <config.h>
39
39
#endif
40
40
 
41
 
#ifdef _WIN32
42
 
#include "BLI_winstuff.h"
43
 
#endif
44
 
 
45
41
#include "BMF_Api.h"
46
42
 
47
43
#include "BLI_blenlib.h"
58
54
#include "BKE_utildefines.h"
59
55
#include "BKE_global.h"
60
56
 
 
57
#include "BIF_interface.h"
61
58
#include "BIF_gl.h"
62
 
#include "BIF_interface.h"
63
59
#include "BIF_glutil.h"
 
60
#include "BIF_mywindow.h"
 
61
#include "BIF_outliner.h"
64
62
#include "BIF_resources.h"
65
63
#include "BIF_screen.h"
66
 
#include "BIF_mywindow.h"
67
 
#include "BIF_resources.h"
68
64
 
69
65
/*  #include "BIF_drawoops.h" bad name :(*/
70
66
#include "BIF_oops.h"
72
68
#include "BSE_drawipo.h"
73
69
#include "BSE_drawoops.h"
74
70
 
 
71
#include "BKE_depsgraph.h"
 
72
 
 
73
extern void build_deps(short mask);
 
74
//extern void draw_deps(DagNode *node);
 
75
 
 
76
 
75
77
float oopscalex;
76
78
 
77
79
void boundbox_oops()
129
131
void draw_oopslink(Oops *oops)
130
132
{
131
133
        OopsLink *ol;
132
 
        float vec[4];
 
134
        float vec[4][3], dist;
 
135
        int a;
133
136
        
134
137
        if(oops->type==ID_SCE) {
135
138
                if(oops->flag & SELECT) {
146
149
                else cpack(0x0);
147
150
        }
148
151
        
 
152
        glEnable(GL_MAP1_VERTEX_3);
 
153
        vec[0][2]= vec[1][2]= vec[2][2]= vec[3][2]= 0.0;
 
154
        
149
155
        ol= oops->link.first;
150
156
        while(ol) {
151
157
                if(ol->to && ol->to->hide==0) {
152
158
                        
153
 
                        give_oopslink_line(oops, ol, vec, vec+2);
 
159
                        give_oopslink_line(oops, ol, vec[0], vec[3]);
 
160
                        
 
161
                        dist= 0.5*VecLenf(vec[0], vec[3]);
 
162
 
 
163
                        /* check ol->xof and yof for direction */
 
164
                        if(ol->xof == 0.0) {
 
165
                                vec[1][0]= vec[0][0]-dist;
 
166
                                vec[1][1]= vec[0][1];
 
167
                        }
 
168
                        else if(ol->xof==OOPSX) {
 
169
                                vec[1][0]= vec[0][0]+dist;
 
170
                                vec[1][1]= vec[0][1];
 
171
                        }
 
172
                        else {
 
173
                                vec[1][0]= vec[0][0];
 
174
                                vec[1][1]= vec[0][1]+dist;
 
175
                        }
 
176
                        
 
177
                        /* v3 is always pointing down */
 
178
                        vec[2][0]= vec[3][0];
 
179
                        vec[2][1]= vec[3][1] - dist;
 
180
 
 
181
                        glMap1f(GL_MAP1_VERTEX_3, 0.0, 1.0, 3, 4, vec[0]);
154
182
                        
155
183
                        glBegin(GL_LINE_STRIP);
156
 
                        glVertex2fv(vec);
157
 
                        glVertex2fv(vec+2);
 
184
                        for(a=0; a<=30; a++) {
 
185
                                glEvalCoord1f((float)a/30.0);
 
186
                        }
158
187
                        glEnd();
159
188
                }
160
189
                ol= ol->next;
366
395
 
367
396
void drawoopsspace(ScrArea *sa, void *spacedata)
368
397
{
 
398
        SpaceOops *soops= spacedata;
369
399
        Oops *oops;
370
400
        float col[3];
371
 
        int ofsx, ofsy;
372
401
        
373
402
        BIF_GetThemeColor3fv(TH_BACK, col);
374
403
        glClearColor(col[0], col[1], col[2], 0.0);
375
404
        glClear(GL_COLOR_BUFFER_BIT);
376
 
        if(G.soops==0) return;  
377
 
 
378
 
        boundbox_oops();
379
 
        calc_scrollrcts(G.v2d, curarea->winx, curarea->winy);
380
 
 
381
 
        if(curarea->winx>SCROLLB+10 && curarea->winy>SCROLLH+10) {
382
 
                if(G.v2d->scroll) {     
383
 
                        ofsx= curarea->winrct.xmin;     /* because of mywin */
384
 
                        ofsy= curarea->winrct.ymin;
385
 
 
386
 
                        glViewport(ofsx+G.v2d->mask.xmin,  ofsy+G.v2d->mask.ymin, ( ofsx+G.v2d->mask.xmax-1)-(ofsx+G.v2d->mask.xmin)+1, ( ofsy+G.v2d->mask.ymax-1)-( ofsy+G.v2d->mask.ymin)+1); 
387
 
                        glScissor(ofsx+G.v2d->mask.xmin,  ofsy+G.v2d->mask.ymin, ( ofsx+G.v2d->mask.xmax-1)-(ofsx+G.v2d->mask.xmin)+1, ( ofsy+G.v2d->mask.ymax-1)-( ofsy+G.v2d->mask.ymin)+1);
388
 
                }
389
 
        }
390
 
 
391
 
        myortho2(G.v2d->cur.xmin, G.v2d->cur.xmax, G.v2d->cur.ymin, G.v2d->cur.ymax);
392
 
 
393
 
        oopscalex= .14*((float)curarea->winx)/(G.v2d->cur.xmax-G.v2d->cur.xmin);
394
 
        calc_ipogrid(); /* for scrollvariables */
395
 
        build_oops();
396
 
 
397
 
        oops= G.soops->oops.first;
398
 
        while(oops) {
399
 
                if(oops->hide==0) {
400
 
                        draw_oopslink(oops);
401
 
                }
402
 
                oops= oops->next;
403
 
        }
404
 
        oops= G.soops->oops.first;
405
 
        while(oops) {
406
 
                if(oops->hide==0) {
407
 
                        if(oops->flag & SELECT); else draw_oops(oops);
408
 
                }
409
 
                oops= oops->next;
410
 
        }
411
 
        oops= G.soops->oops.first;
412
 
        while(oops) {
413
 
                if(oops->hide==0) {
414
 
                        if(oops->flag & SELECT) draw_oops(oops);
415
 
                }
416
 
                oops= oops->next;
 
405
        if(soops==0) return;    
 
406
        
 
407
        if(soops->type==SO_OUTLINER) draw_outliner(sa, soops);
 
408
        else if (soops->type==SO_DEPSGRAPH) {
 
409
                build_deps(soops->deps_flags);
 
410
                boundbox_deps();
 
411
                calc_scrollrcts(sa,G.v2d, curarea->winx, curarea->winy);
 
412
 
 
413
                myortho2(G.v2d->cur.xmin, G.v2d->cur.xmax, G.v2d->cur.ymin, G.v2d->cur.ymax);
 
414
 
 
415
                oopscalex= .14*((float)curarea->winx)/(G.v2d->cur.xmax-G.v2d->cur.xmin);
 
416
                calc_ipogrid(); /* for scrollvariables */
 
417
                draw_all_deps();
 
418
        } else {
 
419
                boundbox_oops();
 
420
                calc_scrollrcts(sa, G.v2d, curarea->winx, curarea->winy);
 
421
 
 
422
                myortho2(G.v2d->cur.xmin, G.v2d->cur.xmax, G.v2d->cur.ymin, G.v2d->cur.ymax);
 
423
 
 
424
                oopscalex= .14*((float)curarea->winx)/(G.v2d->cur.xmax-G.v2d->cur.xmin);
 
425
                calc_ipogrid(); /* for scrollvariables */
 
426
                build_oops();
 
427
 
 
428
                oops= soops->oops.first;
 
429
                while(oops) {
 
430
                        if(oops->hide==0) {
 
431
                                draw_oopslink(oops);
 
432
                        }
 
433
                        oops= oops->next;
 
434
                }
 
435
                oops= soops->oops.first;
 
436
                while(oops) {
 
437
                        if(oops->hide==0) {
 
438
                                if(oops->flag & SELECT); else draw_oops(oops);
 
439
                        }
 
440
                        oops= oops->next;
 
441
                }
 
442
                oops= soops->oops.first;
 
443
                while(oops) {
 
444
                        if(oops->hide==0) {
 
445
                                if(oops->flag & SELECT) draw_oops(oops);
 
446
                        }
 
447
                        oops= oops->next;
 
448
                }
417
449
        }
418
450
        
419
451
        /* restore viewport */
420
452
        mywinset(curarea->win);
421
 
 
422
453
        
423
454
        /* ortho at pixel level curarea */
424
455
        myortho2(-0.375, sa->winx-0.375, -0.375, sa->winy-0.375);
425
 
        if(G.v2d->scroll) {     
426
 
                drawscroll(0);          
 
456
 
 
457
        if(soops->type==SO_OUTLINER) {
 
458
                if(sa->winx>SCROLLB+10 && sa->winy>SCROLLH+10) {
 
459
                        if(G.v2d->scroll) drawscroll(0);                
 
460
                }
427
461
        }
428
462
        draw_area_emboss(sa);   
429
463