Page MenuHome

make object in current area in BoundBox when transform
Closed, InvalidPublicPATCH

Description

Hello, a french user ask if it possible,when the scene contains many faces, to draw the scene with less detail when grab, rotate, size an object or when pan, zoom, turn the view.

I made a little patch to make object in BOUNDBOX when a transform is made.
For the moment, to enable the boundbox mode, I put 2 toggle button in the view & control area.

If what I say is not clear sorry I'm not english.

Index: source/blender/makesdna/DNA_userdef_types.h
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/makesdna/DNA_userdef_types.h,v
retrieving revision 1.36
diff -u -r1.36 DNA_userdef_types.h
--- source/blender/makesdna/DNA_userdef_types.h 21 Mar 2005 14:20:04 -0000 1.36
+++ source/blender/makesdna/DNA_userdef_types.h 30 Mar 2005 09:41:56 -0000
@@ -174,6 +174,7 @@
#define USER_TWOBUTTONMOUSE 4096
#define USER_NONUMPAD 8192
#define USER_LMOUSESELECT 16384
+#define USER_DRAWTYPE 32768

/* viewzom */
#define USER_ZOOM_CONT 0
Index: source/blender/src/space.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/space.c,v
retrieving revision 1.242
diff -u -r1.242 space.c
--- source/blender/src/space.c 28 Mar 2005 14:00:49 -0000 1.242
+++ source/blender/src/space.c 30 Mar 2005 09:45:56 -0000
@@ -2452,6 +2452,19 @@
&(U.flag), 0, 0, 0, 0,
"Emulates Middle Mouse with Alt+LeftMouse (doesnt work with Left Mouse Select option)");

+ uiDefBut(block, LABEL,0,"View when transform",
+ (xpos+(2*edgsp)+(3*mpref)+(3*midsp)),y2label+5,mpref,buth,
+ 0, 0, 0, 0, 0, "");
+
+ uiBlockBeginAlign(block);
+ uiDefButBitS(block, TOGN, USER_DRAWTYPE, B_DRAWINFO, "Normal",
+ (xpos+edgsp+(3*mpref)+(4*midsp)),y1,(mpref/2),buth,
+ &(U.flag), 0, 0, 0, 0, "Don't change the drawtype in transformation");
+ uiDefButBitS(block, TOG, USER_DRAWTYPE, B_DRAWINFO, "BoundBox",
+ (xpos+edgsp+(3*mpref)+(4*midsp)+(mpref/2)),y1,(mpref/2),buth,
+ &(U.flag), 0, 0, 0, 0, "Make drawtype=BOUND_BOX when transform (without widgets)");
+
+ uiBlockEndAlign(block);

uiDefBut(block, LABEL,0,"Middle Mouse Button:",
(xpos+(2*edgsp)+(4*mpref)+(4*midsp)),y6label,mpref,buth,
Index: source/blender/src/transform.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/transform.c,v
retrieving revision 1.66
diff -u -r1.66 transform.c
--- source/blender/src/transform.c 29 Mar 2005 17:05:43 -0000 1.66
+++ source/blender/src/transform.c 30 Mar 2005 09:45:06 -0000
@@ -1420,11 +1420,17 @@
void Transform(int mode, int context)
{
int ret_val = 0;
- short pmval[2] = {0, 0}, mval[2], val, oldprop;
+ short pmval[2] = {0, 0}, mval[2], val, oldprop,savedrawtype;
float mati[3][3];
unsigned short event;
char cmode = '\0';

+ if (G.vd->drawtype!=OB_BOUNDBOX){
+ savedrawtype=G.vd->drawtype;
+ G.vd->drawtype=OB_BOUNDBOX;
+ }
+
+
/* STUPID HACK, but this needs fixing right now */
if (G.f & G_PROPORTIONAL)
oldprop = 1;
@@ -1754,6 +1760,7 @@


/* send events out for redraws */
+ if (U.flag & USER_DRAWTYPE) G.vd->drawtype=savedrawtype;
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWBUTSOBJECT, 0);
scrarea_queue_headredraw(curarea);
@@ -1762,10 +1769,13 @@
void ManipulatorTransform(int mode)
{
int ret_val = 0;
- short pmval[2] = {0, 0}, mval[2], val;
+ short pmval[2] = {0, 0}, mval[2], val,savedrawtype;
unsigned short event;

-
+ if (G.vd->drawtype!=OB_BOUNDBOX){
+ savedrawtype=G.vd->drawtype;
+ G.vd->drawtype=OB_BOUNDBOX;
+ }
/* stupid PET initialisation code */
/* START */
if (Trans.propsize == 0.0f) {
@@ -1911,6 +1921,7 @@
}

/* send events out for redraws */
+ if (U.flag & USER_DRAWTYPE) G.vd->drawtype=savedrawtype;
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWBUTSOBJECT, 0);
scrarea_queue_headredraw(curarea);
Index: source/blender/src/view.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/view.c,v
retrieving revision 1.41
diff -u -r1.41 view.c
--- source/blender/src/view.c 19 Mar 2005 21:08:13 -0000 1.41
+++ source/blender/src/view.c 30 Mar 2005 09:47:32 -0000
@@ -410,7 +410,7 @@
float firstvec[3], newvec[3], dvec[3];
float oldquat[4], q1[4], si, phi, dist0;
int firsttime=1;
- short mvalball[2], mval[2], mvalo[2];
+ short mvalball[2], mval[2], mvalo[2],savedrawtype;

/* sometimes this routine is called from headerbuttons */
areawinset(curarea->win);
@@ -427,7 +427,10 @@
calctrackballvec(&curarea->winrct, mvalo, firstvec);

/* cumultime(0); */
-
+ if ((G.vd->drawtype!=OB_BOUNDBOX)&&(U.flag&USER_DRAWTYPE)){
+ savedrawtype=G.vd->drawtype;
+ G.vd->drawtype=OB_BOUNDBOX;
+ }
while(TRUE) {
getmouseco_sc(mval);

@@ -582,6 +585,12 @@
/* this in the end, otherwise get_mbut does not work on a PC... */
if( !(get_mbut() & (L_MOUSE|M_MOUSE))) break;
}
+ if (U.flag & USER_DRAWTYPE){
+ G.vd->drawtype=savedrawtype;
+ scrarea_do_windraw(curarea);
+ screen_swapbuffers();
+ }
+
}

short v3d_windowmode=0;

Event Timeline

Ton Roosendaal (ton) changed the task status from Unknown Status to Unknown Status.Apr 17 2005, 7:14 PM