- converted full materialbuttons...

EEEK! It doesn't look well yet! Hopefully it inspires others to come
  with great solutions.
- the material buttons have 6 panels, three of them merged
- some drawing errors in preview render
- made settings for new Material that makes sense for Flares
This commit is contained in:
2003-10-11 22:00:30 +00:00
parent e32a73f69e
commit 0ce9abf41d
7 changed files with 222 additions and 139 deletions

View File

@@ -93,6 +93,8 @@ void init_material(Material *ma)
ma->linec= 12;
ma->flarec= 1;
ma->flaresize= ma->subsize= 1.0;
ma->flareboost= 1;
ma->seed2= 6;
ma->friction= 0.5;
ma->refrac= 4.0;
ma->roughness= 0.5;

View File

@@ -46,10 +46,6 @@ void uiRoundBox(float minx, float miny, float maxx, float maxy, float rad);
void uiSetRoundBox(int type);
void uiRoundRect(float minx, float miny, float maxx, float maxy, float rad);
void uiPanelPush(uiBlock *block);
void uiPanelPop(uiBlock *block);
uiBlock *uiFindOpenPanelBlockName(ListBase *lb, char *name);
void uiDrawMenuBox(float minx, float miny, float maxx, float maxy);
void uiTextBoundsBlock(uiBlock *block, int addval);
void uiBoundsBlock(struct uiBlock *block, int addval);
@@ -146,6 +142,7 @@ short pupmenu(char *instr);
short pupmenu_col(char *instr, int maxrow);
extern void uiFreePanels(struct ListBase *lb);
extern void uiNewPanelTabbed(char *, char *);
extern int uiNewPanel(struct ScrArea *sa, struct uiBlock *block, char *panelname, char *tabname, int ofsx, int ofsy, int sizex, int sizey);
extern void uiScalePanelBlock(struct uiBlock *block);
extern int uiIsPanelClosed(struct uiBlock *block);
@@ -153,6 +150,12 @@ extern void uiAnimatePanels(struct ScrArea *sa);
extern void uiSetPanel_view2d(struct ScrArea *sa);
extern void uiDrawBlocksPanels(struct ScrArea *sa, int re_align);
extern void uiNewPanelHeight(struct uiBlock *block, int sizey);
void uiPanelPush(uiBlock *block);
void uiPanelPop(uiBlock *block);
extern uiBlock *uiFindOpenPanelBlockName(ListBase *lb, char *name);
extern void uiMatchPanel_view2d(struct ScrArea *sa);
#endif /* BIF_INTERFACE_H */

View File

@@ -247,6 +247,9 @@ void do_butspace(unsigned short event)
if(event<=100) {
do_global_buttons(event);
}
else if(event < 1000) {
do_headerbuttons(event);
}
else if(event<=B_VIEWBUTS) {
//do_viewbuts(event);
}
@@ -408,6 +411,8 @@ void drawbutspace(ScrArea *sa, void *spacedata)
uiClearButLock();
/* since panels give different layouts, we have to make sure v2d.tot matches */
uiMatchPanel_view2d(sa);
/* when align changes, also do this for new panels */
/* don't always align, this function is called during AnmatePanels too */

View File

