Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2003-10-13 18:57:43 +0400
committerTon Roosendaal <ton@blender.org>2003-10-13 18:57:43 +0400
commitceb26d2a4ebc3097f9a1cd675a70e8f179915289 (patch)
tree3b03ce66c4e0981333cbf50d332600014c21a472
parent5c2005cf06d786985ebf2213aa25070bdbda2a4f (diff)
- experiment: changed drawing style of Panels to minimal and fully
transparant. - converted the Texture buttons, they're nice too!
-rw-r--r--source/blender/include/butspace.h2
-rw-r--r--source/blender/include/mydevice.h12
-rw-r--r--source/blender/src/butspace.c7
-rw-r--r--source/blender/src/buttons.txt1327
-rw-r--r--source/blender/src/buttons_shading.c1179
-rw-r--r--source/blender/src/editipo.c2
-rw-r--r--source/blender/src/header_buttonswin.c15
-rw-r--r--source/blender/src/headerbuttons.c8
-rw-r--r--source/blender/src/interface.c19
-rw-r--r--source/blender/src/space.c11
10 files changed, 1186 insertions, 1396 deletions
diff --git a/source/blender/include/butspace.h b/source/blender/include/butspace.h
index a0c5bd53f3c..0816a3bc355 100644
--- a/source/blender/include/butspace.h
+++ b/source/blender/include/butspace.h
@@ -81,6 +81,8 @@ extern void world_panels(void);
extern void do_worldbuts(unsigned short event);
extern void radio_panels(void);
extern void do_radiobuts(unsigned short event);
+extern void texture_panels(void);
+extern void do_texbuts(unsigned short event);
/* logic */
extern void do_logic_buts(unsigned short event);
diff --git a/source/blender/include/mydevice.h b/source/blender/include/mydevice.h
index 4b76133ca01..8fd6bff3a12 100644
--- a/source/blender/include/mydevice.h
+++ b/source/blender/include/mydevice.h
@@ -213,14 +213,10 @@
#define REDRAWBUTSSCENE 0x4017
#define REDRAWBUTSOBJECT 0x4018
-#define REDRAWBUTSTYPES 0x4019
-#define REDRAWBUTSSHADING 0x401A
-#define REDRAWBUTSEDIT 0x401B
-#define REDRAWBUTSSCRIPT 0x401C
-#define REDRAWBUTSLOGIC 0x401D
-/* can be in 2 places... */
-#define REDRAWBUTSLAMP 0x401F
-
+#define REDRAWBUTSEDIT 0x4019
+#define REDRAWBUTSSCRIPT 0x401A
+#define REDRAWBUTSLOGIC 0x401B
+#define REDRAWBUTSSHADING 0x401C
#define REDRAWINFO 0x4021
#define RENDERPREVIEW 0x4022
diff --git a/source/blender/src/butspace.c b/source/blender/src/butspace.c
index 134d8bf6553..c221108e703 100644
--- a/source/blender/src/butspace.c
+++ b/source/blender/src/butspace.c
@@ -260,7 +260,7 @@ void do_butspace(unsigned short event)
do_matbuts(event);
}
else if(event<=B_TEXBUTS) {
- //do_texbuts(event);
+ do_texbuts(event);
}
else if(event<=B_ANIMBUTS) {
do_object_panels(event);
@@ -410,7 +410,8 @@ void drawbutspace(ScrArea *sa, void *spacedata)
world_panels();
else if(tab==TAB_SHADING_RAD)
radio_panels();
-
+ else if(tab==TAB_SHADING_TEX)
+ texture_panels();
break;
case CONTEXT_EDITING:
@@ -436,7 +437,7 @@ void drawbutspace(ScrArea *sa, void *spacedata)
/* when align changes, also do this for new panels */
/* don't always align, this function is called during AnmatePanels too */
if(sbuts->align)
- if(sbuts->re_align || sbuts->mainbo!=sbuts->mainb)
+ if(sbuts->re_align || sbuts->mainbo!=sbuts->mainb || sbuts->tabo!=sbuts->tab[sbuts->mainb])
align= 1;
uiDrawBlocksPanels(sa, align);
diff --git a/source/blender/src/buttons.txt b/source/blender/src/buttons.txt
index c11ff2d3795..d465b0c8d92 100644
--- a/source/blender/src/buttons.txt
+++ b/source/blender/src/buttons.txt
@@ -198,376 +198,6 @@ char texstr[15][8]= {"None" , "Clouds" , "Wood",
/* Local functions ----------------------------------------------------- */
-
-/* event for buttons (ROW) to indicate the backbuffer isn't OK (ogl) */
-#define B_DIFF 1
-
-/* *********************** */
-#define B_VIEWBUTS 1100
-
-#define B_LOADBGPIC 1001
-#define B_BLENDBGPIC 1002
-#define B_BGPICBROWSE 1003
-#define B_BGPICTEX 1004
-#define B_BGPICCLEAR 1005
-#define B_BGPICTEXCLEAR 1006
-
-/* *********************** */
-#define B_LAMPBUTS 1200
-
-#define B_LAMPREDRAW 1101
-#define B_COLLAMP 1102
-#define B_TEXCLEARLAMP 1103
-#define B_SBUFF 1104
-
-/* *********************** */
-#define B_MATBUTS 1300
-
-#define B_MATCOL 1201
-#define B_SPECCOL 1202
-#define B_MIRCOL 1203
-#define B_ACTCOL 1204
-#define B_MATFROM 1205
-#define B_MATPRV 1206
-#define B_MTEXCOL 1207
-#define B_TEXCLEAR 1208
-#define B_MATPRV_DRAW 1209
-#define B_MTEXPASTE 1210
-#define B_MTEXCOPY 1211
-#define B_MATLAY 1212
-
-/* *********************** */
-#define B_TEXBUTS 1400
-
-#define B_TEXTYPE 1301
-#define B_DEFTEXVAR 1302
-#define B_LOADTEXIMA 1303
-#define B_NAMEIMA 1304
-#define B_TEXCHANNEL 1305
-#define B_TEXREDR_PRV 1306
-#define B_TEXIMABROWSE 1307
-#define B_IMAPTEST 1308
-#define B_RELOADIMA 1309
-#define B_LOADPLUGIN 1310
-#define B_NAMEPLUGIN 1311
-#define B_COLORBAND 1312
-#define B_ADDCOLORBAND 1313
-#define B_DELCOLORBAND 1314
-#define B_CALCCBAND 1315
-#define B_CALCCBAND2 1316
-#define B_DOCOLORBAND 1317
-#define B_REDRAWCBAND 1318
-#define B_BANDCOL 1319
-#define B_LOADTEXIMA1 1320
-#define B_PLUGBUT 1321
-
-/* plugbut reserves 24 buttons at least! */
-
-#define B_ENV_MAKE 1350
-#define B_ENV_FREE 1351
-#define B_ENV_DELETE 1352
-#define B_ENV_SAVE 1353
-#define B_ENV_OB 1354
-
-#define B_PACKIMA 1355
-#define B_TEXSETFRAMES 1356
-
-#define B_ENV_FREE_ALL 1357
-
-/* *********************** */
-#define B_ANIMBUTS 1500
-
-#define B_RECALCPATH 1401
-#define B_MUL_IPO 1402
-#define B_AUTOTIMEOFS 1403
-#define B_FRAMEMAP 1404
-#define B_NEWEFFECT 1405
-#define B_PREVEFFECT 1406
-#define B_NEXTEFFECT 1407
-#define B_CHANGEEFFECT 1408
-#define B_CALCEFFECT 1409
-#define B_DELEFFECT 1410
-#define B_RECALCAL 1411
-#define B_SETSPEED 1412
-#define B_PRINTSPEED 1413
-#define B_PRINTLEN 1414
-#define B_RELKEY 1415
-
- /* this has MAX_EFFECT settings! Next free define is 1450... */
-#define B_SELEFFECT 1430
-
-
-/* *********************** */
-#define B_WORLDBUTS 1600
-
-#define B_TEXCLEARWORLD 1501
-
-/* *********************** */
-#define B_RENDERBUTS 1700
-
-#define B_FS_PIC 1601
-#define B_FS_BACKBUF 1602
-
-#define B_FS_FTYPE 1604
-#define B_DORENDER 1605
-#define B_DOANIM 1606
-#define B_PLAYANIM 1607
-#define B_PR_PAL 1608
-#define B_PR_FULL 1609
-#define B_PR_PRV 1610
-#define B_PR_CDI 1611
-#define B_PR_PAL169 1612
-#define B_PR_D2MAC 1613
-#define B_PR_MPEG 1614
-#define B_REDRAWDISP 1615
-#define B_SETBROWSE 1616
-#define B_CLEARSET 1617
-#define B_PR_PRESET 1618
-#define B_PR_PANO 1619
-#define B_PR_NTSC 1620
-
-#define B_IS_FTYPE 1622
-#define B_IS_BACKBUF 1623
-#define B_PR_PC 1624
-
-#define B_PR_PANO360 1627
-#define B_PR_HALFFIELDS 1628
-#define B_NEWRENDERPIPE 1629
-#define B_R_SCALE 1630
-#define B_G_SCALE 1631
-#define B_B_SCALE 1632
-#define B_USE_R_SCALE 1633
-#define B_USE_G_SCALE 1634
-#define B_USE_B_SCALE 1635
-#define B_EDGECOLSLI 1636
-#define B_GAMMASLI 1637
-
-#define B_FILETYPEMENU 1638
-#define B_SELECTCODEC 1639
-#define B_RTCHANGED 1640
-
-#ifdef __NLA
-/* *********************** */
-enum {
- B_ARMATUREBUTS = 1800,
- B_POSE = 1701
-};
-#endif
-
-/* *********************** */
-#define B_COMMONEDITBUTS 2049
-
-#define B_MATWICH 2003
-#define B_MATNEW 2004
-#define B_MATDEL 2005
-#define B_MATASS 2006
-#define B_MATSEL 2007
-#define B_MATDESEL 2008
-#define B_HIDE 2009
-#define B_REVEAL 2010
-#define B_SELSWAP 2011
-#define B_SETSMOOTH 2012
-#define B_SETSOLID 2013
-#define B_AUTOTEX 2014
-#define B_DOCENTRE 2015
-#define B_DOCENTRENEW 2016
-#define B_DOCENTRECURSOR 2017
-
- /* 32 values! */
-#define B_OBLAY 2018
-
-#define B_MESHBUTS 2100
-
-#define B_FLIPNORM 2050
-#define B_SPIN 2051
-#define B_SPINDUP 2052
-#define B_EXTR 2053
-#define B_SCREW 2054
-#define B_EXTREP 2055
-#define B_SPLIT 2056
-#define B_REMDOUB 2057
-#define B_SUBDIV 2058
-#define B_FRACSUBDIV 2059
-#define B_XSORT 2060
-#define B_HASH 2061
-#define B_DELSTICKY 2062
-#define B_DELVERTCOL 2063
-#define B_MAKE_TFACES 2064
-#define B_TOSPHERE 2065
-#define B_DEL_TFACES 2066
-#define B_NEWVGROUP 2067
-#define B_DELVGROUP 2068
-#define B_ASSIGNVGROUP 2069
-#define B_REMOVEVGROUP 2070
-#define B_SELVGROUP 2071
-#define B_DESELVGROUP 2072
-#define B_DECIM_FACES 2073
-#define B_DECIM_CANCEL 2074
-#define B_DECIM_APPLY 2075
-#define B_AUTOVGROUP 2076
-#define B_SLOWERDRAW 2077
-#define B_FASTERDRAW 2078
-#define B_VERTEXNOISE 2079
-#define B_VERTEXSMOOTH 2080
-#define B_MAKESTICKY 2082
-#define B_MAKEVERTCOL 2083
-
-/* *********************** */
-#define B_CURVEBUTS 2200
-
-#define B_CONVERTPOLY 2101
-#define B_CONVERTBEZ 2102
-#define B_CONVERTBSPL 2103
-#define B_CONVERTCARD 2104
-#define B_CONVERTNURB 2105
-#define B_UNIFU 2106
-#define B_ENDPU 2107
-#define B_BEZU 2108
-#define B_UNIFV 2109
-#define B_ENDPV 2110
-#define B_BEZV 2111
-#define B_SETWEIGHT 2112
-#define B_SETW1 2113
-#define B_SETW2 2114
-#define B_SETW3 2115
-#define B_SETORDER 2116
-#define B_MAKEDISP 2117
-#define B_SUBDIVCURVE 2118
-#define B_SPINNURB 2119
-#define B_CU3D 2120
-#define B_SETRESOLU 2121
-#define B_SETW4 2122
-
-
-/* *********************** */
-#define B_FONTBUTS 2300
-
-#define B_MAKEFONT 2201
-#define B_TOUPPER 2202
-#define B_SETFONT 2203
-#define B_LOADFONT 2204
-#define B_TEXTONCURVE 2205
-#define B_PACKFONT 2206
-
-/* *********************** */
-#define B_IKABUTS 2400
-
-#define B_IKASETREF 2301
-#define B_IKARECALC 2302
-
-/* *********************** */
-#define B_CAMBUTS 2500
-
-/* *********************** */
-#define B_MBALLBUTS 2600
-
-#define B_RECALCMBALL 2501
-
-/* *********************** */
-#define B_LATTBUTS 2700
-
-#define B_RESIZELAT 2601
-#define B_DRAWLAT 2602
-#define B_LATTCHANGED 2603
-
-/* *********************** */
-#define B_GAMEBUTS 2800
-
-/* in editsca.c */
-
-/* *********************** */
-#define B_FPAINTBUTS 2900
-
-#define B_VPCOLSLI 2801
-#define B_VPGAMMA 2802
-
-#define B_COPY_TF_MODE 2804
-#define B_COPY_TF_UV 2805
-#define B_COPY_TF_COL 2806
-#define B_REDR_3D_IMA 2807
-#define B_SET_VCOL 2808
-
-#define B_COPY_TF_TEX 2814
-#define B_TFACE_HALO 2815
-#define B_TFACE_BILLB 2816
-
-#define B_SHOWTEX 2832
-#define B_ASSIGNMESH 2833
-
-
-/* *********************** */
-#define B_RADIOBUTS 3000
-
-#define B_RAD_GO 2901
-#define B_RAD_INIT 2902
-#define B_RAD_LIMITS 2903
-#define B_RAD_FAC 2904
-#define B_RAD_NODELIM 2905
-#define B_RAD_NODEFILT 2906
-#define B_RAD_FACEFILT 2907
-#define B_RAD_ADD 2908
-#define B_RAD_DELETE 2909
-#define B_RAD_COLLECT 2910
-#define B_RAD_SHOOTP 2911
-#define B_RAD_SHOOTE 2912
-#define B_RAD_REPLACE 2913
-#define B_RAD_DRAW 2914
-#define B_RAD_FREE 2915
-#define B_RAD_ADDMESH 2916
-
-/* *********************** */
-#define B_SCRIPTBUTS 3100
-
-#define B_SCRIPT_ADD 3001
-#define B_SCRIPT_DEL 3002
-#define B_SCRIPT_TYPE 3003
-
-/* Scene script buttons */
-#define B_SSCRIPT_ADD 3004
-#define B_SSCRIPT_DEL 3005
-#define B_SSCRIPT_TYPE 3006
-
-/* *********************** */
-#define B_SOUNDBUTS 3200
-enum B_SOUND_BUTTONS {
- B_SOUND_CHANGED = 3101,
- B_SOUND_REDRAW,
- B_SOUND_VOLUME,
- B_SOUND_PANNING,
- B_SOUND_PITCH,
- B_SOUND_LOAD_SAMPLE,
- B_SOUND_MENU_SAMPLE,
- B_SOUND_NAME_SAMPLE,
- B_SOUND_UNLINK_SAMPLE,
- B_SOUND_RELOAD_SAMPLE,
- B_SOUND_UNPACK_SAMPLE,
- B_SOUND_PLAY_SAMPLE,
- B_SOUND_COPY_SOUND,
- B_SOUND_LOOPSTART,
- B_SOUND_LOOPEND,
- B_SOUND_BIDIRECTIONAL,
- B_SOUND_RECALC,
- B_SOUND_RATECHANGED,
- B_SOUND_MIXDOWN
-};
-
-/* *********************** */
-#define B_CONSTRAINTBUTS 3300
-enum {
- B_CONSTRAINT_REDRAW = 3201,
- B_CONSTRAINT_ADD,
- B_CONSTRAINT_DEL,
- B_CONSTRAINT_TEST,
- B_CONSTRAINT_CHANGETYPE,
- B_CONSTRAINT_CHANGENAME,
- B_CONSTRAINT_CHANGETARGET
-};
-
-/* *********************** */
-/* BUTTON BUT: > 4000 */
-/* BUTTON 4001-4032: layers */
-
-
static char *physics_pup(void)
{
/* the number needs to match defines in KX_PhysicsBlenderSceneConverter.cpp */
@@ -596,963 +226,6 @@ static int packdummy = 0;
// Bish made it to here. (reviewing tooltips)
-/* *************************** TEXTURE ******************************** */
-
-Tex *cur_imatex=0;
-int prv_win= 0;
-
-void load_tex_image(char *str) /* called from fileselect */
-{
- Image *ima=0;
- Tex *tex;
-
- tex= cur_imatex;
- if(tex->type==TEX_IMAGE || tex->type==TEX_ENVMAP) {
-
- ima= add_image(str);
- if(ima) {
- if(tex->ima) {
- tex->ima->id.us--;
- }
- tex->ima= ima;
-
- free_image_buffers(ima); /* force reading again */
- ima->ok= 1;
- }
-
- allqueue(REDRAWBUTSTEX, 0);
-
- BIF_preview_changed(G.buts);
- }
-}
-
-void load_plugin_tex(char *str) /* called from fileselect */
-{
- Tex *tex;
-
- tex= cur_imatex;
- if(tex->type!=TEX_PLUGIN) return;
-
- if(tex->plugin) free_plugin_tex(tex->plugin);
-
- tex->stype= 0;
- tex->plugin= add_plugin_tex(str);
-
- allqueue(REDRAWBUTSTEX, 0);
- BIF_preview_changed(G.buts);
-}
-
-int vergcband(const void *a1, const void *a2)
-{
- const CBData *x1=a1, *x2=a2;
-
- if( x1->pos > x2->pos ) return 1;
- else if( x1->pos < x2->pos) return -1;
- return 0;
-}
-
-
-
-void save_env(char *name)
-{
- Tex *tex;
- char str[FILE_MAXFILE];
-
- strcpy(str, name);
- BLI_convertstringcode(str, G.sce, G.scene->r.cfra);
- tex= G.buts->lockpoin;
-
- if(tex && GS(tex->id.name)==ID_TE) {
- if(tex->env && tex->env->ok && saveover(str)) {
- waitcursor(1);
- BIF_save_envmap(tex->env, str);
- strcpy(G.ima, name);
- waitcursor(0);
- }
- }
-
-}
-
-void drawcolorband(ColorBand *coba, float x1, float y1, float sizex, float sizey)
-{
- CBData *cbd;
- float v3[2], v1[2], v2[2];
- int a;
-
- if(coba==0) return;
-
- /* outline */
- v1[0]= x1; v1[1]= y1;
- glLineWidth((GLfloat)(3));
- cpack(0x0);
- glBegin(GL_LINE_LOOP);
- glVertex2fv(v1);
- v1[0]+= sizex;
- glVertex2fv(v1);
- v1[1]+= sizey;
- glVertex2fv(v1);
- v1[0]-= sizex;
- glVertex2fv(v1);
- glEnd();
- glLineWidth((GLfloat)(1));
-
-
- glShadeModel(GL_SMOOTH);
- cbd= coba->data;
-
- v1[0]= v2[0]= x1;
- v1[1]= y1;
- v2[1]= y1+sizey;
-
- glBegin(GL_QUAD_STRIP);
-
- glColor3fv( &cbd->r );
- glVertex2fv(v1); glVertex2fv(v2);
-
- for(a=0; a<coba->tot; a++, cbd++) {
-
- v1[0]=v2[0]= x1+ cbd->pos*sizex;
-
- glColor3fv( &cbd->r );
- glVertex2fv(v1); glVertex2fv(v2);
- }
-
- v1[0]=v2[0]= x1+ sizex;
- glVertex2fv(v1); glVertex2fv(v2);
-
- glEnd();
- glShadeModel(GL_FLAT);
-
- /* help lines */
-
- v1[0]= v2[0]=v3[0]= x1;
- v1[1]= y1;
- v2[1]= y1+0.5*sizey;
- v3[1]= y1+sizey;
-
- cbd= coba->data;
- glBegin(GL_LINES);
- for(a=0; a<coba->tot; a++, cbd++) {
- v1[0]=v2[0]=v3[0]= x1+ cbd->pos*sizex;
-
- glColor3ub(0, 0, 0);
- glVertex2fv(v1);
- glVertex2fv(v2);
-
- if(a==coba->cur) {
- glVertex2f(v1[0]-1, v1[1]);
- glVertex2f(v2[0]-1, v2[1]);
- glVertex2f(v1[0]+1, v1[1]);
- glVertex2f(v2[0]+1, v2[1]);
- }
-
- glColor3ub(255, 255, 255);
- glVertex2fv(v2);
- glVertex2fv(v3);
-
- if(a==coba->cur) {
- glVertex2f(v2[0]-1, v2[1]);
- glVertex2f(v3[0]-1, v3[1]);
- glVertex2f(v2[0]+1, v2[1]);
- glVertex2f(v3[0]+1, v3[1]);
- }
- }
- glEnd();
-
- glFlush();
-}
-
-
-
-void do_texbuts(unsigned short event)
-{
- Tex *tex;
- ImBuf *ibuf;
- ScrArea *sa;
- ID *id;
- CBData *cbd;
- float dx;
- int a, nr;
- short mvalo[2], mval[2];
- char *name, str[80];
-
- tex= G.buts->lockpoin;
-
- switch(event) {
- case B_TEXCHANNEL:
- scrarea_queue_headredraw(curarea);
- BIF_preview_changed(G.buts);
- allqueue(REDRAWBUTSTEX, 0);
- break;
- case B_TEXTYPE:
- if(tex==0) return;
- tex->stype= 0;
- allqueue(REDRAWBUTSTEX, 0);
- BIF_preview_changed(G.buts);
- break;
- case B_DEFTEXVAR:
- if(tex==0) return;
- default_tex(tex);
- allqueue(REDRAWBUTSTEX, 0);
- BIF_preview_changed(G.buts);
- break;
- case B_LOADTEXIMA:
- case B_LOADTEXIMA1:
- if(tex==0) return;
- /* globals: temporal store them: we make another area a fileselect */
- cur_imatex= tex;
- prv_win= curarea->win;
-
- sa= closest_bigger_area();
- areawinset(sa->win);
- if(tex->ima) name= tex->ima->name;
-#ifdef _WIN32
- else {
- if (strcmp (U.textudir, "/") == 0)
- name= G.sce;
- else
- name= U.textudir;
- }
-#else
- else name = U.textudir;
-#endif
-
- if(event==B_LOADTEXIMA)
- activate_imageselect(FILE_SPECIAL, "SELECT IMAGE", name, load_tex_image);
- else
- activate_fileselect(FILE_SPECIAL, "SELECT IMAGE", name, load_tex_image);
-
- break;
- case B_NAMEIMA:
- if(tex==0) return;
- if(tex->ima) {
- cur_imatex= tex;
- prv_win= curarea->win;
-
- /* name in tex->ima has been changed by button! */
- strcpy(str, tex->ima->name);
- if(tex->ima->ibuf) strcpy(tex->ima->name, tex->ima->ibuf->name);
-
- load_tex_image(str);
- }
- break;
- case B_TEXREDR_PRV:
- allqueue(REDRAWBUTSTEX, 0);
- BIF_preview_changed(G.buts);
- break;
- case B_TEXIMABROWSE:
- if(tex) {
- id= (ID*) tex->ima;
-
- if(G.buts->menunr== -2) {
- activate_databrowse(id, ID_IM, 0, B_TEXIMABROWSE, &G.buts->menunr, do_texbuts);
- } else if (G.buts->menunr>0) {
- Image *newima= (Image*) BLI_findlink(&G.main->image, G.buts->menunr-1);
-
- if (newima && newima!=(Image*) id) {
- tex->ima= newima;
- id_us_plus((ID*) newima);
- if(id) id->us--;
-
- allqueue(REDRAWBUTSTEX, 0);
- BIF_preview_changed(G.buts);
- }
- }
- }
- break;
- case B_IMAPTEST:
- if(tex) {
- if( (tex->imaflag & (TEX_FIELDS+TEX_MIPMAP))== TEX_FIELDS+TEX_MIPMAP ) {
- error("Cannot combine fields and mipmap");
- tex->imaflag -= TEX_MIPMAP;
- allqueue(REDRAWBUTSTEX, 0);
- }
-
- if(tex->ima && tex->ima->ibuf) {
- ibuf= tex->ima->ibuf;
- nr= 0;
- if( !(tex->imaflag & TEX_FIELDS) && (ibuf->flags & IB_fields) ) nr= 1;
- if( (tex->imaflag & TEX_FIELDS) && !(ibuf->flags & IB_fields) ) nr= 1;
- if(nr) {
- IMB_freeImBuf(ibuf);
- tex->ima->ibuf= 0;
- tex->ima->ok= 1;
- BIF_preview_changed(G.buts);
- }
- }
- }
- break;
- case B_RELOADIMA:
- if(tex && tex->ima) {
- // check if there is a newer packedfile
-
- if (tex->ima->packedfile) {
- PackedFile *pf;
- pf = newPackedFile(tex->ima->name);
- if (pf) {
- freePackedFile(tex->ima->packedfile);
- tex->ima->packedfile = pf;
- } else {
- error("Image not available. Keeping packed image.");
- }
- }
-
- IMB_freeImBuf(tex->ima->ibuf);
- tex->ima->ibuf= 0;
- tex->ima->ok= 1;
- allqueue(REDRAWBUTSTEX, 0);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWIMAGE, 0);
- BIF_preview_changed(G.buts);
- }
- break;
-
- case B_TEXSETFRAMES:
- if(tex->ima->anim) tex->frames = IMB_anim_get_duration(tex->ima->anim);
- allqueue(REDRAWBUTSTEX, 0);
- break;
-
- case B_PACKIMA:
- if(tex && tex->ima) {
- if (tex->ima->packedfile) {
- if (G.fileflags & G_AUTOPACK) {
- if (okee("Disable AutoPack ?")) {
- G.fileflags &= ~G_AUTOPACK;
- }
- }
-
- if ((G.fileflags & G_AUTOPACK) == 0) {
- unpackImage(tex->ima, PF_ASK);
- }
- } else {
- if (tex->ima->ibuf && (tex->ima->ibuf->userflags & IB_BITMAPDIRTY)) {
- error("Can't pack painted image. Save image from Image window first.");
- } else {
- tex->ima->packedfile = newPackedFile(tex->ima->name);
- }
- }
- allqueue(REDRAWBUTSTEX, 0);
- allqueue(REDRAWHEADERS, 0);
- }
- break;
- case B_LOADPLUGIN:
- if(tex==0) return;
-
- /* globals: store temporal: we make another area a fileselect */
- cur_imatex= tex;
- prv_win= curarea->win;
-
- sa= closest_bigger_area();
- areawinset(sa->win);
- if(tex->plugin) strcpy(str, tex->plugin->name);
- else {
- strcpy(str, U.plugtexdir);
- }
- activate_fileselect(FILE_SPECIAL, "SELECT PLUGIN", str, load_plugin_tex);
-
- break;
-
- case B_NAMEPLUGIN:
- if(tex==0 || tex->plugin==0) return;
- strcpy(str, tex->plugin->name);
- free_plugin_tex(tex->plugin);
- tex->stype= 0;
- tex->plugin= add_plugin_tex(str);
- allqueue(REDRAWBUTSTEX, 0);
- BIF_preview_changed(G.buts);
- break;
-
- case B_COLORBAND:
- if(tex==0) return;
- if(tex->coba==0) tex->coba= add_colorband();
- allqueue(REDRAWBUTSTEX, 0);
- BIF_preview_changed(G.buts);
- break;
-
- case B_ADDCOLORBAND:
- if(tex==0 || tex->coba==0) return;
-
- if(tex->coba->tot < MAXCOLORBAND-1) tex->coba->tot++;
- tex->coba->cur= tex->coba->tot-1;
-
- do_texbuts(B_CALCCBAND);
-
- break;
-
- case B_DELCOLORBAND:
- if(tex==0 || tex->coba==0 || tex->coba->tot<2) return;
-
- for(a=tex->coba->cur; a<tex->coba->tot; a++) {
- tex->coba->data[a]= tex->coba->data[a+1];
- }
- if(tex->coba->cur) tex->coba->cur--;
- tex->coba->tot--;
-
- allqueue(REDRAWBUTSTEX, 0);
- BIF_preview_changed(G.buts);
- break;
-
- case B_CALCCBAND:
- case B_CALCCBAND2:
- if(tex==0 || tex->coba==0 || tex->coba->tot<2) return;
-
- for(a=0; a<tex->coba->tot; a++) tex->coba->data[a].cur= a;
- qsort(tex->coba->data, tex->coba->tot, sizeof(CBData), vergcband);
- for(a=0; a<tex->coba->tot; a++) {
- if(tex->coba->data[a].cur==tex->coba->cur) {
- if(tex->coba->cur!=a) addqueue(curarea->win, REDRAW, 0); /* button cur */
- tex->coba->cur= a;
- break;
- }
- }
- if(event==B_CALCCBAND2) return;
-
- allqueue(REDRAWBUTSTEX, 0);
- BIF_preview_changed(G.buts);
-
- break;
-
- case B_DOCOLORBAND:
- if(tex==0 || tex->coba==0) return;
-
- cbd= tex->coba->data + tex->coba->cur;
- uiGetMouse(mywinget(), mvalo);
-
- while(get_mbut() & L_MOUSE) {
- uiGetMouse(mywinget(), mval);
- if(mval[0]!=mvalo[0]) {
- dx= mval[0]-mvalo[0];
- dx/= 345.0;
- cbd->pos+= dx;
- CLAMP(cbd->pos, 0.0, 1.0);
-
- glDrawBuffer(GL_FRONT);
- drawcolorband(tex->coba, 923,81,345,20);
- /* uiSetButs(B_CALCCBAND, B_CALCCBAND); */
- glDrawBuffer(GL_BACK);
-
- do_texbuts(B_CALCCBAND2);
- cbd= tex->coba->data + tex->coba->cur; /* because qsort */
-
- mvalo[0]= mval[0];
- }
- BIF_wait_for_statechange();
- }
- allqueue(REDRAWBUTSTEX, 0);
- BIF_preview_changed(G.buts);
-
- break;
-
- case B_REDRAWCBAND:
- glDrawBuffer(GL_FRONT);
- drawcolorband(tex->coba, 923,81,345,20);
- glDrawBuffer(GL_BACK);
- BIF_preview_changed(G.buts);
- break;
-
- case B_ENV_DELETE:
- if(tex->env) {
- RE_free_envmap(tex->env);
- tex->env= 0;
- allqueue(REDRAWBUTSTEX, 0);
- BIF_preview_changed(G.buts);
- }
- break;
- case B_ENV_FREE:
- if(tex->env) {
- RE_free_envmapdata(tex->env);
- allqueue(REDRAWBUTSTEX, 0);
- BIF_preview_changed(G.buts);
- }
- break;
- case B_ENV_FREE_ALL:
- tex= G.main->tex.first;
- while(tex) {
- if(tex->id.us && tex->type==TEX_ENVMAP) {
- if(tex->env) {
- if(tex->env->stype!=ENV_LOAD) RE_free_envmapdata(tex->env);
- }
- }
- tex= tex->id.next;
- }
- allqueue(REDRAWBUTSTEX, 0);
- BIF_preview_changed(G.buts);
- break;
- case B_ENV_SAVE:
- if(tex->env && tex->env->ok) {
- sa= closest_bigger_area();
- areawinset(sa->win);
- save_image_filesel_str(str);
- activate_fileselect(FILE_SPECIAL, str, G.ima, save_env);
- }
- break;
- case B_ENV_OB:
- if(tex->env && tex->env->object) {
- BIF_preview_changed(G.buts);
- if ELEM(tex->env->object->type, OB_CAMERA, OB_LAMP) {
- error("Camera or Lamp not allowed");
- tex->env->object= 0;
- }
- }
- break;
-
- default:
- if(event>=B_PLUGBUT && event<=B_PLUGBUT+23) {
- PluginTex *pit= tex->plugin;
- if(pit && pit->callback) {
- pit->callback(event - B_PLUGBUT);
- BIF_preview_changed(G.buts);
- }
- }
- }
-}
-
-static void test_idbutton_cb(void *namev, void *arg2_unused)
-{
- char *name= namev;
- test_idbutton(name+2);
-}
-
-void texbuts(void)
-{
- Object *ob;
- Material *ma=0;
- World *wrld=0;
- Lamp *la=0;
- ID *id = NULL;
- MTex *mtex = NULL;
- Tex *tex;
- VarStruct *varstr;
- PluginTex *pit;
- CBData *cbd;
- EnvMap *env;
- uiBlock *block;
- uiBut *but;
- int a, xco, yco, loos, dx, dy, ok;
- char str[30], *strp;
-
- sprintf(str, "buttonswin %d", curarea->win);
- block= uiNewBlock(&curarea->uiblocks, str, UI_EMBOSSX, UI_HELV, curarea->win);
-
- uiBlockSetCol(block, BUTSALMON);
-
- uiDefButC(block, ROW, B_TEXREDR_PRV, "Mat", 200,172,40,20, &G.buts->texfrom, 3.0, 0.0, 0, 0, "Display the texture of the active material");
- uiDefButC(block, ROW, B_TEXREDR_PRV, "World", 240,172,52,20, &G.buts->texfrom, 3.0, 1.0, 0, 0, "Display the texture of the world block");
- uiDefButC(block, ROW, B_TEXREDR_PRV, "Lamp", 292,172,46,20, &G.buts->texfrom, 3.0, 2.0, 0, 0, "Display the texture of the lamp");
- uiBlockSetCol(block, BUTGREY);
-
- ok= 0;
-
- if(G.buts->texfrom==0) {
- ob= OBACT;
- if(ob) {
- id= ob->data;
- if(id) {
- ma= give_current_material(ob, ob->actcol);
- if(ma) ok= 1;
- }
- }
-
- }
- else if(G.buts->texfrom==1) {
- wrld= G.scene->world;
- if(wrld) {
- id= (ID *)wrld;
- ok= 1;
- }
- }
- else if(G.buts->texfrom==2) {
- ob= OBACT;
- if(ob) {
- if(ob->type==OB_LAMP) {
- la= ob->data;
- id= (ID *)la;
- ok= 1;
- }
- }
- }
-
- if(ok==0) {
- uiDrawBlock(block);
- return;
- }
-
- uiSetButLock(id->lib!=0, "Can't edit library data");
-
- /* CHANNELS */
- yco= 140;
- for(a= 0; a<8; a++) {
- if(G.buts->texfrom==0) mtex= ma->mtex[a];
- else if(G.buts->texfrom==1) mtex= wrld->mtex[a];
- else if(G.buts->texfrom==2) mtex= la->mtex[a];
-
- if(mtex && mtex->tex) splitIDname(mtex->tex->id.name+2, str, &loos);
- else strcpy(str, "");
- str[14]= 0;
- if(G.buts->texfrom==0) {
- uiDefButC(block, ROW, B_TEXCHANNEL, str, 200,(short)yco,140,18, &(ma->texact), 0.0, (float)a, 0, 0, "Linked channel");
- }
- else if(G.buts->texfrom==1) {
- uiDefButS(block, ROW, B_TEXCHANNEL, str, 200,(short)yco,140,18, &(wrld->texact), 0.0, (float)a, 0, 0, "");
- if(a==5) break;
- }
- else if(G.buts->texfrom==2) {
- uiDefButS(block, ROW, B_TEXCHANNEL, str, 200,(short)yco,140,18, &(la->texact), 0.0, (float)a, 0, 0, "");
- if(a==5) break;
- }
- yco-= 19;
- }
-
- if(G.buts->texfrom==0) {
- but= uiDefBut(block, TEX, B_IDNAME, "MA:", 200,195,140,20, ma->id.name+2, 0.0, 18.0, 0, 0, "Name of the datablock");
- uiButSetFunc(but, test_idbutton_cb, ma->id.name, NULL);
- mtex= ma->mtex[ ma->texact ];
- }
- else if(G.buts->texfrom==1) {
- but= uiDefBut(block, TEX, B_IDNAME, "WO:", 200,195,140,20, wrld->id.name+2, 0.0, 18.0, 0, 0, "Name of the datablock");
- uiButSetFunc(but, test_idbutton_cb, wrld->id.name, NULL);
- mtex= wrld->mtex[ wrld->texact ];
- }
- else if(G.buts->texfrom==2) {
- but= uiDefBut(block, TEX, B_IDNAME, "LA:", 200,195,140,20, la->id.name+2, 0.0, 18.0, 0, 0, "Name of the datablock");
- uiButSetFunc(but, test_idbutton_cb, la->id.name, NULL);
- mtex= la->mtex[ la->texact ];
- }
-
- if(mtex && mtex->tex) {
- tex= mtex->tex;
-
- uiSetButLock(tex->id.lib!=0, "Can't edit library data");
- xco= 275;
- uiDefButS(block, ROW, B_TEXTYPE, texstr[0], (short)(xco+=75), 195, 75, 20, &tex->type, 1.0, 0.0, 0, 0, "Default");
- uiDefButS(block, ROW, B_TEXTYPE, texstr[TEX_IMAGE],(short)(xco+=75), 195, 75, 20, &tex->type, 1.0, (float)TEX_IMAGE, 0, 0, "Use image texture");
- uiDefButS(block, ROW, B_TEXTYPE, texstr[TEX_ENVMAP], (short)(xco+=75), 195, 75, 20, &tex->type, 1.0, (float)TEX_ENVMAP, 0, 0, "Use environment maps");
- if(tex->plugin && tex->plugin->doit) strp= tex->plugin->pname; else strp= texstr[TEX_PLUGIN];
- uiDefButS(block, ROW, B_TEXTYPE, strp, (short)(xco+=75), 195, 75, 20, &tex->type, 1.0, (float)TEX_PLUGIN, 0, 0, "Use plugin");
- uiDefButS(block, ROW, B_TEXTYPE, texstr[TEX_CLOUDS], (short)(xco+=75), 195, 75, 20, &tex->type, 1.0, (float)TEX_CLOUDS, 0, 0, "Use clouds texture");
- uiDefButS(block, ROW, B_TEXTYPE, texstr[TEX_WOOD], (short)(xco+=75), 195, 75, 20, &tex->type, 1.0, (float)TEX_WOOD, 0, 0, "Use wood texture");
- uiDefButS(block, ROW, B_TEXTYPE, texstr[TEX_MARBLE], (short)(xco+=75), 195, 75, 20, &tex->type, 1.0, (float)TEX_MARBLE, 0, 0, "Use marble texture");
- uiDefButS(block, ROW, B_TEXTYPE, texstr[TEX_MAGIC], (short)(xco+=75), 195, 75, 20, &tex->type, 1.0, (float)TEX_MAGIC, 0, 0, "Use magic texture");
- uiDefButS(block, ROW, B_TEXTYPE, texstr[TEX_BLEND], (short)(xco+=75), 195, 75, 20, &tex->type, 1.0, (float)TEX_BLEND, 0, 0, "Use blend texture");
- uiDefButS(block, ROW, B_TEXTYPE, texstr[TEX_STUCCI], (short)(xco+=75), 195, 75, 20, &tex->type, 1.0, (float)TEX_STUCCI, 0, 0, "Use strucci texture");
- uiDefButS(block, ROW, B_TEXTYPE, texstr[TEX_NOISE], (short)(xco+=75), 195, 75, 20, &tex->type, 1.0, (float)TEX_NOISE, 0, 0, "Use noise texture");
-
- /* TYPES */
- uiBlockSetCol(block, BUTGREEN);
- switch(tex->type) {
- case TEX_CLOUDS:
- uiDefButS(block, ROW, B_MATPRV, "Default", 350, 170, 75, 18, &tex->stype, 2.0, 0.0, 0, 0, "Use standard noise");
- uiDefButS(block, ROW, B_MATPRV, "Color", 425, 170, 75, 18, &tex->stype, 2.0, 1.0, 0, 0, "Let Noise give RGB value");
- uiBlockSetCol(block, BUTGREY);
- uiDefButF(block, NUM, B_MATPRV, "NoiseSize :", 350, 110, 150, 19, &tex->noisesize, 0.0001, 2.0, 10, 0, "Set the dimension of the noise table");
- uiDefButS(block, NUM, B_MATPRV, "NoiseDepth:", 350, 90, 150, 19, &tex->noisedepth, 0.0, 6.0, 0, 0, "Set the depth of the cloud calculation");
- uiBlockSetCol(block, BUTGREEN);
- uiDefButS(block, ROW, B_MATPRV, "Soft noise", 350, 40, 100, 19, &tex->noisetype, 12.0, 0.0, 0, 0, "Use soft noise");
- uiDefButS(block, ROW, B_MATPRV, "Hard noise", 450, 40, 100, 19, &tex->noisetype, 12.0, 1.0, 0, 0, "Use hard noise");
- break;
-
- case TEX_WOOD:
- uiDefButS(block, ROW, B_MATPRV, "Bands", 350, 170, 75, 18, &tex->stype, 2.0, 0.0, 0, 0, "Use standard wood texture");
- uiDefButS(block, ROW, B_MATPRV, "Rings", 425, 170, 75, 18, &tex->stype, 2.0, 1.0, 0, 0, "Use wood rings");
- uiDefButS(block, ROW, B_MATPRV, "BandNoise", 500, 170, 75, 18, &tex->stype, 2.0, 2.0, 0, 0, "Add noise to standard wood");
- uiDefButS(block, ROW, B_MATPRV, "RingNoise", 575, 170, 75, 18, &tex->stype, 2.0, 3.0, 0, 0, "Add noise to rings");
- uiBlockSetCol(block, BUTGREY);
- uiDefButF(block, NUM, B_MATPRV, "NoiseSize :", 350, 110, 150, 19, &tex->noisesize, 0.0001, 2.0, 10, 0, "Set the dimension of the noise table");
- uiDefButF(block, NUM, B_MATPRV, "Turbulence:", 350, 90, 150, 19, &tex->turbul, 0.0, 200.0, 10, 0, "Set the turbulence of the bandnoise and ringnoise types");
- uiBlockSetCol(block, BUTGREEN);
- uiDefButS(block, ROW, B_MATPRV, "Soft noise", 350, 40, 100, 19, &tex->noisetype, 12.0, 0.0, 0, 0, "Use soft noise");
- uiDefButS(block, ROW, B_MATPRV, "Hard noise", 450, 40, 100, 19, &tex->noisetype, 12.0, 1.0, 0, 0, "Use hard noise");
- break;
-
- case TEX_MARBLE:
- uiDefButS(block, ROW, B_MATPRV, "Soft", 350, 170, 75, 18, &tex->stype, 2.0, 0.0, 0, 0, "Use soft marble");
- uiDefButS(block, ROW, B_MATPRV, "Sharp", 425, 170, 75, 18, &tex->stype, 2.0, 1.0, 0, 0, "Use more clearly defined marble");
- uiDefButS(block, ROW, B_MATPRV, "Sharper", 500, 170, 75, 18, &tex->stype, 2.0, 2.0, 0, 0, "Use very clear defined marble");
- uiBlockSetCol(block, BUTGREY);
- uiDefButF(block, NUM, B_MATPRV, "NoiseSize :", 350, 110, 150, 19, &tex->noisesize, 0.0001, 2.0, 10, 0, "Set the dimension of the noise table");
- uiDefButS(block, NUM, B_MATPRV, "NoiseDepth:", 350, 90, 150, 19, &tex->noisedepth, 0.0, 6.0, 0, 0, "Set the depth of the marble calculation");
- uiDefButF(block, NUM, B_MATPRV, "Turbulence:", 350, 70, 150, 19, &tex->turbul, 0.0, 200.0, 10, 0, "Set the turbulence of the sine bands");
- uiBlockSetCol(block, BUTGREEN);
- uiDefButS(block, ROW, B_MATPRV, "Soft noise", 350, 40, 100, 19, &tex->noisetype, 12.0, 0.0, 0, 0, "Use soft noise");
- uiDefButS(block, ROW, B_MATPRV, "Hard noise", 450, 40, 100, 19, &tex->noisetype, 12.0, 1.0, 0, 0, "Use hard noise");
- break;
-
- case TEX_MAGIC:
- uiBlockSetCol(block, BUTGREY);
- uiDefButF(block, NUM, B_MATPRV, "Size :", 350, 110, 150, 19, &tex->noisesize, 0.0001, 2.0, 10, 0, "Set the dimension of the pattern");
- uiDefButS(block, NUM, B_MATPRV, "Depth:", 350, 90, 150, 19, &tex->noisedepth, 0.0, 10.0, 0, 0, "Set the depth of the pattern");
- uiDefButF(block, NUM, B_MATPRV, "Turbulence:", 350, 70, 150, 19, &tex->turbul, 0.0, 200.0, 10, 0, "Set the strength of the pattern");
- break;
-
- case TEX_BLEND:
- uiDefButS(block, ROW, B_MATPRV, "Lin", 350, 170, 75, 18, &tex->stype, 2.0, 0.0, 0, 0, "Use a linear progresion");
- uiDefButS(block, ROW, B_MATPRV, "Quad", 425, 170, 75, 18, &tex->stype, 2.0, 1.0, 0, 0, "Use a quadratic progression");
- uiDefButS(block, ROW, B_MATPRV, "Ease", 500, 170, 75, 18, &tex->stype, 2.0, 2.0, 0, 0, "");
- uiDefButS(block, ROW, B_MATPRV, "Diag", 575, 170, 75, 18, &tex->stype, 2.0, 3.0, 0, 0, "Use a diagonal progression");
- uiDefButS(block, ROW, B_MATPRV, "Sphere", 650, 170, 75, 18, &tex->stype, 2.0, 4.0, 0, 0, "Use progression with the shape of a sphere");
- uiDefButS(block, ROW, B_MATPRV, "Halo", 725, 170, 75, 18, &tex->stype, 2.0, 5.0, 0, 0, "Use a quadratic progression with the shape of a sphere");
-
- uiDefButS(block, TOG|BIT|1, B_MATPRV, "Flip XY", 350, 130, 75, 18, &tex->flag, 0, 0, 0, 0, "Flip the direction of the progression a quarter turn");
- break;
-
- case TEX_STUCCI:
- uiDefButS(block, ROW, B_MATPRV, "Plastic", 350, 170, 75, 18, &tex->stype, 2.0, 0.0, 0, 0, "Use standard stucci");
- uiDefButS(block, ROW, B_MATPRV, "Wall In", 425, 170, 75, 18, &tex->stype, 2.0, 1.0, 0, 0, "Set start value");
- uiDefButS(block, ROW, B_MATPRV, "Wall Out", 500, 170, 75, 18, &tex->stype, 2.0, 2.0, 0, 0, "Set end value");
- uiBlockSetCol(block, BUTGREY);
- uiDefButF(block, NUM, B_MATPRV, "NoiseSize :", 350, 110, 150, 19, &tex->noisesize, 0.0001, 2.0, 10, 0, "Set the dimension of the noise table");
- uiDefButF(block, NUM, B_MATPRV, "Turbulence:", 350, 90, 150, 19, &tex->turbul, 0.0, 200.0, 10, 0, "Set the depth of the stucci");
- uiBlockSetCol(block, BUTGREEN);
- uiDefButS(block, ROW, B_MATPRV, "Soft noise", 350, 40, 100, 19, &tex->noisetype, 12.0, 0.0, 0, 0, "Use soft noise");
- uiDefButS(block, ROW, B_MATPRV, "Hard noise", 450, 40, 100, 19, &tex->noisetype, 12.0, 1.0, 0, 0, "Use hard noise");
-
- break;
-
- case TEX_NOISE:
- break;
-
- case TEX_IMAGE:
-
- break;
- }
-
- uiBlockSetCol(block, BUTSALMON);
- uiDefBut(block, BUT, B_DEFTEXVAR, "Default Vars", 1180,169,93,47, 0, 0, 0, 0, 0, "Return to standard values");
-
- uiBlockSetCol(block, BUTGREY);
- /* SPECIFIC */
- if(tex->type==TEX_IMAGE) {
- uiDefButF(block, NUM, B_REDR, "MinX ", 350,30,140,19, &tex->cropxmin, -10.0, 10.0, 10, 0, "Set minimum X value for cropping");
- uiDefButF(block, NUM, B_REDR, "MaxX ", 350,10,140,19, &tex->cropxmax, -10.0, 10.0, 10, 0, "Set maximum X value for cropping");
- uiDefButF(block, NUM, B_REDR, "MinY ", 494,30,140,19, &tex->cropymin, -10.0, 10.0, 10, 0, "Set minimum Y value for cropping");
- uiDefButF(block, NUM, B_REDR, "MaxY ", 494,10,140,19, &tex->cropymax, -10.0, 10.0, 10, 0, "Set maximum Y value for cropping");
-
-
- uiDefButS(block, ROW, 0, "Extend", 350,85,69,19, &tex->extend, 4.0, 1.0, 0, 0, "Extend the colour of the edge");
- uiDefButS(block, ROW, 0, "Clip", 421,85,59,19, &tex->extend, 4.0, 2.0, 0, 0, "Return alpha 0.0 outside image");
- uiDefButS(block, ROW, 0, "Repeat", 565,85,68,19, &tex->extend, 4.0, 3.0, 0, 0, "Repeat image horizontally and vertically");
- uiDefButS(block, ROW, 0, "ClipCube", 482,85,82,19, &tex->extend, 4.0, 4.0, 0, 0, "Return alpha 0.0 outside cubeshaped area around image");
-
- uiDefButF(block, NUM, B_MATPRV, "Filter :", 352,109,135,19, &tex->filtersize, 0.1, 25.0, 0, 0, "Set the filter size used by mipmap and interpol");
-
- uiDefButS(block, NUM, B_MATPRV, "Xrepeat:", 350,60,140,19, &tex->xrepeat, 1.0, 512.0, 0, 0, "Set the degree of repetition in the X direction");
- uiDefButS(block, NUM, B_MATPRV, "Yrepeat:", 494,60,140,19, &tex->yrepeat, 1.0, 512.0, 0, 0, "Set the degree of repetition in the Y direction");
-
- uiDefButS(block, NUM, B_MATPRV, "Frames :", 642,110,150,19, &tex->frames, 0.0, 18000.0, 0, 0, "Activate animation option");
- uiDefButS(block, NUM, B_MATPRV, "Offset :", 642,90,150,19, &tex->offset, -9000.0, 9000.0, 0, 0, "Set the number of the first picture of the animation");
- uiDefButS(block, NUM, B_MATPRV, "Fie/Ima:", 642,60,98,19, &tex->fie_ima, 1.0, 200.0, 0, 0, "Set the number of fields per rendered frame");
- uiDefButS(block, NUM, B_MATPRV, "StartFr:", 642,30,150,19, &tex->sfra, 1.0, 9000.0, 0, 0, "Set the start frame of the animation");
- uiDefButS(block, NUM, B_MATPRV, "Len:", 642,10,150,19, &tex->len, 0.0, 9000.0, 0, 0, "Set the length of the animation");
-
- uiDefButS(block, NUM, B_MATPRV, "Fra:", 802,70,73,19, &(tex->fradur[0][0]), 0.0, 18000.0, 0, 0, "Montage mode: frame start");
- uiDefButS(block, NUM, B_MATPRV, "", 879,70,37,19, &(tex->fradur[0][1]), 0.0, 250.0, 0, 0, "Montage mode: amount of displayed frames");
- uiDefButS(block, NUM, B_MATPRV, "Fra:", 802,50,73,19, &(tex->fradur[1][0]), 0.0, 18000.0, 0, 0, "Montage mode: frame start");
- uiDefButS(block, NUM, B_MATPRV, "", 879,50,37,19, &(tex->fradur[1][1]), 0.0, 250.0, 0, 0, "Montage mode: amount of displayed frames");
- uiDefButS(block, NUM, B_MATPRV, "Fra:", 802,30,73,19, &(tex->fradur[2][0]), 0.0, 18000.0, 0, 0, "Montage mode: frame start");
- uiDefButS(block, NUM, B_MATPRV, "", 879,30,37,19, &(tex->fradur[2][1]), 0.0, 250.0, 0, 0, "Montage mode: amount of displayed frames");
- uiDefButS(block, NUM, B_MATPRV, "Fra:", 802,10,73,19, &(tex->fradur[3][0]), 0.0, 18000.0, 0, 0, "Montage mode: frame start");
- uiDefButS(block, NUM, B_MATPRV, "", 879,10,37,19, &(tex->fradur[3][1]), 0.0, 250.0, 0, 0, "Montage mode: amount of displayed frames");
-
- uiBlockSetCol(block, BUTGREEN);
- uiDefButS(block, TOG|BIT|6, 0, "Cyclic", 743,60,48,19, &tex->imaflag, 0, 0, 0, 0, "Repeat animation image");
-
- uiBlockSetCol(block, BUTSALMON);
- uiDefBut(block, BUT, B_LOADTEXIMA, "Load Image", 350,137,132,24, 0, 0, 0, 0, 0, "Load image - thumbnail view");
- uiBlockSetCol(block, BUTGREY);
- uiDefBut(block, BUT, B_LOADTEXIMA1, "", 485,137,10,24, 0, 0, 0, 0, 0, "Load image - file view");
-
- id= (ID *)tex->ima;
- IDnames_to_pupstring(&strp, NULL, NULL, &(G.main->image), id, &(G.buts->menunr));
- if(strp[0])
- uiDefButS(block, MENU, B_TEXIMABROWSE, strp, 496,137,23,24, &(G.buts->menunr), 0, 0, 0, 0, "Browse");
- MEM_freeN(strp);
-
- if(tex->ima) {
- uiDefBut(block, TEX, B_NAMEIMA, "", 520,137,412,24, tex->ima->name, 0.0, 79.0, 0, 0, "Texture name");
- sprintf(str, "%d", tex->ima->id.us);
- uiDefBut(block, BUT, 0, str, 934,137,23,24, 0, 0, 0, 0, 0, "Number of users");
- uiDefBut(block, BUT, B_RELOADIMA, "Reload", 986,137,68,24, 0, 0, 0, 0, 0, "Reload");
-
- if (tex->ima->packedfile) {
- packdummy = 1;
- } else {
- packdummy = 0;
- }
- uiDefIconButI(block, TOG|BIT|0, B_PACKIMA, ICON_PACKAGE, 960,137,24,24, &packdummy, 0, 0, 0, 0, "Pack/Unpack this Image");
- }
-
- uiBlockSetCol(block, BUTGREEN);
-
- uiDefButS(block, TOG|BIT|0, 0, "InterPol", 350, 170, 75, 18, &tex->imaflag, 0, 0, 0, 0, "Interpolate pixels of the image");
- uiDefButS(block, TOG|BIT|1, B_MATPRV, "UseAlpha", 425, 170, 75, 18, &tex->imaflag, 0, 0, 0, 0, "Use the alpha layer");
- uiDefButS(block, TOG|BIT|5, B_MATPRV, "CalcAlpha", 500, 170, 75, 18, &tex->imaflag, 0, 0, 0, 0, "Calculate an alpha based on the RGB");
- uiDefButS(block, TOG|BIT|2, B_MATPRV, "NegAlpha", 575, 170, 75, 18, &tex->flag, 0, 0, 0, 0, "Reverse the alpha value");
- uiDefButS(block, TOG|BIT|2, B_IMAPTEST, "MipMap", 650, 170, 75, 18, &tex->imaflag, 0, 0, 0, 0, "Generate a series of pictures used for mipmapping");
- uiDefButS(block, TOG|BIT|3, B_IMAPTEST, "Fields", 725, 170, 75, 18, &tex->imaflag, 0, 0, 0, 0, "Work with field images");
- uiDefButS(block, TOG|BIT|4, B_MATPRV, "Rot90", 800, 170, 50, 18, &tex->imaflag, 0, 0, 0, 0, "Rotate image 90 degrees when rendered");
- uiDefButS(block, TOG|BIT|7, B_RELOADIMA, "Movie", 850, 170, 50, 18, &tex->imaflag, 0, 0, 0, 0, "Use a movie for an image");
- uiDefButS(block, TOG|BIT|8, 0, "Anti", 900, 170, 50, 18, &tex->imaflag, 0, 0, 0, 0, "Use anti-aliasing");
- uiDefButS(block, TOG|BIT|10, 0, "StField", 950, 170, 50, 18, &tex->imaflag, 0, 0, 0, 0, "");
-
- uiBlockSetCol(block, BUTGREY);
-
- /* print amount of frames anim */
- if(tex->ima && tex->ima->anim) {
- uiDefBut(block, BUT, B_TEXSETFRAMES, "<", 802, 110, 20, 18, 0, 0, 0, 0, 0, "Paste number of frames in Frames: button");
- sprintf(str, "%d frs ", IMB_anim_get_duration(tex->ima->anim));
- uiDefBut(block, LABEL, 0, str, 834, 110, 90, 18, 0, 0, 0, 0, 0, "");
- sprintf(str, "%d cur ", tex->ima->lastframe);
- uiDefBut(block, LABEL, 0, str, 834, 90, 90, 18, 0, 0, 0, 0, 0, "");
- }
-
-
- }
- else if(tex->type==TEX_PLUGIN) {
- if(tex->plugin && tex->plugin->doit) {
-
- pit= tex->plugin;
-
- uiBlockSetCol(block, BUTGREEN);
- for(a=0; a<pit->stypes; a++) {
- uiDefButS(block, ROW, B_MATPRV, pit->stnames+16*a, (short)(350+75*a), 170, 75, 18, &tex->stype, 2.0, (float)a, 0, 0, "");
- }
-
- uiBlockSetCol(block, BUTGREY);
- varstr= pit->varstr;
- if(varstr) {
- for(a=0; a<pit->vars; a++, varstr++) {
- xco= 350 + 140*(a/6);
- yco= 110 - 20*(a % 6);
- pit->data[a] = varstr->def;
- uiDefBut(block, varstr->type, B_PLUGBUT+a, varstr->name, (short)xco,(short)yco,137,19, &(pit->data[a]), varstr->min, varstr->max, 100, 0, varstr->tip);
- }
- }
- uiDefBut(block, TEX, B_NAMEPLUGIN, "", 520,137,412,24, pit->name, 0.0, 159.0, 0, 0, "Browse");
- }
-
- uiBlockSetCol(block, BUTSALMON);
- uiDefBut(block, BUT, B_LOADPLUGIN, "Load Plugin", 350,137,137,24, 0, 0, 0, 0, 0, "");
-
- }
- else if(tex->type==TEX_ENVMAP) {
-
- if(tex->env==0) {
- tex->env= RE_add_envmap();
- tex->env->object= OBACT;
- }
- if(tex->env) {
- env= tex->env;
-
- uiBlockSetCol(block, BUTGREEN);
- uiDefButS(block, ROW, B_REDR, "Static", 350, 170, 75, 18, &env->stype, 2.0, 0.0, 0, 0, "Calculate map only once");
- uiDefButS(block, ROW, B_REDR, "Anim", 425, 170, 75, 18, &env->stype, 2.0, 1.0, 0, 0, "Calculate map each rendering");
- uiDefButS(block, ROW, B_ENV_FREE, "Load", 500, 170, 75, 18, &env->stype, 2.0, 2.0, 0, 0, "Load map from disk");
-
- if(env->stype==ENV_LOAD) {
- uiBlockSetCol(block, BUTSALMON);
- uiDefBut(block, BUT, B_LOADTEXIMA, "Load Image", 350,137,132,24, 0, 0, 0, 0, 0, "Load image - thumbnail view");
- uiBlockSetCol(block, BUTGREY);
- uiDefBut(block, BUT, B_LOADTEXIMA1, "", 485,137,10,24, 0, 0, 0, 0, 0, "Load image - file view");
-
- id= (ID *)tex->ima;
- IDnames_to_pupstring(&strp, NULL, NULL, &(G.main->image), id, &(G.buts->menunr));
- if(strp[0])
- uiDefButS(block, MENU, B_TEXIMABROWSE, strp, 496,137,23,24, &(G.buts->menunr), 0, 0, 0, 0, "");
- MEM_freeN(strp);
-
- if(tex->ima) {
- uiDefBut(block, TEX, B_NAMEIMA, "", 520,137,412,24, tex->ima->name, 0.0, 79.0, 0, 0, "");
- sprintf(str, "%d", tex->ima->id.us);
- uiDefBut(block, BUT, 0, str, 934,137,23,24, 0, 0, 0, 0, 0, "");
- if (tex->ima->packedfile) {
- packdummy = 1;
- } else {
- packdummy = 0;
- }
- uiDefIconButI(block, TOG|BIT|0, B_PACKIMA, ICON_PACKAGE, 960,137,24,24, &packdummy, 0, 0, 0, 0, "Pack/Unpack this Image");
- uiDefBut(block, BUT, B_RELOADIMA, "Reload", 986,137,68,24, 0, 0, 0, 0, 0, "");
- }
- }
- else {
- uiBlockSetCol(block, BUTSALMON);
- uiDefBut(block, BUT, B_ENV_FREE, "Free Data", 350,137,107,24, 0, 0, 0, 0, 0, "Release all images associated with environment map");
- uiBlockSetCol(block, BUTGREY);
- uiDefBut(block, BUT, B_ENV_SAVE, "Save EnvMap", 461,137,115,24, 0, 0, 0, 0, 0, "Save environment map");
- uiBlockSetCol(block, BUTSALMON);
- uiDefBut(block, BUT, B_ENV_FREE_ALL, "Free all EnvMaps", 600,137,160,24, 0, 0, 0, 0, 0, "Frees all rendered environment maps");
- }
- uiBlockSetCol(block, BUTGREY);
- uiDefIDPoinBut(block, test_obpoin_but, B_ENV_OB, "Ob:", 350,95,166,24, &(env->object), "Object name");
- uiDefButF(block, NUM, B_MATPRV, "Filter :", 518,95,120,24, &tex->filtersize, 0.1, 25.0, 0, 0, "Adjust sharpness or blurriness of the reflection"),
- uiDefButS(block, NUM, B_ENV_FREE, "Depth:", 640,95,120,24, &env->depth, 0, 5.0, 0, 0, "Number of times a map gets rendered again, for recursive mirror effect"),
-
- uiDefButF(block, NUM, REDRAWVIEW3D, "ClipSta", 350,68,122,24, &env->clipsta, 0.01, 50.0, 100, 0, "Set start value for clipping");
- uiDefButF(block, NUM, 0, "ClipEnd", 475,68,142,24, &env->clipend, 0.1, 5000.0, 1000, 0, "Set end value for clipping");
- if(env->stype!=ENV_LOAD) uiDefButS(block, NUM, B_ENV_FREE, "CubeRes", 620,68,140,24, &env->cuberes, 50, 2048.0, 0, 0, "Set the resolution in pixels");
-
- uiDefBut(block, LABEL, 0, "Don't render layer:", 772,100,140,22, 0, 0.0, 0.0, 0, 0, "");
- xco= 772;
- dx= 28;
- dy= 26;
- for(a=0; a<10; a++) {
- uiDefButI(block, TOG|BIT|(a+10), 0, "",(short)(xco+a*(dx/2)), 68, (short)(dx/2), (short)(dy/2), &env->notlay, 0, 0, 0, 0, "Render this layer");
- uiDefButI(block, TOG|BIT|a, 0, "", (short)(xco+a*(dx/2)), (short)(68+dy/2), (short)(dx/2), (short)(1+dy/2), &env->notlay, 0, 0, 0, 0, "Render this layer");
- if(a==4) xco+= 5;
- }
-
- }
- }
-
- /* COLORBAND */
- uiBlockSetCol(block, BUTSALMON);
- uiDefButS(block, TOG|BIT|0, B_COLORBAND, "Colorband", 923,103,102,20, &tex->flag, 0, 0, 0, 0, "Use colorband");
- if(tex->flag & TEX_COLORBAND) {
- uiDefBut(block, BUT, B_ADDCOLORBAND, "Add", 1029,103,50,20, 0, 0, 0, 0, 0, "Add new colour to the colorband");
- uiDefBut(block, BUT, B_DELCOLORBAND, "Del", 1218,104,50,20, 0, 0, 0, 0, 0, "Delete the active colour");
- uiBlockSetCol(block, BUTPURPLE);
- uiDefButS(block, NUM, B_REDR, "Cur:", 1082,104,132,20, &tex->coba->cur, 0.0, (float)(tex->coba->tot-1), 0, 0, "The active colour from the colorband");
-
- uiDefBut(block, LABEL, B_DOCOLORBAND, "", 923,81,345,20, 0, 0, 0, 0, 0, "Colorband"); /* only for event! */
-
- drawcolorband(tex->coba, 923,81,345,20);
- cbd= tex->coba->data + tex->coba->cur;
-
- uiDefButF(block, NUM, B_CALCCBAND, "Pos", 923,59,89,20, &cbd->pos, 0.0, 1.0, 10, 0, "Set the position of the active colour");
- uiBlockSetCol(block, BUTGREEN);
- uiDefButS(block, ROW, B_REDRAWCBAND, "E", 1013,59,20,20, &tex->coba->ipotype, 5.0, 1.0, 0, 0, "Interpolation type Ease");
- uiDefButS(block, ROW, B_REDRAWCBAND, "L", 1033,59,20,20, &tex->coba->ipotype, 5.0, 0.0, 0, 0, "Interpolation type Linear");
- uiDefButS(block, ROW, B_REDRAWCBAND, "S", 1053,59,20,20, &tex->coba->ipotype, 5.0, 2.0, 0, 0, "Interpolation type Spline");
- uiBlockSetCol(block, BUTPURPLE);
- uiDefButF(block, COL, B_BANDCOL, "", 1076,59,28,20, &(cbd->r), 0, 0, 0, 0, "");
- uiDefButF(block, NUMSLI, B_REDRAWCBAND, "A ", 1107,58,163,20, &cbd->a, 0.0, 1.0, 0, 0, "Set the alpha value");
-
- uiDefButF(block, NUMSLI, B_REDRAWCBAND, "R ", 923,37,116,20, &cbd->r, 0.0, 1.0, B_BANDCOL, 0, "Set the red value");
- uiDefButF(block, NUMSLI, B_REDRAWCBAND, "G ", 1042,37,111,20, &cbd->g, 0.0, 1.0, B_BANDCOL, 0, "Set the green value");
- uiDefButF(block, NUMSLI, B_REDRAWCBAND, "B ", 1156,36,115,20, &cbd->b, 0.0, 1.0, B_BANDCOL, 0, "Set the blue value");
-
- }
-
-
- /* RGB-BRICON */
- uiBlockSetCol(block, BUTGREY);
- uiDefButF(block, NUMSLI, B_MATPRV, "Bright", 923,11,166,20, &tex->bright, 0.0, 2.0, 0, 0, "Set the brightness of the colour or intensity of a texture");
-
- uiDefButF(block, NUMSLI, B_MATPRV, "Contr", 1093,11,180,20, &tex->contrast, 0.01, 2.0, 0, 0, "Set the contrast of the colour or intensity of a texture");
-
- if((tex->flag & TEX_COLORBAND)==0) {
- uiDefButF(block, NUMSLI, B_MATPRV, "R ", 923,37,116,20, &tex->rfac, 0.0, 2.0, 0, 0, "Set the red value");
- uiDefButF(block, NUMSLI, B_MATPRV, "G ", 1042,37,111,20, &tex->gfac, 0.0, 2.0, 0, 0, "Set the green value");
- uiDefButF(block, NUMSLI, B_MATPRV, "B ", 1156,36,115,20, &tex->bfac, 0.0, 2.0, 0, 0, "Set the blue value");
- }
- }
-
- /* PREVIEW RENDER */
-
- BIF_previewdraw(G.buts);
-
- uiDrawBlock(block);
-}
-
/* ****************************** MATERIAL ************************ */
diff --git a/source/blender/src/buttons_shading.c b/source/blender/src/buttons_shading.c
index 87f1a198418..4ef785e3c7d 100644
--- a/source/blender/src/buttons_shading.c
+++ b/source/blender/src/buttons_shading.c
@@ -43,7 +43,11 @@
#include "BLI_winstuff.h"
#endif
+#include "IMB_imbuf_types.h"
+#include "IMB_imbuf.h"
+
#include "MEM_guardedalloc.h"
+
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
#include "DNA_scene_types.h"
@@ -54,6 +58,9 @@
#include "DNA_lamp_types.h"
#include "DNA_world_types.h"
#include "DNA_view3d_types.h"
+#include "DNA_image_types.h"
+#include "DNA_packedFile_types.h"
+#include "DNA_userdef_types.h"
#include "BKE_global.h"
#include "BKE_main.h"
@@ -63,6 +70,9 @@
#include "BKE_texture.h"
#include "BKE_displist.h"
#include "DNA_radio_types.h"
+#include "BKE_packedFile.h"
+#include "BKE_plugin_types.h"
+#include "BKE_image.h"
#include "BLI_blenlib.h"
#include "BMF_Api.h"
@@ -84,11 +94,14 @@
#include "BIF_space.h"
#include "BIF_previewrender.h"
#include "BIF_butspace.h"
+#include "BIF_writeimage.h"
+#include "BIF_toets.h"
#include "interface.h"
#include "mydevice.h"
#include "blendef.h"
#include "radio.h"
+#include "render.h"
/* -----includes for this file specific----- */
@@ -96,6 +109,1065 @@
static MTex mtexcopybuf;
static MTex emptytex;
+static int packdummy = 0;
+
+
+/* *************************** TEXTURE ******************************** */
+
+Tex *cur_imatex=0;
+int prv_win= 0;
+
+void load_tex_image(char *str) /* called from fileselect */
+{
+ Image *ima=0;
+ Tex *tex;
+
+ tex= cur_imatex;
+ if(tex->type==TEX_IMAGE || tex->type==TEX_ENVMAP) {
+
+ ima= add_image(str);
+ if(ima) {
+ if(tex->ima) {
+ tex->ima->id.us--;
+ }
+ tex->ima= ima;
+
+ free_image_buffers(ima); /* force reading again */
+ ima->ok= 1;
+ }
+
+ allqueue(REDRAWBUTSSHADING, 0);
+
+ BIF_preview_changed(G.buts);
+ }
+}
+
+void load_plugin_tex(char *str) /* called from fileselect */
+{
+ Tex *tex;
+
+ tex= cur_imatex;
+ if(tex->type!=TEX_PLUGIN) return;
+
+ if(tex->plugin) free_plugin_tex(tex->plugin);
+
+ tex->stype= 0;
+ tex->plugin= add_plugin_tex(str);
+
+ allqueue(REDRAWBUTSSHADING, 0);
+ BIF_preview_changed(G.buts);
+}
+
+int vergcband(const void *a1, const void *a2)
+{
+ const CBData *x1=a1, *x2=a2;
+
+ if( x1->pos > x2->pos ) return 1;
+ else if( x1->pos < x2->pos) return -1;
+ return 0;
+}
+
+
+
+void save_env(char *name)
+{
+ Tex *tex;
+ char str[FILE_MAXFILE];
+
+ strcpy(str, name);
+ BLI_convertstringcode(str, G.sce, G.scene->r.cfra);
+ tex= G.buts->lockpoin;
+
+ if(tex && GS(tex->id.name)==ID_TE) {
+ if(tex->env && tex->env->ok && saveover(str)) {
+ waitcursor(1);
+ BIF_save_envmap(tex->env, str);
+ strcpy(G.ima, name);
+ waitcursor(0);
+ }
+ }
+
+}
+
+void drawcolorband(ColorBand *coba, float x1, float y1, float sizex, float sizey)
+{
+ CBData *cbd;
+ float v3[2], v1[2], v2[2];
+ int a;
+
+ if(coba==0) return;
+
+ glShadeModel(GL_SMOOTH);
+ cbd= coba->data;
+
+ v1[0]= v2[0]= x1;
+ v1[1]= y1;
+ v2[1]= y1+sizey;
+
+ glBegin(GL_QUAD_STRIP);
+
+ glColor3fv( &cbd->r );
+ glVertex2fv(v1); glVertex2fv(v2);
+
+ for(a=0; a<coba->tot; a++, cbd++) {
+
+ v1[0]=v2[0]= x1+ cbd->pos*sizex;
+
+ glColor3fv( &cbd->r );
+ glVertex2fv(v1); glVertex2fv(v2);
+ }
+
+ v1[0]=v2[0]= x1+ sizex;
+ glVertex2fv(v1); glVertex2fv(v2);
+
+ glEnd();
+ glShadeModel(GL_FLAT);
+
+
+ /* outline */
+ v1[0]= x1; v1[1]= y1;
+
+ cpack(0x0);
+ glBegin(GL_LINE_LOOP);
+ glVertex2fv(v1);
+ v1[0]+= sizex;
+ glVertex2fv(v1);
+ v1[1]+= sizey;
+ glVertex2fv(v1);
+ v1[0]-= sizex;
+ glVertex2fv(v1);
+ glEnd();
+
+
+ /* help lines */
+
+ v1[0]= v2[0]=v3[0]= x1;
+ v1[1]= y1;
+ v2[1]= y1+0.5*sizey;
+ v3[1]= y1+sizey;
+
+ cbd= coba->data;
+ glBegin(GL_LINES);
+ for(a=0; a<coba->tot; a++, cbd++) {
+ v1[0]=v2[0]=v3[0]= x1+ cbd->pos*sizex;
+
+ glColor3ub(0, 0, 0);
+ glVertex2fv(v1);
+ glVertex2fv(v2);
+
+ if(a==coba->cur) {
+ glVertex2f(v1[0]-1, v1[1]);
+ glVertex2f(v2[0]-1, v2[1]);
+ glVertex2f(v1[0]+1, v1[1]);
+ glVertex2f(v2[0]+1, v2[1]);
+ }
+
+ glColor3ub(255, 255, 255);
+ glVertex2fv(v2);
+ glVertex2fv(v3);
+
+ if(a==coba->cur) {
+ glVertex2f(v2[0]-1, v2[1]);
+ glVertex2f(v3[0]-1, v3[1]);
+ glVertex2f(v2[0]+1, v2[1]);
+ glVertex2f(v3[0]+1, v3[1]);
+ }
+ }
+ glEnd();
+
+
+ glFlush();
+}
+
+
+
+void do_texbuts(unsigned short event)
+{
+ Tex *tex;
+ ImBuf *ibuf;
+ ScrArea *sa;
+ ID *id;
+ CBData *cbd;
+ uiBlock *block;
+ float dx;
+ int a, nr;
+ short mvalo[2], mval[2];
+ char *name, str[80];
+
+ tex= G.buts->lockpoin;
+
+ switch(event) {
+ case B_TEXCHANNEL:
+ scrarea_queue_headredraw(curarea);
+ BIF_preview_changed(G.buts);
+ allqueue(REDRAWBUTSSHADING, 0);
+ break;
+ case B_TEXTYPE:
+ if(tex==0) return;
+ tex->stype= 0;
+ allqueue(REDRAWBUTSSHADING, 0);
+ BIF_preview_changed(G.buts);
+ break;
+ case B_DEFTEXVAR:
+ if(tex==0) return;
+ default_tex(tex);
+ allqueue(REDRAWBUTSSHADING, 0);
+ BIF_preview_changed(G.buts);
+ break;
+ case B_LOADTEXIMA:
+ case B_LOADTEXIMA1:
+ if(tex==0) return;
+ /* globals: temporal store them: we make another area a fileselect */
+ cur_imatex= tex;
+ prv_win= curarea->win;
+
+ sa= closest_bigger_area();
+ areawinset(sa->win);
+ if(tex->ima) name= tex->ima->name;
+#ifdef _WIN32
+ else {
+ if (strcmp (U.textudir, "/") == 0)
+ name= G.sce;
+ else
+ name= U.textudir;
+ }
+#else
+ else name = U.textudir;
+#endif
+
+ if(event==B_LOADTEXIMA)
+ activate_imageselect(FILE_SPECIAL, "SELECT IMAGE", name, load_tex_image);
+ else
+ activate_fileselect(FILE_SPECIAL, "SELECT IMAGE", name, load_tex_image);
+
+ break;
+ case B_NAMEIMA:
+ if(tex==0) return;
+ if(tex->ima) {
+ cur_imatex= tex;
+ prv_win= curarea->win;
+
+ /* name in tex->ima has been changed by button! */
+ strcpy(str, tex->ima->name);
+ if(tex->ima->ibuf) strcpy(tex->ima->name, tex->ima->ibuf->name);
+
+ load_tex_image(str);
+ }
+ break;
+ case B_TEXREDR_PRV:
+ allqueue(REDRAWBUTSSHADING, 0);
+ BIF_preview_changed(G.buts);
+ break;
+ case B_TEXIMABROWSE:
+ if(tex) {
+ id= (ID*) tex->ima;
+
+ if(G.buts->menunr== -2) {
+ activate_databrowse(id, ID_IM, 0, B_TEXIMABROWSE, &G.buts->menunr, do_texbuts);
+ } else if (G.buts->menunr>0) {
+ Image *newima= (Image*) BLI_findlink(&G.main->image, G.buts->menunr-1);
+
+ if (newima && newima!=(Image*) id) {
+ tex->ima= newima;
+ id_us_plus((ID*) newima);
+ if(id) id->us--;
+
+ allqueue(REDRAWBUTSSHADING, 0);
+ BIF_preview_changed(G.buts);
+ }
+ }
+ }
+ break;
+ case B_IMAPTEST:
+ if(tex) {
+ if( (tex->imaflag & (TEX_FIELDS+TEX_MIPMAP))== TEX_FIELDS+TEX_MIPMAP ) {
+ error("Cannot combine fields and mipmap");
+ tex->imaflag -= TEX_MIPMAP;
+ allqueue(REDRAWBUTSSHADING, 0);
+ }
+
+ if(tex->ima && tex->ima->ibuf) {
+ ibuf= tex->ima->ibuf;
+ nr= 0;
+ if( !(tex->imaflag & TEX_FIELDS) && (ibuf->flags & IB_fields) ) nr= 1;
+ if( (tex->imaflag & TEX_FIELDS) && !(ibuf->flags & IB_fields) ) nr= 1;
+ if(nr) {
+ IMB_freeImBuf(ibuf);
+ tex->ima->ibuf= 0;
+ tex->ima->ok= 1;
+ BIF_preview_changed(G.buts);
+ }
+ }
+ }
+ break;
+ case B_RELOADIMA:
+ if(tex && tex->ima) {
+ // check if there is a newer packedfile
+
+ if (tex->ima->packedfile) {
+ PackedFile *pf;
+ pf = newPackedFile(tex->ima->name);
+ if (pf) {
+ freePackedFile(tex->ima->packedfile);
+ tex->ima->packedfile = pf;
+ } else {
+ error("Image not available. Keeping packed image.");
+ }
+ }
+
+ IMB_freeImBuf(tex->ima->ibuf);
+ tex->ima->ibuf= 0;
+ tex->ima->ok= 1;
+ allqueue(REDRAWVIEW3D, 0);
+ allqueue(REDRAWIMAGE, 0);
+ BIF_preview_changed(G.buts);
+ }
+ allqueue(REDRAWBUTSSHADING, 0); // redraw buttons
+
+ break;
+
+ case B_TEXSETFRAMES:
+ if(tex->ima->anim) tex->frames = IMB_anim_get_duration(tex->ima->anim);
+ allqueue(REDRAWBUTSSHADING, 0);
+ break;
+
+ case B_PACKIMA:
+ if(tex && tex->ima) {
+ if (tex->ima->packedfile) {
+ if (G.fileflags & G_AUTOPACK) {
+ if (okee("Disable AutoPack ?")) {
+ G.fileflags &= ~G_AUTOPACK;
+ }
+ }
+
+ if ((G.fileflags & G_AUTOPACK) == 0) {
+ unpackImage(tex->ima, PF_ASK);
+ }
+ } else {
+ if (tex->ima->ibuf && (tex->ima->ibuf->userflags & IB_BITMAPDIRTY)) {
+ error("Can't pack painted image. Save image from Image window first.");
+ } else {
+ tex->ima->packedfile = newPackedFile(tex->ima->name);
+ }
+ }
+ allqueue(REDRAWBUTSSHADING, 0);
+ allqueue(REDRAWHEADERS, 0);
+ }
+ break;
+ case B_LOADPLUGIN:
+ if(tex==0) return;
+
+ /* globals: store temporal: we make another area a fileselect */
+ cur_imatex= tex;
+ prv_win= curarea->win;
+
+ sa= closest_bigger_area();
+ areawinset(sa->win);
+ if(tex->plugin) strcpy(str, tex->plugin->name);
+ else {
+ strcpy(str, U.plugtexdir);
+ }
+ activate_fileselect(FILE_SPECIAL, "SELECT PLUGIN", str, load_plugin_tex);
+
+ break;
+
+ case B_NAMEPLUGIN:
+ if(tex==0 || tex->plugin==0) return;
+ strcpy(str, tex->plugin->name);
+ free_plugin_tex(tex->plugin);
+ tex->stype= 0;
+ tex->plugin= add_plugin_tex(str);
+ allqueue(REDRAWBUTSSHADING, 0);
+ BIF_preview_changed(G.buts);
+ break;
+
+ case B_COLORBAND:
+ if(tex==0) return;
+ if(tex->coba==0) tex->coba= add_colorband();
+ allqueue(REDRAWBUTSSHADING, 0);
+ BIF_preview_changed(G.buts);
+ break;
+
+ case B_ADDCOLORBAND:
+ if(tex==0 || tex->coba==0) return;
+
+ if(tex->coba->tot < MAXCOLORBAND-1) tex->coba->tot++;
+ tex->coba->cur= tex->coba->tot-1;
+
+ do_texbuts(B_CALCCBAND);
+
+ break;
+
+ case B_DELCOLORBAND:
+ if(tex==0 || tex->coba==0 || tex->coba->tot<2) return;
+
+ for(a=tex->coba->cur; a<tex->coba->tot; a++) {
+ tex->coba->data[a]= tex->coba->data[a+1];
+ }
+ if(tex->coba->cur) tex->coba->cur--;
+ tex->coba->tot--;
+
+ allqueue(REDRAWBUTSSHADING, 0);
+ BIF_preview_changed(G.buts);
+ break;
+
+ case B_CALCCBAND:
+ case B_CALCCBAND2:
+ if(tex==0 || tex->coba==0 || tex->coba->tot<2) return;
+
+ for(a=0; a<tex->coba->tot; a++) tex->coba->data[a].cur= a;
+ qsort(tex->coba->data, tex->coba->tot, sizeof(CBData), vergcband);
+ for(a=0; a<tex->coba->tot; a++) {
+ if(tex->coba->data[a].cur==tex->coba->cur) {
+ if(tex->coba->cur!=a) addqueue(curarea->win, REDRAW, 0); /* button cur */
+ tex->coba->cur= a;
+ break;
+ }
+ }
+ if(event==B_CALCCBAND2) return;
+
+ allqueue(REDRAWBUTSSHADING, 0);
+ BIF_preview_changed(G.buts);
+
+ break;
+
+ case B_DOCOLORBAND:
+ if(tex==0 || tex->coba==0) return;
+
+ block= uiFindOpenPanelBlockName(&curarea->uiblocks, "Colors");
+ if(block) {
+ cbd= tex->coba->data + tex->coba->cur;
+ uiGetMouse(mywinget(), mvalo);
+
+ while(get_mbut() & L_MOUSE) {
+ uiGetMouse(mywinget(), mval);
+ if(mval[0]!=mvalo[0]) {
+ dx= mval[0]-mvalo[0];
+ dx/= 345.0;
+ cbd->pos+= dx;
+ CLAMP(cbd->pos, 0.0, 1.0);
+
+ glDrawBuffer(GL_FRONT);
+ uiPanelPush(block);
+ drawcolorband(tex->coba, 10,150,300,20);
+ uiPanelPop(block);
+ glDrawBuffer(GL_BACK);
+
+ do_texbuts(B_CALCCBAND2);
+ cbd= tex->coba->data + tex->coba->cur; /* because qsort */
+
+ mvalo[0]= mval[0];
+ }
+ BIF_wait_for_statechange();
+ }
+ allqueue(REDRAWBUTSSHADING, 0);
+ BIF_preview_changed(G.buts);
+ }
+ break;
+
+ case B_ENV_DELETE:
+ if(tex->env) {
+ RE_free_envmap(tex->env);
+ tex->env= 0;
+ allqueue(REDRAWBUTSSHADING, 0);
+ BIF_preview_changed(G.buts);
+ }
+ break;
+ case B_ENV_FREE:
+ if(tex->env) {
+ RE_free_envmapdata(tex->env);
+ allqueue(REDRAWBUTSSHADING, 0);
+ BIF_preview_changed(G.buts);
+ }
+ break;
+ case B_ENV_FREE_ALL:
+ tex= G.main->tex.first;
+ while(tex) {
+ if(tex->id.us && tex->type==TEX_ENVMAP) {
+ if(tex->env) {
+ if(tex->env->stype!=ENV_LOAD) RE_free_envmapdata(tex->env);
+ }
+ }
+ tex= tex->id.next;
+ }
+ allqueue(REDRAWBUTSSHADING, 0);
+ BIF_preview_changed(G.buts);
+ break;
+ case B_ENV_SAVE:
+ if(tex->env && tex->env->ok) {
+ sa= closest_bigger_area();
+ areawinset(sa->win);
+ save_image_filesel_str(str);
+ activate_fileselect(FILE_SPECIAL, str, G.ima, save_env);
+ }
+ break;
+ case B_ENV_OB:
+ if(tex->env && tex->env->object) {
+ BIF_preview_changed(G.buts);
+ if ELEM(tex->env->object->type, OB_CAMERA, OB_LAMP) {
+ error("Camera or Lamp not allowed");
+ tex->env->object= 0;
+ }
+ }
+ break;
+
+ default:
+ if(event>=B_PLUGBUT && event<=B_PLUGBUT+23) {
+ PluginTex *pit= tex->plugin;
+ if(pit && pit->callback) {
+ pit->callback(event - B_PLUGBUT);
+ BIF_preview_changed(G.buts);
+ }
+ }
+ }
+}
+
+static void texture_panel_plugin(Tex *tex)
+{
+ uiBlock *block;
+ VarStruct *varstr;
+ PluginTex *pit;
+ short xco, yco, a;
+
+ block= uiNewBlock(&curarea->uiblocks, "texture_panel_plugin", UI_EMBOSSX, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "Plugin", "Texture", 640, 0, 318, 204)==0) return;
+ uiSetButLock(tex->id.lib!=0, "Can't edit library data");
+
+ if(tex->plugin && tex->plugin->doit) {
+
+ pit= tex->plugin;
+
+ uiBlockSetCol(block, BUTGREEN);
+ for(a=0; a<pit->stypes; a++) {
+ uiDefButS(block, ROW, B_MATPRV, pit->stnames+16*a, (350+75*a), 170, 75, 18, &tex->stype, 2.0, (float)a, 0, 0, "");
+ }
+
+ uiBlockSetCol(block, BUTGREY);
+ varstr= pit->varstr;
+ if(varstr) {
+ for(a=0; a<pit->vars; a++, varstr++) {
+ xco= 350 + 140*(a/6);
+ yco= 110 - 20*(a % 6);
+ pit->data[a] = varstr->def;
+ uiDefBut(block, varstr->type, B_PLUGBUT+a, varstr->name, xco,yco,137,19, &(pit->data[a]), varstr->min, varstr->max, 100, 0, varstr->tip);
+ }
+ }
+ uiDefBut(block, TEX, B_NAMEPLUGIN, "", 350,130,290,24, pit->name, 0.0, 159.0, 0, 0, "");
+ }
+
+ uiBlockSetCol(block, BUTSALMON);
+ uiDefBut(block, BUT, B_LOADPLUGIN, "Load Plugin", 350,150,137,24, 0, 0, 0, 0, 0, "");
+
+}
+
+
+static void texture_panel_magic(Tex *tex)
+{
+ uiBlock *block;
+
+ block= uiNewBlock(&curarea->uiblocks, "texture_panel_magic", UI_EMBOSSX, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "Magic", "Texture", 640, 0, 318, 204)==0) return;
+ uiSetButLock(tex->id.lib!=0, "Can't edit library data");
+
+ uiBlockSetCol(block, BUTGREY);
+ uiDefButF(block, NUM, B_MATPRV, "Size :", 10, 110, 150, 19, &tex->noisesize, 0.0001, 2.0, 10, 0, "Set the dimension of the pattern");
+ uiDefButS(block, NUM, B_MATPRV, "Depth:", 10, 90, 150, 19, &tex->noisedepth, 0.0, 10.0, 0, 0, "Set the depth of the pattern");
+ uiDefButF(block, NUM, B_MATPRV, "Turbulence:", 10, 70, 150, 19, &tex->turbul, 0.0, 200.0, 10, 0, "Set the strength of the pattern");
+}
+
+static void texture_panel_blend(Tex *tex)
+{
+ uiBlock *block;
+
+ block= uiNewBlock(&curarea->uiblocks, "texture_panel_blend", UI_EMBOSSX, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "Blend", "Texture", 640, 0, 318, 204)==0) return;
+ uiSetButLock(tex->id.lib!=0, "Can't edit library data");
+
+ uiBlockSetCol(block, BUTGREEN);
+ uiDefButS(block, ROW, B_MATPRV, "Lin", 10, 180, 75, 19, &tex->stype, 2.0, 0.0, 0, 0, "Use a linear progresion");
+ uiDefButS(block, ROW, B_MATPRV, "Quad", 85, 180, 75, 19, &tex->stype, 2.0, 1.0, 0, 0, "Use a quadratic progression");
+ uiDefButS(block, ROW, B_MATPRV, "Ease", 160, 180, 75, 19, &tex->stype, 2.0, 2.0, 0, 0, "");
+ uiDefButS(block, TOG|BIT|1, B_MATPRV, "Flip XY", 235, 180, 75, 19, &tex->flag, 0, 0, 0, 0, "Flip the direction of the progression a quarter turn");
+
+ uiDefButS(block, ROW, B_MATPRV, "Diag", 10, 160, 75, 19, &tex->stype, 2.0, 3.0, 0, 0, "Use a diagonal progression");
+ uiDefButS(block, ROW, B_MATPRV, "Sphere", 85, 160, 75, 19, &tex->stype, 2.0, 4.0, 0, 0, "Use progression with the shape of a sphere");
+ uiDefButS(block, ROW, B_MATPRV, "Halo", 160, 160, 75, 19, &tex->stype, 2.0, 5.0, 0, 0, "Use a quadratic progression with the shape of a sphere");
+
+}
+
+
+
+static void texture_panel_wood(Tex *tex)
+{
+ uiBlock *block;
+
+ block= uiNewBlock(&curarea->uiblocks, "texture_panel_wood", UI_EMBOSSX, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "Wood", "Texture", 640, 0, 318, 204)==0) return;
+ uiSetButLock(tex->id.lib!=0, "Can't edit library data");
+
+ uiBlockSetCol(block, BUTGREEN);
+ uiDefButS(block, ROW, B_MATPRV, "Bands", 10, 180, 75, 18, &tex->stype, 2.0, 0.0, 0, 0, "Use standard wood texture");
+ uiDefButS(block, ROW, B_MATPRV, "Rings", 85, 180, 75, 18, &tex->stype, 2.0, 1.0, 0, 0, "Use wood rings");
+ uiDefButS(block, ROW, B_MATPRV, "BandNoise", 160, 180, 75, 18, &tex->stype, 2.0, 2.0, 0, 0, "Add noise to standard wood");
+ uiDefButS(block, ROW, B_MATPRV, "RingNoise", 235, 180, 75, 18, &tex->stype, 2.0, 3.0, 0, 0, "Add noise to rings");
+
+ uiDefButS(block, ROW, B_MATPRV, "Soft noise", 10, 160, 75, 19, &tex->noisetype, 12.0, 0.0, 0, 0, "Use soft noise");
+ uiDefButS(block, ROW, B_MATPRV, "Hard noise", 85, 160, 75, 19, &tex->noisetype, 12.0, 1.0, 0, 0, "Use hard noise");
+
+ uiBlockSetCol(block, BUTGREY);
+ uiDefButF(block, NUM, B_MATPRV, "NoiseSize :", 10, 130, 150, 19, &tex->noisesize, 0.0001, 2.0, 10, 0, "Set the dimension of the noise table");
+ uiDefButF(block, NUM, B_MATPRV, "Turbulence:", 160, 130, 150, 19, &tex->turbul, 0.0, 200.0, 10, 0, "Set the turbulence of the bandnoise and ringnoise types");
+
+
+}
+
+static void texture_panel_stucci(Tex *tex)
+{
+ uiBlock *block;
+
+ block= uiNewBlock(&curarea->uiblocks, "texture_panel_stucci", UI_EMBOSSX, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "Stucci", "Texture", 640, 0, 318, 204)==0) return;
+ uiSetButLock(tex->id.lib!=0, "Can't edit library data");
+
+ uiBlockSetCol(block, BUTGREEN);
+ uiDefButS(block, ROW, B_MATPRV, "Plastic", 10, 180, 100, 19, &tex->stype, 2.0, 0.0, 0, 0, "Use standard stucci");
+ uiDefButS(block, ROW, B_MATPRV, "Wall In", 110, 180, 100, 19, &tex->stype, 2.0, 1.0, 0, 0, "Set start value");
+ uiDefButS(block, ROW, B_MATPRV, "Wall Out", 210, 180, 100, 19, &tex->stype, 2.0, 2.0, 0, 0, "Set end value");
+ uiDefButS(block, ROW, B_MATPRV, "Soft noise", 10, 160, 100, 19, &tex->noisetype, 12.0, 0.0, 0, 0, "Use soft noise");
+ uiDefButS(block, ROW, B_MATPRV, "Hard noise", 110, 160, 100, 19, &tex->noisetype, 12.0, 1.0, 0, 0, "Use hard noise");
+
+ uiBlockSetCol(block, BUTGREY);
+ uiDefButF(block, NUM, B_MATPRV, "NoiseSize :", 10, 110, 150, 19, &tex->noisesize, 0.0001, 2.0, 10, 0, "Set the dimension of the noise table");
+ uiDefButF(block, NUM, B_MATPRV, "Turbulence:", 10, 90, 150, 19, &tex->turbul, 0.0, 200.0, 10, 0, "Set the depth of the stucci");
+}
+
+static void texture_panel_marble(Tex *tex)
+{
+ uiBlock *block;
+
+ block= uiNewBlock(&curarea->uiblocks, "texture_panel_marble", UI_EMBOSSX, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "Marble", "Texture", 640, 0, 318, 204)==0) return;
+ uiSetButLock(tex->id.lib!=0, "Can't edit library data");
+
+ uiBlockSetCol(block, BUTGREEN);
+ uiDefButS(block, ROW, B_MATPRV, "Soft", 10, 180, 75, 18, &tex->stype, 2.0, 0.0, 0, 0, "Use soft marble");
+ uiDefButS(block, ROW, B_MATPRV, "Sharp", 85, 180, 75, 18, &tex->stype, 2.0, 1.0, 0, 0, "Use more clearly defined marble");
+ uiDefButS(block, ROW, B_MATPRV, "Sharper", 160, 180, 75, 18, &tex->stype, 2.0, 2.0, 0, 0, "Use very clear defined marble");
+
+ uiDefButS(block, ROW, B_MATPRV, "Soft noise", 10, 160, 100, 19, &tex->noisetype, 12.0, 0.0, 0, 0, "Use soft noise");
+ uiDefButS(block, ROW, B_MATPRV, "Hard noise", 110, 160, 100, 19, &tex->noisetype, 12.0, 1.0, 0, 0, "Use hard noise");
+
+ uiBlockSetCol(block, BUTGREY);
+ uiDefButF(block, NUM, B_MATPRV, "NoiseSize :", 10, 110, 150, 19, &tex->noisesize, 0.0001, 2.0, 10, 0, "Set the dimension of the noise table");
+ uiDefButS(block, NUM, B_MATPRV, "NoiseDepth:", 10, 90, 150, 19, &tex->noisedepth, 0.0, 6.0, 0, 0, "Set the depth of the marble calculation");
+ uiDefButF(block, NUM, B_MATPRV, "Turbulence:", 10, 70, 150, 19, &tex->turbul, 0.0, 200.0, 10, 0, "Set the turbulence of the sine bands");
+
+
+}
+
+static void texture_panel_clouds(Tex *tex)
+{
+ uiBlock *block;
+
+ block= uiNewBlock(&curarea->uiblocks, "texture_panel_clouds", UI_EMBOSSX, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "Clouds", "Texture", 640, 0, 318, 204)==0) return;
+ uiSetButLock(tex->id.lib!=0, "Can't edit library data");
+
+ uiBlockSetCol(block, BUTGREEN);
+ uiDefButS(block, ROW, B_MATPRV, "Default", 10, 180, 70, 18, &tex->stype, 2.0, 0.0, 0, 0, "Use standard noise");
+ uiDefButS(block, ROW, B_MATPRV, "Color", 80, 180, 70, 18, &tex->stype, 2.0, 1.0, 0, 0, "Let Noise give RGB value");
+ uiDefButS(block, ROW, B_MATPRV, "Soft noise", 155, 180, 75, 19, &tex->noisetype, 12.0, 0.0, 0, 0, "Use soft noise");
+ uiDefButS(block, ROW, B_MATPRV, "Hard noise", 230, 180, 80, 19, &tex->noisetype, 12.0, 1.0, 0, 0, "Use hard noise");
+
+ uiBlockSetCol(block, BUTGREY);
+ uiDefButF(block, NUM, B_MATPRV, "NoiseSize :", 10, 130, 150, 19, &tex->noisesize, 0.0001, 2.0, 10, 0, "Set the dimension of the noise table");
+ uiDefButS(block, NUM, B_MATPRV, "NoiseDepth:", 160, 130, 150, 19, &tex->noisedepth, 0.0, 6.0, 0, 0, "Set the depth of the cloud calculation");
+
+}
+
+
+static void texture_panel_envmap(Tex *tex)
+{
+ uiBlock *block;
+ EnvMap *env;
+ ID *id;
+ short a, xco, yco, dx, dy;
+ char *strp, str[32];
+
+ block= uiNewBlock(&curarea->uiblocks, "texture_panel_envmap", UI_EMBOSSX, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "Envmap", "Texture", 640, 0, 318, 204)==0) return;
+ uiSetButLock(tex->id.lib!=0, "Can't edit library data");
+
+ if(tex->env==0) {
+ tex->env= RE_add_envmap();
+ tex->env->object= OBACT;
+ }
+ if(tex->env) {
+ env= tex->env;
+
+ uiBlockSetCol(block, BUTGREEN);
+ uiDefButS(block, ROW, B_REDR, "Static", 10, 180, 100, 19, &env->stype, 2.0, 0.0, 0, 0, "Calculate map only once");
+ uiDefButS(block, ROW, B_REDR, "Anim", 110, 180, 100, 19, &env->stype, 2.0, 1.0, 0, 0, "Calculate map each rendering");
+ uiDefButS(block, ROW, B_ENV_FREE, "Load", 210, 180, 100, 19, &env->stype, 2.0, 2.0, 0, 0, "Load map from disk");
+
+ if(env->stype==ENV_LOAD) {
+ /* file input */
+ uiBlockSetCol(block, BUTGREY);
+ id= (ID *)tex->ima;
+ IDnames_to_pupstring(&strp, NULL, NULL, &(G.main->image), id, &(G.buts->menunr));
+ if(strp[0])
+ uiDefButS(block, MENU, B_TEXIMABROWSE, strp, 10,135,23,20, &(G.buts->menunr), 0, 0, 0, 0, "Browse");
+ MEM_freeN(strp);
+
+ uiBlockSetCol(block, BUTSALMON);
+ uiDefBut(block, BUT, B_LOADTEXIMA1, "Load Image", 10,115,130,20, 0, 0, 0, 0, 0, "Load image - file view");
+ uiBlockSetCol(block, BUTPURPLE);
+ uiDefBut(block, BUT, B_LOADTEXIMA, "", 140,115,20,20, 0, 0, 0, 0, 0, "Load image - thumb view");
+
+ if(tex->ima) {
+ uiDefBut(block, TEX, B_NAMEIMA, "", 35,135,255,20, tex->ima->name, 0.0, 79.0, 0, 0, "Texture name");
+ sprintf(str, "%d", tex->ima->id.us);
+ uiDefBut(block, BUT, 0, str, 290,135,20,20, 0, 0, 0, 0, 0, "Number of users");
+ uiBlockSetCol(block, BUTSALMON);
+ uiDefBut(block, BUT, B_RELOADIMA, "Reload", 230,115,80,20, 0, 0, 0, 0, 0, "Reload");
+
+ if (tex->ima->packedfile) packdummy = 1;
+ else packdummy = 0;
+
+ uiBlockSetCol(block, BUTGREY);
+ uiDefIconButI(block, TOG|BIT|0, B_PACKIMA, ICON_PACKAGE, 205,115,24,20, &packdummy, 0, 0, 0, 0, "Pack/Unpack this Image");
+ }
+ }
+ else {
+ uiBlockSetCol(block, BUTSALMON);
+ uiDefBut(block, BUT, B_ENV_FREE, "Free Data", 10,135,100,20, 0, 0, 0, 0, 0, "Release all images associated with environment map");
+ uiBlockSetCol(block, BUTGREY);
+ uiDefBut(block, BUT, B_ENV_SAVE, "Save EnvMap", 110,135,100,20, 0, 0, 0, 0, 0, "Save environment map");
+ uiBlockSetCol(block, BUTSALMON);
+ uiDefBut(block, BUT, B_ENV_FREE_ALL, "Free all EnvMaps", 210,135,100,20, 0, 0, 0, 0, 0, "Frees all rendered environment maps");
+ }
+
+ uiBlockSetCol(block, BUTGREY);
+ uiDefIDPoinBut(block, test_obpoin_but, B_ENV_OB, "Ob:", 10,90,150,20, &(env->object), "Object name");
+ if(env->stype!=ENV_LOAD)
+ uiDefButS(block, NUM, B_ENV_FREE, "CubeRes", 160,90,150,20, &env->cuberes, 50, 2048.0, 0, 0, "Set the resolution in pixels");
+
+ uiDefButF(block, NUM, B_MATPRV, "Filter :", 10,65,150,20, &tex->filtersize, 0.1, 25.0, 0, 0, "Adjust sharpness or blurriness of the reflection"),
+ uiDefButS(block, NUM, B_ENV_FREE, "Depth:", 160,65,150,20, &env->depth, 0, 5.0, 0, 0, "Number of times a map gets rendered again, for recursive mirror effect"),
+
+ uiDefButF(block, NUM, REDRAWVIEW3D, "ClipSta", 10,40,150,20, &env->clipsta, 0.01, 50.0, 100, 0, "Set start value for clipping");
+ uiDefButF(block, NUM, 0, "ClipEnd", 160,40,150,20, &env->clipend, 0.1, 5000.0, 1000, 0, "Set end value for clipping");
+
+ uiDefBut(block, LABEL, 0, "Don't render layer:", 10,10,140,22, 0, 0.0, 0.0, 0, 0, "");
+ xco= 160;
+ yco= 10;
+ dx= 28;
+ dy= 26;
+ for(a=0; a<10; a++) {
+ uiDefButI(block, TOG|BIT|(a+10), 0, "",(xco+a*(dx/2)), yco, (dx/2), (dy/2), &env->notlay, 0, 0, 0, 0, "Render this layer");
+ uiDefButI(block, TOG|BIT|a, 0, "", (xco+a*(dx/2)), (yco+dy/2), (dx/2), (1+dy/2), &env->notlay, 0, 0, 0, 0, "Render this layer");
+ if(a==4) xco+= 5;
+ }
+
+ }
+}
+
+
+static void texture_panel_image1(Tex *tex)
+{
+ uiBlock *block;
+ char str[32];
+
+ block= uiNewBlock(&curarea->uiblocks, "texture_panel1", UI_EMBOSSX, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "Crop and Anim", "Texture", 960, 0, 318, 204)==0) return;
+ uiSetButLock(tex->id.lib!=0, "Can't edit library data");
+
+ if(tex->imaflag & TEX_ANIM5) {
+
+ /* print amount of frames anim */
+ if(tex->ima && tex->ima->anim) {
+ uiDefBut(block, BUT, B_TEXSETFRAMES, "<", 802, 110, 20, 18, 0, 0, 0, 0, 0, "Paste number of frames in Frames: button");
+ sprintf(str, "%d frs ", IMB_anim_get_duration(tex->ima->anim));
+ uiDefBut(block, LABEL, 0, str, 834, 110, 90, 18, 0, 0, 0, 0, 0, "");
+ sprintf(str, "%d cur ", tex->ima->lastframe);
+ uiDefBut(block, LABEL, 0, str, 834, 90, 90, 18, 0, 0, 0, 0, 0, "");
+ }
+ else uiDefBut(block, LABEL, 0, "<", 802, 110, 20, 18, 0, 0, 0, 0, 0, "");
+
+ uiDefButS(block, NUM, B_MATPRV, "Frames :", 642,110,150,19, &tex->frames, 0.0, 18000.0, 0, 0, "Activate animation option");
+ uiDefButS(block, NUM, B_MATPRV, "Offset :", 642,90,150,19, &tex->offset, -9000.0, 9000.0, 0, 0, "Set the number of the first picture of the animation");
+ uiDefButS(block, NUM, B_MATPRV, "Fie/Ima:", 642,60,98,19, &tex->fie_ima, 1.0, 200.0, 0, 0, "Set the number of fields per rendered frame");
+ uiDefButS(block, NUM, B_MATPRV, "StartFr:", 642,30,150,19, &tex->sfra, 1.0, 9000.0, 0, 0, "Set the start frame of the animation");
+ uiDefButS(block, NUM, B_MATPRV, "Len:", 642,10,150,19, &tex->len, 0.0, 9000.0, 0, 0, "Set the length of the animation");
+
+ uiDefButS(block, NUM, B_MATPRV, "Fra:", 802,70,73,19, &(tex->fradur[0][0]), 0.0, 18000.0, 0, 0, "Montage mode: frame start");
+ uiDefButS(block, NUM, B_MATPRV, "", 879,70,37,19, &(tex->fradur[0][1]), 0.0, 250.0, 0, 0, "Montage mode: amount of displayed frames");
+ uiDefButS(block, NUM, B_MATPRV, "Fra:", 802,50,73,19, &(tex->fradur[1][0]), 0.0, 18000.0, 0, 0, "Montage mode: frame start");
+ uiDefButS(block, NUM, B_MATPRV, "", 879,50,37,19, &(tex->fradur[1][1]), 0.0, 250.0, 0, 0, "Montage mode: amount of displayed frames");
+ uiDefButS(block, NUM, B_MATPRV, "Fra:", 802,30,73,19, &(tex->fradur[2][0]), 0.0, 18000.0, 0, 0, "Montage mode: frame start");
+ uiDefButS(block, NUM, B_MATPRV, "", 879,30,37,19, &(tex->fradur[2][1]), 0.0, 250.0, 0, 0, "Montage mode: amount of displayed frames");
+ uiDefButS(block, NUM, B_MATPRV, "Fra:", 802,10,73,19, &(tex->fradur[3][0]), 0.0, 18000.0, 0, 0, "Montage mode: frame start");
+ uiDefButS(block, NUM, B_MATPRV, "", 879,10,37,19, &(tex->fradur[3][1]), 0.0, 250.0, 0, 0, "Montage mode: amount of displayed frames");
+
+ uiBlockSetCol(block, BUTGREEN);
+ uiDefButS(block, TOG|BIT|6, 0, "Cyclic", 743,60,48,19, &tex->imaflag, 0, 0, 0, 0, "Repeat animation image");
+ }
+}
+
+
+static void texture_panel_image(Tex *tex)
+{
+ uiBlock *block;
+ ID *id;
+ char *strp, str[32];
+
+ block= uiNewBlock(&curarea->uiblocks, "texture_panel_image", UI_EMBOSSX, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "Image", "Texture", 640, 0, 318, 204)==0) return;
+ uiSetButLock(tex->id.lib!=0, "Can't edit library data");
+
+ /* types */
+ uiBlockSetCol(block, BUTGREEN);
+
+ uiDefButS(block, TOG|BIT|0, 0, "InterPol", 10, 180, 75, 18, &tex->imaflag, 0, 0, 0, 0, "Interpolate pixels of the image");
+ uiDefButS(block, TOG|BIT|1, B_MATPRV, "UseAlpha", 85, 180, 75, 18, &tex->imaflag, 0, 0, 0, 0, "Use the alpha layer");
+ uiDefButS(block, TOG|BIT|5, B_MATPRV, "CalcAlpha", 160, 180, 75, 18, &tex->imaflag, 0, 0, 0, 0, "Calculate an alpha based on the RGB");
+ uiDefButS(block, TOG|BIT|2, B_MATPRV, "NegAlpha", 235, 180, 75, 18, &tex->flag, 0, 0, 0, 0, "Reverse the alpha value");
+
+ uiDefButS(block, TOG|BIT|2, B_IMAPTEST, "MipMap", 10, 160, 60, 18, &tex->imaflag, 0, 0, 0, 0, "Generate a series of pictures used for mipmapping");
+ uiDefButS(block, TOG|BIT|3, B_IMAPTEST, "Fields", 70, 160, 50, 18, &tex->imaflag, 0, 0, 0, 0, "Work with field images");
+ uiDefButS(block, TOG|BIT|4, B_MATPRV, "Rot90", 120, 160, 50, 18, &tex->imaflag, 0, 0, 0, 0, "Rotate image 90 degrees when rendered");
+ uiDefButS(block, TOG|BIT|7, B_RELOADIMA, "Movie", 170, 160, 50, 18, &tex->imaflag, 0, 0, 0, 0, "Use a movie for an image");
+ uiDefButS(block, TOG|BIT|8, 0, "Anti", 220, 160, 40, 18, &tex->imaflag, 0, 0, 0, 0, "Use anti-aliasing");
+ uiDefButS(block, TOG|BIT|10, 0, "StField", 260, 160, 50, 18, &tex->imaflag, 0, 0, 0, 0, "");
+
+ /* file input */
+ uiBlockSetCol(block, BUTGREY);
+ id= (ID *)tex->ima;
+ IDnames_to_pupstring(&strp, NULL, NULL, &(G.main->image), id, &(G.buts->menunr));
+ if(strp[0])
+ uiDefButS(block, MENU, B_TEXIMABROWSE, strp, 10,135,23,20, &(G.buts->menunr), 0, 0, 0, 0, "Browse");
+ MEM_freeN(strp);
+
+ uiBlockSetCol(block, BUTSALMON);
+ uiDefBut(block, BUT, B_LOADTEXIMA1, "Load Image", 10,115,130,20, 0, 0, 0, 0, 0, "Load image - file view");
+ uiBlockSetCol(block, BUTPURPLE);
+ uiDefBut(block, BUT, B_LOADTEXIMA, "", 140,115,20,20, 0, 0, 0, 0, 0, "Load image - thumb view");
+
+ uiBlockSetCol(block, BUTGREY);
+
+ if(tex->ima) {
+ uiDefBut(block, TEX, B_NAMEIMA, "", 35,135,255,20, tex->ima->name, 0.0, 79.0, 0, 0, "Texture name");
+ sprintf(str, "%d", tex->ima->id.us);
+ uiDefBut(block, BUT, 0, str, 290,135,20,20, 0, 0, 0, 0, 0, "Number of users");
+ uiBlockSetCol(block, BUTSALMON);
+ uiDefBut(block, BUT, B_RELOADIMA, "Reload", 230,115,80,20, 0, 0, 0, 0, 0, "Reload");
+
+ if (tex->ima->packedfile) packdummy = 1;
+ else packdummy = 0;
+
+ uiBlockSetCol(block, BUTGREY);
+ uiDefIconButI(block, TOG|BIT|0, B_PACKIMA, ICON_PACKAGE, 205,115,24,20, &packdummy, 0, 0, 0, 0, "Pack/Unpack this Image");
+ }
+
+ /* crop extend clip */
+
+ uiDefButF(block, NUM, B_MATPRV, "Filter :", 10,92,135,19, &tex->filtersize, 0.1, 25.0, 0, 0, "Set the filter size used by mipmap and interpol");
+
+ uiBlockSetCol(block, BUTGREEN);
+ uiDefButS(block, ROW, 0, "Extend", 10,70,75,19, &tex->extend, 4.0, 1.0, 0, 0, "Extend the colour of the edge");
+ uiDefButS(block, ROW, 0, "Clip", 85,70,75,19, &tex->extend, 4.0, 2.0, 0, 0, "Return alpha 0.0 outside image");
+ uiDefButS(block, ROW, 0, "ClipCube", 160,70,75,19, &tex->extend, 4.0, 4.0, 0, 0, "Return alpha 0.0 outside cubeshaped area around image");
+ uiDefButS(block, ROW, 0, "Repeat", 235,70,75,19, &tex->extend, 4.0, 3.0, 0, 0, "Repeat image horizontally and vertically");
+
+ uiBlockSetCol(block, BUTGREY);
+ uiDefButS(block, NUM, B_MATPRV, "Xrepeat:", 10,50,150,19, &tex->xrepeat, 1.0, 512.0, 0, 0, "Set the degree of repetition in the X direction");
+ uiDefButS(block, NUM, B_MATPRV, "Yrepeat:", 160,50,150,19, &tex->yrepeat, 1.0, 512.0, 0, 0, "Set the degree of repetition in the Y direction");
+
+ uiDefButF(block, NUM, B_REDR, "MinX ", 10,28,150,19, &tex->cropxmin, -10.0, 10.0, 10, 0, "Set minimum X value for cropping");
+ uiDefButF(block, NUM, B_REDR, "MaxX ", 160,28,150,19, &tex->cropxmax, -10.0, 10.0, 10, 0, "Set maximum X value for cropping");
+ uiDefButF(block, NUM, B_REDR, "MinY ", 10,8,150,19, &tex->cropymin, -10.0, 10.0, 10, 0, "Set minimum Y value for cropping");
+ uiDefButF(block, NUM, B_REDR, "MaxY ", 160,8,150,19, &tex->cropymax, -10.0, 10.0, 10, 0, "Set maximum Y value for cropping");
+
+}
+
+static void drawcolorband_cb(void)
+{
+ ID *id, *idfrom;
+
+ buttons_active_id(&id, &idfrom);
+ if( GS(id->name)==ID_TE) {
+ Tex *tex= (Tex *)id;
+ drawcolorband(tex->coba, 10,150,300,20);
+ }
+}
+
+static void texture_panel_colors(Tex *tex)
+{
+ uiBlock *block;
+ CBData *cbd;
+
+ block= uiNewBlock(&curarea->uiblocks, "texture_panel_colors", UI_EMBOSSX, UI_HELV, curarea->win);
+ uiNewPanelTabbed("Texture", "Texture");
+ if(uiNewPanel(curarea, block, "Colors", "Texture", 1280, 0, 318, 204)==0) return;
+
+
+ /* COLORBAND */
+ uiBlockSetCol(block, BUTSALMON);
+ uiDefButS(block, TOG|BIT|0, B_COLORBAND, "Colorband",10,180,100,20, &tex->flag, 0, 0, 0, 0, "Use colorband");
+
+ if(tex->flag & TEX_COLORBAND) {
+ uiDefBut(block, BUT, B_ADDCOLORBAND, "Add", 110,180,50,20, 0, 0, 0, 0, 0, "Add new colour to the colorband");
+ uiBlockSetCol(block, BUTGREY);
+ uiDefButS(block, NUM, B_REDR, "Cur:", 160,180,100,20, &tex->coba->cur, 0.0, (float)(tex->coba->tot-1), 0, 0, "The active colour from the colorband");
+ uiBlockSetCol(block, BUTSALMON);
+ uiDefBut(block, BUT, B_DELCOLORBAND, "Del", 260,180,50,20, 0, 0, 0, 0, 0, "Delete the active colour");
+ uiBlockSetCol(block, BUTGREY);
+ uiDefBut(block, LABEL, B_DOCOLORBAND, "", 10,150,300,20, 0, 0, 0, 0, 0, "Colorband"); /* only for event! */
+
+ uiBlockSetDrawExtraFunc(block, drawcolorband_cb);
+ cbd= tex->coba->data + tex->coba->cur;
+
+ uiDefButF(block, NUM, B_CALCCBAND, "Pos", 10,120,80,20, &cbd->pos, 0.0, 1.0, 10, 0, "Set the position of the active colour");
+ uiBlockSetCol(block, BUTGREEN);
+ uiDefButS(block, ROW, B_MATPRV, "E", 90,120,20,20, &tex->coba->ipotype, 5.0, 1.0, 0, 0, "Interpolation type Ease");
+ uiDefButS(block, ROW, B_MATPRV, "L", 110,120,20,20, &tex->coba->ipotype, 5.0, 0.0, 0, 0, "Interpolation type Linear");
+ uiDefButS(block, ROW, B_MATPRV, "S", 130,120,20,20, &tex->coba->ipotype, 5.0, 2.0, 0, 0, "Interpolation type Spline");
+ uiBlockSetCol(block, BUTGREY);
+ uiDefButF(block, COL, B_BANDCOL, "", 150,120,30,20, &(cbd->r), 0, 0, 0, 0, "");
+ uiDefButF(block, NUMSLI, B_MATPRV, "A ", 180,120,130,20, &cbd->a, 0.0, 1.0, 0, 0, "Set the alpha value");
+
+ uiDefButF(block, NUMSLI, B_MATPRV, "R ", 10,100,100,20, &cbd->r, 0.0, 1.0, B_BANDCOL, 0, "Set the red value");
+ uiDefButF(block, NUMSLI, B_MATPRV, "G ", 110,100,100,20, &cbd->g, 0.0, 1.0, B_BANDCOL, 0, "Set the green value");
+ uiDefButF(block, NUMSLI, B_MATPRV, "B ", 210,100,100,20, &cbd->b, 0.0, 1.0, B_BANDCOL, 0, "Set the blue value");
+
+ }
+
+ /* RGB-BRICON */
+ uiBlockSetCol(block, BUTGREY);
+ if((tex->flag & TEX_COLORBAND)==0) {
+ uiDefButF(block, NUMSLI, B_MATPRV, "R ", 60,80,200,20, &tex->rfac, 0.0, 2.0, 0, 0, "Set the red value");
+ uiDefButF(block, NUMSLI, B_MATPRV, "G ", 60,60,200,20, &tex->gfac, 0.0, 2.0, 0, 0, "Set the green value");
+ uiDefButF(block, NUMSLI, B_MATPRV, "B ", 60,40,200,20, &tex->bfac, 0.0, 2.0, 0, 0, "Set the blue value");
+ }
+ uiDefButF(block, NUMSLI, B_MATPRV, "Bright", 10,10,150,20, &tex->bright, 0.0, 2.0, 0, 0, "Set the brightness of the colour or intensity of a texture");
+ uiDefButF(block, NUMSLI, B_MATPRV, "Contr", 160,10,150,20, &tex->contrast, 0.01, 2.0, 0, 0, "Set the contrast of the colour or intensity of a texture");
+
+}
+
+
+static void texture_panel_texture(MTex *mtex, Material *ma, World *wrld, Lamp *la)
+{
+ extern char texstr[15][8]; // butspace.c
+ MTex *mt;
+ uiBlock *block;
+ ID *id, *idfrom;
+ int a, yco, loos;
+ char str[32], *strp;
+
+
+ block= uiNewBlock(&curarea->uiblocks, "texture_panel_texture", UI_EMBOSSX, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "Texture", "Texture", 320, 0, 318, 204)==0) return;
+
+ /* first do the browse but */
+ buttons_active_id(&id, &idfrom);
+
+ uiBlockSetCol(block, BUTPURPLE);
+ if(ma) {
+ std_libbuttons(block, 10, 180, 0, NULL, B_TEXBROWSE, id, idfrom, &(G.buts->texnr), B_TEXALONE, B_TEXLOCAL, B_TEXDELETE, B_AUTOTEXNAME, B_KEEPDATA);
+ }
+ else if(wrld) {
+ std_libbuttons(block, 10, 180, 0, NULL, B_WTEXBROWSE, id, idfrom, &(G.buts->texnr), B_TEXALONE, B_TEXLOCAL, B_TEXDELETE, B_AUTOTEXNAME, B_KEEPDATA);
+ }
+ else if(la) {
+ std_libbuttons(block, 10, 180, 0, NULL, B_LTEXBROWSE, id, idfrom, &(G.buts->texnr), B_TEXALONE, B_TEXLOCAL, B_TEXDELETE, B_AUTOTEXNAME, B_KEEPDATA);
+ }
+
+
+ /* From button: removed */
+
+ /* CHANNELS */
+ yco= 10;
+ for(a= 7; a>=0; a--) {
+
+ if(ma) mt= ma->mtex[a];
+ else if(wrld && a<6) mt= wrld->mtex[a];
+ else if(la && a<6) mt= la->mtex[a];
+
+ if(mt && mt->tex) splitIDname(mt->tex->id.name+2, str, &loos);
+ else strcpy(str, "");
+ str[14]= 0;
+
+ if(ma) {
+ uiDefButC(block, ROW, B_TEXCHANNEL, str, 10,yco,140,19, &(ma->texact), 0.0, (float)a, 0, 0, "Linked channel");
+ yco+= 20;
+ }
+ else if(wrld && a<6) {
+ uiDefButS(block, ROW, B_TEXCHANNEL, str, 10,yco,140,19, &(wrld->texact), 0.0, (float)a, 0, 0, "");
+ yco+= 20;
+ }
+ else if(la && a<6) {
+ uiDefButS(block, ROW, B_TEXCHANNEL, str, 10,yco,140,19, &(la->texact), 0.0, (float)a, 0, 0, "");
+ yco+= 20;
+ }
+
+ }
+
+ /* TYPES */
+ if(mtex && mtex->tex) {
+ Tex *tex= mtex->tex;
+ int xco;
+
+ uiBlockSetCol(block, BUTGREEN);
+
+ uiSetButLock(tex->id.lib!=0, "Can't edit library data");
+ xco= 275;
+ uiDefButS(block, ROW, B_TEXTYPE, texstr[0], 160, 110, 70, 20, &tex->type, 1.0, 0.0, 0, 0, "Default");
+
+ uiDefButS(block, ROW, B_TEXTYPE, texstr[TEX_IMAGE], 160, 90, 70, 20, &tex->type, 1.0, (float)TEX_IMAGE, 0, 0, "Use image texture");
+ uiDefButS(block, ROW, B_TEXTYPE, texstr[TEX_ENVMAP],240, 90, 70, 20, &tex->type, 1.0, (float)TEX_ENVMAP, 0, 0, "Use environment maps");
+
+ uiDefButS(block, ROW, B_TEXTYPE, texstr[TEX_CLOUDS],160, 70, 70, 20, &tex->type, 1.0, (float)TEX_CLOUDS, 0, 0, "Use clouds texture");
+ uiDefButS(block, ROW, B_TEXTYPE, texstr[TEX_MARBLE],240, 70, 70, 20, &tex->type, 1.0, (float)TEX_MARBLE, 0, 0, "Use marble texture");
+
+ uiDefButS(block, ROW, B_TEXTYPE, texstr[TEX_STUCCI],160, 50, 70, 20, &tex->type, 1.0, (float)TEX_STUCCI, 0, 0, "Use strucci texture");
+ uiDefButS(block, ROW, B_TEXTYPE, texstr[TEX_WOOD], 240, 50, 70, 20, &tex->type, 1.0, (float)TEX_WOOD, 0, 0, "Use wood texture");
+
+ uiDefButS(block, ROW, B_TEXTYPE, texstr[TEX_MAGIC], 160, 30, 70, 20, &tex->type, 1.0, (float)TEX_MAGIC, 0, 0, "Use magic texture");
+ uiDefButS(block, ROW, B_TEXTYPE, texstr[TEX_BLEND], 240, 30, 70, 20, &tex->type, 1.0, (float)TEX_BLEND, 0, 0, "Use blend texture");
+
+ uiDefButS(block, ROW, B_TEXTYPE, texstr[TEX_NOISE], 160, 10, 70, 20, &tex->type, 1.0, (float)TEX_NOISE, 0, 0, "Use noise texture");
+ if(tex->plugin && tex->plugin->doit) strp= tex->plugin->pname; else strp= texstr[TEX_PLUGIN];
+ uiDefButS(block, ROW, B_TEXTYPE, strp, 240, 10, 70, 20, &tex->type, 1.0, (float)TEX_PLUGIN, 0, 0, "Use plugin");
+ }
+ else {
+ // label to avoid centering
+ uiDefBut(block, LABEL, 0, " ", 240, 10, 70, 20, 0, 0, 0, 0, 0, "");
+ }
+}
+
+static void texture_panel_preview(int preview)
+{
+ uiBlock *block;
+
+ block= uiNewBlock(&curarea->uiblocks, "texture_panel_preview", UI_EMBOSSX, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "Preview", "Texture", 0, 0, 318, 204)==0) return;
+
+ if(preview) uiBlockSetDrawExtraFunc(block, BIF_previewdraw);
+
+ // label to force a boundbox for buttons not to be centered
+ uiDefBut(block, LABEL, 0, " ", 20,20,10,10, 0, 0, 0, 0, 0, "");
+
+ uiBlockSetCol(block, BUTGREEN);
+
+ uiDefButC(block, ROW, B_TEXREDR_PRV, "Mat", 200,175,80,25, &G.buts->texfrom, 3.0, 0.0, 0, 0, "Display the texture of the active material");
+ uiDefButC(block, ROW, B_TEXREDR_PRV, "World", 200,150,80,25, &G.buts->texfrom, 3.0, 1.0, 0, 0, "Display the texture of the world block");
+ uiDefButC(block, ROW, B_TEXREDR_PRV, "Lamp", 200,125,80,25, &G.buts->texfrom, 3.0, 2.0, 0, 0, "Display the texture of the lamp");
+
+ uiDefBut(block, BUT, B_DEFTEXVAR, "Default Vars",200,10,80,20, 0, 0, 0, 0, 0, "Return to standard values");
+
+}
+
+
/* *************************** RADIO ******************************** */
@@ -583,7 +1655,7 @@ void do_lampbuts(unsigned short event)
if(mtex->tex) mtex->tex->id.us--;
MEM_freeN(mtex);
la->mtex[ la->texact ]= 0;
- allqueue(REDRAWBUTSLAMP, 0);
+ allqueue(REDRAWBUTSSHADING, 0);
allqueue(REDRAWOOPS, 0);
BIF_preview_changed(G.buts);
}
@@ -592,7 +1664,7 @@ void do_lampbuts(unsigned short event)
{
la= G.buts->lockpoin;
la->bufsize = la->bufsize&=(~15);
- allqueue(REDRAWBUTSLAMP, 0);
+ allqueue(REDRAWBUTSSHADING, 0);
allqueue(REDRAWOOPS, 0);
/*la->bufsize = la->bufsize % 64;*/
}
@@ -839,13 +1911,13 @@ void do_matbuts(unsigned short event)
switch(event) {
case B_ACTCOL:
scrarea_queue_headredraw(curarea);
- allqueue(REDRAWBUTSMAT, 0);
+ allqueue(REDRAWBUTSSHADING, 0);
allqueue(REDRAWIPO, 0);
BIF_preview_changed(G.buts);
break;
case B_MATFROM:
scrarea_queue_headredraw(curarea);
- allqueue(REDRAWBUTSMAT, 0);
+ allqueue(REDRAWBUTSSHADING, 0);
// BIF_previewdraw(); push/pop!
break;
case B_MATPRV:
@@ -854,7 +1926,7 @@ void do_matbuts(unsigned short event)
break;
case B_MATPRV_DRAW:
BIF_preview_changed(G.buts);
- allqueue(REDRAWBUTSMAT, 0);
+ allqueue(REDRAWBUTSSHADING, 0);
break;
case B_TEXCLEAR:
ma= G.buts->lockpoin;
@@ -863,7 +1935,7 @@ void do_matbuts(unsigned short event)
if(mtex->tex) mtex->tex->id.us--;
MEM_freeN(mtex);
ma->mtex[ (int) ma->texact ]= 0;
- allqueue(REDRAWBUTSMAT, 0);
+ allqueue(REDRAWBUTSSHADING, 0);
allqueue(REDRAWOOPS, 0);
BIF_preview_changed(G.buts);
}
@@ -1012,9 +2084,9 @@ static void material_panel_map_input(Material *ma)
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, "");
+ uiDefButC(block, ROW, B_MATPRV, str, xco, 50, 24, 18, &(mtex->projx), 6.0, (float)a, 0, 0, "");
+ uiDefButC(block, ROW, B_MATPRV, str, xco, 30, 24, 18, &(mtex->projy), 7.0, (float)a, 0, 0, "");
+ uiDefButC(block, ROW, B_MATPRV, str, xco, 10, 24, 18, &(mtex->projz), 8.0, (float)a, 0, 0, "");
xco+= 26;
}
@@ -1263,14 +2335,14 @@ static 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,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");
+ uiDefButC(block, ROW, REDRAWBUTSSHADING, "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, REDRAWBUTSSHADING, "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, REDRAWBUTSSHADING, "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,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");
+ uiDefButC(block, ROW, REDRAWBUTSSHADING, "Col", 83,115,40,25, &(ma->rgbsel), 2.0, 0.0, 0, 0, "Set the basic colour of the material");
+ uiDefButC(block, ROW, REDRAWBUTSSHADING, "Spe", 83,88,40,25, &(ma->rgbsel), 2.0, 1.0, 0, 0, "Set the colour of the specularity");
+ uiDefButC(block, ROW, REDRAWBUTSSHADING, "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;}
@@ -1294,10 +2366,10 @@ static void material_panel_material(Object *ob, Material *ma)
uiDefButF(block, NUMSLI, B_MATPRV, "SpecTra ", 128,32,175,20, &(ma->spectra), 0.0, 1.0, 0, 0, "Make specular areas opaque");
}
- 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");
+ uiDefButS(block, ROW, REDRAWBUTSSHADING, "RGB", 8,32,35,20, &(ma->colormodel), 1.0, (float)MA_RGB, 0, 0, "Create colour by red, green and blue");
+ uiDefButS(block, ROW, REDRAWBUTSSHADING, "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,45,20, &(ma->dynamode), 0.0, 0.0, 0, 0, "Adjust parameters for dynamics options");
+ uiDefButS(block, TOG|BIT|0, REDRAWBUTSSHADING, "DYN", 78,32,45,20, &(ma->dynamode), 0.0, 0.0, 0, 0, "Adjust parameters for dynamics options");
}
@@ -1377,6 +2449,77 @@ void world_panels()
}
}
+void texture_panels()
+{
+ Material *ma=NULL;
+ Lamp *la=NULL;
+ World *wrld=NULL;
+ Object *ob= OBACT;
+ MTex *mtex= NULL;
+
+ if(G.buts->texfrom==0) {
+ if(ob) {
+ ma= give_current_material(ob, ob->actcol);
+ if(ma) mtex= ma->mtex[ ma->texact ];
+ }
+ }
+ else if(G.buts->texfrom==1) {
+ wrld= G.scene->world;
+ if(wrld) mtex= wrld->mtex[ wrld->texact ];
+ }
+ else if(G.buts->texfrom==2) {
+ if(ob && ob->type==OB_LAMP) {
+ la= ob->data;
+ mtex= la->mtex[ la->texact ];
+ }
+ }
+
+ texture_panel_preview(ma || wrld || la); // for 'from' buttons
+
+ if(ma || wrld || la) {
+
+ texture_panel_texture(mtex, ma, wrld, la);
+
+ if(mtex && mtex->tex) {
+ texture_panel_colors(mtex->tex);
+
+ switch(mtex->tex->type) {
+ case TEX_IMAGE:
+ texture_panel_image(mtex->tex);
+ texture_panel_image1(mtex->tex);
+ break;
+ case TEX_ENVMAP:
+ texture_panel_envmap(mtex->tex);
+ break;
+ case TEX_CLOUDS:
+ texture_panel_clouds(mtex->tex);
+ break;
+ case TEX_MARBLE:
+ texture_panel_marble(mtex->tex);
+ break;
+ case TEX_STUCCI:
+ texture_panel_stucci(mtex->tex);
+ break;
+ case TEX_WOOD:
+ texture_panel_wood(mtex->tex);
+ break;
+ case TEX_BLEND:
+ texture_panel_blend(mtex->tex);
+ break;
+ case TEX_MAGIC:
+ texture_panel_magic(mtex->tex);
+ break;
+ case TEX_PLUGIN:
+ texture_panel_plugin(mtex->tex);
+ break;
+ case TEX_NOISE:
+ // no panel!
+ break;
+ }
+ }
+ }
+}
+
void radio_panels()
{
Radio *rad;
diff --git a/source/blender/src/editipo.c b/source/blender/src/editipo.c
index ac7992dfc03..2d52b6e9f62 100644
--- a/source/blender/src/editipo.c
+++ b/source/blender/src/editipo.c
@@ -638,7 +638,7 @@ void editipo_changed(SpaceIpo *si, int doredraw)
else if(si->blocktype==ID_MA) allqueue(REDRAWBUTSSHADING, 0);
else if(si->blocktype==ID_WO) allqueue(REDRAWBUTSSHADING, 0);
- else if(si->blocktype==ID_LA) allqueue(REDRAWBUTSLAMP, 0);
+ else if(si->blocktype==ID_LA) allqueue(REDRAWBUTSSHADING, 0);
// else if(si->blocktype==ID_SO) allqueue(REDRAWBUTSSOUND, 0);
else if(si->blocktype==ID_CA) {
allqueue(REDRAWBUTSEDIT, 0);
diff --git a/source/blender/src/header_buttonswin.c b/source/blender/src/header_buttonswin.c
index 1783dc0fff1..d4a88ca57cb 100644
--- a/source/blender/src/header_buttonswin.c
+++ b/source/blender/src/header_buttonswin.c
@@ -458,21 +458,6 @@ void buts_buttons(void)
if(tab==TAB_SHADING_MAT) {
}
else if(tab==TAB_SHADING_TEX) {
- if(G.buts->texfrom==0) {
- if(idfrom) {
- xco= std_libbuttons(block, xco, 0, 0, NULL, B_TEXBROWSE, id, idfrom, &(G.buts->texnr), B_TEXALONE, B_TEXLOCAL, B_TEXDELETE, B_AUTOTEXNAME, B_KEEPDATA);
- }
- }
- else if(G.buts->texfrom==1) {
- if(idfrom) {
- xco= std_libbuttons(block, xco, 0, 0, NULL, B_WTEXBROWSE, id, idfrom, &(G.buts->texnr), B_TEXALONE, B_TEXLOCAL, B_TEXDELETE, B_AUTOTEXNAME, B_KEEPDATA);
- }
- }
- else if(G.buts->texfrom==2) {
- if(idfrom) {
- xco= std_libbuttons(block, xco, 0, 0, NULL, B_LTEXBROWSE, id, idfrom, &(G.buts->texnr), B_TEXALONE, B_TEXLOCAL, B_TEXDELETE, B_AUTOTEXNAME, B_KEEPDATA);
- }
- }
}
else if(tab==TAB_SHADING_LAMP) {
if(id) {
diff --git a/source/blender/src/headerbuttons.c b/source/blender/src/headerbuttons.c
index b78bc3fc04c..9e1edfc93aa 100644
--- a/source/blender/src/headerbuttons.c
+++ b/source/blender/src/headerbuttons.c
@@ -1065,7 +1065,7 @@ void do_global_buttons(unsigned short event)
else if(ipo->blocktype==ID_LA) {
( (Lamp *)from)->ipo= ipo;
id_us_plus(idtest);
- allqueue(REDRAWBUTSLAMP, 0);
+ allqueue(REDRAWBUTSSHADING, 0);
}
else if(ipo->blocktype==ID_CA) {
( (Camera *)from)->ipo= ipo;
@@ -1257,7 +1257,7 @@ void do_global_buttons(unsigned short event)
if(id) id->us--;
allqueue(REDRAWBUTSHEAD, 0);
- allqueue(REDRAWBUTSLAMP, 0);
+ allqueue(REDRAWBUTSSHADING, 0);
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWIPO, 0);
BIF_preview_changed(G.buts);
@@ -1315,7 +1315,6 @@ void do_global_buttons(unsigned short event)
allqueue(REDRAWBUTSHEAD, 0);
allqueue(REDRAWBUTSSHADING, 0);
- allqueue(REDRAWBUTSLAMP, 0);
allqueue(REDRAWIPO, 0);
BIF_preview_changed(G.buts);
}
@@ -1336,7 +1335,6 @@ void do_global_buttons(unsigned short event)
if(G.buts->mainb==CONTEXT_SHADING) {
if(G.buts->tab[CONTEXT_SHADING]==TAB_SHADING_TEX) {
autotexname(G.buts->lockpoin);
- allqueue(REDRAWBUTSHEAD, 0);
allqueue(REDRAWBUTSSHADING, 0);
}
else if(G.buts->tab[CONTEXT_SHADING]==TAB_SHADING_MAT) {
@@ -1352,7 +1350,7 @@ void do_global_buttons(unsigned short event)
else if(G.buts->tab[CONTEXT_SHADING]==TAB_SHADING_LAMP) {
la= G.buts->lockpoin;
if(la->mtex[ la->texact]) autotexname(la->mtex[la->texact]->tex);
- allqueue(REDRAWBUTSLAMP, 0);
+ allqueue(REDRAWBUTSSHADING, 0);
}
}
break;
diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c
index af56c43f7bf..65794b4e8c2 100644
--- a/source/blender/src/interface.c
+++ b/source/blender/src/interface.c
@@ -6167,12 +6167,12 @@ int uiNewPanel(ScrArea *sa, uiBlock *block, char *panelname, char *tabname, int
block->panel= pa;
pa->active= 1;
- if(block->panel->paneltab) return 0;
- if(block->panel->flag & PNL_CLOSED) return 0;
-
/* clear global */
panel_tabbed= group_tabbed= NULL;
+ if(block->panel->paneltab) return 0;
+ if(block->panel->flag & PNL_CLOSED) return 0;
+
return 1;
}
@@ -6404,7 +6404,7 @@ static void ui_draw_panel_header(uiBlock *block)
/* active tab */
uiSetRoundBox(15);
glColor3ub(140, 140, 147);
- uiRoundBox(PNL_ICON+a*width, panel->sizey+3, PNL_ICON+(a+1)*width, panel->sizey+PNL_HEADER-3, 8);
+ uiRoundBox(2+PNL_ICON+a*width, panel->sizey+3, PNL_ICON+(a+1)*width, panel->sizey+PNL_HEADER-3, 8);
glColor3ub(255,255,255);
glRasterPos2f(10+PNL_ICON+a*width, panel->sizey+5);
@@ -6458,18 +6458,21 @@ static void ui_draw_panel(uiBlock *block)
else {
uiSetRoundBox(3);
- glColor3ub(160, 160, 167);
- uiRoundBox(block->minx, block->maxy, block->maxx, block->maxy+PNL_HEADER, 10);
+ //glColor3ub(160, 160, 167);
+ //uiRoundBox(block->minx, block->maxy, block->maxx, block->maxy+PNL_HEADER, 10);
+
+ glColor3ub(218, 218, 218);
+ uiRoundRect(block->minx, block->miny, block->maxx, block->maxy+PNL_HEADER, 10);
glColor3ub(198, 198, 198);
- glRectf(block->minx, block->miny, block->maxx, block->maxy);
+ //glRectf(block->minx, block->miny, block->maxx, block->maxy);
if(G.buts->align) {
glColor3ub(206, 206, 206);
if(G.buts->align==BUT_HORIZONTAL) ui_set_panel_pattern('h');
else ui_set_panel_pattern('v');
- glRectf(block->minx, block->miny, block->maxx, block->maxy);
+ //glRectf(block->minx, block->miny, block->maxx, block->maxy);
glDisable(GL_POLYGON_STIPPLE);
}
diff --git a/source/blender/src/space.c b/source/blender/src/space.c
index d24c8ce0e02..70a8bdbd098 100644
--- a/source/blender/src/space.c
+++ b/source/blender/src/space.c
@@ -3287,17 +3287,6 @@ void allqueue(unsigned short event, short val)
}
}
break;
- case REDRAWBUTSLAMP:
- if(sa->spacetype==SPACE_BUTS) {
- buts= sa->spacedata.first;
- if(buts->mainb==CONTEXT_SHADING) {
- buts->re_align= 1;
- scrarea_queue_winredraw(sa);
- scrarea_queue_headredraw(sa);
- }
- }
- break;
-
case REDRAWDATASELECT:
if(sa->spacetype==SPACE_FILE) {