~ubuntu-branches/ubuntu/lucid/blender/lucid

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Chris Coulson
  • Date: 2009-08-06 22:32:19 UTC
  • mfrom: (1.2.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20090806223219-8z4eej1u8levu4pz
Tags: 2.49a+dfsg-0ubuntu1
* Merge from debian unstable, remaining changes:
  - debian/control: Build-depend on python-2.6 rather than python-2.5.
  - debian/misc/*.desktop: Add Spanish translation to .desktop 
    files.
  - debian/pyversions: 2.6.
  - debian/rules: Clean *.o of source/blender/python/api2_2x/
* New upstream release (LP: #382153).
* Refreshed patches:
  - 01_sanitize_sys.patch
  - 02_tmp_in_HOME
  - 10_use_systemwide_ftgl
  - 70_portability_platform_detection
* Removed patches merged upstream:
  - 30_fix_python_syntax_warning
  - 90_ubuntu_ffmpeg_52_changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**
2
 
 * $Id: view.c 17166 2008-10-22 05:33:45Z pidhash $
 
2
 * $Id: view.c 19305 2009-03-16 02:55:42Z theeth $
3
3
 *
4
4
 * ***** BEGIN GPL LICENSE BLOCK *****
5
5
 *
75
75
#include "BIF_space.h"
76
76
#include "BIF_screen.h"
77
77
#include "BIF_toolbox.h"
 
78
#include "BIF_sketch.h"
78
79
 
79
80
#include "BSE_view.h"
80
81
#include "BSE_edit.h"           /* For countall */
83
84
#include "BDR_drawobject.h"     /* For draw_object */
84
85
#include "BDR_editface.h"       /* For minmax_tface */
85
86
#include "BDR_sculptmode.h"
 
87
#include "BDR_sketch.h"
86
88
 
87
89
#include "mydevice.h"
88
90
#include "blendef.h"
796
798
        BIF_view3d_previewrender_signal(curarea, PR_DBASE|PR_DISPRECT);
797
799
}
798
800
 
799
 
int view_autodist( float mouse_worldloc[3] ) //, float *autodist )
 
801
/* Be sure to run persp(PERSP_VIEW) if this isnt set,
 
802
 *
 
803
 * mouse_worldloc - worldspace vector that is set
 
804
 * mval - screenspace location, or from getmouseco_areawin(mval)
 
805
 * dist - the size of the square to use when averaging the Z depth.
 
806
 */
 
807
int view_mouse_depth( float mouse_worldloc[3], short mval[2], int dist)
800
808
{
801
809
        View3D *v3d = G.vd;
802
 
        
803
 
        /* Zooms in on a border drawn by the user */
804
 
        short mval[2];
805
810
        rcti rect;
806
811
        
807
812
        /* ZBuffer depth vars */
813
818
        
814
819
        getmouseco_areawin(mval);
815
820
        
816
 
        persp(PERSP_VIEW);
817
 
        
818
 
        rect.xmax = mval[0] + 4;
819
 
        rect.ymax = mval[1] + 4;
820
 
        
821
 
        rect.xmin = mval[0] - 4;
822
 
        rect.ymin = mval[1] - 4;
 
821
        /* persp(PERSP_VIEW); */
 
822
        
 
823
        rect.xmax = mval[0] + dist;
 
824
        rect.ymax = mval[1] + dist;
 
825
        
 
826
        rect.xmin = mval[0] - dist;
 
827
        rect.ymin = mval[1] - dist;
823
828
        
824
829
        /* Get Z Depths, needed for perspective, nice for ortho */
825
830
        bgl_get_mats(&mats);
943
948
                VecMulf(obofs, -1.0f);
944
949
        }
945
950
        else if (U.uiflag & USER_ORBIT_ZBUF) {
946
 
                if ((use_sel=view_autodist(obofs))) {
 
951
                persp(PERSP_VIEW);
 
952
                if ((use_sel=view_mouse_depth(obofs, mval_area, 4))) {
947
953
                        if (G.vd->persp==V3D_PERSP) {
948
954
                                float my_origin[3]; /* original G.vd->ofs */
949
955
                                float my_pivot[3]; /* view */
974
980
                } else {
975
981
                        ofs[0] = ofs[1] = ofs[2] = 0.0f;
976
982
                }
 
983
 
 
984
                persp(PERSP_WIN);
977
985
        }
978
986
        else
979
987
                ofs[0] = ofs[1] = ofs[2] = 0.0f;
1573
1581
        }
1574
1582
}
1575
1583
 
 
1584
int get_view3d_ortho(View3D *v3d)
 
1585
{
 
1586
        Camera *cam;
 
1587
        
 
1588
        if(v3d->persp==V3D_CAMOB) {
 
1589
                if(v3d->camera && v3d->camera->type==OB_CAMERA) {
 
1590
                        cam= v3d->camera->data;
 
1591
 
 
1592
                        if(cam && cam->type==CAM_ORTHO)
 
1593
                                return 1;
 
1594
                        else
 
1595
                                return 0;
 
1596
                }
 
1597
                else
 
1598
                        return 0;
 
1599
        }
 
1600
        
 
1601
        if(v3d->persp==V3D_ORTHO)
 
1602
                return 1;
 
1603
 
 
1604
        return 0;
 
1605
}
1576
1606
 
1577
1607
int get_view3d_viewplane(int winxi, int winyi, rctf *viewplane, float *clipsta, float *clipend, float *pixsize)
1578
1608
{
1879
1909
                draw_object(BASACT, DRAW_PICKING|DRAW_CONSTCOLOR);
1880
1910
        }
1881
1911
        else if ((G.obedit && G.obedit->type==OB_ARMATURE)) {
1882
 
                draw_object(BASACT, DRAW_PICKING|DRAW_CONSTCOLOR);
 
1912
                if (BIF_fullSketchMode())
 
1913
                {
 
1914
                        BDR_drawSketchNames();
 
1915
                }
 
1916
                else
 
1917
                {
 
1918
                        draw_object(BASACT, DRAW_PICKING|DRAW_CONSTCOLOR);
 
1919
                }
1883
1920
        }
1884
1921
        else {
1885
1922
                Base *base;
2002
2039
        locallay= free_localbit();
2003
2040
 
2004
2041
        if(locallay==0) {
2005
 
                error("Sorry,  no more than 8 localviews");
 
2042
                error("Sorry, no more than 8 localviews");
2006
2043
                ok= 0;
2007
2044
        }
2008
2045
        else {