@@ -138,7 +138,6 @@ void do_matbuts(unsigned short event)
}
else {
memcpy(&mtexcopybuf, ma->mtex[(int)ma->texact], sizeof(MTex));
notice("copied!");
mtexcopied= 1;
}
}
@@ -150,7 +149,6 @@ void do_matbuts(unsigned short event)
memcpy(ma->mtex[(int)ma->texact], &mtexcopybuf, sizeof(MTex));
id_us_plus((ID *)mtexcopybuf.tex);
notice("pasted!");
BIF_preview_changed(G.buts);
scrarea_queue_winredraw(curarea);
}
@@ -164,115 +162,21 @@ void do_matbuts(unsigned short event)
}
}
void matbuts(void)
void material_panel_map_to(Material *ma)
{
Object *ob;
Material *ma;
ID *id, *idn;
MTex *mtex;
uiBlock *block;
uiBut *but;
float *colpoin = NULL, min;
int rgbsel = 0, a, loos;
char str[30], *strp;
short xco;
MTex *mtex;
ob= OBACT;
if(ob==0 || ob->data==0) return;
sprintf(str, "buttonswin %d", curarea->win);
block= uiNewBlock(&curarea->uiblocks, str, UI_EMBOSSX, UI_HELV, curarea->win);
/* TEX CHANNELS */
uiBlockSetCol(block, BUTGREY);
xco= 665;
for(a= 0; a<8; a++) {
mtex= ma->mtex[a];
if(mtex && mtex->tex) splitIDname(mtex->tex->id.name+2, str, &loos);
else strcpy(str, "");
str[10]= 0;
uiDefButC(block, ROW, B_MATPRV_DRAW, str, xco, 195, 63, 20, &(ma->texact), 3.0, (float)a, 0, 0, "");
xco+= 65;
}
uiDefIconBut(block, BUT, B_MTEXCOPY, ICON_COPYUP, (short)xco,195,20,21, 0, 0, 0, 0, 0, "Copy the material settings to the buffer");
uiDefIconBut(block, BUT, B_MTEXPASTE, ICON_PASTEUP, (short)(xco+20),195,20,21, 0, 0, 0, 0, 0, "Paste the material settings from the buffer");
uiBlockSetCol(block, BUTGREEN);
uiDefButC(block, TOG, B_MATPRV, "SepT", (short)(xco+40), 195, 40, 20, &(ma->septex), 0, 0, 0, 0, "Render only use active texture channel");
uiBlockSetCol(block, BUTGREY);
block= uiNewBlock(&curarea->uiblocks, "material_panel_map_to", UI_EMBOSSX, UI_HELV, curarea->win);
uiNewPanelTabbed("Texture", "Material");
if(uiNewPanel(curarea, block, "Map To", "Material", 1530, 0, 318, 204)==0) return;
mtex= ma->mtex[ ma->texact ];
if(mtex==0) {
mtex= &emptytex;
default_mtex(mtex);
}
/* TEXCO */
uiBlockSetCol(block, BUTGREEN);
uiDefButS(block, ROW, B_MATPRV, "Object", 694,166,49,18, &(mtex->texco), 4.0, (float)TEXCO_OBJECT, 0, 0, "Use linked object's coordinates for texture coordinates");
uiDefIDPoinBut(block, test_obpoin_but, B_MATPRV, "", 745,166,133,18, &(mtex->object), "");
uiDefButS(block, ROW, B_MATPRV, "UV", 664,166,29,18, &(mtex->texco), 4.0, (float)TEXCO_UV, 0, 0, "Use UV coordinates for texture coordinates");
uiDefButS(block, ROW, B_MATPRV, "Glob", 665,146,35,18, &(mtex->texco), 4.0, (float)TEXCO_GLOB, 0, 0, "Use global coordinates for the texture coordinates");
uiDefButS(block, ROW, B_MATPRV, "Orco", 701,146,38,18, &(mtex->texco), 4.0, (float)TEXCO_ORCO, 0, 0, "Use the original coordinates of the mesh");
uiDefButS(block, ROW, B_MATPRV, "Stick", 739,146,38,18, &(mtex->texco), 4.0, (float)TEXCO_STICKY, 0, 0, "Use mesh sticky coordaintes for the texture coordinates");
uiDefButS(block, ROW, B_MATPRV, "Win", 779,146,31,18, &(mtex->texco), 4.0, (float)TEXCO_WINDOW, 0, 0, "Use screen coordinates as texture coordinates");
uiDefButS(block, ROW, B_MATPRV, "Nor", 811,146,32,18, &(mtex->texco), 4.0, (float)TEXCO_NORM, 0, 0, "Use normal vector as texture coordinates");
uiDefButS(block, ROW, B_MATPRV, "Refl", 844,146,33,18, &(mtex->texco), 4.0, (float)TEXCO_REFL, 0, 0, "Use reflection vector as texture coordinates");
uiBlockSetCol(block, BUTGREY);
/* COORDS */
uiDefButC(block, ROW, B_MATPRV, "Flat", 666,114,48,18, &(mtex->mapping), 5.0, (float)MTEX_FLAT, 0, 0, "Map X and Y coordinates directly");
uiDefButC(block, ROW, B_MATPRV, "Cube", 717,114,50,18, &(mtex->mapping), 5.0, (float)MTEX_CUBE, 0, 0, "Map using the normal vector");
uiDefButC(block, ROW, B_MATPRV, "Tube", 666,94,48,18, &(mtex->mapping), 5.0, (float)MTEX_TUBE, 0, 0, "Map with Z as central axis (tube-like)");
uiDefButC(block, ROW, B_MATPRV, "Sphe", 716,94,50,18, &(mtex->mapping), 5.0, (float)MTEX_SPHERE, 0, 0, "Map with Z as central axis (sphere-like)");
xco= 665;
for(a=0; a<4; a++) {
if(a==0) strcpy(str, "");
else if(a==1) strcpy(str, "X");
else if(a==2) strcpy(str, "Y");
else strcpy(str, "Z");
uiDefButC(block, ROW, B_MATPRV, str, (short)xco, 50, 24, 18, &(mtex->projx), 6.0, (float)a, 0, 0, "");
uiDefButC(block, ROW, B_MATPRV, str, (short)xco, 30, 24, 18, &(mtex->projy), 7.0, (float)a, 0, 0, "");
uiDefButC(block, ROW, B_MATPRV, str, (short)xco, 10, 24, 18, &(mtex->projz), 8.0, (float)a, 0, 0, "");
xco+= 26;
}
uiDefButF(block, NUM, B_MATPRV, "ofsX", 778,114,100,18, mtex->ofs, -10.0, 10.0, 10, 0, "Fine tune X coordinate");
uiDefButF(block, NUM, B_MATPRV, "ofsY", 778,94,100,18, mtex->ofs+1, -10.0, 10.0, 10, 0, "Fine tune Y coordinate");
uiDefButF(block, NUM, B_MATPRV, "ofsZ", 778,74,100,18, mtex->ofs+2, -10.0, 10.0, 10, 0, "Fine tune Z coordinate");
uiDefButF(block, NUM, B_MATPRV, "sizeX", 778,50,100,18, mtex->size, -100.0, 100.0, 10, 0, "Set an extra scaling for the texture coordinate");
uiDefButF(block, NUM, B_MATPRV, "sizeY", 778,30,100,18, mtex->size+1, -100.0, 100.0, 10, 0, "Set an extra scaling for the texture coordinate");
uiDefButF(block, NUM, B_MATPRV, "sizeZ", 778,10,100,18, mtex->size+2, -100.0, 100.0, 10, 0, "Set an extra scaling for the texture coordinate");
/* TEXTUREBLOK SELECT */
if(G.main->tex.first==0)
id= NULL;
else
id= (ID*) mtex->tex;
IDnames_to_pupstring(&strp, NULL, "ADD NEW %x32767", &(G.main->tex), id, &(G.buts->texnr));
uiDefButS(block, MENU, B_EXTEXBROWSE, strp, 900,146,20,19, &(G.buts->texnr), 0, 0, 0, 0, "The name of the texture");
MEM_freeN(strp);
if(id) {
uiDefBut(block, TEX, B_IDNAME, "TE:", 900,166,163,19, id->name+2, 0.0, 18.0, 0, 0, "The name of the texture block");
sprintf(str, "%d", id->us);
uiDefBut(block, BUT, 0, str, 996,146,21,19, 0, 0, 0, 0, 0, "");
uiDefIconBut(block, BUT, B_AUTOTEXNAME, ICON_AUTO, 1041,146,21,19, 0, 0, 0, 0, 0, "Auto-assign name to texture");
if(id->lib) {
if(ma->id.lib) uiDefIconBut(block, BUT, 0, ICON_DATALIB, 1019,146,21,19, 0, 0, 0, 0, 0, "");
else uiDefIconBut(block, BUT, 0, ICON_PARLIB, 1019,146,21,19, 0, 0, 0, 0, 0, "");
}
uiBlockSetCol(block, BUTSALMON);
uiDefBut(block, BUT, B_TEXCLEAR, "Clear", 922, 146, 72, 19, 0, 0, 0, 0, 0, "Erase link to datablock");
uiBlockSetCol(block, BUTGREY);
}
/* TEXTURE OUTPUT */
uiDefButS(block, TOG|BIT|1, B_MATPRV, "Stencil", 900,114,52,18, &(mtex->texflag), 0, 0, 0, 0, "Set the mapping to stencil mode");
uiDefButS(block, TOG|BIT|2, B_MATPRV, "Neg", 954,114,38,18, &(mtex->texflag), 0, 0, 0, 0, "Reverse the effect of the texture");
@@ -299,15 +203,15 @@ void matbuts(void)
/* MAP TO */
uiBlockSetCol(block, BUTGREEN);
uiDefButS(block, TOG|BIT|0, B_MATPRV, "Col", 1087,166,35,18, &(mtex->mapto), 0, 0, 0, 0, "Let the texture affect basic colour of the material");
uiDefButS(block, TOG3|BIT|1, B_MATPRV, "Nor", 1126,166,31,18, &(mtex->mapto), 0, 0, 0, 0, "Let the texture affect the rendered normal");
uiDefButS(block, TOG|BIT|2, B_MATPRV, "Csp", 1160,166,34,18, &(mtex->mapto), 0, 0, 0, 0, "Let the texture affect the specularity colour");
uiDefButS(block, TOG|BIT|3, B_MATPRV, "Cmir", 1196,166,35,18, &(mtex->mapto), 0, 0, 0, 0, "Let the texture affext the mirror colour");
uiDefButS(block, TOG3|BIT|4, B_MATPRV, "Ref", 1234,166,31,18, &(mtex->mapto), 0, 0, 0, 0, "Let the texture affect the value of the materials reflectivity");
uiDefButS(block, TOG3|BIT|5, B_MATPRV, "Spec", 1087,146,36,18, &(mtex->mapto), 0, 0, 0, 0, "Let the texture affect the value of specularity");
uiDefButS(block, TOG3|BIT|8, B_MATPRV, "Hard", 1126,146,44,18, &(mtex->mapto), 0, 0, 0, 0, "Let the texture affect the hardness value");
uiDefButS(block, TOG3|BIT|7, B_MATPRV, "Alpha", 1172,146,45,18, &(mtex->mapto), 0, 0, 0, 0, "Let the texture affect the alpha value");
uiDefButS(block, TOG3|BIT|6, B_MATPRV, "Emit", 1220,146,45,18, &(mtex->mapto), 0, 0, 0, 0, "Let the texture affect the emit value");
uiDefButS(block, TOG|BIT|0, B_MATPRV, "Col", 900,166,35,18, &(mtex->mapto), 0, 0, 0, 0, "Let the texture affect basic colour of the material");
uiDefButS(block, TOG3|BIT|1, B_MATPRV, "Nor", 935,166,35,18, &(mtex->mapto), 0, 0, 0, 0, "Let the texture affect the rendered normal");
uiDefButS(block, TOG|BIT|2, B_MATPRV, "Csp", 970,166,40,18, &(mtex->mapto), 0, 0, 0, 0, "Let the texture affect the specularity colour");
uiDefButS(block, TOG|BIT|3, B_MATPRV, "Cmir", 1010,166,42,18, &(mtex->mapto), 0, 0, 0, 0, "Let the texture affext the mirror colour");
uiDefButS(block, TOG3|BIT|4, B_MATPRV, "Ref", 1052,166,35,18, &(mtex->mapto), 0, 0, 0, 0, "Let the texture affect the value of the materials reflectivity");
uiDefButS(block, TOG3|BIT|5, B_MATPRV, "Spec", 1087,166,36,18, &(mtex->mapto), 0, 0, 0, 0, "Let the texture affect the value of specularity");
uiDefButS(block, TOG3|BIT|8, B_MATPRV, "Hard", 1126,166,44,18, &(mtex->mapto), 0, 0, 0, 0, "Let the texture affect the hardness value");
uiDefButS(block, TOG3|BIT|7, B_MATPRV, "Alpha", 1172,166,45,18, &(mtex->mapto), 0, 0, 0, 0, "Let the texture affect the alpha value");
uiDefButS(block, TOG3|BIT|6, B_MATPRV, "Emit", 1220,166,45,18, &(mtex->mapto), 0, 0, 0, 0, "Let the texture affect the emit value");
/* uiDefButS(block, TOG|BIT|3, B_MATPRV, "Alpha Mix",1087,114,100,18, &(mtex->texflag), 0, 0, 0, 0); ,""*/
@@ -320,8 +224,132 @@ void matbuts(void)
uiDefButF(block, NUMSLI, B_MATPRV, "Col ", 1087,50,179,18, &(mtex->colfac), 0.0, 1.0, 0, 0, "Set the amount the texture affects colour");
uiDefButF(block, NUMSLI, B_MATPRV, "Nor ", 1087,30,179,18, &(mtex->norfac), 0.0, 5.0, 0, 0, "Set the amount the texture affects the normal");
uiDefButF(block, NUMSLI, B_MATPRV, "Var ", 1087,10,179,18, &(mtex->varfac), 0.0, 1.0, 0, 0, "Set the amount the texture affects a value");
}
void material_panel_map_input(Material *ma)
{
uiBlock *block;
MTex *mtex;
int a, xco;
char str[32];
block= uiNewBlock(&curarea->uiblocks, "material_panel_map_input", UI_EMBOSSX, UI_HELV, curarea->win);
uiNewPanelTabbed("Texture", "Material");
if(uiNewPanel(curarea, block, "Map Input", "Material", 1210, 0, 318, 204)==0) return;
mtex= ma->mtex[ ma->texact ];
if(mtex==0) {
mtex= &emptytex;
default_mtex(mtex);
}
/* TEXCO */
uiBlockSetCol(block, BUTGREEN);
uiDefButS(block, ROW, B_MATPRV, "UV", 630,166,40,18, &(mtex->texco), 4.0, (float)TEXCO_UV, 0, 0, "Use UV coordinates for texture coordinates");
uiDefButS(block, ROW, B_MATPRV, "Object", 670,166,75,18, &(mtex->texco), 4.0, (float)TEXCO_OBJECT, 0, 0, "Use linked object's coordinates for texture coordinates");
uiDefIDPoinBut(block, test_obpoin_but, B_MATPRV, "",745,166,163,18, &(mtex->object), "");
uiDefButS(block, ROW, B_MATPRV, "Glob", 630,146,45,18, &(mtex->texco), 4.0, (float)TEXCO_GLOB, 0, 0, "Use global coordinates for the texture coordinates");
uiDefButS(block, ROW, B_MATPRV, "Orco", 675,146,50,18, &(mtex->texco), 4.0, (float)TEXCO_ORCO, 0, 0, "Use the original coordinates of the mesh");
uiDefButS(block, ROW, B_MATPRV, "Stick", 725,146,50,18, &(mtex->texco), 4.0, (float)TEXCO_STICKY, 0, 0, "Use mesh sticky coordaintes for the texture coordinates");
uiDefButS(block, ROW, B_MATPRV, "Win", 775,146,45,18, &(mtex->texco), 4.0, (float)TEXCO_WINDOW, 0, 0, "Use screen coordinates as texture coordinates");
uiDefButS(block, ROW, B_MATPRV, "Nor", 820,146,44,18, &(mtex->texco), 4.0, (float)TEXCO_NORM, 0, 0, "Use normal vector as texture coordinates");
uiDefButS(block, ROW, B_MATPRV, "Refl", 864,146,44,18, &(mtex->texco), 4.0, (float)TEXCO_REFL, 0, 0, "Use reflection vector as texture coordinates");
uiBlockSetCol(block, BUTGREY);
/* COORDS */
uiDefButC(block, ROW, B_MATPRV, "Flat", 666,114,48,18, &(mtex->mapping), 5.0, (float)MTEX_FLAT, 0, 0, "Map X and Y coordinates directly");
uiDefButC(block, ROW, B_MATPRV, "Cube", 717,114,50,18, &(mtex->mapping), 5.0, (float)MTEX_CUBE, 0, 0, "Map using the normal vector");
uiDefButC(block, ROW, B_MATPRV, "Tube", 666,94,48,18, &(mtex->mapping), 5.0, (float)MTEX_TUBE, 0, 0, "Map with Z as central axis (tube-like)");
uiDefButC(block, ROW, B_MATPRV, "Sphe", 716,94,50,18, &(mtex->mapping), 5.0, (float)MTEX_SPHERE, 0, 0, "Map with Z as central axis (sphere-like)");
xco= 665;
for(a=0; a<4; a++) {
if(a==0) strcpy(str, "");
else if(a==1) strcpy(str, "X");
else if(a==2) strcpy(str, "Y");
else strcpy(str, "Z");
uiDefButC(block, ROW, B_MATPRV, str, (short)xco, 50, 24, 18, &(mtex->projx), 6.0, (float)a, 0, 0, "");
uiDefButC(block, ROW, B_MATPRV, str, (short)xco, 30, 24, 18, &(mtex->projy), 7.0, (float)a, 0, 0, "");
uiDefButC(block, ROW, B_MATPRV, str, (short)xco, 10, 24, 18, &(mtex->projz), 8.0, (float)a, 0, 0, "");
xco+= 26;
}
uiDefButF(block, NUM, B_MATPRV, "ofsX", 778,114,130,18, mtex->ofs, -10.0, 10.0, 10, 0, "Fine tune X coordinate");
uiDefButF(block, NUM, B_MATPRV, "ofsY", 778,94,130,18, mtex->ofs+1, -10.0, 10.0, 10, 0, "Fine tune Y coordinate");
uiDefButF(block, NUM, B_MATPRV, "ofsZ", 778,74,130,18, mtex->ofs+2, -10.0, 10.0, 10, 0, "Fine tune Z coordinate");
uiDefButF(block, NUM, B_MATPRV, "sizeX", 778,50,130,18, mtex->size, -100.0, 100.0, 10, 0, "Set an extra scaling for the texture coordinate");
uiDefButF(block, NUM, B_MATPRV, "sizeY", 778,30,130,18, mtex->size+1, -100.0, 100.0, 10, 0, "Set an extra scaling for the texture coordinate");
uiDefButF(block, NUM, B_MATPRV, "sizeZ", 778,10,130,18, mtex->size+2, -100.0, 100.0, 10, 0, "Set an extra scaling for the texture coordinate");
}
void material_panel_texture(Material *ma)
{
uiBlock *block;
MTex *mtex;
ID *id;
int loos;
int a, xco;
char str[64], *strp;
block= uiNewBlock(&curarea->uiblocks, "material_panel_texture", UI_EMBOSSX, UI_HELV, curarea->win);
if(uiNewPanel(curarea, block, "Texture", "Material", 890, 0, 318, 204)==0) return;
/* TEX CHANNELS */
uiBlockSetCol(block, BUTGREY);
xco= 665;
for(a= 0; a<8; a++) {
mtex= ma->mtex[a];
if(mtex && mtex->tex) splitIDname(mtex->tex->id.name+2, str, &loos);
else strcpy(str, "");
str[10]= 0;
uiDefButC(block, ROW, B_MATPRV_DRAW, str, 10, 180-22*a, 70, 20, &(ma->texact), 3.0, (float)a, 0, 0, "");
xco+= 65;
}
uiDefIconBut(block, BUT, B_MTEXCOPY, ICON_COPYUP, 100,180,23,21, 0, 0, 0, 0, 0, "Copy the mapping settings to the buffer");
uiDefIconBut(block, BUT, B_MTEXPASTE, ICON_PASTEUP, 125,180,23,21, 0, 0, 0, 0, 0, "Paste the mapping settings from the buffer");
uiBlockSetCol(block, BUTGREEN);
uiDefButC(block, TOG, B_MATPRV, "SepTex", 160, 180, 100, 20, &(ma->septex), 0, 0, 0, 0, "Render only use active texture channel");
uiBlockSetCol(block, BUTGREY);
mtex= ma->mtex[ ma->texact ];
if(mtex==0) {
mtex= &emptytex;
default_mtex(mtex);
}
/* TEXTUREBLOK SELECT */
if(G.main->tex.first==0)
id= NULL;
else
id= (ID*) mtex->tex;
IDnames_to_pupstring(&strp, NULL, "ADD NEW %x32767", &(G.main->tex), id, &(G.buts->texnr));
uiDefButS(block, MENU, B_EXTEXBROWSE, strp, 100,130,20,20, &(G.buts->texnr), 0, 0, 0, 0, "The name of the texture");
MEM_freeN(strp);
if(id) {
uiDefBut(block, TEX, B_IDNAME, "TE:", 100,150,163,20, id->name+2, 0.0, 18.0, 0, 0, "The name of the texture block");
sprintf(str, "%d", id->us);
uiDefBut(block, BUT, 0, str, 196,130,21,20, 0, 0, 0, 0, 0, "");
uiDefIconBut(block, BUT, B_AUTOTEXNAME, ICON_AUTO, 241,130,21,20, 0, 0, 0, 0, 0, "Auto-assign name to texture");
if(id->lib) {
if(ma->id.lib) uiDefIconBut(block, BUT, 0, ICON_DATALIB, 219,130,21,20, 0, 0, 0, 0, 0, "");
else uiDefIconBut(block, BUT, 0, ICON_PARLIB, 219,130,21,20, 0, 0, 0, 0, 0, "");
}
uiBlockSetCol(block, BUTSALMON);
uiDefBut(block, BUT, B_TEXCLEAR, "Clear", 122, 130, 72, 20, 0, 0, 0, 0, 0, "Erase link to datablock");
uiBlockSetCol(block, BUTGREY);
}
uiDrawBlock(block);
}
void material_panel_shading(Material *ma)
@@ -393,16 +421,16 @@ void material_panel_shading(Material *ma)
}
/* default shading variables */
uiDefButF(block, NUMSLI, B_MATPRV, "Amb ", 9,30,117,19, &(ma->amb), 0.0, 1.0, 0, 0, "Set the amount of global ambient color");
uiDefButF(block, NUMSLI, B_MATPRV, "Emit ", 133,30,118,19, &(ma->emit), 0.0, 1.0, 0, 0, "Set the amount of emitting light");
uiDefButF(block, NUMSLI, B_MATPRV, "Add ", 9,10,119,19, &(ma->add), 0.0, 1.0, 0, 0, "Glow factor for transparant");
uiDefButF(block, NUM, 0, "Zoffs:", 133,10,118,19, &(ma->zoffs), 0.0, 10.0, 0, 0, "Give face an artificial offset");
uiDefButF(block, NUMSLI, B_MATPRV, "Amb ", 9,30,117,19, &(ma->amb), 0.0, 1.0, 0, 0, "Set the amount of global ambient color");
uiDefButF(block, NUMSLI, B_MATPRV, "Emit ", 133,30,110,19, &(ma->emit), 0.0, 1.0, 0, 0, "Set the amount of emitting light");
uiDefButF(block, NUMSLI, B_MATPRV, "Add ", 9,10,117,19, &(ma->add), 0.0, 1.0, 0, 0, "Glow factor for transparant");
uiDefButF(block, NUM, 0, "Zoffs:", 133,10,110,19, &(ma->zoffs), 0.0, 10.0, 0, 0, "Give face an artificial offset");
uiBlockSetCol(block, BUTBLUE);
uiDefButI(block, TOG|BIT|0, 0, "Traceable", 245,161,65,18, &(ma->mode), 0, 0, 0, 0, "Make material visible for shadow lamps");
uiDefButI(block, TOG|BIT|1, 0, "Shadow", 245,142,65,18, &(ma->mode), 0, 0, 0, 0, "Enable material for shadows");
uiDefButI(block, TOG|BIT|16, 0, "Radio", 245,123,65,18, &(ma->mode), 0, 0, 0, 0, "Set the material insensitive to mist");
uiDefButI(block, TOG|BIT|16, 0, "Radio", 245,123,65,18, &(ma->mode), 0, 0, 0, 0, "Enable radiosty render");
uiDefButI(block, TOG|BIT|3, 0, "Wire", 245,104,65,18, &(ma->mode), 0, 0, 0, 0, "Render only the edges of faces");
uiDefButI(block, TOG|BIT|6, 0, "ZTransp", 245,85, 65,18, &(ma->mode), 0, 0, 0, 0, "Z-Buffer transparent faces");
uiDefButI(block, TOG|BIT|9, 0, "Env", 245,66, 65,18, &(ma->mode), 0, 0, 0, 0, "Do not render material");
@@ -503,14 +531,14 @@ void material_panel_material(Object *ob, Material *ma)
uiDefButF(block, COL, B_MIRCOL, "", 8,61,72,24, &(ma->mirr), 0, 0, 0, 0, "");
if(ma->mode & MA_HALO) {
uiDefButC(block, ROW, REDRAWBUTSMAT, "Halo", 83,115,30,25, &(ma->rgbsel), 2.0, 0.0, 0, 0, "Mix the colour of the halo with the RGB sliders");
uiDefButC(block, ROW, REDRAWBUTSMAT, "Line", 83,88,30,25, &(ma->rgbsel), 2.0, 1.0, 0, 0, "Mix the colour of the lines with the RGB sliders");
uiDefButC(block, ROW, REDRAWBUTSMAT, "Ring", 83,61,30,25, &(ma->rgbsel), 2.0, 2.0, 0, 0, "Mix the colour of the rings with the RGB sliders");
uiDefButC(block, ROW, REDRAWBUTSMAT, "Halo", 83,115,40,25, &(ma->rgbsel), 2.0, 0.0, 0, 0, "Mix the colour of the halo with the RGB sliders");
uiDefButC(block, ROW, REDRAWBUTSMAT, "Line", 83,88,40,25, &(ma->rgbsel), 2.0, 1.0, 0, 0, "Mix the colour of the lines with the RGB sliders");
uiDefButC(block, ROW, REDRAWBUTSMAT, "Ring", 83,61,40,25, &(ma->rgbsel), 2.0, 2.0, 0, 0, "Mix the colour of the rings with the RGB sliders");
}
else {
uiDefButC(block, ROW, REDRAWBUTSMAT, "Col", 83,115,30,25, &(ma->rgbsel), 2.0, 0.0, 0, 0, "Set the basic colour of the material");
uiDefButC(block, ROW, REDRAWBUTSMAT, "Spe", 83,88,30,25, &(ma->rgbsel), 2.0, 1.0, 0, 0, "Set the colour of the specularity");
uiDefButC(block, ROW, REDRAWBUTSMAT, "Mir", 83,61,30,25, &(ma->rgbsel), 2.0, 2.0, 0, 0, "Use mirror colour");
uiDefButC(block, ROW, REDRAWBUTSMAT, "Col", 83,115,40,25, &(ma->rgbsel), 2.0, 0.0, 0, 0, "Set the basic colour of the material");
uiDefButC(block, ROW, REDRAWBUTSMAT, "Spe", 83,88,40,25, &(ma->rgbsel), 2.0, 1.0, 0, 0, "Set the colour of the specularity");
uiDefButC(block, ROW, REDRAWBUTSMAT, "Mir", 83,61,40,25, &(ma->rgbsel), 2.0, 2.0, 0, 0, "Use mirror colour");
}
if(ma->rgbsel==0) {colpoin= &(ma->r); rgbsel= B_MATCOL;}
else if(ma->rgbsel==1) {colpoin= &(ma->specr); rgbsel= B_SPECCOL;}
@@ -537,7 +565,7 @@ void material_panel_material(Object *ob, Material *ma)
uiDefButS(block, ROW, REDRAWBUTSMAT, "RGB", 8,32,35,20, &(ma->colormodel), 1.0, (float)MA_RGB, 0, 0, "Create colour by red, green and blue");
uiDefButS(block, ROW, REDRAWBUTSMAT, "HSV", 43,32,35,20, &(ma->colormodel), 1.0, (float)MA_HSV, 0, 0, "Mix colour with hue, saturation and value");
uiBlockSetCol(block, BUTGREEN);
uiDefButS(block, TOG|BIT|0, REDRAWBUTSMAT, "DYN", 78,32,35,20, &(ma->dynamode), 0.0, 0.0, 0, 0, "Adjust parameters for dynamics options");
uiDefButS(block, TOG|BIT|0, REDRAWBUTSMAT, "DYN", 78,32,45,20, &(ma->dynamode), 0.0, 0.0, 0, 0, "Adjust parameters for dynamics options");
}
@@ -578,8 +606,12 @@ void material_panels()
material_panel_preview(ma);
material_panel_material(ob, ma);
if(ma) material_panel_shading(ma);
if(ma) {
material_panel_shading(ma);
material_panel_texture(ma);
material_panel_map_input(ma);
material_panel_map_to(ma);
}
}
}

