hotkey for changing a mesh to a subsurface and back again: shift+o

hotkey for changing display resolution for subdiv: ctrl+1 or 2 or 3 or 4
written by Green
This commit is contained in:
2003-05-07 19:27:29 +00:00
parent cb2d8c7225
commit f28516e7b0
4 changed files with 92 additions and 8 deletions

View File

@@ -113,6 +113,7 @@ void auto_timeoffs(void);
void texspace_edit(void); void texspace_edit(void);
void first_base(void); void first_base(void);
void make_displists_by_obdata(void *obdata); void make_displists_by_obdata(void *obdata);
void flip_subdivison(struct Object *ob, int);
#endif /* BDR_EDITOBJECT_H */ #endif /* BDR_EDITOBJECT_H */

View File

@@ -217,6 +217,7 @@ char texstr[15][8]= {"None" , "Clouds" , "Wood",
#define B_LAMPREDRAW 1101 #define B_LAMPREDRAW 1101
#define B_COLLAMP 1102 #define B_COLLAMP 1102
#define B_TEXCLEARLAMP 1103 #define B_TEXCLEARLAMP 1103
#define B_SBUFF 1104
/* *********************** */ /* *********************** */
#define B_MATBUTS 1300 #define B_MATBUTS 1300
@@ -4844,6 +4845,15 @@ void do_lampbuts(unsigned short event)
BIF_preview_changed(G.buts); BIF_preview_changed(G.buts);
} }
break; break;
case B_SBUFF:
{
la= G.buts->lockpoin;
la->bufsize = la->bufsize&=(~15);
allqueue(REDRAWBUTSLAMP, 0);
allqueue(REDRAWOOPS, 0);
/*la->bufsize = la->bufsize % 64;*/
}
break;
} }
if(event) freefastshade(); if(event) freefastshade();
@@ -4899,11 +4909,10 @@ void lampbuts(void)
#endif #endif
uiBlockSetCol(block, BUTGREY); uiBlockSetCol(block, BUTGREY);
uiDefButS(block, ROW,B_DIFF,"BufSi 512", 203,30,89,19, &la->bufsize,2.0,512.0, 0, 0, "Set the size of the shadow buffer"); uiDefButS(block, NUM,B_SBUFF,"ShadowBuffSize:", 203,30,140,19, &la->bufsize,512,5120, 0, 0, "Set the size of the shadow buffer");
uiDefButS(block, ROW,B_DIFF,"768", 293,30,48,19, &la->bufsize,2.0,768.0, 0, 0, "Set the size of the shadow buffer"); uiDefButF(block, NUM,REDRAWVIEW3D,"ClipSta:", 346,30,146,19, &la->clipsta, 0.1*grid,1000.0*grid, 10, 0, "Set the shadow map clip start");
uiDefButS(block, ROW,B_DIFF,"1024", 203,10,43,19, &la->bufsize,2.0,1024.0, 0, 0, "Set the size of the shadow buffer"); uiDefButF(block, NUM,REDRAWVIEW3D,"ClipEnd:", 346,9,146,19,&la->clipend, 1.0, 5000.0*grid, 100, 0, "Set the shadow map clip end");
uiDefButS(block, ROW,B_DIFF,"1536", 248,10,45,19, &la->bufsize,2.0,1536.0, 0, 0, "Set the size of the shadow buffer");
uiDefButS(block, ROW,B_DIFF,"2560", 293,10,48,19, &la->bufsize,2.0,2560.0, 0, 0, "Set the size of the shadow buffer");
uiDefButF(block, NUM,REDRAWVIEW3D,"ClipSta:", 346,30,146,19, &la->clipsta, 0.1*grid,1000.0*grid, 10, 0, "Set the shadow map clip start"); uiDefButF(block, NUM,REDRAWVIEW3D,"ClipSta:", 346,30,146,19, &la->clipsta, 0.1*grid,1000.0*grid, 10, 0, "Set the shadow map clip start");
uiDefButF(block, NUM,REDRAWVIEW3D,"ClipEnd:", 346,9,146,19,&la->clipend, 1.0, 5000.0*grid, 100, 0, "Set the shadow map clip end"); uiDefButF(block, NUM,REDRAWVIEW3D,"ClipEnd:", 346,9,146,19,&la->clipend, 1.0, 5000.0*grid, 100, 0, "Set the shadow map clip end");

View File

@@ -1745,6 +1745,30 @@ void convertmenu(void)
allqueue(REDRAWBUTSEDIT, 0); allqueue(REDRAWBUTSEDIT, 0);
} }
void flip_subdivison(Object *ob, int level)
{
Base *base;
Mesh *me, *tme;
short i, j;
me = ob->data;
if (level == 0)
{
if(me->flag & ME_SUBSURF)
me->flag &= ~ME_SUBSURF;
else
me->flag |= ME_SUBSURF;
} else {
me->subdiv = level;
}
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWOOPS, 0);
allqueue(REDRAWBUTSEDIT, 0);
makeDispList(ob);
}
void copymenu_properties(Object *ob) void copymenu_properties(Object *ob)
{ {
bProperty *prop, *propn, *propc; bProperty *prop, *propn, *propc;

View File

@@ -610,12 +610,53 @@ void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
break; break;
case ONEKEY: case ONEKEY:
do_layer_buttons(0); break; ob= OBACT;
if(G.qual & LR_CTRLKEY) {
if(G.obedit) {
flip_subdivison(G.obedit, 1);
}
else if(ob->type == OB_MESH) {
flip_subdivison(ob, 1);
}
}
else
do_layer_buttons(0); break;
case TWOKEY: case TWOKEY:
do_layer_buttons(1); break; ob= OBACT;
if(G.qual & LR_CTRLKEY) {
if(G.obedit) {
flip_subdivison(G.obedit, 2);
}
else if(ob->type == OB_MESH) {
flip_subdivison(ob, 2);
}
}
else
do_layer_buttons(1);
break;
case THREEKEY: case THREEKEY:
ob= OBACT;
if(G.qual & LR_CTRLKEY) {
if(G.obedit) {
flip_subdivison(G.obedit, 3);
}
else if(ob->type == OB_MESH) {
flip_subdivison(ob, 3);
}
}
else
do_layer_buttons(2); break; do_layer_buttons(2); break;
case FOURKEY: case FOURKEY:
ob= OBACT;
if(G.qual & LR_CTRLKEY) {
if(G.obedit) {
flip_subdivison(G.obedit, 4);
}
else if(ob->type == OB_MESH) {
flip_subdivison(ob, 4);
}
}
else
do_layer_buttons(3); break; do_layer_buttons(3); break;
case FIVEKEY: case FIVEKEY:
do_layer_buttons(4); break; do_layer_buttons(4); break;
@@ -860,7 +901,16 @@ void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
} }
break; break;
case OKEY: case OKEY:
if(G.qual & LR_ALTKEY) clear_object('o'); ob= OBACT;
if(G.qual & LR_SHIFTKEY) {
if(G.obedit) {
flip_subdivison(G.obedit, 0);
}
else if(ob->type == OB_MESH) {
flip_subdivison(ob, 0);
}
}
else if(G.qual & LR_ALTKEY) clear_object('o');
else if(G.obedit) { else if(G.obedit) {
extern int prop_mode; extern int prop_mode;