- added Theme for File Window
- made grid drawing using the main theme color - was annoyed with the primitive grid... so coded something that allows zooming in and out a 100fold without losing gridlines - brought back 'NKEY' for mesh editmode - added to this a 'median' option; when more vertices selected you see the average coordinate. works nice when inputting values as well (todo: make this for other editmodes) - renamed the 'NKEY' panel to 'Transform Properties', also fixed in pulldown menu. I am off for the rest of the day. More committing fun tomorrow! -Ton-
This commit is contained in:
@@ -366,6 +366,7 @@ void BIF_InitThemeColors(void);
|
||||
void BIF_ThemeColor(struct ScrArea *sa, int colorid);
|
||||
void BIF_ThemeColor4(struct ScrArea *sa, int colorid);
|
||||
void BIF_ThemeColorShade(struct ScrArea *sa, int colorid, int offset);
|
||||
void BIF_ThemeColorBlend(struct ScrArea *sa, int colorid1, int colorid2, float fac);
|
||||
|
||||
// get only one value, not scaled
|
||||
float BIF_GetThemeColorf(struct ScrArea *sa, int colorid);
|
||||
|
||||
@@ -122,6 +122,7 @@ void test_idbutton_cb(void *namev, void *arg2_unused);
|
||||
#define B_BGPICTEXCLEAR 1006
|
||||
|
||||
#define B_OBJECTPANELROT 1007
|
||||
#define B_OBJECTPANELMEDIAN 1008
|
||||
|
||||
/* *********************** */
|
||||
#define B_LAMPBUTS 1200
|
||||
|
||||
@@ -403,12 +403,37 @@ void timestr(double time, char *str)
|
||||
str[11]=0;
|
||||
}
|
||||
|
||||
static void drawgrid_draw(float wx, float wy, float x, float y, float dx)
|
||||
{
|
||||
float fx, fy;
|
||||
|
||||
x+= (wx);
|
||||
y+= (wy);
|
||||
fx= x/dx;
|
||||
fx= x-dx*floor(fx);
|
||||
|
||||
while(fx< curarea->winx) {
|
||||
fdrawline(fx, 0.0, fx, (float)curarea->winy);
|
||||
fx+= dx;
|
||||
}
|
||||
|
||||
fy= y/dx;
|
||||
fy= y-dx*floor(fy);
|
||||
|
||||
|
||||
while(fy< curarea->winy) {
|
||||
fdrawline(0.0, fy, (float)curarea->winx, fy);
|
||||
fy+= dx;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void drawgrid(ScrArea *sa)
|
||||
{
|
||||
/* extern short bgpicmode; */
|
||||
float wx, wy, x, y, fw, fx, fy, dx;
|
||||
float vec4[4];
|
||||
char col[3];
|
||||
|
||||
vec4[0]=vec4[1]=vec4[2]=0.0;
|
||||
vec4[3]= 1.0;
|
||||
@@ -434,51 +459,85 @@ static void drawgrid(ScrArea *sa)
|
||||
dx= fabs(x-(wx)*fx/fw);
|
||||
if(dx==0) dx= fabs(y-(wy)*fy/fw);
|
||||
|
||||
/* check zoom out */
|
||||
BIF_ThemeColor(sa, TH_GRID);
|
||||
persp(PERSP_WIN);
|
||||
|
||||
if(dx<6.0) {
|
||||
dx*= 10.0;
|
||||
setlinestyle(3);
|
||||
|
||||
if(dx<6.0) {
|
||||
dx*= 10.0;
|
||||
|
||||
if(dx<6.0) {
|
||||
setlinestyle(0);
|
||||
return;
|
||||
dx*=10;
|
||||
if(dx<6.0);
|
||||
else {
|
||||
BIF_ThemeColor(sa, TH_GRID);
|
||||
drawgrid_draw(wx, wy, x, y, dx);
|
||||
}
|
||||
}
|
||||
else { // start blending out
|
||||
BIF_ThemeColorBlend(curarea, TH_BACK, TH_GRID, dx/60.0);
|
||||
drawgrid_draw(wx, wy, x, y, dx);
|
||||
|
||||
BIF_ThemeColor(sa, TH_GRID);
|
||||
drawgrid_draw(wx, wy, x, y, 10*dx);
|
||||
}
|
||||
}
|
||||
else { // start blending out (6 < dx < 60)
|
||||
BIF_ThemeColorBlend(curarea, TH_BACK, TH_GRID, dx/60.0);
|
||||
drawgrid_draw(wx, wy, x, y, dx);
|
||||
|
||||
BIF_ThemeColor(sa, TH_GRID);
|
||||
drawgrid_draw(wx, wy, x, y, 10*dx);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(dx>60.0) { // start blending in
|
||||
dx/= 10.0;
|
||||
if(dx>60.0) { // start blending in
|
||||
dx/= 10.0;
|
||||
if(dx>60.0) {
|
||||
BIF_ThemeColor(sa, TH_GRID);
|
||||
drawgrid_draw(wx, wy, x, y, dx);
|
||||
}
|
||||
else {
|
||||
BIF_ThemeColorBlend(curarea, TH_BACK, TH_GRID, dx/60.0);
|
||||
drawgrid_draw(wx, wy, x, y, dx);
|
||||
BIF_ThemeColor(sa, TH_GRID);
|
||||
drawgrid_draw(wx, wy, x, y, dx*10);
|
||||
}
|
||||
}
|
||||
else {
|
||||
BIF_ThemeColorBlend(curarea, TH_BACK, TH_GRID, dx/60.0);
|
||||
drawgrid_draw(wx, wy, x, y, dx);
|
||||
BIF_ThemeColor(sa, TH_GRID);
|
||||
drawgrid_draw(wx, wy, x, y, dx*10);
|
||||
}
|
||||
}
|
||||
else {
|
||||
BIF_ThemeColorBlend(curarea, TH_BACK, TH_GRID, dx/60.0);
|
||||
drawgrid_draw(wx, wy, x, y, dx);
|
||||
BIF_ThemeColor(sa, TH_GRID);
|
||||
drawgrid_draw(wx, wy, x, y, dx*10);
|
||||
}
|
||||
}
|
||||
|
||||
persp(PERSP_WIN);
|
||||
|
||||
BIF_ThemeColor(sa, TH_GRID);
|
||||
|
||||
x+= (wx);
|
||||
y+= (wy);
|
||||
fx= x/dx;
|
||||
fx= x-dx*floor(fx);
|
||||
|
||||
while(fx< curarea->winx) {
|
||||
fdrawline(fx, 0.0, fx, (float)curarea->winy);
|
||||
fx+= dx;
|
||||
}
|
||||
|
||||
fy= y/dx;
|
||||
fy= y-dx*floor(fy);
|
||||
|
||||
|
||||
while(fy< curarea->winy) {
|
||||
fdrawline(0.0, fy, (float)curarea->winx, fy);
|
||||
fy+= dx;
|
||||
}
|
||||
BIF_GetThemeColor3ubv(curarea, TH_GRID, col);
|
||||
|
||||
/* center cross */
|
||||
if(G.vd->view==3) cpack(0xA0D0A0); /* y-as */
|
||||
else cpack(0xA0A0D0); /* x-as */
|
||||
if(G.vd->view==3) glColor3ub(col[0]<36?0:col[0]-36, col[1]>199?255:col[1]+56, col[2]<36?0:col[2]-36); /* y-as */
|
||||
else glColor3ub(col[0]>219?255:col[0]+36, col[1]<26?0:col[1]-26, col[2]<26?0:col[2]-26); /* x-as */
|
||||
|
||||
fdrawline(0.0, y, (float)curarea->winx, y);
|
||||
|
||||
if(G.vd->view==7) cpack(0xA0D0A0); /* y-as */
|
||||
else cpack(0xE0A0A0); /* z-as */
|
||||
if(G.vd->view==7) glColor3ub(col[0]<36?0:col[0]-36, col[1]>199?255:col[1]+56, col[2]<36?0:col[2]-36); /* y-as */
|
||||
else glColor3ub(col[0]<36?0:col[0]-36, col[1]<36?0:col[1]-36, col[2]>209?255:col[2]+46); /* z-as */
|
||||
|
||||
fdrawline(x, 0.0, x, (float)curarea->winy);
|
||||
fdrawline(x, 0.0, x, (float)curarea->winy);
|
||||
|
||||
persp(PERSP_VIEW);
|
||||
setlinestyle(0);
|
||||
@@ -490,6 +549,7 @@ static void drawfloor(ScrArea *sa)
|
||||
View3D *vd;
|
||||
float vert[3], grid;
|
||||
int a, gridlines;
|
||||
char col[3];
|
||||
|
||||
vd= curarea->spacedata.first;
|
||||
|
||||
@@ -501,12 +561,12 @@ static void drawfloor(ScrArea *sa)
|
||||
grid= gridlines*vd->grid;
|
||||
|
||||
BIF_ThemeColor(sa, TH_GRID);
|
||||
BIF_GetThemeColor3ubv(curarea, TH_GRID, col);
|
||||
|
||||
for(a= -gridlines;a<=gridlines;a++) {
|
||||
|
||||
if(a==0) {
|
||||
if(vd->persp==0) cpack(0xA0D0A0);
|
||||
else cpack(0x402000);
|
||||
glColor3ub(col[0]<36?0:col[0]-36, col[1]>199?255:col[1]+56, col[2]<36?0:col[2]-36); /* y-as */
|
||||
}
|
||||
else if(a==1) {
|
||||
BIF_ThemeColor(sa, TH_GRID);
|
||||
@@ -526,8 +586,7 @@ static void drawfloor(ScrArea *sa)
|
||||
|
||||
for(a= -gridlines;a<=gridlines;a++) {
|
||||
if(a==0) {
|
||||
if(vd->persp==0) cpack(0xA0A0D0);
|
||||
else cpack(0);
|
||||
glColor3ub(col[0]>219?255:col[0]+36, col[1]<26?0:col[1]-26, col[2]<26?0:col[2]-26); /* x-as */
|
||||
}
|
||||
else if(a==1) {
|
||||
BIF_ThemeColor(sa, TH_GRID);
|
||||
@@ -864,6 +923,68 @@ static void load_bgpic_image(char *name)
|
||||
|
||||
/* this one assumes there is only one global active object in blender... (for object panel) */
|
||||
static float ob_eul[3];
|
||||
/* this one assumes there is only one editmode in blender... (for object panel) */
|
||||
static float ve_median[3];
|
||||
static int ve_median_tot=0;
|
||||
|
||||
/* is used for both read and write... */
|
||||
static void v3d_editvertex_buts(uiBlock *block, Object *ob, float lim)
|
||||
{
|
||||
EditVert *eve;
|
||||
float median[3];
|
||||
int tot;
|
||||
|
||||
median[0]= median[1]= median[2]= 0.0;
|
||||
tot= 0;
|
||||
|
||||
if(ob->type==OB_MESH) {
|
||||
eve= G.edve.first;
|
||||
while(eve) {
|
||||
if(eve->f & 1) {
|
||||
tot++;
|
||||
VecAddf(median, median, eve->co);
|
||||
}
|
||||
eve= eve->next;
|
||||
}
|
||||
}
|
||||
if(tot==0) return;
|
||||
|
||||
median[0] /= (float)tot;
|
||||
median[1] /= (float)tot;
|
||||
median[2] /= (float)tot;
|
||||
|
||||
if(block) { // buttons
|
||||
|
||||
ve_median_tot= tot;
|
||||
VECCOPY(ve_median, median);
|
||||
|
||||
if(ve_median_tot==1) {
|
||||
uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Vertex X:", 10, 140, 300, 19, &(ve_median[0]), -lim, lim, 10, 0, "");
|
||||
uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Vertex Y:", 10, 120, 300, 19, &(ve_median[1]), -lim, lim, 10, 0, "");
|
||||
uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Vertex Z:", 10, 100, 300, 19, &(ve_median[2]), -lim, lim, 10, 0, "");
|
||||
}
|
||||
else {
|
||||
uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Median X:", 10, 140, 300, 19, &(ve_median[0]), -lim, lim, 10, 0, "");
|
||||
uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Median Y:", 10, 120, 300, 19, &(ve_median[1]), -lim, lim, 10, 0, "");
|
||||
uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Median Z:", 10, 100, 300, 19, &(ve_median[2]), -lim, lim, 10, 0, "");
|
||||
}
|
||||
}
|
||||
else { // apply
|
||||
|
||||
VecSubf(median, ve_median, median);
|
||||
|
||||
if(ob->type==OB_MESH) {
|
||||
eve= G.edve.first;
|
||||
while(eve) {
|
||||
if(eve->f & 1) {
|
||||
VecAddf(eve->co, eve->co, median);
|
||||
}
|
||||
eve= eve->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void do_viewbuts(unsigned short event)
|
||||
{
|
||||
@@ -931,9 +1052,17 @@ void do_viewbuts(unsigned short event)
|
||||
allqueue(REDRAWVIEW3D, 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case B_OBJECTPANELMEDIAN:
|
||||
if(ob) {
|
||||
v3d_editvertex_buts(NULL, ob, 1.0);
|
||||
allqueue(REDRAWVIEW3D, 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void view3d_panel_object(short cntrl) // VIEW3D_HANDLER_OBJECT
|
||||
{
|
||||
uiBlock *block;
|
||||
@@ -945,29 +1074,33 @@ static void view3d_panel_object(short cntrl) // VIEW3D_HANDLER_OBJECT
|
||||
block= uiNewBlock(&curarea->uiblocks, "view3d_panel_object", UI_EMBOSSX, UI_HELV, curarea->win);
|
||||
uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | cntrl);
|
||||
uiSetPanelHandler(VIEW3D_HANDLER_OBJECT); // for close and esc
|
||||
if(uiNewPanel(curarea, block, "Object", "View3d", 10, 230, 318, 204)==0) return;
|
||||
if(uiNewPanel(curarea, block, "Transform Properties", "View3d", 10, 230, 318, 204)==0) return;
|
||||
|
||||
uiDefBut(block, TEX, B_IDNAME, "OB: ", 10,180,150,20, ob->id.name+2, 0.0, 18.0, 0, 0, "");
|
||||
uiDefIDPoinBut(block, test_obpoin_but, B_REDR, "Par:", 160, 180, 150, 20, &ob->parent, "Parent Object");
|
||||
|
||||
lim= 1000.0*MAX2(1.0, G.vd->grid);
|
||||
|
||||
uiDefButF(block, NUM, REDRAWVIEW3D, "LocX:", 10, 140, 150, 19, &(ob->loc[0]), -lim, lim, 100, 0, "");
|
||||
uiDefButF(block, NUM, REDRAWVIEW3D, "LocY:", 10, 120, 150, 19, &(ob->loc[1]), -lim, lim, 100, 0, "");
|
||||
uiDefButF(block, NUM, REDRAWVIEW3D, "LocZ:", 10, 100, 150, 19, &(ob->loc[2]), -lim, lim, 100, 0, "");
|
||||
if(ob==G.obedit) {
|
||||
v3d_editvertex_buts(block, ob, lim);
|
||||
}
|
||||
else {
|
||||
uiDefButF(block, NUM, REDRAWVIEW3D, "LocX:", 10, 140, 150, 19, &(ob->loc[0]), -lim, lim, 100, 0, "");
|
||||
uiDefButF(block, NUM, REDRAWVIEW3D, "LocY:", 10, 120, 150, 19, &(ob->loc[1]), -lim, lim, 100, 0, "");
|
||||
uiDefButF(block, NUM, REDRAWVIEW3D, "LocZ:", 10, 100, 150, 19, &(ob->loc[2]), -lim, lim, 100, 0, "");
|
||||
|
||||
ob_eul[0]= 180.0*ob->rot[0]/M_PI;
|
||||
ob_eul[1]= 180.0*ob->rot[1]/M_PI;
|
||||
ob_eul[2]= 180.0*ob->rot[2]/M_PI;
|
||||
ob_eul[0]= 180.0*ob->rot[0]/M_PI;
|
||||
ob_eul[1]= 180.0*ob->rot[1]/M_PI;
|
||||
ob_eul[2]= 180.0*ob->rot[2]/M_PI;
|
||||
|
||||
uiDefButF(block, NUM, B_OBJECTPANELROT, "RotX:", 10, 70, 150, 19, &(ob_eul[0]), -lim, lim, 1000, 0, "");
|
||||
uiDefButF(block, NUM, B_OBJECTPANELROT, "RotY:", 10, 50, 150, 19, &(ob_eul[1]), -lim, lim, 1000, 0, "");
|
||||
uiDefButF(block, NUM, B_OBJECTPANELROT, "RotZ:", 10, 30, 150, 19, &(ob_eul[2]), -lim, lim, 1000, 0, "");
|
||||
|
||||
uiDefButF(block, NUM, REDRAWVIEW3D, "SizeX:", 160, 70, 150, 19, &(ob->size[0]), -lim, lim, 100, 0, "");
|
||||
uiDefButF(block, NUM, REDRAWVIEW3D, "SizeY:", 160, 50, 150, 19, &(ob->size[1]), -lim, lim, 100, 0, "");
|
||||
uiDefButF(block, NUM, REDRAWVIEW3D, "SizeZ:", 160, 30, 150, 19, &(ob->size[2]), -lim, lim, 100, 0, "");
|
||||
uiDefButF(block, NUM, B_OBJECTPANELROT, "RotX:", 10, 70, 150, 19, &(ob_eul[0]), -lim, lim, 1000, 0, "");
|
||||
uiDefButF(block, NUM, B_OBJECTPANELROT, "RotY:", 10, 50, 150, 19, &(ob_eul[1]), -lim, lim, 1000, 0, "");
|
||||
uiDefButF(block, NUM, B_OBJECTPANELROT, "RotZ:", 10, 30, 150, 19, &(ob_eul[2]), -lim, lim, 1000, 0, "");
|
||||
|
||||
uiDefButF(block, NUM, REDRAWVIEW3D, "SizeX:", 160, 70, 150, 19, &(ob->size[0]), -lim, lim, 100, 0, "");
|
||||
uiDefButF(block, NUM, REDRAWVIEW3D, "SizeY:", 160, 50, 150, 19, &(ob->size[1]), -lim, lim, 100, 0, "");
|
||||
uiDefButF(block, NUM, REDRAWVIEW3D, "SizeZ:", 160, 30, 150, 19, &(ob->size[2]), -lim, lim, 100, 0, "");
|
||||
}
|
||||
}
|
||||
|
||||
static void view3d_panel_settings(cntrl) // VIEW3D_HANDLER_BACKGROUND
|
||||
|
||||
@@ -887,41 +887,37 @@ static void draw_filescroll(SpaceFile *sfile)
|
||||
|
||||
if(scrollrct.ymin+10 >= scrollrct.ymax) return;
|
||||
|
||||
cpack(0x808080);
|
||||
BIF_ThemeColor(curarea, TH_BACK);
|
||||
glRecti(scrollrct.xmin, scrollrct.ymin, scrollrct.xmax, scrollrct.ymax);
|
||||
|
||||
uiEmboss(scrollrct.xmin, scrollrct.ymin, scrollrct.xmax, scrollrct.ymax, 1);
|
||||
|
||||
glColor3f(.715, .715, .715);
|
||||
BIF_ThemeColor(curarea, TH_HEADER);
|
||||
glRecti(bar.xmin+2, bar.ymin+2, bar.xmax-2, bar.ymax-2);
|
||||
|
||||
uiEmboss(bar.xmin+2, bar.ymin+2, bar.xmax-2, bar.ymax-2, filescrollselect);
|
||||
|
||||
}
|
||||
|
||||
static void regelrect(unsigned int col, int x, int y)
|
||||
static void regelrect(int id, int x, int y)
|
||||
{
|
||||
cpack(col);
|
||||
if(id & ACTIVE) {
|
||||
if(id & HILITE) BIF_ThemeColorShade(curarea, TH_HILITE, 20);
|
||||
else BIF_ThemeColor(curarea, TH_HILITE);
|
||||
}
|
||||
else if(id & HILITE) BIF_ThemeColorShade(curarea, TH_BACK, 20);
|
||||
else BIF_ThemeColor(curarea, TH_BACK);
|
||||
|
||||
glRects(x-17, y-3, x+collumwidth-21, y+11);
|
||||
|
||||
}
|
||||
|
||||
static void printregel(SpaceFile *sfile, struct direntry *files, int x, int y)
|
||||
{
|
||||
unsigned int boxcol=0;
|
||||
int boxcol=0;
|
||||
char *s;
|
||||
|
||||
switch(files->flags & (HILITE + ACTIVE)) {
|
||||
case HILITE+ACTIVE:
|
||||
boxcol= (0xD0A0A0);
|
||||
break;
|
||||
case HILITE:
|
||||
boxcol= (0xA0A0A0);
|
||||
break;
|
||||
case ACTIVE:
|
||||
boxcol= (0xC0A0A0);
|
||||
break;
|
||||
}
|
||||
boxcol= files->flags & (HILITE + ACTIVE);
|
||||
|
||||
if(boxcol) {
|
||||
regelrect(boxcol, x, y);
|
||||
@@ -956,8 +952,8 @@ static void printregel(SpaceFile *sfile, struct direntry *files, int x, int y)
|
||||
glRects(x-14, y, x-8, y+7);
|
||||
}
|
||||
|
||||
if(S_ISDIR(files->type)) cpack(0xFFFFFF);
|
||||
else cpack(0x0);
|
||||
if(S_ISDIR(files->type)) BIF_ThemeColor(curarea, TH_TEXT_HI);
|
||||
else BIF_ThemeColor(curarea, TH_TEXT);
|
||||
|
||||
s = files->string;
|
||||
if(s) {
|
||||
@@ -1071,7 +1067,7 @@ static void set_active_file(SpaceFile *sfile, int act)
|
||||
glScissor(curarea->winrct.xmin, curarea->winrct.ymin, curarea->winx-12, curarea->winy);
|
||||
|
||||
if( calc_filesel_regel(sfile, old, &x, &y) ) {
|
||||
regelrect(0x888888, x, y);
|
||||
regelrect(0, x, y);
|
||||
printregel(sfile, sfile->filelist+old, x, y);
|
||||
}
|
||||
if( calc_filesel_regel(sfile, newi, &x, &y) ) {
|
||||
@@ -1099,7 +1095,7 @@ static void draw_filetext(SpaceFile *sfile)
|
||||
|
||||
|
||||
/* box */
|
||||
cpack(0x888888);
|
||||
BIF_ThemeColor(curarea, TH_BACK);
|
||||
glRecti(textrct.xmin, textrct.ymin, textrct.xmax, textrct.ymax);
|
||||
|
||||
/* collums */
|
||||
@@ -1132,7 +1128,7 @@ static void draw_filetext(SpaceFile *sfile)
|
||||
/* clear drawing errors, with text at the right hand side: */
|
||||
uiEmboss(textrct.xmin, textrct.ymin, textrct.xmax, textrct.ymax, 1);
|
||||
|
||||
glColor3f(.715, .715, .715);
|
||||
BIF_ThemeColor(curarea, TH_HEADER);
|
||||
glRecti(textrct.xmax+2, textrct.ymin, textrct.xmax+10, textrct.ymax);
|
||||
}
|
||||
|
||||
@@ -1140,6 +1136,7 @@ void drawfilespace(ScrArea *sa, void *spacedata)
|
||||
{
|
||||
SpaceFile *sfile;
|
||||
uiBlock *block;
|
||||
float col[3];
|
||||
int act, loadbutton;
|
||||
short mval[2];
|
||||
char name[20];
|
||||
@@ -1147,7 +1144,8 @@ void drawfilespace(ScrArea *sa, void *spacedata)
|
||||
|
||||
myortho2(-0.5, sa->winx-0.5, -0.5, sa->winy-0.5);
|
||||
|
||||
glClearColor(.715, .715, .715, 0.0); /* headercol */
|
||||
BIF_GetThemeColor3fv(sa, TH_HEADER, col); // basic undrawn color is border
|
||||
glClearColor(col[0], col[1], col[2], 0.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
sfile= curarea->spacedata.first;
|
||||
|
||||
@@ -934,7 +934,7 @@ static uiBlock *view3d_edit_objectmenu(void *arg_unused)
|
||||
uiBlockSetButmFunc(block, do_view3d_edit_objectmenu, NULL);
|
||||
uiBlockSetCol(block, MENUCOL);
|
||||
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Object Attributes...|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 15, "");
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Object Transform|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 15, "");
|
||||
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
|
||||
|
||||
//uiDefIconTextBlockBut(block, 0, NULL, ICON_RIGHTARROW_THIN, "Move", 0, yco-=20, 120, 19, "");
|
||||
@@ -1223,7 +1223,7 @@ static void do_view3d_edit_meshmenu(void *arg, int event)
|
||||
remake_editMesh();
|
||||
break;
|
||||
case 1: /* transform properties */
|
||||
blenderqread(NKEY, 1);
|
||||
add_blockhandler(curarea, VIEW3D_HANDLER_OBJECT, 0);
|
||||
break;
|
||||
case 2: /* Extrude */
|
||||
extrude_mesh();
|
||||
@@ -1291,7 +1291,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, "");
|
||||
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Transform Properties...|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Transform Properties...|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Snap...|Shift S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 14, "");
|
||||
|
||||
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
|
||||
|
||||
@@ -361,6 +361,9 @@ char *BIF_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
|
||||
case SPACE_IPO:
|
||||
ts= &btheme->tipo;
|
||||
break;
|
||||
case SPACE_FILE:
|
||||
ts= &btheme->tfile;
|
||||
break;
|
||||
default:
|
||||
ts= &btheme->tv3d;
|
||||
break;
|
||||
@@ -435,7 +438,7 @@ void BIF_InitThemeColors(void)
|
||||
strcpy(btheme->name, "Default");
|
||||
}
|
||||
|
||||
/* buttons */
|
||||
/* UI buttons (todo) */
|
||||
|
||||
/* space view3d */
|
||||
SETCOL(btheme->tv3d.back, 115, 115, 115, 255);
|
||||
@@ -447,7 +450,7 @@ void BIF_InitThemeColors(void)
|
||||
SETCOL(btheme->tv3d.shade1, 160, 160, 160, 100);
|
||||
SETCOL(btheme->tv3d.shade2, 0x7f, 0x70, 0x70, 100);
|
||||
|
||||
SETCOL(btheme->tv3d.grid, 0x60, 0x60, 0x60, 255);
|
||||
SETCOL(btheme->tv3d.grid, 0x58, 0x58, 0x58, 255);
|
||||
SETCOL(btheme->tv3d.wire, 0x0, 0x0, 0x0, 255);
|
||||
SETCOL(btheme->tv3d.select, 0xff, 0x88, 0xff, 255);
|
||||
SETCOL(btheme->tv3d.active, 0xff, 0xbb, 0xff, 255);
|
||||
@@ -460,13 +463,16 @@ void BIF_InitThemeColors(void)
|
||||
SETCOL(btheme->tv3d.face, 0, 50, 150, 30);
|
||||
SETCOL(btheme->tv3d.face_select, 200, 100, 200, 60);
|
||||
|
||||
/* copy this to the others, to have something initialized */
|
||||
/* space buttons */
|
||||
/* to have something initialized */
|
||||
btheme->tbuts= btheme->tv3d;
|
||||
|
||||
SETCOL(btheme->tbuts.back, 180, 180, 180, 255);
|
||||
SETCOL(btheme->tbuts.header, 195, 195, 195, 255);
|
||||
SETCOL(btheme->tbuts.panel, 255, 255, 255, 40);
|
||||
|
||||
/* space ipo */
|
||||
/* to have something initialized */
|
||||
btheme->tipo= btheme->tv3d;
|
||||
|
||||
SETCOL(btheme->tipo.grid, 94, 94, 94, 255);
|
||||
@@ -479,7 +485,14 @@ void BIF_InitThemeColors(void)
|
||||
SETCOL(btheme->tipo.vertex_select, 0xff, 0xff, 0x70, 255);
|
||||
SETCOL(btheme->tipo.hilite, 0x60, 0xc0, 0x40, 255); // green cfra line
|
||||
|
||||
/* space file */
|
||||
/* to have something initialized */
|
||||
btheme->tfile= btheme->tv3d;
|
||||
SETCOL(btheme->tfile.back, 128, 128, 128, 255);
|
||||
SETCOL(btheme->tfile.text, 0, 0, 0, 255);
|
||||
SETCOL(btheme->tfile.text_hi, 255, 255, 255, 255);
|
||||
SETCOL(btheme->tfile.header, 182, 182, 182, 255);
|
||||
SETCOL(btheme->tfile.hilite, 0xA0, 0xA0, 0xD0, 255); // selected files
|
||||
|
||||
btheme->tinfo= btheme->tv3d;
|
||||
|
||||
@@ -511,9 +524,9 @@ char *BIF_ThemeColorsPup(int spacetype)
|
||||
sprintf(str, "Text %%x%d|", TH_TEXT); strcat(cp, str);
|
||||
sprintf(str, "Text Hilite %%x%d|", TH_TEXT_HI); strcat(cp, str);
|
||||
sprintf(str, "Header %%x%d|", TH_HEADER); strcat(cp, str);
|
||||
sprintf(str, "Panel %%x%d|", TH_PANEL); strcat(cp, str);
|
||||
|
||||
if(spacetype==SPACE_VIEW3D) {
|
||||
sprintf(str, "Panel %%x%d|", TH_PANEL); strcat(cp, str);
|
||||
strcat(cp,"%l|");
|
||||
sprintf(str, "Grid %%x%d|", TH_GRID); strcat(cp, str);
|
||||
sprintf(str, "Wire %%x%d|", TH_WIRE); strcat(cp, str);
|
||||
@@ -531,6 +544,7 @@ char *BIF_ThemeColorsPup(int spacetype)
|
||||
sprintf(str, "Face Selected %%x%d", TH_FACE_SELECT); strcat(cp, str);
|
||||
}
|
||||
else if(spacetype==SPACE_IPO) {
|
||||
sprintf(str, "Panel %%x%d|", TH_PANEL); strcat(cp, str);
|
||||
strcat(cp,"%l|");
|
||||
sprintf(str, "Main Shade %%x%d|", TH_SHADE1); strcat(cp, str);
|
||||
sprintf(str, "Alt Shade %%x%d|", TH_SHADE2); strcat(cp, str);
|
||||
@@ -539,6 +553,9 @@ char *BIF_ThemeColorsPup(int spacetype)
|
||||
sprintf(str, "Current frame %%x%d", TH_HILITE); strcat(cp, str);
|
||||
// last item without '|'
|
||||
}
|
||||
else if(spacetype==SPACE_FILE) {
|
||||
sprintf(str, "Selected file %%x%d", TH_HILITE); strcat(cp, str);
|
||||
}
|
||||
}
|
||||
return cp;
|
||||
}
|
||||
@@ -594,6 +611,28 @@ void BIF_ThemeColorShade(ScrArea *sa, int colorid, int offset)
|
||||
}
|
||||
}
|
||||
|
||||
void BIF_ThemeColorBlend(ScrArea *sa, int colorid1, int colorid2, float fac)
|
||||
{
|
||||
bTheme *btheme= U.themes.first;
|
||||
int r, g, b;
|
||||
char *cp1, *cp2;
|
||||
|
||||
if(btheme) {
|
||||
cp1= BIF_ThemeGetColorPtr(btheme, sa->spacetype, colorid1);
|
||||
cp2= BIF_ThemeGetColorPtr(btheme, sa->spacetype, colorid2);
|
||||
if(fac<0.0) fac=0.0; else if(fac>1.0) fac= 1.0;
|
||||
r= floor((1.0-fac)*cp1[0] + fac*cp2[0]);
|
||||
g= floor((1.0-fac)*cp1[1] + fac*cp2[1]);
|
||||
b= floor((1.0-fac)*cp1[2] + fac*cp2[2]);
|
||||
|
||||
glColor3ub(r, g, b);
|
||||
}
|
||||
else { // debug mostly, you never know
|
||||
glColor3ub(255, 0, 255);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// get individual values, not scaled
|
||||
float BIF_GetThemeColorf(ScrArea *sa, int colorid)
|
||||
{
|
||||
|
||||
@@ -1078,9 +1078,7 @@ void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
|
||||
allqueue(REDRAWVIEW3D, 0);
|
||||
}
|
||||
else {
|
||||
if(G.obedit);
|
||||
else add_blockhandler(curarea, VIEW3D_HANDLER_OBJECT, UI_PNL_TO_MOUSE);
|
||||
|
||||
add_blockhandler(curarea, VIEW3D_HANDLER_OBJECT, UI_PNL_TO_MOUSE);
|
||||
allqueue(REDRAWVIEW3D, 0);
|
||||
}
|
||||
break;
|
||||
@@ -1596,7 +1594,7 @@ void info_user_themebuts(uiBlock *block, short y1, short y2, short y3)
|
||||
uiDefBut(block, TEX, B_NAME_THEME, "", 255,y3,200,20, btheme->name, 1.0, 30.0, 0, 0, "Rename theme");
|
||||
|
||||
/* main choices pup */
|
||||
uiDefButS(block, MENU, B_CHANGE_THEME, "UI and Buttons %x1|3D View %x2|Ipo Window %x3|Buttons Window %x4",
|
||||
uiDefButS(block, MENU, B_CHANGE_THEME, "UI and Buttons %x1|3D View %x2|Ipo Window %x3|Buttons Window %x4|File Window %x5",
|
||||
255,y2,200,20, &curmain, 0, 0, 0, 0, "Specify theme for...");
|
||||
if(curmain==2) spacetype= SPACE_VIEW3D;
|
||||
if(curmain==3) spacetype= SPACE_IPO;
|
||||
|
||||
@@ -758,7 +758,7 @@ int blenderqread(unsigned short event, short val)
|
||||
if(textediting==0 && textspace==0 ) {
|
||||
if(G.qual & LR_CTRLKEY);
|
||||
else if(G.qual==0 || (G.qual & LR_SHIFTKEY)) {
|
||||
if(curarea->spacetype!=SPACE_VIEW3D) {
|
||||
if(curarea->spacetype!=SPACE_VIEW3D) { // is new panel, in view3d queue
|
||||
clever_numbuts();
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user