View File

@@ -1235,7 +1235,7 @@ static void ui_emboss_TABL(BIFColorID bc, float asp, float x1, float y1, float x
glEnd();
glShadeModel(GL_FLAT);
}
static void ui_emboss_TABM(BIFColorID bc, float asp, float x1, float y1, float x2, float y2, int flag)
@@ -1492,6 +1492,7 @@ static void ui_emboss_slider(uiBut *but, float fac)
BIF_set_color(BUTGREY, COLORSHADE_GREY);
fdrawline(x1+fac, y2-2, x1+fac, y1+2);
glShadeModel(GL_FLAT);
}
static void ui_draw_but_BUT(uiBut *but)
@@ -2651,12 +2652,13 @@ void uiDrawBlock(uiBlock *block)
}
else if(block->panel) ui_draw_panel(block);
if(block->drawextra) block->drawextra();
for (but= block->buttons.first; but; but= but->next) {
ui_draw_but(but);
}
ui_draw_links(block);
if(block->drawextra) block->drawextra();
uiPanelPop(block); // matrix restored
}
@@ -6085,6 +6087,14 @@ short pupmenu_col(char *instr, int maxrow)
/* ************** panels ************* */
/* ugly global... but will be NULLed after each 'newPanel' call */
static char *panel_tabbed=NULL, *group_tabbed=NULL;
void uiNewPanelTabbed(char *panelname, char *groupname)
{
panel_tabbed= panelname;
group_tabbed= groupname;
}
/* ofsx/ofsy only used for new panel definitions */
/* return 1 if visible (create buttons!) */
@@ -6128,6 +6138,20 @@ int uiNewPanel(ScrArea *sa, uiBlock *block, char *panelname, char *tabname, int
pa->ofsx= palign->ofsx + palign->sizex;
}
}
/* make new Panel tabbed? */
if(panel_tabbed && group_tabbed) {
Panel *papar;
for(papar= sa->panels.first; papar; papar= papar->next) {
if(papar->active && papar->paneltab==NULL) {
if( strncmp(panel_tabbed, papar->panelname, UI_MAX_NAME_STR)==0) {
if( strncmp(group_tabbed, papar->tabname, UI_MAX_NAME_STR)==0) {
pa->paneltab= papar;
break;
}
}
}
}
}
}
block->panel= pa;
@@ -6136,6 +6160,9 @@ int uiNewPanel(ScrArea *sa, uiBlock *block, char *panelname, char *tabname, int
if(block->panel->paneltab) return 0;
if(block->panel->flag & PNL_CLOSED) return 0;
/* clear global */
panel_tabbed= group_tabbed= NULL;
return 1;
}
@@ -6242,6 +6269,24 @@ void uiSetPanel_view2d(ScrArea *sa)
}
void uiMatchPanel_view2d(ScrArea *sa)
{
Panel *pa;
pa= sa->panels.first;
while(pa) {
if(pa->active) {
if(pa->ofsx < G.v2d->tot.xmin) G.v2d->tot.xmin= pa->ofsx;
if(pa->ofsx+pa->sizex > G.v2d->tot.xmax)
G.v2d->tot.xmax= pa->ofsx+pa->sizex;
if(pa->ofsy < G.v2d->tot.ymin) G.v2d->tot.ymin= pa->ofsy;
if(pa->ofsy+pa->sizey+PNL_HEADER > G.v2d->tot.ymax)
G.v2d->tot.ymax= pa->ofsy+pa->sizey+PNL_HEADER;
}
pa= pa->next;
}
}
/* extern used ny previewrender */
void uiPanelPush(uiBlock *block)
{
@@ -6482,9 +6527,6 @@ static int find_leftmost_panel(const void *a1, const void *a2)
if( ps1->pa->ofsx > ps2->pa->ofsx) return 1;
else if( ps1->pa->ofsx < ps2->pa->ofsx) return -1;
else if( ps1->pa->next == ps2->pa) return -1;
else if( ((long)ps1->pa) < ((long)ps2->pa)) return -1;
else if( ((long)ps1->pa) > ((long)ps2->pa)) return 1;
return 0;
}
@@ -6496,8 +6538,6 @@ static int find_highest_panel(const void *a1, const void *a2)
if( ps1->pa->ofsy < ps2->pa->ofsy) return 1;
else if( ps1->pa->ofsy > ps2->pa->ofsy) return -1;
else if( ((long)ps1->pa) < ((long)ps2->pa)) return -1;
else if( ((long)ps1->pa) > ((long)ps2->pa)) return 1;
return 0;
}

View File

@@ -530,14 +530,15 @@ static void previewflare(SpaceButs *sbuts, HaloRen *har, unsigned int *rect)
R.rectot= rect;
waitcursor(1);
RE_renderflare(har);
waitcursor(0);
// not sure why, either waitcursor or renderflare screws up
areawinset(curarea->win);
uiPanelPush(block);
BIF_previewdraw();
uiPanelPop(block);
waitcursor(0);
/* temps */
R.ycor= ycor;

View File

@@ -2047,7 +2047,7 @@ void winqreadbutspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
if (nr>=0) {
sbuts->align= nr;
if(nr) {
// uiAnimatePanels(sa);
//uiAnimatePanels(sa);
uiAlignPanelStep(sa, 1.0);
do_buts_buttons(B_BUTSHOME);
}