forked from bartvdbraak/blender
UI cleanup work;
Proportional edit: - Proportional mode added to header as button/menu. Including new option to have only connected geometry influenced. - Added icons for proportional & proportional modes - Make proportional edit data part of Scene, so all gets saved. The Global flag G_PROPORTIONAL was removed - Made sure #defines get used properly, also tweaked order for proportional so it starts with regular 'smooth' by default. - Use ALT+O in editmode to switch to new proportional 'connected' mode Other UI stuff: - in EditMode, the layer buttons get hidden... the amount of icons in 3d header grows to fast. :) - made less ugly icons for the Manipulators. Still can be better. - Added alpha-filter for pre-processing Icon-image, giving nicer display of icon-antialising on dark or bright backdrops - disabled Manipulators when in editmode, and current layers don't show the edited data. - Added the value used to define Normal size (editmode draw) in Scene too, so it gets saved.
This commit is contained in:
parent
cdca939c2c
commit
422b69fe1e
@ -165,10 +165,10 @@ typedef struct Global {
|
||||
#define G_ALLEDGES 2048
|
||||
#define G_DEBUG 4096
|
||||
#define G_SCENESCRIPT 8192
|
||||
#define G_PROPORTIONAL 16384
|
||||
#define G_WEIGHTPAINT 32768 /* __NLA */
|
||||
/* #define G_PROPORTIONAL 16384 removed! so can be used later for other stuff */
|
||||
#define G_WEIGHTPAINT 32768
|
||||
#define G_TEXTUREPAINT 65536
|
||||
#define G_NOFROZEN (1 << 17) // frozen modules inactive
|
||||
/* #define G_NOFROZEN (1 << 17) also removed */
|
||||
#define G_DRAWEDGES (1 << 18)
|
||||
#define G_DRAWCREASES (1 << 19)
|
||||
#define G_DRAWSEAMS (1 << 20)
|
||||
|
@ -160,6 +160,7 @@ Scene *add_scene(char *name)
|
||||
sce= alloc_libblock(&G.main->scene, ID_SCE, name);
|
||||
sce->lay= 1;
|
||||
sce->selectmode= SCE_SELECT_VERTEX;
|
||||
sce->editbutsize= 0.1;
|
||||
|
||||
sce->r.mode= R_GAMMA;
|
||||
sce->r.cfra= 1;
|
||||
|
@ -4662,6 +4662,7 @@ static void do_versions(Main *main)
|
||||
sce->r.zblur= 10.0;
|
||||
sce->r.zmin= 0.8;
|
||||
}
|
||||
if(sce->editbutsize==0.0) sce->editbutsize= 0.1;
|
||||
|
||||
sce= sce->id.next;
|
||||
}
|
||||
|
@ -258,15 +258,15 @@ typedef enum {
|
||||
ICON_CAMERA_DEHLT,
|
||||
ICON_ARMATURE_DEHLT,
|
||||
|
||||
ICON_SHARPCURVE,
|
||||
ICON_SMOOTHCURVE,
|
||||
ICON_SPHERECURVE,
|
||||
ICON_ROOTCURVE,
|
||||
ICON_SHARPCURVE,
|
||||
ICON_LINCURVE,
|
||||
ICON_NOCURVE,
|
||||
ICON_BLANK46,
|
||||
ICON_BLANK47,
|
||||
ICON_BLANK48,
|
||||
ICON_BLANK49,
|
||||
ICON_PROP_OFF,
|
||||
ICON_PROP_ON,
|
||||
ICON_PROP_CON,
|
||||
ICON_BLANK50,
|
||||
ICON_BLANK51,
|
||||
ICON_BLANK52,
|
||||
@ -280,13 +280,13 @@ typedef enum {
|
||||
ICON_BLANK60,
|
||||
ICON_BLANK61,
|
||||
|
||||
ICON_BLANK65,
|
||||
ICON_BLANK66,
|
||||
ICON_BLANK67,
|
||||
ICON_MANIPUL,
|
||||
ICON_MAN_TRANS,
|
||||
ICON_MAN_ROT,
|
||||
ICON_MAN_SCALE,
|
||||
ICON_MANIPUL,
|
||||
ICON_BLANK65,
|
||||
ICON_BLANK66,
|
||||
ICON_BLANK67,
|
||||
ICON_BLANK68,
|
||||
ICON_BLANK69,
|
||||
ICON_BLANK70,
|
||||
|
@ -58,13 +58,6 @@
|
||||
#define CTX_NO_NOR_RECALC 8
|
||||
#define CTX_SETLOCALCONST 16
|
||||
|
||||
/* TRANSFORM PROPORTIONAL FALLOFF MODES */
|
||||
#define PROP_SHARP 0
|
||||
#define PROP_LIN 1
|
||||
#define PROP_ROOT 2
|
||||
#define PROP_SPHERE 3
|
||||
#define PROP_CONST 4
|
||||
#define PROP_SMOOTH 5
|
||||
|
||||
void Transform(int mode, int context);
|
||||
|
||||
|
@ -259,7 +259,11 @@ typedef struct Scene {
|
||||
float twcent[3]; /* center for transform widget */
|
||||
float twmin[3], twmax[3]; /* boundbox of selection for transform widget */
|
||||
unsigned int lay;
|
||||
|
||||
/* editmode stuff */
|
||||
short selectmode, pad;
|
||||
short proportional, prop_mode;
|
||||
float editbutsize; /* size of normals */
|
||||
|
||||
void *ed;
|
||||
struct Radio *radio;
|
||||
@ -387,6 +391,14 @@ typedef struct Scene {
|
||||
#define SCE_SELECT_EDGE 2
|
||||
#define SCE_SELECT_FACE 4
|
||||
|
||||
/* sce->prop_mode (proportional falloff) */
|
||||
#define PROP_SMOOTH 0
|
||||
#define PROP_SPHERE 1
|
||||
#define PROP_ROOT 2
|
||||
#define PROP_SHARP 3
|
||||
#define PROP_LIN 4
|
||||
#define PROP_CONST 5
|
||||
|
||||
/* return flag next_object function */
|
||||
#define F_START 0
|
||||
#define F_SCENE 1
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -160,7 +160,7 @@ static short degr= 90, step= 9, turn= 1;
|
||||
static float extr_offs= 1.0;
|
||||
static float editbutweight=1.0;
|
||||
short editbutflag= 1;
|
||||
float doublimit= 0.001, editbutvweight=1, editbutsize=0.1;
|
||||
float doublimit= 0.001, editbutvweight=1;
|
||||
float uv_calc_radius= 1.0, uv_calc_cubesize= 1.0;
|
||||
short uv_calc_mapdir= 1, uv_calc_mapalign= 1, facesel_draw_edges= 0;
|
||||
|
||||
@ -1247,7 +1247,7 @@ static void editing_panel_curve_tools1(Object *ob, Curve *cu)
|
||||
uiDefBut(block, BUT,B_SELSWAP, "Select Swap", 400,80,150,18, 0, 0, 0, 0, 0, "Selects unselected faces, and deselects selected faces");
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
uiDefButF(block, NUM, REDRAWVIEW3D, "NSize:", 400, 40, 150, 19, &editbutsize, 0.001, 1.0, 10, 0, "Normal size for drawing");
|
||||
uiDefButF(block, NUM, REDRAWVIEW3D, "NSize:", 400, 40, 150, 19, &G.scene->editbutsize, 0.001, 1.0, 10, 0, "Normal size for drawing");
|
||||
}
|
||||
|
||||
/* for curve, surf and font! */
|
||||
@ -2166,7 +2166,7 @@ static void editing_panel_mesh_tools1(Object *ob, Mesh *me)
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefButF(block, NUM, REDRAWVIEW3D, "NSize:", 955, 131, 150, 19, &editbutsize, 0.001, 2.0, 10, 0, "Sets the length to use when displaying face normals");
|
||||
uiDefButF(block, NUM, REDRAWVIEW3D, "NSize:", 955, 131, 150, 19, &G.scene->editbutsize, 0.001, 2.0, 10, 0, "Sets the length to use when displaying face normals");
|
||||
uiDefButI(block, TOG|BIT|6, REDRAWVIEW3D, "Draw Normals", 955,110,150,19, &G.f, 0, 0, 0, 0, "Displays face normals as lines");
|
||||
uiDefButI(block, TOG|BIT|7, REDRAWVIEW3D, "Draw Faces", 955,88,150,19, &G.f, 0, 0, 0, 0, "Displays all faces as shades");
|
||||
uiDefButI(block, TOG|BIT|18, REDRAWVIEW3D, "Draw Edges", 955,66,150,19, &G.f, 0, 0, 0, 0, "Displays selected edges using hilights");
|
||||
|
@ -499,7 +499,7 @@ static void draw_image_prop_circle(ImBuf *ibuf)
|
||||
float aspx, aspy;
|
||||
extern float prop_cent[3];
|
||||
|
||||
if(G.moving && G.f & G_PROPORTIONAL) {
|
||||
if(G.moving && G.scene->proportional) {
|
||||
|
||||
if(ibuf==0 || ibuf->rect==0 || ibuf->x==0 || ibuf->y==0) {
|
||||
aspx= aspy= 1.0;
|
||||
|
@ -1622,7 +1622,6 @@ static void draw_em_measure_stats(Object *ob, EditMesh *em)
|
||||
|
||||
static void draw_em_fancy(Object *ob, EditMesh *em, DerivedMesh *baseDM, DerivedMesh *realDM, int dt)
|
||||
{
|
||||
extern float editbutsize; /* buttons.c */
|
||||
Mesh *me = ob->data;
|
||||
DerivedMesh *cageDM;
|
||||
|
||||
@ -1701,7 +1700,7 @@ static void draw_em_fancy(Object *ob, EditMesh *em, DerivedMesh *baseDM, Derived
|
||||
|
||||
if(G.f & G_DRAWNORMALS) {
|
||||
BIF_ThemeColor(TH_NORMAL);
|
||||
draw_em_face_normals(em, editbutsize);
|
||||
draw_em_face_normals(em, G.scene->editbutsize);
|
||||
}
|
||||
|
||||
if(G.f & (G_DRAW_EDGELEN|G_DRAW_FACEAREA|G_DRAW_EDGEANG))
|
||||
@ -2684,7 +2683,6 @@ static void draw_editnurb(Object *ob, Nurb *nurb, int sel)
|
||||
|
||||
static void drawnurb(Object *ob, Nurb *nurb, int dt)
|
||||
{
|
||||
extern float editbutsize; /* buttons.c */
|
||||
Curve *cu;
|
||||
Nurb *nu;
|
||||
BevPoint *bevp;
|
||||
@ -2726,13 +2724,13 @@ static void drawnurb(Object *ob, Nurb *nurb, int dt)
|
||||
while(nr-- > 0) {
|
||||
|
||||
glBegin(GL_LINE_STRIP);
|
||||
vec[0]= bevp->x-editbutsize*bevp->mat[0][0];
|
||||
vec[1]= bevp->y-editbutsize*bevp->mat[0][1];
|
||||
vec[2]= bevp->z-editbutsize*bevp->mat[0][2];
|
||||
vec[0]= bevp->x-G.scene->editbutsize*bevp->mat[0][0];
|
||||
vec[1]= bevp->y-G.scene->editbutsize*bevp->mat[0][1];
|
||||
vec[2]= bevp->z-G.scene->editbutsize*bevp->mat[0][2];
|
||||
glVertex3fv(vec);
|
||||
vec[0]= bevp->x+editbutsize*bevp->mat[0][0];
|
||||
vec[1]= bevp->y+editbutsize*bevp->mat[0][1];
|
||||
vec[2]= bevp->z+editbutsize*bevp->mat[0][2];
|
||||
vec[0]= bevp->x+G.scene->editbutsize*bevp->mat[0][0];
|
||||
vec[1]= bevp->y+G.scene->editbutsize*bevp->mat[0][1];
|
||||
vec[2]= bevp->z+G.scene->editbutsize*bevp->mat[0][2];
|
||||
glVertex3fv(vec);
|
||||
|
||||
glEnd();
|
||||
|
@ -175,7 +175,6 @@ TransVert *transvmain= 0;
|
||||
int tottrans=0, transmode=0; /* 1: texspace */
|
||||
|
||||
float prop_size= 1.0;
|
||||
int prop_mode= 0;
|
||||
float prop_cent[3];
|
||||
|
||||
/* used in editipo, editcurve and here */
|
||||
@ -4182,7 +4181,7 @@ void make_trans_verts(float *min, float *max, int mode)
|
||||
/* now only in use by drawimage.c */
|
||||
void draw_prop_circle()
|
||||
{
|
||||
if (G.f & G_PROPORTIONAL) {
|
||||
if (G.scene->proportional) {
|
||||
float tmat[4][4], imat[4][4];
|
||||
|
||||
if(G.moving) {
|
||||
@ -4217,7 +4216,7 @@ void set_proportional_weight(TransVert *tv, float *min, float *max)
|
||||
else if(dist > prop_size) tv->fac= 0.0;
|
||||
else {
|
||||
dist= (prop_size-dist)/prop_size;
|
||||
if(prop_mode==1) tv->fac= 3.0*dist*dist - 2.0*dist*dist*dist;
|
||||
if(G.scene->prop_mode==1) tv->fac= 3.0*dist*dist - 2.0*dist*dist*dist;
|
||||
else tv->fac= dist*dist;
|
||||
}
|
||||
}
|
||||
@ -4702,7 +4701,6 @@ void restore_tob(TransOb *tob)
|
||||
int cylinder_intersect_test(void)
|
||||
{
|
||||
EditMesh *em = G.editMesh;
|
||||
extern float editbutsize;
|
||||
float *oldloc, speed[3], s, t, labda, labdacor, dist, len, len2, axis[3], *base, rc[3], n[3], o[3];
|
||||
EditVert *v1;
|
||||
|
||||
@ -4728,13 +4726,13 @@ int cylinder_intersect_test(void)
|
||||
|
||||
dist= fabs( rc[0]*n[0] + rc[1]*n[1] + rc[2]*n[2] );
|
||||
|
||||
if( dist>=editbutsize ) return 0;
|
||||
if( dist>=G.scene->editbutsize ) return 0;
|
||||
|
||||
Crossf(o, rc, axis);
|
||||
t= -(o[0]*n[0] + o[1]*n[1] + o[2]*n[2])/len;
|
||||
|
||||
Crossf(o, n, axis);
|
||||
s= fabs(sqrt(editbutsize*editbutsize-dist*dist) / (o[0]*speed[0] + o[1]*speed[1] + o[2]*speed[2]));
|
||||
s= fabs(sqrt(G.scene->editbutsize*G.scene->editbutsize-dist*dist) / (o[0]*speed[0] + o[1]*speed[1] + o[2]*speed[2]));
|
||||
|
||||
labdacor= t-s;
|
||||
labda= t+s;
|
||||
@ -4768,7 +4766,6 @@ int cylinder_intersect_test(void)
|
||||
int sphere_intersect_test(void)
|
||||
{
|
||||
EditMesh *em = G.editMesh;
|
||||
extern float editbutsize;
|
||||
float *oldloc, speed[3], labda, labdacor, len, bsq, u, disc, *base, rc[3];
|
||||
EditVert *v1;
|
||||
|
||||
@ -4785,7 +4782,7 @@ int sphere_intersect_test(void)
|
||||
|
||||
VecSubf(rc, oldloc, base);
|
||||
bsq= rc[0]*speed[0] + rc[1]*speed[1] + rc[2]*speed[2];
|
||||
u= rc[0]*rc[0] + rc[1]*rc[1] + rc[2]*rc[2] - editbutsize*editbutsize;
|
||||
u= rc[0]*rc[0] + rc[1]*rc[1] + rc[2]*rc[2] - G.scene->editbutsize*G.scene->editbutsize;
|
||||
|
||||
disc= bsq*bsq - u;
|
||||
|
||||
@ -4794,7 +4791,7 @@ int sphere_intersect_test(void)
|
||||
labdacor= (-bsq - disc)/len; /* entry point */
|
||||
labda= (-bsq + disc)/len;
|
||||
|
||||
printf("var1: %f, var2: %f, var3: %f\n", labdacor, labda, editbutsize);
|
||||
printf("var1: %f, var2: %f, var3: %f\n", labdacor, labda, G.scene->editbutsize);
|
||||
}
|
||||
else return 0;
|
||||
|
||||
|
@ -359,12 +359,11 @@ void transform_tface_uv(int mode, int context) // 2 args, for callback
|
||||
short mval[2], val, xo, yo, xn, yn, xc, yc;
|
||||
char str[80];
|
||||
extern float prop_size, prop_cent[3];
|
||||
extern int prop_mode;
|
||||
|
||||
if( is_uv_tface_editing_allowed()==0 ) return;
|
||||
me= get_mesh(OBACT);
|
||||
|
||||
if(G.f & G_PROPORTIONAL) propmode= 1;
|
||||
if(G.scene->proportional) propmode= 1;
|
||||
|
||||
min[0]= min[1]= 10000.0;
|
||||
max[0]= max[1]= -10000.0;
|
||||
@ -488,7 +487,7 @@ void transform_tface_uv(int mode, int context) // 2 args, for callback
|
||||
else if(dist > prop_size) tv->fac= 0.0;
|
||||
else {
|
||||
dist= (prop_size-dist)/prop_size;
|
||||
if(prop_mode==1)
|
||||
if(G.scene->prop_mode==1)
|
||||
tv->fac= 3.0*dist*dist - 2.0*dist*dist*dist;
|
||||
else tv->fac= dist*dist;
|
||||
}
|
||||
|
@ -802,14 +802,13 @@ static uiBlock *image_uvs_showhidemenu(void *arg_unused)
|
||||
|
||||
static void do_image_uvs_propfalloffmenu(void *arg, int event)
|
||||
{
|
||||
extern int prop_mode;
|
||||
|
||||
switch(event) {
|
||||
case 0: /* proportional edit - sharp*/
|
||||
prop_mode = 0;
|
||||
G.scene->prop_mode = 0;
|
||||
break;
|
||||
case 1: /* proportional edit - smooth*/
|
||||
prop_mode = 1;
|
||||
G.scene->prop_mode = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -818,14 +817,13 @@ static uiBlock *image_uvs_propfalloffmenu(void *arg_unused)
|
||||
{
|
||||
uiBlock *block;
|
||||
short yco = 20, menuwidth = 120;
|
||||
extern int prop_mode;
|
||||
|
||||
block= uiNewBlock(&curarea->uiblocks, "image_uvs_propfalloffmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
|
||||
uiBlockSetButmFunc(block, do_image_uvs_propfalloffmenu, NULL);
|
||||
|
||||
if (prop_mode==0) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Sharp|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
|
||||
if (G.scene->prop_mode==0) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Sharp|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
|
||||
else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Sharp|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
|
||||
if (prop_mode==1) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Smooth|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
|
||||
if (G.scene->prop_mode==1) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Smooth|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
|
||||
else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Smooth|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
|
||||
|
||||
uiBlockSetDirection(block, UI_RIGHT);
|
||||
@ -952,10 +950,10 @@ static void do_image_uvsmenu(void *arg, int event)
|
||||
stitch_uv_tface(0);
|
||||
break;
|
||||
case 5: /* Proportional Edit (toggle) */
|
||||
if(G.f & G_PROPORTIONAL)
|
||||
G.f &= ~G_PROPORTIONAL;
|
||||
if(G.scene->proportional)
|
||||
G.scene->proportional= 0;
|
||||
else
|
||||
G.f |= G_PROPORTIONAL;
|
||||
G.scene->proportional= 1;
|
||||
break;
|
||||
case 7: /* UVs Snap to Pixel */
|
||||
if(G.sima->flag & SI_NOPIXELSNAP) G.sima->flag &= ~SI_NOPIXELSNAP;
|
||||
@ -1013,7 +1011,7 @@ static uiBlock *image_uvsmenu(void *arg_unused)
|
||||
|
||||
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
|
||||
|
||||
if(G.f & G_PROPORTIONAL)
|
||||
if(G.scene->proportional)
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Proportional Editing|O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
|
||||
else
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Proportional Editing|O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
|
||||
|
@ -1831,9 +1831,8 @@ static uiBlock *view3d_edit_objectmenu(void *arg_unused)
|
||||
|
||||
static void do_view3d_edit_propfalloffmenu(void *arg, int event)
|
||||
{
|
||||
extern int prop_mode;
|
||||
|
||||
prop_mode= event;
|
||||
G.scene->prop_mode= event;
|
||||
|
||||
allqueue(REDRAWVIEW3D, 1);
|
||||
}
|
||||
@ -1842,21 +1841,22 @@ static uiBlock *view3d_edit_propfalloffmenu(void *arg_unused)
|
||||
{
|
||||
uiBlock *block;
|
||||
short yco = 20, menuwidth = 120;
|
||||
extern int prop_mode;
|
||||
|
||||
block= uiNewBlock(&curarea->uiblocks, "view3d_edit_propfalloffmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
|
||||
uiBlockSetButmFunc(block, do_view3d_edit_propfalloffmenu, NULL);
|
||||
|
||||
if (prop_mode==0) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Sharp|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
|
||||
else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Sharp|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
|
||||
if (prop_mode==1) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Smooth|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
|
||||
else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Smooth|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
|
||||
if (prop_mode==2) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Root|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 2, 1, "");
|
||||
else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Root|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 2, 1, "");
|
||||
if (prop_mode==3) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Linear|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 3, 1, "");
|
||||
else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Linear|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 3, 1, "");
|
||||
if (prop_mode==4) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Constant|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 4, 1, "");
|
||||
else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Constant|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 4, 1, "");
|
||||
if (G.scene->prop_mode==PROP_SMOOTH) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Smooth|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SMOOTH, "");
|
||||
else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Smooth|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SMOOTH, "");
|
||||
if (G.scene->prop_mode==PROP_SPHERE) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Smooth|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SPHERE, "");
|
||||
else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Smooth|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SPHERE, "");
|
||||
if (G.scene->prop_mode==PROP_ROOT) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Root|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_ROOT, "");
|
||||
else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Root|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_ROOT, "");
|
||||
if (G.scene->prop_mode==PROP_SHARP) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Sharp|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SHARP, "");
|
||||
else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Sharp|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SHARP, "");
|
||||
if (G.scene->prop_mode==PROP_LIN) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Linear|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_LIN, "");
|
||||
else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Linear|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_LIN, "");
|
||||
if (G.scene->prop_mode==PROP_CONST) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Constant|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_CONST, "");
|
||||
else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Constant|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_CONST, "");
|
||||
|
||||
uiBlockSetDirection(block, UI_RIGHT);
|
||||
uiTextBoundsBlock(block, 60);
|
||||
@ -2253,8 +2253,8 @@ static void do_view3d_edit_meshmenu(void *arg, int event)
|
||||
Transform(TFM_WARP, CTX_NONE);
|
||||
break;
|
||||
case 12: /* proportional edit (toggle) */
|
||||
if(G.f & G_PROPORTIONAL) G.f &= ~G_PROPORTIONAL;
|
||||
else G.f |= G_PROPORTIONAL;
|
||||
if(G.scene->proportional) G.scene->proportional= 1;
|
||||
else G.scene->proportional= 0;
|
||||
break;
|
||||
}
|
||||
allqueue(REDRAWVIEW3D, 0);
|
||||
@ -2311,7 +2311,7 @@ static uiBlock *view3d_edit_meshmenu(void *arg_unused)
|
||||
|
||||
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
|
||||
|
||||
if(G.f & G_PROPORTIONAL) {
|
||||
if(G.scene->proportional) {
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Proportional Editing|O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");
|
||||
} else {
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Proportional Editing|O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");
|
||||
@ -2496,8 +2496,8 @@ static void do_view3d_edit_curvemenu(void *arg, int event)
|
||||
delete_context_selected();
|
||||
break;
|
||||
case 9: /* proportional edit (toggle) */
|
||||
if(G.f & G_PROPORTIONAL) G.f &= ~G_PROPORTIONAL;
|
||||
else G.f |= G_PROPORTIONAL;
|
||||
if(G.scene->proportional) G.scene->proportional= 0;
|
||||
else G.scene->proportional= 1;
|
||||
break;
|
||||
case 13: /* Shear */
|
||||
Transform(TFM_SHEAR, CTX_NONE);
|
||||
@ -2550,7 +2550,7 @@ static uiBlock *view3d_edit_curvemenu(void *arg_unused)
|
||||
|
||||
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
|
||||
|
||||
if(G.f & G_PROPORTIONAL) {
|
||||
if(G.scene->proportional) {
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Proportional Editing|O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
|
||||
} else {
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Proportional Editing|O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
|
||||
@ -2834,8 +2834,8 @@ static void do_view3d_edit_latticemenu(void *arg, int event)
|
||||
Transform(TFM_WARP, CTX_NONE);
|
||||
break;
|
||||
case 5: /* proportional edit (toggle) */
|
||||
if(G.f & G_PROPORTIONAL) G.f &= ~G_PROPORTIONAL;
|
||||
else G.f |= G_PROPORTIONAL;
|
||||
if(G.scene->proportional) G.scene->proportional= 0;
|
||||
else G.scene->proportional= 1;
|
||||
break;
|
||||
}
|
||||
allqueue(REDRAWVIEW3D, 0);
|
||||
@ -2867,7 +2867,7 @@ static uiBlock *view3d_edit_latticemenu(void *arg_unused)
|
||||
|
||||
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
|
||||
|
||||
if(G.f & G_PROPORTIONAL) {
|
||||
if(G.scene->proportional) {
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Proportional Editing|O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
|
||||
} else {
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Proportional Editing|O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
|
||||
@ -3476,12 +3476,12 @@ static char *propfalloff_pup(void)
|
||||
static char string[512];
|
||||
|
||||
strcpy(string, "Falloff: %t");
|
||||
strcat(string, "|Sharp Falloff%x0");
|
||||
strcat(string, "|Linear Falloff%x1");
|
||||
strcat(string, "|Smooth Falloff%x0");
|
||||
strcat(string, "|Sphere Falloff%x1");
|
||||
strcat(string, "|Root Falloff%x2");
|
||||
strcat(string, "|Round Falloff%x3");
|
||||
strcat(string, "|Constant, No Falloff%x4");
|
||||
strcat(string, "|Smooth Falloff%x5");
|
||||
strcat(string, "|Sharp Falloff%x3");
|
||||
strcat(string, "|Linear Falloff%x4");
|
||||
strcat(string, "|Constant, No Falloff%x5");
|
||||
return (string);
|
||||
}
|
||||
|
||||
@ -4049,7 +4049,7 @@ void view3d_buttons(void)
|
||||
xco+= 8;
|
||||
|
||||
/* LAYERS */
|
||||
if(G.vd->localview==0) {
|
||||
if(G.obedit==NULL && G.vd->localview==0) {
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
for(a=0; a<5; a++)
|
||||
@ -4073,15 +4073,19 @@ void view3d_buttons(void)
|
||||
xco+= XIC+10;
|
||||
|
||||
}
|
||||
else xco+= (10+1)*(XIC/2)+10;
|
||||
|
||||
/* proportional falloff */
|
||||
if(G.obedit && (G.obedit->type == OB_MESH || G.obedit->type == OB_CURVE || G.obedit->type == OB_SURF || G.obedit->type == OB_LATTICE)) {
|
||||
extern int prop_mode;
|
||||
if(G.f & G_PROPORTIONAL) {
|
||||
uiDefIconTextButI(block, ICONTEXTROW,B_REDR, ICON_SHARPCURVE, propfalloff_pup(), xco,0,XIC+10,YIC, &(prop_mode), 0, 1.0, 0, 0, "Proportional Edit Falloff (Hotkey: Shift O) ");
|
||||
xco+= XIC+20;
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefIconTextButS(block, ICONTEXTROW,B_REDR, ICON_PROP_OFF, "Proportional %t|Off %x0|On %x1|Connected %x2", xco,0,XIC+10,YIC, &(G.scene->proportional), 0, 1.0, 0, 0, "Proportional Edit Falloff (Hotkey: O) ");
|
||||
xco+= XIC+10;
|
||||
|
||||
if(G.scene->proportional) {
|
||||
uiDefIconTextButS(block, ICONTEXTROW,B_REDR, ICON_SMOOTHCURVE, propfalloff_pup(), xco,0,XIC+10,YIC, &(G.scene->prop_mode), 0.0, 0.0, 0, 0, "Proportional Edit Falloff (Hotkey: Shift O) ");
|
||||
xco+= XIC+10;
|
||||
}
|
||||
xco+= 10;
|
||||
}
|
||||
|
||||
/* selection modus */
|
||||
|
@ -1863,7 +1863,7 @@ static int ui_do_but_ICONTEXTROW(uiBut *but)
|
||||
width+= 30;
|
||||
if (width<50) width=50;
|
||||
|
||||
ypos = 0;
|
||||
ypos = 1;
|
||||
|
||||
/* loop through the menu options and draw them out with icons & text labels */
|
||||
for(a=0; a<md->nitems; a++) {
|
||||
@ -1878,6 +1878,14 @@ static int ui_do_but_ICONTEXTROW(uiBut *but)
|
||||
}
|
||||
}
|
||||
|
||||
if(md->title) {
|
||||
uiBut *bt;
|
||||
uiSetCurFont(block, block->font+1);
|
||||
bt= uiDefBut(block, LABEL, 0, md->title, 0, ypos, (short)width, 19, NULL, 0.0, 0.0, 0, 0, "");
|
||||
uiSetCurFont(block, block->font);
|
||||
bt->flag= UI_TEXT_LEFT;
|
||||
}
|
||||
|
||||
block->direction= UI_TOP;
|
||||
ui_positionblock(block, but);
|
||||
|
||||
|
@ -227,22 +227,37 @@ static void def_icon(ImBuf *bbuf, GLuint texid, BIFIconID icon, int xidx, int yi
|
||||
}
|
||||
}
|
||||
|
||||
/***/
|
||||
/* this only works for the hardcoded buttons image, turning the grey AA pixels to alpha, and slight off-grey to half alpha */
|
||||
|
||||
static void clear_transp_rect_soft(unsigned char *transp, unsigned char *rect, int w, int h, int rowstride)
|
||||
{
|
||||
int x,y;
|
||||
int x, y, val;
|
||||
|
||||
for (y=0; y<h; y++) {
|
||||
for (y=1; y<h-1; y++) {
|
||||
unsigned char *row0= &rect[(y-1)*rowstride];
|
||||
unsigned char *row= &rect[y*rowstride];
|
||||
for (x=0; x<w; x++) {
|
||||
unsigned char *row1= &rect[(y+1)*rowstride];
|
||||
for (x=1; x<w-1; x++) {
|
||||
unsigned char *pxl0= &row0[x*4];
|
||||
unsigned char *pxl= &row[x*4];
|
||||
unsigned char *pxl1= &row1[x*4];
|
||||
|
||||
if (*((unsigned int*) pxl)==*((unsigned int*) transp)) {
|
||||
pxl[3]= 0;
|
||||
if(pxl[3]!=0) {
|
||||
val= (abs(pxl[0]-transp[0]) + abs(pxl[1]-transp[1]) + abs(pxl[2]-transp[2]))/3;
|
||||
if(val<20) {
|
||||
pxl[3]= 128;
|
||||
}
|
||||
else if(val<60) {
|
||||
// one of pixels surrounding has alpha null?
|
||||
if(pxl[3-4]==0 || pxl[3+4]==0 || pxl0[3]==0 || pxl1[3]==0) {
|
||||
|
||||
if(pxl[0]>val) pxl[0]-= val; else pxl[0]= 0;
|
||||
if(pxl[1]>val) pxl[1]-= val; else pxl[1]= 0;
|
||||
if(pxl[2]>val) pxl[2]-= val; else pxl[2]= 0;
|
||||
|
||||
pxl[3]= 128;
|
||||
}
|
||||
}
|
||||
else if( abs(pxl[0]-transp[0])<10 && abs(pxl[1]-transp[1])<10 && abs(pxl[2]-transp[2])<10) {
|
||||
pxl[3]= 40;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -282,12 +297,15 @@ void BIF_resources_init(void)
|
||||
transp[1]= start[1];
|
||||
transp[2]= start[2];
|
||||
transp[3]= start[3];
|
||||
clear_transp_rect(transp, start, 20, 21, rowstride);
|
||||
clear_transp_rect_soft(transp, start, 20, 21, rowstride);
|
||||
|
||||
/* this sets outside of icon to zero alpha */
|
||||
start= ((unsigned char*) bbuf->rect) + (y*21)*rowstride + (x*20)*4;
|
||||
QUATCOPY(transp, start);
|
||||
clear_transp_rect(transp, start, 20, 21, rowstride);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1462,12 +1462,16 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
|
||||
ob= OBACT;
|
||||
if (G.obedit) {
|
||||
if (G.qual==LR_SHIFTKEY) {
|
||||
extern int prop_mode;
|
||||
prop_mode = (prop_mode+1)%6;
|
||||
G.scene->prop_mode = (G.scene->prop_mode+1)%6;
|
||||
allqueue(REDRAWHEADERS, 0);
|
||||
}
|
||||
else if((G.qual==LR_ALTKEY)) {
|
||||
if(G.scene->proportional==2) G.scene->proportional= 1;
|
||||
else G.scene->proportional= 2;
|
||||
allqueue(REDRAWHEADERS, 0);
|
||||
}
|
||||
else if((G.qual==0)) {
|
||||
G.f ^= G_PROPORTIONAL;
|
||||
G.scene->proportional= !G.scene->proportional;
|
||||
allqueue(REDRAWHEADERS, 0);
|
||||
}
|
||||
}
|
||||
@ -3825,14 +3829,10 @@ static void winqreadimagespace(ScrArea *sa, void *spacedata, BWinEvent *evt)
|
||||
break;
|
||||
case OKEY:
|
||||
if (G.qual==LR_SHIFTKEY) {
|
||||
extern int prop_mode;
|
||||
prop_mode= !prop_mode;
|
||||
G.scene->prop_mode= !G.scene->prop_mode;
|
||||
}
|
||||
else if((G.qual==0)) {
|
||||
if(G.f & G_PROPORTIONAL)
|
||||
G.f &= ~G_PROPORTIONAL;
|
||||
else
|
||||
G.f |= G_PROPORTIONAL;
|
||||
G.scene->proportional= !G.scene->proportional;
|
||||
}
|
||||
break;
|
||||
case PKEY:
|
||||
|
@ -2015,8 +2015,8 @@ static void tb_do_transform(void *arg, int event)
|
||||
Transform(TFM_WARP, CTX_NONE);
|
||||
break;
|
||||
case 8: /* proportional edit (toggle) */
|
||||
if(G.f & G_PROPORTIONAL) G.f &= ~G_PROPORTIONAL;
|
||||
else G.f |= G_PROPORTIONAL;
|
||||
if(G.scene->proportional) G.scene->proportional= 0;
|
||||
else G.scene->proportional= 1;
|
||||
break;
|
||||
}
|
||||
allqueue(REDRAWVIEW3D, 0);
|
||||
|
@ -487,8 +487,7 @@ void Transform(int mode, int context)
|
||||
break;
|
||||
case OKEY:
|
||||
if (Trans.flag & T_PROP_EDIT && G.qual==LR_SHIFTKEY) {
|
||||
extern int prop_mode;
|
||||
prop_mode = (prop_mode+1)%6;
|
||||
G.scene->prop_mode = (G.scene->prop_mode+1)%6;
|
||||
calculatePropRatio(&Trans);
|
||||
Trans.redraw= 1;
|
||||
}
|
||||
|
@ -387,8 +387,9 @@ void initTrans (TransInfo *t)
|
||||
t->flag = 0;
|
||||
|
||||
/* setting PET flag */
|
||||
if ((t->context & CTX_NO_PET) == 0 && (G.f & G_PROPORTIONAL)) {
|
||||
if ((t->context & CTX_NO_PET) == 0 && (G.scene->proportional)) {
|
||||
t->flag |= T_PROP_EDIT;
|
||||
if(G.scene->proportional==2) t->flag |= T_PROP_CONNECTED; // yes i know, has to become define
|
||||
}
|
||||
|
||||
getmouseco_areawin(t->imval);
|
||||
@ -719,7 +720,6 @@ void calculatePropRatio(TransInfo *t)
|
||||
int i;
|
||||
float dist;
|
||||
short connected = t->flag & T_PROP_CONNECTED;
|
||||
extern int prop_mode;
|
||||
|
||||
if (t->flag & T_PROP_EDIT) {
|
||||
for(i = 0 ; i < t->total; i++, td++) {
|
||||
@ -743,7 +743,7 @@ void calculatePropRatio(TransInfo *t)
|
||||
/* Use rdist for falloff calculations, it is the real distance */
|
||||
td->flag &= ~TD_NOACTION;
|
||||
dist= (t->propsize-td->rdist)/t->propsize;
|
||||
switch(prop_mode) {
|
||||
switch(G.scene->prop_mode) {
|
||||
case PROP_SHARP:
|
||||
td->factor= dist*dist;
|
||||
break;
|
||||
@ -767,7 +767,7 @@ void calculatePropRatio(TransInfo *t)
|
||||
}
|
||||
}
|
||||
}
|
||||
switch(prop_mode) {
|
||||
switch(G.scene->prop_mode) {
|
||||
case PROP_SHARP:
|
||||
strcpy(t->proptext, "(Sharp)");
|
||||
break;
|
||||
|
@ -181,6 +181,7 @@ static int calc_manipulator(ScrArea *sa)
|
||||
|
||||
if(G.obedit) {
|
||||
ob= G.obedit;
|
||||
if((ob->lay & G.vd->lay)==0) return 0;
|
||||
|
||||
if(G.obedit->type==OB_MESH) {
|
||||
EditMesh *em = G.editMesh;
|
||||
@ -320,6 +321,8 @@ static int calc_manipulator(ScrArea *sa)
|
||||
bArmature *arm= G.obpose->data;
|
||||
|
||||
ob= G.obpose;
|
||||
if((ob->lay & G.vd->lay)==0) return 0;
|
||||
|
||||
Trans.mode= TFM_ROTATION; // mislead counting bones... bah
|
||||
|
||||
/* count total */
|
||||
|
Loading…
Reference in New Issue
Block a user