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

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Florian Ernst
  • Date: 2007-05-17 11:47:59 UTC
  • mfrom: (1.2.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20070517114759-yp4ybrnhp2u7pk66
Tags: 2.44-1
* New upstream release.
* Drop debian/patches/01_64bits_stupidity, not needed anymore: as of this
  version blender is 64 bits safe again. Adjust README.Debian accordingly.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**
2
 
 * $Id: drawview.c,v 1.272 2007/02/01 20:25:24 khughes Exp $
 
2
 * $Id: drawview.c,v 1.288 2007/04/26 19:05:22 campbellbarton Exp $
3
3
 *
4
4
 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
5
5
 *
65
65
#include "DNA_curve_types.h"
66
66
#include "DNA_group_types.h"
67
67
#include "DNA_image_types.h"
 
68
#include "DNA_key_types.h"
68
69
#include "DNA_lattice_types.h"
69
70
#include "DNA_mesh_types.h"
70
71
#include "DNA_meshdata_types.h"
612
613
        /* center cross */
613
614
        if(G.vd->view==3) make_axis_color(col, col2, 'y');
614
615
        else make_axis_color(col, col2, 'x');
615
 
        glColor3ubv(col2);
 
616
        glColor3ubv((GLubyte *)col2);
616
617
        
617
618
        fdrawline(0.0,  y,  (float)curarea->winx,  y); 
618
619
        
619
620
        if(G.vd->view==7) make_axis_color(col, col2, 'y');
620
621
        else make_axis_color(col, col2, 'z');
621
 
        glColor3ubv(col2);
 
622
        glColor3ubv((GLubyte *)col2);
622
623
 
623
624
        fdrawline(x, 0.0, x, (float)curarea->winy); 
624
625
 
662
663
                        /* check for the 'show Y axis' preference */
663
664
                        if (vd->gridflag & V3D_SHOW_Y) { 
664
665
                                make_axis_color(col, col2, 'y');
665
 
                                glColor3ubv(col2);
 
666
                                glColor3ubv((GLubyte *)col2);
666
667
                                
667
668
                                draw_line = 1;
668
669
                        } else if (vd->gridflag & V3D_SHOW_FLOOR) {
701
702
                        /* check for the 'show X axis' preference */
702
703
                        if (vd->gridflag & V3D_SHOW_X) { 
703
704
                                make_axis_color(col, col2, 'x');
704
 
                                glColor3ubv(col2);
 
705
                                glColor3ubv((GLubyte *)col2);
705
706
                                
706
707
                                draw_line = 1;
707
708
                        } else if (vd->gridflag & V3D_SHOW_FLOOR) {
738
739
        /* check for the 'show Z axis' preference */
739
740
        if (vd->gridflag & V3D_SHOW_Z) {
740
741
                make_axis_color(col, col2, 'z');
741
 
                glColor3ubv(col2);
 
742
                glColor3ubv((GLubyte *)col2);
742
743
                
743
744
                glBegin(GL_LINE_STRIP);
744
745
                vert[0]= 0;
985
986
        y2= viewborder.ymax;
986
987
 
987
988
        /* passepartout, specified in camera edit buttons */
988
 
        if (ca && (ca->flag & CAM_SHOWPASSEPARTOUT)) {
989
 
                glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
990
 
                glEnable(GL_BLEND);
991
 
                glColor4f(0, 0, 0, ca->passepartalpha);
992
 
                
 
989
        if (ca && (ca->flag & CAM_SHOWPASSEPARTOUT) && ca->passepartalpha > 0.000001) {
 
990
                if (ca->passepartalpha == 1.0) {
 
991
                        glColor3f(0, 0, 0);
 
992
                } else {
 
993
                        glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
 
994
                        glEnable(GL_BLEND);
 
995
                        glColor4f(0, 0, 0, ca->passepartalpha);
 
996
                }
993
997
                if (x1 > 0.0)
994
998
                        glRectf(0.0, (float)curarea->winy, x1, 0.0);
995
999
                if (x2 < (float)curarea->winx)
1342
1346
                else
1343
1347
                        sprintf(info, "(%d) %s", CFRA, ob->id.name+2);
1344
1348
        }
 
1349
        else if(ob->type==OB_MESH) {
 
1350
                Key *key= NULL;
 
1351
                KeyBlock *kb = NULL;
 
1352
                char shapes[75];
 
1353
                
 
1354
                shapes[0] = 0;
 
1355
                key = ob_get_key(ob);
 
1356
                if(key){
 
1357
                        kb = BLI_findlink(&key->block, ob->shapenr-1);
 
1358
                        if(kb){
 
1359
                                sprintf(shapes, ": %s ", kb->name);             
 
1360
                                if(ob->shapeflag == OB_SHAPE_LOCK){
 
1361
                                        sprintf(shapes, "%s (Pinned)",shapes);
 
1362
                                }
 
1363
                        }
 
1364
                }
 
1365
                sprintf(info, "(%d) %s %s", CFRA, ob->id.name+2, shapes);
 
1366
        }
1345
1367
        else sprintf(info, "(%d) %s", CFRA, ob->id.name+2);
1346
1368
 
1347
1369
        BIF_ThemeColor(TH_TEXT_HI);
1372
1394
        float dx, dy;
1373
1395
        float h, s, v;
1374
1396
        
1375
 
        BIF_GetThemeColor3ubv(TH_GRID, gridcol);
 
1397
        BIF_GetThemeColor3ubv(TH_GRID, (char *)gridcol);
1376
1398
        
1377
1399
        /* X */
1378
1400
        vec[0] = vec[3] = 1;
1379
1401
        vec[1] = vec[2] = 0;
1380
1402
        QuatMulVecf(G.vd->viewquat, vec);
1381
1403
        
1382
 
        make_axis_color(gridcol, col, 'x');
 
1404
        make_axis_color((char *)gridcol, (char *)col, 'x');
1383
1405
        rgb_to_hsv(col[0]/255.0f, col[1]/255.0f, col[2]/255.0f, &h, &s, &v);
1384
1406
        s = s<0.5 ? s+0.5 : 1.0;
1385
1407
        v = 0.3;
1400
1422
        vec[0] = vec[2] = 0;
1401
1423
        QuatMulVecf(G.vd->viewquat, vec);
1402
1424
        
1403
 
        make_axis_color(gridcol, col, 'y');
 
1425
        make_axis_color((char *)gridcol, (char *)col, 'y');
1404
1426
        rgb_to_hsv(col[0]/255.0f, col[1]/255.0f, col[2]/255.0f, &h, &s, &v);
1405
1427
        s = s<0.5 ? s+0.5 : 1.0;
1406
1428
        v = 0.3;
1421
1443
        vec[1] = vec[0] = 0;
1422
1444
        QuatMulVecf(G.vd->viewquat, vec);
1423
1445
        
1424
 
        make_axis_color(gridcol, col, 'z');
 
1446
        make_axis_color((char *)gridcol, (char *)col, 'z');
1425
1447
        rgb_to_hsv(col[0]/255.0f, col[1]/255.0f, col[2]/255.0f, &h, &s, &v);
1426
1448
        s = s<0.5 ? s+0.5 : 1.0;
1427
1449
        v = 0.5;
1536
1558
                if(tot==1 && dvert && dvert->totweight) {
1537
1559
                        bDeformGroup *dg;
1538
1560
                        int i, max=1, init=1;
1539
 
                        char str[32];
 
1561
                        char str[320];
1540
1562
                        
1541
1563
                        for (i=0; i<dvert->totweight; i++){
1542
1564
                                dg = BLI_findlink (&ob->defbase, dvert->dw[i].def_nr);
1639
1661
        if(block) {     // buttons
1640
1662
        
1641
1663
                uiBlockBeginAlign(block);
1642
 
                uiDefButBitS(block, TOG, V3D_GLOBAL_STATS, REDRAWVIEW3D, "Global",              160, 150, 70, 19, &G.vd->flag, 0, 0, 0, 0, "Displays global values");
1643
 
                uiDefButBitS(block, TOGN, V3D_GLOBAL_STATS, REDRAWVIEW3D, "Local",              230, 150, 70, 19, &G.vd->flag, 0, 0, 0, 0, "Displays local values");
1644
 
                
 
1664
                if((ob->parent) && (ob->partype == PARBONE)) {
 
1665
                        uiDefButBitS(block, TOG, V3D_GLOBAL_STATS, REDRAWVIEW3D, "Global",              160, 135, 70, 19, &G.vd->flag, 0, 0, 0, 0, "Displays global values");
 
1666
                        uiDefButBitS(block, TOGN, V3D_GLOBAL_STATS, REDRAWVIEW3D, "Local",              230, 135, 70, 19, &G.vd->flag, 0, 0, 0, 0, "Displays local values");
 
1667
                }
 
1668
                else {
 
1669
                        uiDefButBitS(block, TOG, V3D_GLOBAL_STATS, REDRAWVIEW3D, "Global",              160, 150, 70, 19, &G.vd->flag, 0, 0, 0, 0, "Displays global values");
 
1670
                        uiDefButBitS(block, TOGN, V3D_GLOBAL_STATS, REDRAWVIEW3D, "Local",              230, 150, 70, 19, &G.vd->flag, 0, 0, 0, 0, "Displays local values");
 
1671
                }
 
1672
 
1645
1673
                memcpy(tfp->ve_median, median, sizeof(tfp->ve_median));
1646
1674
                
1647
1675
                uiBlockBeginAlign(block);
1822
1850
                        break;
1823
1851
        }
1824
1852
        if (!pchan || !bone) return;
1825
 
        
1826
 
        but= uiDefBut(block, TEX, B_DIFF, "Bone:",                              160, 140, 140, 19, bone->name, 1, 31, 0, 0, "");
 
1853
 
 
1854
        if((ob->parent) && (ob->partype == PARBONE))
 
1855
                but= uiDefBut (block, TEX, B_DIFF, "Bone:",                             160, 130, 140, 19, bone->name, 1, 31, 0, 0, "");
 
1856
        else
 
1857
                but= uiDefBut(block, TEX, B_DIFF, "Bone:",                              160, 140, 140, 19, bone->name, 1, 31, 0, 0, "");
1827
1858
        uiButSetFunc(but, validate_bonebutton_cb, bone, NULL);
1828
1859
        
1829
1860
        QuatToEul(pchan->quat, tfp->ob_eul);
1874
1905
        if (!ebone)
1875
1906
                return;
1876
1907
        
1877
 
        but= uiDefBut(block, TEX, B_DIFF, "Bone:",                      160, 150, 140, 19, ebone->name, 1, 31, 0, 0, "");
 
1908
        if((ob->parent) && (ob->partype == PARBONE))
 
1909
                but= uiDefBut(block, TEX, B_DIFF, "Bone:", 160, 130, 140, 19, ebone->name, 1, 31, 0, 0, "");
 
1910
        else
 
1911
                but= uiDefBut(block, TEX, B_DIFF, "Bone:",                      160, 150, 140, 19, ebone->name, 1, 31, 0, 0, "");
1878
1912
        uiButSetFunc(but, validate_editbonebutton_cb, ebone, NULL);
1879
1913
 
1880
1914
        uiBlockBeginAlign(block);
1958
1992
 
1959
1993
        case B_OBJECTPANELSCALE:
1960
1994
                if(ob) {
1961
 
                        float ratio, tmp, max = 0.0;
1962
 
                        int axis;
1963
1995
 
1964
 
                        /* figure out which axis changed */
1965
 
                        axis = 0;
1966
 
                        max = fabs(tfp->ob_scale[0] - ob->size[0]);
1967
 
                        tmp = fabs(tfp->ob_scale[1] - ob->size[1]);
1968
 
                        if (tmp > max) {
1969
 
                                axis = 1;
1970
 
                                max = tmp;
1971
 
                        }
1972
 
                        tmp = fabs(tfp->ob_scale[2] - ob->size[2]);
1973
 
                        if (tmp > max) {
1974
 
                                axis = 2;
1975
 
                                max = tmp;
1976
 
                        }
1977
 
                
1978
 
                        if (ob->size[axis] != tfp->ob_scale[axis]) {
1979
 
                                if (tfp->link_scale) {
 
1996
                        /* link scale; figure out which axis changed */
 
1997
                        if (tfp->link_scale) {
 
1998
                                float ratio, tmp, max = 0.0;
 
1999
                                int axis;
 
2000
                                
 
2001
                                axis = 0;
 
2002
                                max = fabs(tfp->ob_scale[0] - ob->size[0]);
 
2003
                                tmp = fabs(tfp->ob_scale[1] - ob->size[1]);
 
2004
                                if (tmp > max) {
 
2005
                                        axis = 1;
 
2006
                                        max = tmp;
 
2007
                                }
 
2008
                                tmp = fabs(tfp->ob_scale[2] - ob->size[2]);
 
2009
                                if (tmp > max) {
 
2010
                                        axis = 2;
 
2011
                                        max = tmp;
 
2012
                                }
 
2013
                        
 
2014
                                if (ob->size[axis] != tfp->ob_scale[axis]) {
1980
2015
                                        if (fabs(ob->size[axis]) > FLT_EPSILON) {
1981
2016
                                                ratio = tfp->ob_scale[axis] / ob->size[axis];
1982
2017
                                                ob->size[0] *= ratio;
1984
2019
                                                ob->size[2] *= ratio;
1985
2020
                                        }
1986
2021
                                }
1987
 
                                ob->size[axis] = tfp->ob_scale[axis];
1988
 
 
1989
 
                                DAG_object_flush_update(G.scene, ob, OB_RECALC_OB);
1990
 
                                allqueue(REDRAWVIEW3D, 1);
1991
 
                        }
 
2022
                        }
 
2023
                        else {
 
2024
                                VECCOPY(ob->size, tfp->ob_scale);
 
2025
                                
 
2026
                        }
 
2027
                        DAG_object_flush_update(G.scene, ob, OB_RECALC_OB);
 
2028
                        allqueue(REDRAWVIEW3D, 1);
1992
2029
                }
1993
2030
                break;
1994
2031
 
2046
2083
                        allqueue(REDRAWVIEW3D, 1);
2047
2084
                }
2048
2085
                break;
 
2086
                
 
2087
                /* note; this case also used for parbone */
2049
2088
        case B_OBJECTPANELPARENT:
2050
2089
                if(ob) {
2051
2090
                        if(ob->id.lib || test_parent_loop(ob->parent, ob) ) 
2161
2200
        uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | cntrl);
2162
2201
        uiSetPanelHandler(VIEW3D_HANDLER_OBJECT);  // for close and esc
2163
2202
 
2164
 
        if((G.f & G_SCULPTMODE) && !G.obedit) {
2165
 
                if(!uiNewPanel(curarea, block, "Transform Properties", "View3d", 10, 230, 425, 234)) return;
2166
 
        } else {
2167
 
                if(!uiNewPanel(curarea, block, "Transform Properties", "View3d", 10, 230, 318, 204)) return;
2168
 
        }
 
2203
        if(!uiNewPanel(curarea, block, "Transform Properties", "View3d", 10, 230, 318, 204))
 
2204
                return;
2169
2205
 
2170
 
        if(ob->id.lib) uiSetButLock(1, "Can't edit library data");
 
2206
        uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
2171
2207
        
2172
2208
        if(G.f & (G_VERTEXPAINT|G_FACESELECT|G_TEXTUREPAINT|G_WEIGHTPAINT)) {
2173
2209
                uiBlockSetFlag(block, UI_BLOCK_FRONTBUFFER);    // force old style frontbuffer draw
2174
2210
        }
2175
2211
        else {
2176
 
                bt= uiDefBut(block, TEX, B_IDNAME, "OB: ",      10,180,140,20, ob->id.name+2, 0.0, 19.0, 0, 0, "");
 
2212
                bt= uiDefBut(block, TEX, B_IDNAME, "OB: ",      10,180,140,20, ob->id.name+2, 0.0, 21.0, 0, 0, "");
2177
2213
#ifdef WITH_VERSE
2178
2214
                if(ob->vnode) uiButSetFunc(bt, test_and_send_idbutton_cb, ob, ob->id.name);
2179
2215
                else uiButSetFunc(bt, test_idbutton_cb, ob->id.name, NULL);
2183
2219
 
2184
2220
 
2185
2221
                uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_OBJECTPANELPARENT, "Par:", 160, 180, 140, 20, &ob->parent, "Parent Object"); 
 
2222
                if((ob->parent) && (ob->partype == PARBONE)) {
 
2223
                        if (G.f & G_SCULPTMODE)
 
2224
                                uiDefBut(block, TEX, B_OBJECTPANELPARENT, "ParBone:", 310, 180, 140, 20, ob->parsubstr, 0.0, 32.0, 0, 0, "");
 
2225
                        else
 
2226
                                uiDefBut(block, TEX, B_OBJECTPANELPARENT, "ParBone:", 160, 160, 140, 20, ob->parsubstr, 0.0, 32.0, 0, 0, "");
 
2227
                }
2186
2228
        }
2187
2229
 
2188
2230
        lim= 10000.0f*MAX2(1.0, G.vd->grid);
2216
2258
        else if(G.f & G_SCULPTMODE) {
2217
2259
                uiNewPanelTitle(block, "Sculpt Properties");
2218
2260
                sculptmode_draw_interface_tools(block,10,150);
2219
 
                sculptmode_draw_interface_textures(block,220,150);
2220
2261
        } else {
2221
2262
                BoundBox *bb = NULL;
2222
2263
 
2233
2274
                tfp->ob_eul[2]= 180.0*ob->rot[2]/M_PI;
2234
2275
                
2235
2276
                uiBlockBeginAlign(block);
2236
 
                uiDefIconButBitS(block, ICONTOG, OB_LOCK_ROTX, REDRAWVIEW3D, ICON_UNLOCKED,     160,150,20,19, &(ob->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
2237
 
                uiDefButF(block, NUM, B_OBJECTPANELROT, "RotX:",        180, 150, 120, 19, &(tfp->ob_eul[0]), -lim, lim, 1000, 3, "");
2238
 
                uiDefIconButBitS(block, ICONTOG, OB_LOCK_ROTY, REDRAWVIEW3D, ICON_UNLOCKED,     160,130,20,19, &(ob->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
2239
 
                uiDefButF(block, NUM, B_OBJECTPANELROT, "RotY:",        180, 130, 120, 19, &(tfp->ob_eul[1]), -lim, lim, 1000, 3, "");
2240
 
                uiDefIconButBitS(block, ICONTOG, OB_LOCK_ROTZ, REDRAWVIEW3D, ICON_UNLOCKED,     160,110,20,19, &(ob->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
2241
 
                uiDefButF(block, NUM, B_OBJECTPANELROT, "RotZ:",        180, 110, 120, 19, &(tfp->ob_eul[2]), -lim, lim, 1000, 3, "");
 
2277
                if ((ob->parent) && (ob->partype == PARBONE)) {
 
2278
                        uiDefIconButBitS(block, ICONTOG, OB_LOCK_ROTX, REDRAWVIEW3D, ICON_UNLOCKED,     160,130,20,19, &(ob->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
 
2279
                        uiDefButF(block, NUM, B_OBJECTPANELROT, "RotX:",        180, 130, 120, 19, &(tfp->ob_eul[0]), -lim, lim, 1000, 3, "");
 
2280
                        uiDefIconButBitS(block, ICONTOG, OB_LOCK_ROTY, REDRAWVIEW3D, ICON_UNLOCKED,     160,110,20,19, &(ob->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
 
2281
                        uiDefButF(block, NUM, B_OBJECTPANELROT, "RotY:",        180, 110, 120, 19, &(tfp->ob_eul[1]), -lim, lim, 1000, 3, "");
 
2282
                        uiDefIconButBitS(block, ICONTOG, OB_LOCK_ROTZ, REDRAWVIEW3D, ICON_UNLOCKED,     160,90,20,19, &(ob->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
 
2283
                        uiDefButF(block, NUM, B_OBJECTPANELROT, "RotZ:",        180, 90, 120, 19, &(tfp->ob_eul[2]), -lim, lim, 1000, 3, "");
 
2284
 
 
2285
                }
 
2286
                else {
 
2287
                        uiDefIconButBitS(block, ICONTOG, OB_LOCK_ROTX, REDRAWVIEW3D, ICON_UNLOCKED,     160,150,20,19, &(ob->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
 
2288
                        uiDefButF(block, NUM, B_OBJECTPANELROT, "RotX:",        180, 150, 120, 19, &(tfp->ob_eul[0]), -lim, lim, 1000, 3, "");
 
2289
                        uiDefIconButBitS(block, ICONTOG, OB_LOCK_ROTY, REDRAWVIEW3D, ICON_UNLOCKED,     160,130,20,19, &(ob->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
 
2290
                        uiDefButF(block, NUM, B_OBJECTPANELROT, "RotY:",        180, 130, 120, 19, &(tfp->ob_eul[1]), -lim, lim, 1000, 3, "");
 
2291
                        uiDefIconButBitS(block, ICONTOG, OB_LOCK_ROTZ, REDRAWVIEW3D, ICON_UNLOCKED,     160,110,20,19, &(ob->protectflag), 0, 0, 0, 0, "Protects this value from being Transformed");
 
2292
                        uiDefButF(block, NUM, B_OBJECTPANELROT, "RotZ:",        180, 110, 120, 19, &(tfp->ob_eul[2]), -lim, lim, 1000, 3, "");
 
2293
                }
2242
2294
 
2243
2295
                tfp->ob_scale[0]= ob->size[0];
2244
2296
                tfp->ob_scale[1]= ob->size[1];
2266
2318
                        tfp->ob_dims[2] = fabs(scale[2]) * (bb->vec[1][2] - bb->vec[0][2]);
2267
2319
 
2268
2320
                        uiBlockBeginAlign(block);
2269
 
                        uiDefButF(block, NUM, B_OBJECTPANELDIMS, "DimX:",               160, 80, 140, 19, &(tfp->ob_dims[0]), 0.0, lim, 10, 3, "Manipulate bounding box size");
2270
 
                        uiDefButF(block, NUM, B_OBJECTPANELDIMS, "DimY:",               160, 60, 140, 19, &(tfp->ob_dims[1]), 0.0, lim, 10, 3, "Manipulate bounding box size");
2271
 
                        uiDefButF(block, NUM, B_OBJECTPANELDIMS, "DimZ:",               160, 40, 140, 19, &(tfp->ob_dims[2]), 0.0, lim, 10, 3, "Manipulate bounding box size");
 
2321
                        if ((ob->parent) && (ob->partype == PARBONE)) {
 
2322
                                uiDefButF(block, NUM, B_OBJECTPANELDIMS, "DimX:",               160, 60, 140, 19, &(tfp->ob_dims[0]), 0.0, lim, 10, 3, "Manipulate bounding box size");
 
2323
                                uiDefButF(block, NUM, B_OBJECTPANELDIMS, "DimY:",               160, 40, 140, 19, &(tfp->ob_dims[1]), 0.0, lim, 10, 3, "Manipulate bounding box size");
 
2324
                                uiDefButF(block, NUM, B_OBJECTPANELDIMS, "DimZ:",               160, 20, 140, 19, &(tfp->ob_dims[2]), 0.0, lim, 10, 3, "Manipulate bounding box size");
 
2325
 
 
2326
                        }
 
2327
                        else {
 
2328
                                uiDefButF(block, NUM, B_OBJECTPANELDIMS, "DimX:",               160, 80, 140, 19, &(tfp->ob_dims[0]), 0.0, lim, 10, 3, "Manipulate bounding box size");
 
2329
                                uiDefButF(block, NUM, B_OBJECTPANELDIMS, "DimY:",               160, 60, 140, 19, &(tfp->ob_dims[1]), 0.0, lim, 10, 3, "Manipulate bounding box size");
 
2330
                                uiDefButF(block, NUM, B_OBJECTPANELDIMS, "DimZ:",               160, 40, 140, 19, &(tfp->ob_dims[2]), 0.0, lim, 10, 3, "Manipulate bounding box size");
 
2331
                        }
2272
2332
 
2273
2333
                        uiBlockEndAlign(block);
2274
2334
                }
2380
2440
 
2381
2441
        uiDefBut(block, LABEL, 1, "View Locking:",                              160, 50, 150, 19, NULL, 0.0, 0.0, 0, 0, "");
2382
2442
        uiBlockBeginAlign(block);
2383
 
        uiDefIDPoinBut(block, test_obpoin_but, ID_OB, REDRAWVIEW3D, "Object:", 160, 30, 140, 19, &vd->ob_centre, "Lock view to centre always on this Object"); 
 
2443
        uiDefIDPoinBut(block, test_obpoin_but, ID_OB, REDRAWVIEW3D, "Object:", 160, 30, 140, 19, &vd->ob_centre, "Lock view to center always on this Object"); 
2384
2444
        uiDefBut(block, TEX, REDRAWVIEW3D, "Bone:",                                             160, 10, 140, 19, vd->ob_centre_bone, 1, 31, 0, 0, "If view locked to Object, use this Bone to lock to view to");
2385
2445
 
2386
2446
}
2513
2573
 
2514
2574
/* *********************** */
2515
2575
 
2516
 
static void draw_dupli_objects(View3D *v3d, Base *base)
2517
 
{
 
2576
/*
 
2577
        In most cases call draw_dupli_objects,
 
2578
        draw_dupli_objects_color was added because when drawing set dupli's
 
2579
        we need to force the color
 
2580
*/
 
2581
static void draw_dupli_objects_color(View3D *v3d, Base *base, int color)
 
2582
{       
2518
2583
        ListBase *lb;
2519
2584
        DupliObject *dob;
2520
2585
        Base tbase;
2521
2586
        BoundBox *bb= NULL;
2522
2587
        GLuint displist=0;
2523
 
        int color= (base->flag & SELECT)?TH_SELECT:TH_WIRE;
2524
2588
        short transflag, use_displist= -1;      /* -1 is initialize */
2525
2589
        char dt, dtx;
2526
2590
        
2527
2591
        if (base->object->restrictflag & OB_RESTRICT_VIEW) return;
2528
2592
        
2529
 
        /* debug */
2530
 
        if(base->object->dup_group && base->object->dup_group->id.us<1)
2531
 
                color= TH_REDALERT;
2532
 
        
2533
2593
        /* test if we can do a displist */
2534
2594
        if(base->object->transflag & OB_DUPLIGROUP)
2535
2595
                use_displist= 0;
2606
2666
                glDeleteLists(displist, 1);
2607
2667
}
2608
2668
 
 
2669
static void draw_dupli_objects(View3D *v3d, Base *base)
 
2670
{
 
2671
        /* define the color here so draw_dupli_objects_color can be called
 
2672
         * from the set loop */
 
2673
        
 
2674
        int color= (base->flag & SELECT)?TH_SELECT:TH_WIRE;
 
2675
        /* debug */
 
2676
        if(base->object->dup_group && base->object->dup_group->id.us<1)
 
2677
                color= TH_REDALERT;
 
2678
        
 
2679
        draw_dupli_objects_color(v3d, base, color);
 
2680
}
 
2681
 
2609
2682
void view3d_update_depths(View3D *v3d)
2610
2683
{
2611
2684
        /* Create storage for, and, if necessary, copy depth buffer */
2665
2738
                float len1, len2, vec[3];
2666
2739
 
2667
2740
                VECCOPY(vec, v3d->persinv[0]);
2668
 
                len1= Normalise(vec);
 
2741
                len1= Normalize(vec);
2669
2742
                VECCOPY(vec, v3d->persinv[1]);
2670
 
                len2= Normalise(vec);
 
2743
                len2= Normalize(vec);
2671
2744
                
2672
2745
                v3d->pixsize= 2.0f*(len1>len2?len1:len2);
2673
2746
                
2743
2816
                                draw_object(base, DRAW_CONSTCOLOR);
2744
2817
 
2745
2818
                                if(base->object->transflag & OB_DUPLI) {
2746
 
                                        draw_dupli_objects(v3d, base);
 
2819
                                        draw_dupli_objects_color(v3d, base, TH_WIRE);
2747
2820
                                }
2748
2821
                        }
2749
2822
                }
2815
2888
                PropsetData *pd= sculpt_session()->propset;
2816
2889
                short r1=100, r2=100, r3=100;
2817
2890
                short mouse[2];
2818
 
                float *ang= get_tex_angle();
2819
2891
                if(pd) {
2820
2892
                        if(pd->mode == PropsetSize) {
2821
2893
                                r1= sculptmode_brush()->size;
2842
2914
                        
2843
2915
                        glPushMatrix();
2844
2916
                        glTranslatef(pd->origloc[0], pd->origloc[1], 0);
2845
 
                        if(ang) glRotatef(*ang, 0, 0, 1);
 
2917
                        glRotatef(tex_angle(), 0, 0, 1);
2846
2918
 
2847
2919
                        glEnable(GL_TEXTURE_2D);
2848
2920
                        glBegin(GL_QUADS);
3117
3189
        tottime -= swaptime;
3118
3190
        while (update_time()) PIL_sleep_ms(1);
3119
3191
 
3120
 
        if(CFRA>=EFRA) {
 
3192
        if(CFRA>=PEFRA) {
3121
3193
                if (tottime > 0.0) tottime = 0.0;
3122
 
                CFRA= SFRA;
 
3194
                CFRA= PSFRA;
3123
3195
                audiostream_stop();
3124
3196
                audiostream_start( CFRA );
3125
3197
        }
3145
3217
        if(SFRA==0) SFRA= 1;
3146
3218
        if(EFRA==0) EFRA= 250;
3147
3219
 
3148
 
        if(SFRA>EFRA) return 0;
 
3220
        if(PSFRA>PEFRA) return 0;
3149
3221
        
3150
3222
        update_time();
3151
3223
 
3197
3269
                inner_play_anim_loop(0, 0);
3198
3270
                screen_swapbuffers();
3199
3271
                                
3200
 
                if((mode & 2) && CFRA==EFRA) break; /* no replay */     
 
3272
                if((mode & 2) && CFRA==PEFRA) break; /* no replay */    
3201
3273
        }
3202
3274
 
3203
3275
        if(event==SPACEKEY);