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-12 17:58:56 +0400
committerTon Roosendaal <ton@blender.org>2003-10-12 17:58:56 +0400
commit5f6d8e59c4d6a32b4743fabd17678cf4a82bddb3 (patch)
tree400a1d4526517faf64f6e786e518f55f90e1b91a /source/blender
parenta9c694d6c56a867583b56ee47418667137ac92ec (diff)
- Converted lamp buttons and world buttons, they're pretty!
- menu auto open now is user preset, including 2 thresholds you can set - hilites of pulldown menus were not cleared, fixed - changed F4 key to logic. F5 will show lamp buttons, when lamp active - in 'shader context' buttons, clicking camera will show world - Converted lamp buttons and world buttons, they're pretty! - menu auto open now is user preset, including 2 thresholds you can set - hilites of pulldown menus were not cleared, fixed - changed F4 key to logic. F5 will show lamp buttons, when lamp active - in 'shader context' buttons, clicking camera will show world
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/blender.c6
-rw-r--r--source/blender/include/BIF_interface.h2
-rw-r--r--source/blender/include/butspace.h9
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h2
-rw-r--r--source/blender/src/butspace.c34
-rw-r--r--source/blender/src/buttons.txt390
-rw-r--r--source/blender/src/buttons_shading.c561
-rw-r--r--source/blender/src/editscreen.c6
-rw-r--r--source/blender/src/header_buttonswin.c22
-rw-r--r--source/blender/src/interface.c11
-rw-r--r--source/blender/src/previewrender.c12
-rw-r--r--source/blender/src/space.c45
12 files changed, 651 insertions, 449 deletions
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index 4a5b733ed9d..3408b2781b8 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -265,7 +265,13 @@ static void setup_app_data(BlendFileData *bfd, char *filename) {
if (bfd->user) {
U= *bfd->user;
MEM_freeN(bfd->user);
+
+ /* the UserDef struct is not corrected with do_versions() .... ugh! */
if(U.wheellinescroll == 0) U.wheellinescroll = 3;
+ if(U.menuthreshold1==0) {
+ U.menuthreshold1= 5;
+ U.menuthreshold2= 2;
+ }
}
R.winpos= bfd->winpos;
diff --git a/source/blender/include/BIF_interface.h b/source/blender/include/BIF_interface.h
index f2ef10883c1..5cc4e0decf9 100644
--- a/source/blender/include/BIF_interface.h
+++ b/source/blender/include/BIF_interface.h
@@ -154,7 +154,7 @@ void uiPanelPush(uiBlock *block);
void uiPanelPop(uiBlock *block);
extern uiBlock *uiFindOpenPanelBlockName(ListBase *lb, char *name);
extern void uiMatchPanel_view2d(struct ScrArea *sa);
-
+extern int uiAlignPanelStep(struct ScrArea *sa, float fac);
diff --git a/source/blender/include/butspace.h b/source/blender/include/butspace.h
index 9dc71f16049..570403ae6a9 100644
--- a/source/blender/include/butspace.h
+++ b/source/blender/include/butspace.h
@@ -73,8 +73,12 @@ extern void do_latticebuts(unsigned short event);
extern void do_fpaintbuts(unsigned short event);
/* shading */
-extern void do_matbuts(unsigned short event);
extern void material_panels(void);
+extern void do_matbuts(unsigned short event);
+extern void lamp_panels(void);
+extern void do_lampbuts(unsigned short event);
+extern void world_panels(void);
+extern void do_worldbuts(unsigned short event);
/* logic */
extern void do_logic_buts(unsigned short event);
@@ -196,6 +200,9 @@ void test_idbutton_cb(void *namev, void *arg2_unused);
#define B_WORLDBUTS 1600
#define B_TEXCLEARWORLD 1501
+#define B_COLHOR 1502
+#define B_COLZEN 1503
+
/* *********************** */
#define B_RENDERBUTS 1700
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 5a329749708..db5f83ebb07 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -57,6 +57,7 @@ typedef struct UserDef {
int fontsize;
short encoding;
short transopts;
+ short menuthreshold1, menuthreshold2;
char fontname[64];
} UserDef;
@@ -91,6 +92,7 @@ extern UserDef U; /* from usiblender.c !!!! */
#define FLIPINFOMENU 64
#define FLIPFULLSCREEN 128
#define ALLWINCODECS 256
+#define MENUOPENAUTO 512
/* transopts */
diff --git a/source/blender/src/butspace.c b/source/blender/src/butspace.c
index c9e97748202..e8eef1e6130 100644
--- a/source/blender/src/butspace.c
+++ b/source/blender/src/butspace.c
@@ -254,7 +254,7 @@ void do_butspace(unsigned short event)
//do_viewbuts(event);
}
else if(event<=B_LAMPBUTS) {
- //do_lampbuts(event);
+ do_lampbuts(event);
}
else if(event<=B_MATBUTS) {
do_matbuts(event);
@@ -266,7 +266,7 @@ void do_butspace(unsigned short event)
do_object_panels(event);
}
else if(event<=B_WORLDBUTS) {
- //do_worldbuts(event);
+ do_worldbuts(event);
}
else if(event<=B_RENDERBUTS) {
do_render_panels(event); // buttons_scene.c
@@ -334,18 +334,29 @@ void redraw_test_buttons(Base *new)
// change type automatically
if(new) {
- if(buts->tab[CONTEXT_SHADING] == TAB_SHADING_WORLD);
- else if(buts->tab[CONTEXT_SHADING] == TAB_SHADING_TEX);
+ int tab= buts->tab[CONTEXT_SHADING];
+
+ if(tab == TAB_SHADING_WORLD) {
+ if(new->object->type==OB_LAMP) {
+ buts->tab[CONTEXT_SHADING]= TAB_SHADING_LAMP;
+ }
+ else buts->tab[CONTEXT_SHADING]= TAB_SHADING_MAT;
+
+ }
+ else if(tab == TAB_SHADING_TEX) {
+ }
+ else if(tab == TAB_SHADING_RAD) {
+ }
+ else if(new->object->type==OB_CAMERA) {
+ buts->tab[CONTEXT_SHADING]= TAB_SHADING_WORLD;
+ }
else if(new->object->type==OB_LAMP) {
buts->tab[CONTEXT_SHADING]= TAB_SHADING_LAMP;
- BIF_preview_changed(buts);
- addqueue(sa->win, REDRAW, 1);
}
else {
buts->tab[CONTEXT_SHADING]= TAB_SHADING_MAT;
- BIF_preview_changed(buts);
- addqueue(sa->win, REDRAW, 1);
}
+ BIF_preview_changed(buts);
}
}
}
@@ -393,7 +404,12 @@ void drawbutspace(ScrArea *sa, void *spacedata)
if(tab==TAB_SHADING_MAT)
material_panels();
-
+ else if(tab==TAB_SHADING_LAMP)
+ lamp_panels();
+ else if(tab==TAB_SHADING_WORLD)
+ world_panels();
+
+
break;
case CONTEXT_EDITING:
/* no tabs */
diff --git a/source/blender/src/buttons.txt b/source/blender/src/buttons.txt
index 3f19f84f7ef..c300c5066e4 100644
--- a/source/blender/src/buttons.txt
+++ b/source/blender/src/buttons.txt
@@ -2562,396 +2562,6 @@ void soundbuts(void)
uiDrawBlock(block);
}
-/* ************************ LAMP *************************** */
-
-void do_lampbuts(unsigned short event)
-{
- Lamp *la;
- MTex *mtex;
-
- switch(event) {
- case B_LAMPREDRAW:
- BIF_preview_changed(G.buts);
- allqueue(REDRAWVIEW3D, 0);
- break;
- case B_TEXCLEARLAMP:
- la= G.buts->lockpoin;
- mtex= la->mtex[ la->texact ];
- if(mtex) {
- if(mtex->tex) mtex->tex->id.us--;
- MEM_freeN(mtex);
- la->mtex[ la->texact ]= 0;
- allqueue(REDRAWBUTSLAMP, 0);
- allqueue(REDRAWOOPS, 0);
- BIF_preview_changed(G.buts);
- }
- break;
- case B_SBUFF:
- {
- la= G.buts->lockpoin;
- la->bufsize = la->bufsize&=(~15);
- allqueue(REDRAWBUTSLAMP, 0);
- allqueue(REDRAWOOPS, 0);
- /*la->bufsize = la->bufsize % 64;*/
- }
- break;
- }
-
- if(event) freefastshade();
-}
-
-
-void lampbuts(void)
-{
- Object *ob;
- Lamp *la;
- MTex *mtex;
- ID *id;
- uiBlock *block;
- float grid=0.0;
- int loos, a;
- char *strp, str[32];
- short xco;
-
- if(G.vd) grid= G.vd->grid;
- if(grid<1.0) grid= 1.0;
-
- ob= OBACT;
- if(ob==0) return;
- if(ob->type!=OB_LAMP) return;
-
- sprintf(str, "buttonswin %d", curarea->win);
- block= uiNewBlock(&curarea->uiblocks, str, UI_EMBOSSX, UI_HELV, curarea->win);
-
- la= ob->data;
- uiSetButLock(la->id.lib!=0, "Can't edit library data");
-
- uiBlockSetCol(block, BUTGREEN);
- uiDefButS(block, ROW,B_LAMPREDRAW,"Lamp", 317,190,61,25,&la->type,1.0,(float)LA_LOCAL, 0, 0, "Use a point light source");
- uiDefButS(block, ROW,B_LAMPREDRAW,"Spot", 379,190,59,25,&la->type,1.0,(float)LA_SPOT, 0, 0, "Restrict lamp to conical space");
- uiDefButS(block, ROW,B_LAMPREDRAW,"Sun", 439,190,58,25,&la->type,1.0,(float)LA_SUN, 0, 0, "Light shines from constant direction");
- uiDefButS(block, ROW,B_LAMPREDRAW,"Hemi", 499,190,55,25,&la->type,1.0,(float)LA_HEMI, 0, 0, "Light shines as half a sphere");
-
- uiBlockSetCol(block, BUTGREY);
- uiDefButF(block, NUM,B_LAMPREDRAW,"Dist:",611,190,104,25,&la->dist, 0.01, 5000.0, 100, 0, "Set the distance value");
-
- uiBlockSetCol(block, BUTBLUE);
- uiDefButS(block, TOG|BIT|3, B_MATPRV,"Quad", 203,196,100,17,&la->mode, 0, 0, 0, 0, "Use inverse quadratic proportion");
- uiDefButS(block, TOG|BIT|6, REDRAWVIEW3D,"Sphere", 203,178,100,17,&la->mode, 0, 0, 0, 0, "Lamp only shines inside a sphere");
- uiDefButS(block, TOG|BIT|0, REDRAWVIEW3D, "Shadows", 203,160,100,17,&la->mode, 0, 0, 0, 0, "Let lamp produce shadows");
- uiDefButS(block, TOG|BIT|1, 0,"Halo", 203,142,100,17,&la->mode, 0, 0, 0, 0, "Render spotlights with a volumetric halo");
- uiDefButS(block, TOG|BIT|2, 0,"Layer", 203,124,100,17,&la->mode, 0, 0, 0, 0, "Illuminate objects in the same layer only");
- uiDefButS(block, TOG|BIT|4, B_MATPRV,"Negative", 203,106,100,17,&la->mode, 0, 0, 0, 0, "Cast negative light");
- uiDefButS(block, TOG|BIT|5, 0,"OnlyShadow", 203,88,100,17,&la->mode, 0, 0, 0, 0, "Render shadow only");
- uiDefButS(block, TOG|BIT|7, B_LAMPREDRAW,"Square", 203,70,100,17,&la->mode, 0, 0, 0, 0, "Use square spotbundles");
- uiDefButS(block, TOG|BIT|11, 0,"No Diffuse", 203,52,100,17,&la->mode, 0, 0, 0, 0, "No diffuse shading of material");
- uiDefButS(block, TOG|BIT|12, 0,"No Specular", 203,34,100,17,&la->mode, 0, 0, 0, 0, "No specular shading of material");
-
-
-#ifdef __SHADOW_EXP
- /* move this elsewhere */
- uiDefButS(block, TOG|BIT|10, 0,"DeepShadow", 203,216,100,19,&la->mode, 0, 0, 0, 0, "");
-#endif
-
- uiBlockSetCol(block, BUTGREY);
- uiDefButS(block, NUM,B_SBUFF,"ShadowBuffSize:", 203,10,140,19, &la->bufsize,512,5120, 0, 0, "Set the size of the shadow buffer");
- uiDefButF(block, NUM,REDRAWVIEW3D,"ClipSta:", 346,30,146,19, &la->clipsta, 0.1*grid,1000.0*grid, 10, 0, "Set the shadow map clip start");
- uiDefButF(block, NUM,REDRAWVIEW3D,"ClipEnd:", 346,9,146,19,&la->clipend, 1.0, 5000.0*grid, 100, 0, "Set the shadow map clip end");
-
- uiDefButS(block, NUM,0,"Samples:", 496,30,105,19, &la->samp,1.0,16.0, 0, 0, "Number of shadow map samples");
- uiDefButS(block, NUM,0,"Halo step:", 496,10,105,19, &la->shadhalostep, 0.0, 12.0, 0, 0, "Volumetric halo sampling frequency");
- uiDefButF(block, NUM,0,"Bias:", 605,30,108,19, &la->bias, 0.01, 5.0, 1, 0, "Shadow map sampling bias");
- uiDefButF(block, NUM,0,"Soft:", 605,10,108,19, &la->soft,1.0,100.0, 100, 0, "Set the size of the shadow sample area");
-
- uiBlockSetCol(block, BUTGREY);
- uiDefButF(block, NUMSLI,B_MATPRV,"Energy ", 520,156,195,20, &(la->energy), 0.0, 10.0, 0, 0, "Set the intensity of the light");
-
- uiDefButF(block, NUMSLI,B_MATPRV,"R ", 520,128,194,20,&la->r, 0.0, 1.0, B_COLLAMP, 0, "Set the red component of the light");
- uiDefButF(block, NUMSLI,B_MATPRV,"G ", 520,108,194,20,&la->g, 0.0, 1.0, B_COLLAMP, 0, "Set the green component of the light");
- uiDefButF(block, NUMSLI,B_MATPRV,"B ", 520,88,194,20,&la->b, 0.0, 1.0, B_COLLAMP, 0, "Set the blue component of the light");
-
- uiDefButF(block, COL, B_COLLAMP, "", 520,64,193,23, &la->r, 0, 0, 0, 0, "");
-
- uiDefButF(block, NUMSLI,B_LAMPREDRAW,"SpotSi ",317,157,192,19,&la->spotsize, 1.0, 180.0, 0, 0, "Set the angle of the spot beam in degrees");
- uiDefButF(block, NUMSLI,B_MATPRV,"SpotBl ", 316,136,192,19,&la->spotblend, 0.0, 1.0, 0, 0, "Set the softness of the spot edge");
- uiDefButF(block, NUMSLI,B_MATPRV,"Quad1 ", 316,106,192,19,&la->att1, 0.0, 1.0, 0, 0, "Set the light intensity value 1 for a quad lamp");
- uiDefButF(block, NUMSLI,B_MATPRV,"Quad2 ", 317,86,191,19,&la->att2, 0.0, 1.0, 0, 0, "Set the light intensity value 2 for a quad lamp");
- uiDefButF(block, NUMSLI,0,"HaloInt ", 316,64,193,19,&la->haint, 0.0, 5.0, 0, 0, "Set the intensity of the spot halo");
-
-
- /* TEX CHANNELS */
- uiBlockSetCol(block, BUTGREY);
- xco= 745;
- for(a= 0; a<6; a++) {
- mtex= la->mtex[a];
- if(mtex && mtex->tex) splitIDname(mtex->tex->id.name+2, str, &loos);
- else strcpy(str, "");
- str[10]= 0;
- uiDefButS(block, ROW, B_REDR, str, xco, 195, 83, 20, &(la->texact), 3.0, (float)a, 0, 0, "");
- xco+= 85;
- }
-
- mtex= la->mtex[ la->texact ];
- if(mtex==0) {
- mtex= &emptytex;
- default_mtex(mtex);
- mtex->texco= TEXCO_VIEW;
- }
-
- /* TEXCO */
- uiBlockSetCol(block, BUTGREEN);
- uiDefButS(block, ROW, B_MATPRV, "Object", 745,146,49,18, &(mtex->texco), 4.0, (float)TEXCO_OBJECT, 0, 0, "Use linked object's coordinates for texture coordinates");
- uiDefIDPoinBut(block, test_obpoin_but, B_MATPRV, "", 745,166,133,18, &(mtex->object), "");
- uiDefButS(block, ROW, B_MATPRV, "Glob", 795,146,45,18, &(mtex->texco), 4.0, (float)TEXCO_GLOB, 0, 0, "Generate texture coordinates from global coordinates");
- uiDefButS(block, ROW, B_MATPRV, "View", 839,146,39,18, &(mtex->texco), 4.0, (float)TEXCO_VIEW, 0, 0, "Generate texture coordinates from view coordinates");
-
- uiBlockSetCol(block, BUTGREY);
- uiDefButF(block, NUM, B_MATPRV, "dX", 745,114,133,18, mtex->ofs, -20.0, 20.0, 10, 0, "Set the extra translation of the texture coordinate");
- uiDefButF(block, NUM, B_MATPRV, "dY", 745,94,133,18, mtex->ofs+1, -20.0, 20.0, 10, 0, "Set the extra translation of the texture coordinate");
- uiDefButF(block, NUM, B_MATPRV, "dZ", 745,74,133,18, mtex->ofs+2, -20.0, 20.0, 10, 0, "Set the extra translation of the texture coordinate");
- uiDefButF(block, NUM, B_MATPRV, "sizeX", 745,50,133,18, mtex->size, -10.0, 10.0, 10, 0, "Set the extra scaling of the texture coordinate");
- uiDefButF(block, NUM, B_MATPRV, "sizeY", 745,30,133,18, mtex->size+1, -10.0, 10.0, 10, 0, "Set the extra scaling of the texture coordinate");
- uiDefButF(block, NUM, B_MATPRV, "sizeZ", 745,10,133,18, mtex->size+2, -10.0, 10.0, 10, 0, "Set the extra scaling of the texture coordinate");
-
- /* TEXTUREBLOK SELECT */
- id= (ID *)mtex->tex;
- IDnames_to_pupstring(&strp, NULL, "ADD NEW %x 32767", &(G.main->tex), id, &(G.buts->texnr));
-
- /* doesnt work, because lockpoin points to lamp, not to texture */
- uiDefButS(block, MENU, B_LTEXBROWSE, strp, 900,146,20,19, &(G.buts->texnr), 0, 0, 0, 0, "Select an existing texture, or create new");
- MEM_freeN(strp);
-
- if(id) {
- uiDefBut(block, TEX, B_IDNAME, "TE:", 900,166,163,19, id->name+2, 0.0, 18.0, 0, 0, "Name of the texture block");
- sprintf(str, "%d", id->us);
- uiDefBut(block, BUT, 0, str, 996,146,21,19, 0, 0, 0, 0, 0, "Select an existing texture, or create new");
- uiDefIconBut(block, BUT, B_AUTOTEXNAME, ICON_AUTO, 1041,146,21,19, 0, 0, 0, 0, 0, "Auto assign a name to the texture");
- if(id->lib) {
- if(la->id.lib) uiDefIconBut(block, BUT, 0, ICON_DATALIB, 1019,146,21,19, 0, 0, 0, 0, 0, "");
- else uiDefIconBut(block, BUT, 0, ICON_PARLIB, 1019,146,21,19, 0, 0, 0, 0, 0, "");
- }
- uiBlockSetCol(block, BUTSALMON);
- uiDefBut(block, BUT, B_TEXCLEARLAMP, "Clear", 922, 146, 72, 19, 0, 0, 0, 0, 0, "Erase link to texture");
- uiBlockSetCol(block, BUTGREY);
- }
-
- /* TEXTURE OUTPUT */
- uiDefButS(block, TOG|BIT|1, B_MATPRV, "Stencil", 900,114,52,18, &(mtex->texflag), 0, 0, 0, 0, "Set the mapping to stencil mode");
- uiDefButS(block, TOG|BIT|2, B_MATPRV, "Neg", 954,114,38,18, &(mtex->texflag), 0, 0, 0, 0, "Apply the inverse of the texture");
- uiDefButS(block, TOG|BIT|0, B_MATPRV, "RGBtoInt", 994,114,69,18, &(mtex->texflag), 0, 0, 0, 0, "Use an RGB texture as an intensity texture");
-
- uiDefButF(block, COL, B_MTEXCOL, "", 900,100,163,12, &(mtex->r), 0, 0, 0, 0, "");
- uiDefButF(block, NUMSLI, B_MATPRV, "R ", 900,80,163,18, &(mtex->r), 0.0, 1.0, B_MTEXCOL, 0, "Set the red component of the intensity texture to blend with");
- uiDefButF(block, NUMSLI, B_MATPRV, "G ", 900,60,163,18, &(mtex->g), 0.0, 1.0, B_MTEXCOL, 0, "Set the green component of the intensity texture to blend with");
- uiDefButF(block, NUMSLI, B_MATPRV, "B ", 900,40,163,18, &(mtex->b), 0.0, 1.0, B_MTEXCOL, 0, "Set the blue component of the intensity texture to blend with");
- uiDefButF(block, NUMSLI, B_MATPRV, "DVar ", 900,10,163,18, &(mtex->def_var), 0.0, 1.0, 0, 0, "Set the value the texture blends with");
-
- /* MAP TO */
- uiBlockSetCol(block, BUTGREEN);
- uiDefButS(block, TOG|BIT|0, B_MATPRV, "Col", 1087,166,81,18, &(mtex->mapto), 0, 0, 0, 0, "Let the texture affect the colour of the lamp");
-
- uiBlockSetCol(block, BUTGREY);
- uiDefButS(block, ROW, B_MATPRV, "Blend", 1087,114,48,18, &(mtex->blendtype), 9.0, (float)MTEX_BLEND, 0, 0, "Mix the values");
- uiDefButS(block, ROW, B_MATPRV, "Mul", 1136,114,44,18, &(mtex->blendtype), 9.0, (float)MTEX_MUL, 0, 0, "Multiply the values");
- uiDefButS(block, ROW, B_MATPRV, "Add", 1182,114,41,18, &(mtex->blendtype), 9.0, (float)MTEX_ADD, 0, 0, "Add the values");
- uiDefButS(block, ROW, B_MATPRV, "Sub", 1226,114,40,18, &(mtex->blendtype), 9.0, (float)MTEX_SUB, 0, 0, "Subtract the values");
-
- uiDefButF(block, NUMSLI, B_MATPRV, "Col ", 1087,50,179,18, &(mtex->colfac), 0.0, 1.0, 0, 0, "Set the amount the texture affects the colour");
- uiDefButF(block, NUMSLI, B_MATPRV, "Nor ", 1087,30,179,18, &(mtex->norfac), 0.0, 1.0, 0, 0, "Set the amount the texture affects the normal");
- uiDefButF(block, NUMSLI, B_MATPRV, "Var ", 1087,10,179,18, &(mtex->varfac), 0.0, 1.0, 0, 0, "Set the amount the texture affects the value");
-
-
- BIF_previewdraw(G.buts);
-
- uiDrawBlock(block);
-}
-
-
-/* ***************************** WORLD ************************** */
-
-void do_worldbuts(unsigned short event)
-{
- World *wrld;
- MTex *mtex;
-
- switch(event) {
- case B_TEXCLEARWORLD:
- wrld= G.buts->lockpoin;
- mtex= wrld->mtex[ wrld->texact ];
- if(mtex) {
- if(mtex->tex) mtex->tex->id.us--;
- MEM_freeN(mtex);
- wrld->mtex[ wrld->texact ]= 0;
- allqueue(REDRAWBUTSWORLD, 0);
- allqueue(REDRAWOOPS, 0);
- BIF_preview_changed(G.buts);
- }
- break;
- }
-}
-
-void worldbuts(void)
-{
- World *wrld;
- MTex *mtex;
- ID *id;
- uiBlock *block;
- int a, loos;
- char str[30], *strp;
- short xco;
-
- wrld= G.scene->world;
- if(wrld==0) return;
-
- sprintf(str, "buttonswin %d", curarea->win);
- block= uiNewBlock(&curarea->uiblocks, str, UI_EMBOSSX, UI_HELV, curarea->win);
-
- uiSetButLock(wrld->id.lib!=0, "Can't edit library data");
- uiBlockSetCol(block, BUTGREEN);
-
- uiDefButS(block, TOG|BIT|1,B_MATPRV,"Real", 286,190,71,19, &wrld->skytype, 0, 0, 0, 0, "Render background with real horizon");
- uiDefButS(block, TOG|BIT|0,B_MATPRV,"Blend", 208,190,74,19, &wrld->skytype, 0, 0, 0, 0, "Render background with natural progression");
- uiDefButS(block, TOG|BIT|2,B_MATPRV,"Paper", 361,190,71,19, &wrld->skytype, 0, 0, 0, 0, "Flatten blend or texture coordinates");
- uiBlockSetCol(block, BUTGREY);
- uiDefButF(block, NUMSLI,B_MATPRV,"HoR ", 200,55,175,18, &(wrld->horr), 0.0, 1.0, 0,0, "The amount of red of the horizon colour");
- uiDefButF(block, NUMSLI,B_MATPRV,"HoG ", 200,34,175,18, &(wrld->horg), 0.0, 1.0, 0,0, "The amount of green of the horizon colour");
- uiDefButF(block, NUMSLI,B_MATPRV,"HoB ", 200,13,175,18, &(wrld->horb), 0.0, 1.0, 0,0, "The amount of blue of the horizon colour");
- uiDefButF(block, NUMSLI,B_MATPRV,"ZeR ", 200,136,175,18, &(wrld->zenr), 0.0, 1.0, 0,0, "The amount of red of the zenith colour");
- uiDefButF(block, NUMSLI,B_MATPRV,"ZeG ", 200,116,175,18, &(wrld->zeng), 0.0, 1.0, 0,0, "The amount of green of the zenith colour");
- uiDefButF(block, NUMSLI,B_MATPRV,"ZeB ", 200,96,175,18, &(wrld->zenb), 0.0, 1.0, 0,0, "The amount of blue of the zenith colour");
- uiDefButF(block, NUMSLI,B_MATPRV,"AmbR ", 380,55,175,18, &(wrld->ambr), 0.0, 1.0 ,0,0, "The amount of red of the ambient colour");
- uiDefButF(block, NUMSLI,B_MATPRV,"AmbG ", 380,34,175,18, &(wrld->ambg), 0.0, 1.0 ,0,0, "The amount of red of the ambient colour");
- uiDefButF(block, NUMSLI,B_MATPRV,"AmbB ", 380,13,175,18, &(wrld->ambb), 0.0, 1.0 ,0,0, "The amount of red of the ambient colour");
-
- uiDefBut(block, MENU|SHO, 1, physics_pup(),
- 380,152,175,18, &wrld->pad1, 0, 0, 0, 0, "Physics Engine");
-
-
- /* Activity bubble */
- // uiDefButS(block, TOG|BIT|3,B_DIFF, "Do activity culling",
- // 380,152,175,18, &wrld->mode, 0, 0, 0, 0,
- // "Disable logic and physics for far away objects.");
-/* if (wrld->mode & WO_ACTIVITY_CULLING) { */
- // uiDefButF(block, NUM,0, "Active R ",
- // 380,132,175,18, &(wrld->activityBoxRadius), 0.5, 10000.0, 100.0, 0,
- // "Radius for activity culling (in Manhattan length).");
-/* } */
-
- /* Gravitation for the game worlds */
- uiDefButF(block, NUMSLI,0, "Grav ",
- 380,112,175,18, &(wrld->gravity), 0.0, 25.0, 0, 0,
- "Gravitation constant of the game world.");
-
- uiDefButF(block, NUMSLI,0, "Expos ", 380,92,175,18, &(wrld->exposure), 0.2, 5.0, 0, 0, "Set the lighting time, exposure");
-
- uiBlockSetCol(block, BUTGREEN);
- uiDefButS(block, TOG|BIT|0,REDRAWVIEW3D,"Mist", 571,190,100,19, &wrld->mode, 0, 0, 0, 0, "Enable mist");
- uiBlockSetCol(block, BUTGREY);
- uiDefButS(block, ROW, B_DIFF, "Qua", 571, 170, 33, 19, &wrld->mistype, 1.0, 0.0, 0, 0, "Use quadratic progression");
- uiDefButS(block, ROW, B_DIFF, "Lin", 604, 170, 33, 19, &wrld->mistype, 1.0, 1.0, 0, 0, "Use linear progression");
- uiDefButS(block, ROW, B_DIFF, "Sqr", 637, 170, 33, 19, &wrld->mistype, 1.0, 2.0, 0, 0, "Use inverse quadratic progression");
-
- uiDefButF(block, NUM,REDRAWVIEW3D, "Sta:",571,150,100,17, &wrld->miststa, 0.0, 1000.0, 10, 0, "Specify the starting distance of the mist");
- uiDefButF(block, NUM,REDRAWVIEW3D, "Di:",571,133,100,17, &wrld->mistdist, 0.0,1000.0, 10, 00, "Specify the depth of the mist");
- uiDefButF(block, NUM,B_DIFF,"Hi:", 571,116,100,17, &wrld->misthi,0.0,100.0, 10, 0, "Specify the factor for a less dense mist with increasing height");
-
- uiDefButF(block, NUM, 0, "misi", 571,99,100,17, &(wrld->misi), 0., 1.0, 0, 0, "Set the mist intensity");
-
- uiBlockSetCol(block, BUTGREEN);
- uiDefButS(block, TOG|BIT|1,B_DIFF, "Stars",571,82,100,17, &wrld->mode, 0, 0, 0, 0, "Enable stars");
- uiBlockSetCol(block, BUTGREY);
- uiDefButF(block, NUM,B_DIFF,"StarDist:", 571,65,100,17, &(wrld->stardist), 2.0, 1000.0, 100, 0, "Specify the average distance between two stars");
- uiDefButF(block, NUM,B_DIFF,"MinDist:", 571,48,100,17, &(wrld->starmindist), 0.0, 1000.0, 100, 0, "Specify the minimum distance to the camera");
- uiDefButF(block, NUM,B_DIFF,"Size:", 571,31,100,17, &(wrld->starsize), 0.0, 10.0, 10, 0, "Specify the average screen dimension");
- uiDefButF(block, NUM,B_DIFF,"Colnoise:", 571,12,100,17, &(wrld->starcolnoise), 0.0, 1.0, 100, 0, "Randomize starcolour");
-
-
- /* TEX CHANNELS */
- uiBlockSetCol(block, BUTGREY);
- xco= 745;
- for(a= 0; a<6; a++) {
- mtex= wrld->mtex[a];
- if(mtex && mtex->tex) splitIDname(mtex->tex->id.name+2, str, &loos);
- else strcpy(str, "");
- str[10]= 0;
- uiDefButS(block, ROW, REDRAWBUTSWORLD, str, xco, 195, 83, 20, &(wrld->texact), 3.0, (float)a, 0, 0, "Texture channel");
- xco+= 85;
- }
-
- mtex= wrld->mtex[ wrld->texact ];
- if(mtex==0) {
- mtex= &emptytex;
- default_mtex(mtex);
- mtex->texco= TEXCO_VIEW;
- }
-
- /* TEXCO */
- uiBlockSetCol(block, BUTGREEN);
- uiDefButS(block, ROW, B_MATPRV, "Object", 745,146,49,18, &(mtex->texco), 4.0, (float)TEXCO_OBJECT, 0, 0, "The name of the object used as a source for texture coordinates");
- uiDefIDPoinBut(block, test_obpoin_but, B_MATPRV, "", 745,166,133,18, &(mtex->object), "");
- uiDefButS(block, ROW, B_MATPRV, "View", 839,146,39,18, &(mtex->texco), 4.0, (float)TEXCO_VIEW, 0, 0, "Pass camera view vector on to the texture");
-
- uiBlockSetCol(block, BUTGREY);
- uiDefButF(block, NUM, B_MATPRV, "dX", 745,114,133,18, mtex->ofs, -20.0, 20.0, 10, 0, "Fine tune X coordinate");
- uiDefButF(block, NUM, B_MATPRV, "dY", 745,94,133,18, mtex->ofs+1, -20.0, 20.0, 10, 0, "Fine tune Y coordinate");
- uiDefButF(block, NUM, B_MATPRV, "dZ", 745,74,133,18, mtex->ofs+2, -20.0, 20.0, 10, 0, "Fine tune Z coordinate");
- uiDefButF(block, NUM, B_MATPRV, "sizeX", 745,50,133,18, mtex->size, -20.0, 20.0, 10, 0, "Set an extra scaling for the texture coordinate");
- uiDefButF(block, NUM, B_MATPRV, "sizeY", 745,30,133,18, mtex->size+1, -20.0, 20.0, 10, 0, "Set an extra scaling for the texture coordinate");
- uiDefButF(block, NUM, B_MATPRV, "sizeZ", 745,10,133,18, mtex->size+2, -20.0, 20.0, 10, 0, "Set an extra scaling for the texture coordinate");
-
- /* TEXTUREBLOCK SELECT */
- id= (ID *)mtex->tex;
- IDnames_to_pupstring(&strp, NULL, "ADD NEW %x 32767", &(G.main->tex), id, &(G.buts->texnr));
- uiDefButS(block, MENU, B_WTEXBROWSE, strp, 900,146,20,19, &(G.buts->texnr), 0, 0, 0, 0, "Browse");
- MEM_freeN(strp);
-
- if(id) {
- uiDefBut(block, TEX, B_IDNAME, "TE:", 900,166,163,19, id->name+2, 0.0, 18.0, 0, 0, "Specify the texture name");
- sprintf(str, "%d", id->us);
- uiDefBut(block, BUT, 0, str, 996,146,21,19, 0, 0, 0, 0, 0, "Number of users");
- uiDefIconBut(block, BUT, B_AUTOTEXNAME, ICON_AUTO, 1041,146,21,19, 0, 0, 0, 0, 0, "Auto assign name to texture");
- if(id->lib) {
- if(wrld->id.lib) uiDefIconBut(block, BUT, 0, ICON_DATALIB, 1019,146,21,19, 0, 0, 0, 0, 0, "");
- else uiDefIconBut(block, BUT, 0, ICON_PARLIB, 1019,146,21,19, 0, 0, 0, 0, 0, "");
- }
- uiBlockSetCol(block, BUTSALMON);
- uiDefBut(block, BUT, B_TEXCLEARWORLD, "Clear", 922, 146, 72, 19, 0, 0, 0, 0, 0, "Erase link to texture");
- uiBlockSetCol(block, BUTGREY);
- }
-
- /* TEXTURE OUTPUT */
- uiDefButS(block, TOG|BIT|1, B_MATPRV, "Stencil", 900,114,52,18, &(mtex->texflag), 0, 0, 0, 0, "Use stencil mode");
- uiDefButS(block, TOG|BIT|2, B_MATPRV, "Neg", 954,114,38,18, &(mtex->texflag), 0, 0, 0, 0, "Inverse texture operation");
- uiDefButS(block, TOG|BIT|0, B_MATPRV, "RGBtoInt", 994,114,69,18, &(mtex->texflag), 0, 0, 0, 0, "Use RGB values for intensity texure");
-
- uiDefButF(block, COL, B_MTEXCOL, "", 900,100,163,12, &(mtex->r), 0, 0, 0, 0, "");
- uiDefButF(block, NUMSLI, B_MATPRV, "R ", 900,80,163,18, &(mtex->r), 0.0, 1.0, B_MTEXCOL, 0, "The amount of red that blends with the intensity colour");
- uiDefButF(block, NUMSLI, B_MATPRV, "G ", 900,60,163,18, &(mtex->g), 0.0, 1.0, B_MTEXCOL, 0, "The amount of green that blends with the intensity colour");
- uiDefButF(block, NUMSLI, B_MATPRV, "B ", 900,40,163,18, &(mtex->b), 0.0, 1.0, B_MTEXCOL, 0, "The amount of blue that blends with the intensity colour");
- uiDefButF(block, NUMSLI, B_MATPRV, "DVar ", 900,10,163,18, &(mtex->def_var), 0.0, 1.0, 0, 0, "The value that an intensity texture blends with the current value");
-
- /* MAP TO */
- uiBlockSetCol(block, BUTGREEN);
- uiDefButS(block, TOG|BIT|0, B_MATPRV, "Blend", 1087,166,81,18, &(mtex->mapto), 0, 0, 0, 0, "Let the texture work on the colour progression in the sky");
- uiDefButS(block, TOG|BIT|1, B_MATPRV, "Hori", 1172,166,81,18, &(mtex->mapto), 0, 0, 0, 0, "Let the texture work on the colour of the horizon");
- uiDefButS(block, TOG|BIT|2, B_MATPRV, "ZenUp", 1087,147,81,18, &(mtex->mapto), 0, 0, 0, 0, "Let the texture work on the colour of the zenith above");
- uiDefButS(block, TOG|BIT|3, B_MATPRV, "ZenDo", 1172,147,81,18, &(mtex->mapto), 0, 0, 0, 0, "Let the texture work on the colour of the zenith below");
-
- uiBlockSetCol(block, BUTGREY);
- uiDefButS(block, ROW, B_MATPRV, "Blend", 1087,114,48,18, &(mtex->blendtype), 9.0, (float)MTEX_BLEND, 0, 0, "The texture blends the values");
- uiDefButS(block, ROW, B_MATPRV, "Mul", 1136,114,44,18, &(mtex->blendtype), 9.0, (float)MTEX_MUL, 0, 0, "The texture multiplies the values");
- uiDefButS(block, ROW, B_MATPRV, "Add", 1182,114,41,18, &(mtex->blendtype), 9.0, (float)MTEX_ADD, 0, 0, "The texture adds the values");
- uiDefButS(block, ROW, B_MATPRV, "Sub", 1226,114,40,18, &(mtex->blendtype), 9.0, (float)MTEX_SUB, 0, 0, "The texture subtracts the values");
-
- uiDefButF(block, NUMSLI, B_MATPRV, "Col ", 1087,50,179,18, &(mtex->colfac), 0.0, 1.0, 0, 0, "Specify the extent to which the texture works on colour");
- uiDefButF(block, NUMSLI, B_MATPRV, "Nor ", 1087,30,179,18, &(mtex->norfac), 0.0, 1.0, 0, 0, "Specify the extent to which the texture works on the normal");
- uiDefButF(block, NUMSLI, B_MATPRV, "Var ", 1087,10,179,18, &(mtex->varfac), 0.0, 1.0, 0, 0, "Specify the extent to which the texture works on a value");
-
-
- BIF_previewdraw(G.buts);
-
- uiDrawBlock(block);
-}
/* **************************** VIEW ************************ */
diff --git a/source/blender/src/buttons_shading.c b/source/blender/src/buttons_shading.c
index 05795765d9c..41555f7c162 100644
--- a/source/blender/src/buttons_shading.c
+++ b/source/blender/src/buttons_shading.c
@@ -51,7 +51,9 @@
#include "DNA_material_types.h"
#include "DNA_texture_types.h"
#include "DNA_object_types.h"
-
+#include "DNA_lamp_types.h"
+#include "DNA_world_types.h"
+#include "DNA_view3d_types.h"
#include "BKE_global.h"
#include "BKE_main.h"
@@ -59,6 +61,7 @@
#include "BKE_utildefines.h"
#include "BKE_material.h"
#include "BKE_texture.h"
+#include "BKE_displist.h"
#include "BLI_blenlib.h"
@@ -91,6 +94,519 @@
static MTex mtexcopybuf;
static MTex emptytex;
+
+/* ***************************** WORLD ************************** */
+
+void do_worldbuts(unsigned short event)
+{
+ World *wrld;
+ MTex *mtex;
+
+ switch(event) {
+ case B_TEXCLEARWORLD:
+ wrld= G.buts->lockpoin;
+ mtex= wrld->mtex[ wrld->texact ];
+ if(mtex) {
+ if(mtex->tex) mtex->tex->id.us--;
+ MEM_freeN(mtex);
+ wrld->mtex[ wrld->texact ]= 0;
+ allqueue(REDRAWBUTSSHADING, 0);
+ allqueue(REDRAWOOPS, 0);
+ BIF_preview_changed(G.buts);
+ }
+ break;
+ }
+}
+
+static void world_panel_mapto(World *wrld)
+{
+ uiBlock *block;
+ MTex *mtex;
+
+ block= uiNewBlock(&curarea->uiblocks, "world_panel_mapto", UI_EMBOSSX, UI_HELV, curarea->win);
+ uiNewPanelTabbed("Texture and Input", "World");
+ if(uiNewPanel(curarea, block, "Map To", "World", 1280, 0, 318, 204)==0) return;
+
+ uiSetButLock(wrld->id.lib!=0, "Can't edit library data");
+
+ mtex= wrld->mtex[ wrld->texact ];
+ if(mtex==0) {
+ mtex= &emptytex;
+ default_mtex(mtex);
+ mtex->texco= TEXCO_VIEW;
+ }
+
+ /* TEXTURE OUTPUT */
+ uiDefButS(block, TOG|BIT|1, B_MATPRV, "Stencil", 920,114,52,18, &(mtex->texflag), 0, 0, 0, 0, "Use stencil mode");
+ uiDefButS(block, TOG|BIT|2, B_MATPRV, "Neg", 974,114,38,18, &(mtex->texflag), 0, 0, 0, 0, "Inverse texture operation");
+ uiDefButS(block, TOG|BIT|0, B_MATPRV, "RGBtoInt", 1014,114,69,18, &(mtex->texflag), 0, 0, 0, 0, "Use RGB values for intensity texure");
+
+ uiDefButF(block, COL, B_MTEXCOL, "", 920,100,163,12, &(mtex->r), 0, 0, 0, 0, "");
+ uiDefButF(block, NUMSLI, B_MATPRV, "R ", 920,80,163,18, &(mtex->r), 0.0, 1.0, B_MTEXCOL, 0, "The amount of red that blends with the intensity colour");
+ uiDefButF(block, NUMSLI, B_MATPRV, "G ", 920,60,163,18, &(mtex->g), 0.0, 1.0, B_MTEXCOL, 0, "The amount of green that blends with the intensity colour");
+ uiDefButF(block, NUMSLI, B_MATPRV, "B ", 920,40,163,18, &(mtex->b), 0.0, 1.0, B_MTEXCOL, 0, "The amount of blue that blends with the intensity colour");
+ uiDefButF(block, NUMSLI, B_MATPRV, "DVar ", 920,10,163,18, &(mtex->def_var), 0.0, 1.0, 0, 0, "The value that an intensity texture blends with the current value");
+
+ /* MAP TO */
+ uiBlockSetCol(block, BUTGREEN);
+ uiDefButS(block, TOG|BIT|0, B_MATPRV, "Blend", 1087,166,81,18, &(mtex->mapto), 0, 0, 0, 0, "Let the texture work on the colour progression in the sky");
+ uiDefButS(block, TOG|BIT|1, B_MATPRV, "Hori", 1172,166,81,18, &(mtex->mapto), 0, 0, 0, 0, "Let the texture work on the colour of the horizon");
+ uiDefButS(block, TOG|BIT|2, B_MATPRV, "ZenUp", 1087,147,81,18, &(mtex->mapto), 0, 0, 0, 0, "Let the texture work on the colour of the zenith above");
+ uiDefButS(block, TOG|BIT|3, B_MATPRV, "ZenDo", 1172,147,81,18, &(mtex->mapto), 0, 0, 0, 0, "Let the texture work on the colour of the zenith below");
+
+ uiBlockSetCol(block, BUTGREY);
+ uiDefButS(block, ROW, B_MATPRV, "Blend", 1087,114,48,18, &(mtex->blendtype), 9.0, (float)MTEX_BLEND, 0, 0, "The texture blends the values");
+ uiDefButS(block, ROW, B_MATPRV, "Mul", 1136,114,44,18, &(mtex->blendtype), 9.0, (float)MTEX_MUL, 0, 0, "The texture multiplies the values");
+ uiDefButS(block, ROW, B_MATPRV, "Add", 1182,114,41,18, &(mtex->blendtype), 9.0, (float)MTEX_ADD, 0, 0, "The texture adds the values");
+ uiDefButS(block, ROW, B_MATPRV, "Sub", 1226,114,40,18, &(mtex->blendtype), 9.0, (float)MTEX_SUB, 0, 0, "The texture subtracts the values");
+
+ uiDefButF(block, NUMSLI, B_MATPRV, "Col ", 1087,50,179,18, &(mtex->colfac), 0.0, 1.0, 0, 0, "Specify the extent to which the texture works on colour");
+ uiDefButF(block, NUMSLI, B_MATPRV, "Nor ", 1087,30,179,18, &(mtex->norfac), 0.0, 1.0, 0, 0, "Specify the extent to which the texture works on the normal");
+ uiDefButF(block, NUMSLI, B_MATPRV, "Var ", 1087,10,179,18, &(mtex->varfac), 0.0, 1.0, 0, 0, "Specify the extent to which the texture works on a value");
+
+}
+
+static void world_panel_texture(World *wrld)
+{
+ uiBlock *block;
+ MTex *mtex;
+ ID *id;
+ int a, loos;
+ char str[64], *strp;
+
+ block= uiNewBlock(&curarea->uiblocks, "world_panel_texture", UI_EMBOSSX, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "Texture and Input", "World", 960, 0, 318, 204)==0) return;
+
+ uiSetButLock(wrld->id.lib!=0, "Can't edit library data");
+
+ /* TEX CHANNELS */
+ uiBlockSetCol(block, BUTGREY);
+
+ for(a= 0; a<6; a++) {
+ mtex= wrld->mtex[a];
+ if(mtex && mtex->tex) splitIDname(mtex->tex->id.name+2, str, &loos);
+ else strcpy(str, "");
+ str[10]= 0;
+ uiDefButS(block, ROW, REDRAWBUTSSHADING, str,10, 140-20*a, 80, 20, &(wrld->texact), 3.0, (float)a, 0, 0, "Texture channel");
+ }
+
+ mtex= wrld->mtex[ wrld->texact ];
+ if(mtex==0) {
+ mtex= &emptytex;
+ default_mtex(mtex);
+ mtex->texco= TEXCO_VIEW;
+ }
+
+ /* TEXTUREBLOCK SELECT */
+ id= (ID *)mtex->tex;
+ IDnames_to_pupstring(&strp, NULL, "ADD NEW %x 32767", &(G.main->tex), id, &(G.buts->texnr));
+ uiDefButS(block, MENU, B_WTEXBROWSE, strp, 100,140,20,19, &(G.buts->texnr), 0, 0, 0, 0, "Browse");
+ MEM_freeN(strp);
+
+ if(id) {
+ uiDefBut(block, TEX, B_IDNAME, "TE:", 100,160,163,19, id->name+2, 0.0, 18.0, 0, 0, "Specify the texture name");
+ sprintf(str, "%d", id->us);
+ uiDefBut(block, BUT, 0, str, 196,140,21,19, 0, 0, 0, 0, 0, "Number of users");
+ uiDefIconBut(block, BUT, B_AUTOTEXNAME, ICON_AUTO, 241,140,21,19, 0, 0, 0, 0, 0, "Auto assign name to texture");
+ if(id->lib) {
+ if(wrld->id.lib) uiDefIconBut(block, BUT, 0, ICON_DATALIB, 1019,146,21,19, 0, 0, 0, 0, 0, "");
+ else uiDefIconBut(block, BUT, 0, ICON_PARLIB, 219,140,21,19, 0, 0, 0, 0, 0, "");
+ }
+ uiBlockSetCol(block, BUTSALMON);
+ uiDefBut(block, BUT, B_TEXCLEARWORLD, "Clear", 122, 140, 72, 19, 0, 0, 0, 0, 0, "Erase link to texture");
+ uiBlockSetCol(block, BUTGREY);
+ }
+
+
+ /* TEXCO */
+ uiBlockSetCol(block, BUTGREEN);
+ uiDefButS(block, ROW, B_MATPRV, "View", 100,110,50,19, &(mtex->texco), 4.0, (float)TEXCO_VIEW, 0, 0, "Pass camera view vector on to the texture");
+ uiDefButS(block, ROW, B_MATPRV, "Object", 150,110,50,19, &(mtex->texco), 4.0, (float)TEXCO_OBJECT, 0, 0, "The name of the object used as a source for texture coordinates");
+ uiDefIDPoinBut(block, test_obpoin_but, B_MATPRV, "", 100,110,100,19, &(mtex->object), "");
+
+ uiBlockSetCol(block, BUTGREY);
+ uiDefButF(block, NUM, B_MATPRV, "dX", 100,50,100,18, mtex->ofs, -20.0, 20.0, 10, 0, "Set the extra translation of the texture coordinate");
+ uiDefButF(block, NUM, B_MATPRV, "dY", 100,30,100,18, mtex->ofs+1, -20.0, 20.0, 10, 0, "Set the extra translation of the texture coordinate");
+ uiDefButF(block, NUM, B_MATPRV, "dZ", 100,10,100,18, mtex->ofs+2, -20.0, 20.0, 10, 0, "Set the extra translation of the texture coordinate");
+ uiDefButF(block, NUM, B_MATPRV, "sizeX", 200,50,100,18, mtex->size, -10.0, 10.0, 10, 0, "Set the extra scaling of the texture coordinate");
+ uiDefButF(block, NUM, B_MATPRV, "sizeY", 200,30,100,18, mtex->size+1, -10.0, 10.0, 10, 0, "Set the extra scaling of the texture coordinate");
+ uiDefButF(block, NUM, B_MATPRV, "sizeZ", 200,10,100,18, mtex->size+2, -10.0, 10.0, 10, 0, "Set the extra scaling of the texture coordinate");
+
+
+}
+
+static void world_panel_mistaph(World *wrld)
+{
+ uiBlock *block;
+
+ block= uiNewBlock(&curarea->uiblocks, "world_panel_mistaph", UI_EMBOSSX, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "Mist Stars Physics", "World", 640, 0, 318, 204)==0) return;
+
+ uiSetButLock(wrld->id.lib!=0, "Can't edit library data");
+
+ uiDefBut(block, MENU|SHO, 1, "Physics %t|None %x1|Sumo %x2|ODE %x3 |Dynamo %x4|",
+ 10,180,140,19, &wrld->pad1, 0, 0, 0, 0, "Physics Engine");
+
+ /* Gravitation for the game worlds */
+ uiDefButF(block, NUMSLI,0, "Grav ", 150,180,150,19, &(wrld->gravity), 0.0, 25.0, 0, 0, "Gravitation constant of the game world.");
+
+
+ uiBlockSetCol(block, BUTBLUE);
+ uiDefButS(block, TOG|BIT|0,REDRAWVIEW3D,"Mist", 10,110,140,19, &wrld->mode, 0, 0, 0, 0, "Enable mist");
+
+ uiBlockSetCol(block, BUTGREEN);
+ uiDefButS(block, ROW, B_DIFF, "Qua", 10, 90, 40, 19, &wrld->mistype, 1.0, 0.0, 0, 0, "Use quadratic progression");
+ uiDefButS(block, ROW, B_DIFF, "Lin", 50, 90, 50, 19, &wrld->mistype, 1.0, 1.0, 0, 0, "Use linear progression");
+ uiDefButS(block, ROW, B_DIFF, "Sqr", 100, 90, 50, 19, &wrld->mistype, 1.0, 2.0, 0, 0, "Use inverse quadratic progression");
+
+ uiBlockSetCol(block, BUTGREY);
+ uiDefButF(block, NUM,REDRAWVIEW3D, "Sta:",10,70,140,19, &wrld->miststa, 0.0, 1000.0, 10, 0, "Specify the starting distance of the mist");
+ uiDefButF(block, NUM,REDRAWVIEW3D, "Di:",10,50,140,19, &wrld->mistdist, 0.0,1000.0, 10, 00, "Specify the depth of the mist");
+ uiDefButF(block, NUM,B_DIFF,"Hi:", 10,30,140,19, &wrld->misthi,0.0,100.0, 10, 0, "Specify the factor for a less dense mist with increasing height");
+ uiDefButF(block, NUMSLI, 0, "Misi", 10,10,140,19, &(wrld->misi), 0., 1.0, 0, 0, "Set the mist intensity");
+
+ uiBlockSetCol(block, BUTBLUE);
+ uiDefButS(block, TOG|BIT|1,B_DIFF, "Stars",160,110,140,19, &wrld->mode, 0, 0, 0, 0, "Enable stars");
+ uiBlockSetCol(block, BUTGREY);
+ uiDefButF(block, NUM,B_DIFF,"StarDist:", 160,70,140,19, &(wrld->stardist), 2.0, 1000.0, 100, 0, "Specify the average distance between two stars");
+ uiDefButF(block, NUM,B_DIFF,"MinDist:", 160,50,140,19, &(wrld->starmindist), 0.0, 1000.0, 100, 0, "Specify the minimum distance to the camera");
+ uiDefButF(block, NUMSLI,B_DIFF,"Size:", 160,30,140,19, &(wrld->starsize), 0.0, 10.0, 10, 0, "Specify the average screen dimension");
+ uiDefButF(block, NUMSLI,B_DIFF,"Colnoise:", 160,10,140,19, &(wrld->starcolnoise), 0.0, 1.0, 100, 0, "Randomize starcolour");
+
+
+}
+
+static void world_panel_world(World *wrld)
+{
+ uiBlock *block;
+ ID *id, *idfrom;
+ short xco;
+
+ block= uiNewBlock(&curarea->uiblocks, "world_panel_world", UI_EMBOSSX, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "World", "World", 320, 0, 318, 204)==0) return;
+
+ /* first do the browse but */
+ buttons_active_id(&id, &idfrom);
+
+ uiBlockSetCol(block, BUTPURPLE);
+ xco= std_libbuttons(block, 10, 180, 0, NULL, B_WORLDBROWSE, id, idfrom, &(G.buts->menunr), B_WORLDALONE, B_WORLDLOCAL, B_WORLDDELETE, 0, B_KEEPDATA);
+
+ if(wrld==NULL) return;
+
+ uiSetButLock(wrld->id.lib!=0, "Can't edit library data");
+ uiBlockSetCol(block, BUTGREY);
+
+ uiDefButF(block, COL, B_COLHOR, "", 10,150,150,19, &wrld->horr, 0, 0, 0, 0, "");
+ uiDefButF(block, NUMSLI,B_MATPRV,"HoR ", 10,130,150,19, &(wrld->horr), 0.0, 1.0, B_COLHOR,0, "The amount of red of the horizon colour");
+ uiDefButF(block, NUMSLI,B_MATPRV,"HoG ", 10,110,150,19, &(wrld->horg), 0.0, 1.0, B_COLHOR,0, "The amount of green of the horizon colour");
+ uiDefButF(block, NUMSLI,B_MATPRV,"HoB ", 10,90,150,19, &(wrld->horb), 0.0, 1.0, B_COLHOR,0, "The amount of blue of the horizon colour");
+
+ uiDefButF(block, COL, B_COLZEN, "", 160,150,150,19, &wrld->zenr, 0, 0, 0, 0, "");
+ uiDefButF(block, NUMSLI,B_MATPRV,"ZeR ", 160,130,150,19, &(wrld->zenr), 0.0, 1.0, B_COLZEN,0, "The amount of red of the zenith colour");
+ uiDefButF(block, NUMSLI,B_MATPRV,"ZeG ", 160,110,150,19, &(wrld->zeng), 0.0, 1.0, B_COLZEN,0, "The amount of green of the zenith colour");
+ uiDefButF(block, NUMSLI,B_MATPRV,"ZeB ", 160,90,150,19, &(wrld->zenb), 0.0, 1.0, B_COLZEN,0, "The amount of blue of the zenith colour");
+
+ uiDefButF(block, NUMSLI,B_MATPRV,"AmbR ", 10,50,150,19, &(wrld->ambr), 0.0, 1.0 ,0,0, "The amount of red of the ambient colour");
+ uiDefButF(block, NUMSLI,B_MATPRV,"AmbG ", 10,30,150,19, &(wrld->ambg), 0.0, 1.0 ,0,0, "The amount of red of the ambient colour");
+ uiDefButF(block, NUMSLI,B_MATPRV,"AmbB ", 10,10,150,19, &(wrld->ambb), 0.0, 1.0 ,0,0, "The amount of red of the ambient colour");
+ uiDefButF(block, NUMSLI,0, "Expos ", 160,10,155,19, &(wrld->exposure), 0.2, 5.0, 0, 0, "Set the lighting time, exposure");
+
+
+}
+
+static void world_panel_preview(World *wrld)
+{
+ uiBlock *block;
+
+ /* name "Preview" is abused to detect previewrender offset panel */
+ block= uiNewBlock(&curarea->uiblocks, "world_panel_preview", UI_EMBOSSX, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "Preview", "World", 0, 0, 318, 204)==0) return;
+
+ if(wrld==NULL) return;
+
+ uiSetButLock(wrld->id.lib!=0, "Can't edit library data");
+
+ 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);
+
+ uiDefButS(block, TOG|BIT|1,B_MATPRV,"Real", 200,175,80,25, &wrld->skytype, 0, 0, 0, 0, "Render background with real horizon");
+ uiDefButS(block, TOG|BIT|0,B_MATPRV,"Blend",200,150,80,19, &wrld->skytype, 0, 0, 0, 0, "Render background with natural progression");
+ uiDefButS(block, TOG|BIT|2,B_MATPRV,"Paper",200,125,80,19, &wrld->skytype, 0, 0, 0, 0, "Flatten blend or texture coordinates");
+
+}
+
+
+
+/* ************************ LAMP *************************** */
+
+void do_lampbuts(unsigned short event)
+{
+ Lamp *la;
+ MTex *mtex;
+
+ switch(event) {
+ case B_LAMPREDRAW:
+ BIF_preview_changed(G.buts);
+ allqueue(REDRAWVIEW3D, 0);
+ break;
+ case B_TEXCLEARLAMP:
+ la= G.buts->lockpoin;
+ mtex= la->mtex[ la->texact ];
+ if(mtex) {
+ if(mtex->tex) mtex->tex->id.us--;
+ MEM_freeN(mtex);
+ la->mtex[ la->texact ]= 0;
+ allqueue(REDRAWBUTSLAMP, 0);
+ allqueue(REDRAWOOPS, 0);
+ BIF_preview_changed(G.buts);
+ }
+ break;
+ case B_SBUFF:
+ {
+ la= G.buts->lockpoin;
+ la->bufsize = la->bufsize&=(~15);
+ allqueue(REDRAWBUTSLAMP, 0);
+ allqueue(REDRAWOOPS, 0);
+ /*la->bufsize = la->bufsize % 64;*/
+ }
+ break;
+ }
+
+ if(event) freefastshade();
+}
+
+
+static void lamp_panel_mapto(Object *ob, Lamp *la)
+{
+ uiBlock *block;
+ MTex *mtex;
+
+ block= uiNewBlock(&curarea->uiblocks, "lamp_panel_mapto", UI_EMBOSSX, UI_HELV, curarea->win);
+ uiNewPanelTabbed("Texture and Input", "Lamp");
+ if(uiNewPanel(curarea, block, "Map To", "Lamp", 1280, 0, 318, 204)==0) return;
+
+ uiSetButLock(la->id.lib!=0, "Can't edit library data");
+
+ mtex= la->mtex[ la->texact ];
+ if(mtex==0) {
+ mtex= &emptytex;
+ default_mtex(mtex);
+ mtex->texco= TEXCO_VIEW;
+ }
+
+ /* TEXTURE OUTPUT */
+ uiDefButS(block, TOG|BIT|1, B_MATPRV, "Stencil", 920,114,52,18, &(mtex->texflag), 0, 0, 0, 0, "Set the mapping to stencil mode");
+ uiDefButS(block, TOG|BIT|2, B_MATPRV, "Neg", 974,114,38,18, &(mtex->texflag), 0, 0, 0, 0, "Apply the inverse of the texture");
+ uiDefButS(block, TOG|BIT|0, B_MATPRV, "RGBtoInt", 1014,114,69,18, &(mtex->texflag), 0, 0, 0, 0, "Use an RGB texture as an intensity texture");
+
+ uiDefButF(block, COL, B_MTEXCOL, "", 920,100,163,12, &(mtex->r), 0, 0, 0, 0, "");
+ uiDefButF(block, NUMSLI, B_MATPRV, "R ", 920,80,163,18, &(mtex->r), 0.0, 1.0, B_MTEXCOL, 0, "Set the red component of the intensity texture to blend with");
+ uiDefButF(block, NUMSLI, B_MATPRV, "G ", 920,60,163,18, &(mtex->g), 0.0, 1.0, B_MTEXCOL, 0, "Set the green component of the intensity texture to blend with");
+ uiDefButF(block, NUMSLI, B_MATPRV, "B ", 920,40,163,18, &(mtex->b), 0.0, 1.0, B_MTEXCOL, 0, "Set the blue component of the intensity texture to blend with");
+ uiDefButF(block, NUMSLI, B_MATPRV, "DVar ", 920,10,163,18, &(mtex->def_var), 0.0, 1.0, 0, 0, "Set the value the texture blends with");
+
+ /* MAP TO */
+ uiBlockSetCol(block, BUTGREEN);
+ uiDefButS(block, TOG|BIT|0, B_MATPRV, "Col", 1107,166,81,18, &(mtex->mapto), 0, 0, 0, 0, "Let the texture affect the colour of the lamp");
+
+ uiBlockSetCol(block, BUTGREY);
+ uiDefButS(block, ROW, B_MATPRV, "Blend", 1087,114,48,18, &(mtex->blendtype), 9.0, (float)MTEX_BLEND, 0, 0, "Mix the values");
+ uiDefButS(block, ROW, B_MATPRV, "Mul", 1136,114,44,18, &(mtex->blendtype), 9.0, (float)MTEX_MUL, 0, 0, "Multiply the values");
+ uiDefButS(block, ROW, B_MATPRV, "Add", 1182,114,41,18, &(mtex->blendtype), 9.0, (float)MTEX_ADD, 0, 0, "Add the values");
+ uiDefButS(block, ROW, B_MATPRV, "Sub", 1226,114,40,18, &(mtex->blendtype), 9.0, (float)MTEX_SUB, 0, 0, "Subtract the values");
+
+ uiDefButF(block, NUMSLI, B_MATPRV, "Col ", 1087,50,179,18, &(mtex->colfac), 0.0, 1.0, 0, 0, "Set the amount the texture affects the colour");
+ uiDefButF(block, NUMSLI, B_MATPRV, "Nor ", 1087,30,179,18, &(mtex->norfac), 0.0, 1.0, 0, 0, "Set the amount the texture affects the normal");
+ uiDefButF(block, NUMSLI, B_MATPRV, "Var ", 1087,10,179,18, &(mtex->varfac), 0.0, 1.0, 0, 0, "Set the amount the texture affects the value");
+
+}
+
+
+static void lamp_panel_texture(Object *ob, Lamp *la)
+{
+ uiBlock *block;
+ MTex *mtex;
+ ID *id;
+ int a, loos;
+ char *strp, str[64];
+
+ block= uiNewBlock(&curarea->uiblocks, "lamp_panel_texture", UI_EMBOSSX, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "Texture and Input", "Lamp", 960, 0, 318, 204)==0) return;
+
+ uiSetButLock(la->id.lib!=0, "Can't edit library data");
+
+ /* TEX CHANNELS */
+ uiBlockSetCol(block, BUTGREY);
+ for(a= 0; a<6; a++) {
+ mtex= la->mtex[a];
+ if(mtex && mtex->tex) splitIDname(mtex->tex->id.name+2, str, &loos);
+ else strcpy(str, "");
+ str[10]= 0;
+ uiDefButS(block, ROW, B_REDR, str, 10, 140-20*a, 80, 20, &(la->texact), 3.0, (float)a, 0, 0, "");
+ }
+
+ mtex= la->mtex[ la->texact ];
+ if(mtex==0) {
+ mtex= &emptytex;
+ default_mtex(mtex);
+ mtex->texco= TEXCO_VIEW;
+ }
+
+ /* TEXTUREBLOK SELECT */
+ id= (ID *)mtex->tex;
+ IDnames_to_pupstring(&strp, NULL, "ADD NEW %x 32767", &(G.main->tex), id, &(G.buts->texnr));
+
+ /* doesnt work, because lockpoin points to lamp, not to texture */
+ uiDefButS(block, MENU, B_LTEXBROWSE, strp, 100,140,20,19, &(G.buts->texnr), 0, 0, 0, 0, "Select an existing texture, or create new");
+ MEM_freeN(strp);
+
+ if(id) {
+ uiDefBut(block, TEX, B_IDNAME, "TE:", 100,160,163,19, id->name+2, 0.0, 18.0, 0, 0, "Name of the texture block");
+ sprintf(str, "%d", id->us);
+ uiDefBut(block, BUT, 0, str, 196,140,21,19, 0, 0, 0, 0, 0, "Select an existing texture, or create new");
+ uiDefIconBut(block, BUT, B_AUTOTEXNAME, ICON_AUTO, 241,140,21,19, 0, 0, 0, 0, 0, "Auto assign a name to the texture");
+ if(id->lib) {
+ if(la->id.lib) uiDefIconBut(block, BUT, 0, ICON_DATALIB, 219,140,21,19, 0, 0, 0, 0, 0, "");
+ else uiDefIconBut(block, BUT, 0, ICON_PARLIB, 219,140,21,19, 0, 0, 0, 0, 0, "");
+ }
+ uiBlockSetCol(block, BUTSALMON);
+ uiDefBut(block, BUT, B_TEXCLEARLAMP, "Clear", 122, 140, 72, 19, 0, 0, 0, 0, 0, "Erase link to texture");
+ uiBlockSetCol(block, BUTGREY);
+ }
+
+ /* TEXCO */
+ uiBlockSetCol(block, BUTGREEN);
+ uiDefButS(block, ROW, B_MATPRV, "Glob", 100,110,60,20, &(mtex->texco), 4.0, (float)TEXCO_GLOB, 0, 0, "Generate texture coordinates from global coordinates");
+ uiDefButS(block, ROW, B_MATPRV, "View", 160,110,70,20, &(mtex->texco), 4.0, (float)TEXCO_VIEW, 0, 0, "Generate texture coordinates from view coordinates");
+ uiDefButS(block, ROW, B_MATPRV, "Object", 230,110,70,20, &(mtex->texco), 4.0, (float)TEXCO_OBJECT, 0, 0, "Use linked object's coordinates for texture coordinates");
+ uiDefIDPoinBut(block, test_obpoin_but, B_MATPRV, "", 100,90,200,20, &(mtex->object), "");
+
+ uiBlockSetCol(block, BUTGREY);
+ uiDefButF(block, NUM, B_MATPRV, "dX", 100,50,100,18, mtex->ofs, -20.0, 20.0, 10, 0, "Set the extra translation of the texture coordinate");
+ uiDefButF(block, NUM, B_MATPRV, "dY", 100,30,100,18, mtex->ofs+1, -20.0, 20.0, 10, 0, "Set the extra translation of the texture coordinate");
+ uiDefButF(block, NUM, B_MATPRV, "dZ", 100,10,100,18, mtex->ofs+2, -20.0, 20.0, 10, 0, "Set the extra translation of the texture coordinate");
+ uiDefButF(block, NUM, B_MATPRV, "sizeX", 200,50,100,18, mtex->size, -10.0, 10.0, 10, 0, "Set the extra scaling of the texture coordinate");
+ uiDefButF(block, NUM, B_MATPRV, "sizeY", 200,30,100,18, mtex->size+1, -10.0, 10.0, 10, 0, "Set the extra scaling of the texture coordinate");
+ uiDefButF(block, NUM, B_MATPRV, "sizeZ", 200,10,100,18, mtex->size+2, -10.0, 10.0, 10, 0, "Set the extra scaling of the texture coordinate");
+
+}
+
+static void lamp_panel_spot(Object *ob, Lamp *la)
+{
+ uiBlock *block;
+ float grid=0.0;
+
+ block= uiNewBlock(&curarea->uiblocks, "lamp_panel_spot", UI_EMBOSSX, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "Spot", "Lamp", 640, 0, 318, 204)==0) return;
+
+ if(G.vd) grid= G.vd->grid;
+ if(grid<1.0) grid= 1.0;
+
+ uiSetButLock(la->id.lib!=0, "Can't edit library data");
+
+ uiBlockSetCol(block, BUTBLUE);
+ uiDefButS(block, TOG|BIT|0, REDRAWVIEW3D, "Shadows",10,150,80,19,&la->mode, 0, 0, 0, 0, "Let lamp produce shadows");
+ uiDefButS(block, TOG|BIT|5, 0,"OnlyShadow", 10,130,80,19,&la->mode, 0, 0, 0, 0, "Render shadow only");
+ uiDefButS(block, TOG|BIT|7, B_LAMPREDRAW,"Square", 10,90,80,19,&la->mode, 0, 0, 0, 0, "Use square spotbundles");
+ uiDefButS(block, TOG|BIT|1, 0,"Halo", 10,50,80,19,&la->mode, 0, 0, 0, 0, "Render spotlights with a volumetric halo");
+
+ uiBlockSetCol(block, BUTGREY);
+ uiDefButF(block, NUMSLI,B_LAMPREDRAW,"SpotSi ", 100,180,200,19,&la->spotsize, 1.0, 180.0, 0, 0, "Set the angle of the spot beam in degrees");
+ uiDefButF(block, NUMSLI,B_MATPRV,"SpotBl ", 100,160,200,19,&la->spotblend, 0.0, 1.0, 0, 0, "Set the softness of the spot edge");
+ uiDefButF(block, NUMSLI,0,"HaloInt ", 100,130,200,19,&la->haint, 0.0, 5.0, 0, 0, "Set the intensity of the spot halo");
+
+
+ uiDefButS(block, NUMSLI,B_SBUFF,"ShadowBuffSize:", 100,110,200,19, &la->bufsize,512,5120, 0, 0, "Set the size of the shadow buffer");
+
+ uiDefButF(block, NUM,REDRAWVIEW3D,"ClipSta:", 100,70,100,19, &la->clipsta, 0.1*grid,1000.0*grid, 10, 0, "Set the shadow map clip start");
+ uiDefButF(block, NUM,REDRAWVIEW3D,"ClipEnd:", 200,70,100,19,&la->clipend, 1.0, 5000.0*grid, 100, 0, "Set the shadow map clip end");
+
+ uiDefButS(block, NUM,0,"Samples:", 100,30,100,19, &la->samp,1.0,16.0, 0, 0, "Number of shadow map samples");
+ uiDefButS(block, NUM,0,"Halo step:", 200,30,100,19, &la->shadhalostep, 0.0, 12.0, 0, 0, "Volumetric halo sampling frequency");
+ uiDefButF(block, NUM,0,"Bias:", 100,10,100,19, &la->bias, 0.01, 5.0, 1, 0, "Shadow map sampling bias");
+ uiDefButF(block, NUM,0,"Soft:", 200,10,100,19, &la->soft,1.0,100.0, 100, 0, "Set the size of the shadow sample area");
+
+
+}
+
+
+static void lamp_panel_lamp(Object *ob, Lamp *la)
+{
+ uiBlock *block;
+ ID *id, *idfrom;
+ float grid= 0.0;
+ short xco;
+
+ block= uiNewBlock(&curarea->uiblocks, "lamp_panel_lamp", UI_EMBOSSX, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "Lamp", "Lamp", 320, 0, 318, 204)==0) return;
+
+ if(G.vd) grid= G.vd->grid;
+ if(grid<1.0) grid= 1.0;
+
+ uiSetButLock(la->id.lib!=0, "Can't edit library data");
+
+ /* first do the browse but */
+ buttons_active_id(&id, &idfrom);
+
+ uiBlockSetCol(block, BUTPURPLE);
+ xco= std_libbuttons(block, 8, 180, 0, NULL, B_LAMPBROWSE, id, (ID *)ob, &(G.buts->menunr), B_LAMPALONE, B_LAMPLOCAL, 0, 0, 0);
+
+ uiBlockSetCol(block, BUTGREY);
+ uiDefButF(block, NUM,B_LAMPREDRAW,"Dist:",xco+10,180,104,20,&la->dist, 0.01, 5000.0, 100, 0, "Set the distance value");
+
+ uiBlockSetCol(block, BUTBLUE);
+ uiDefButS(block, TOG|BIT|3, B_MATPRV,"Quad", 10,150,100,19,&la->mode, 0, 0, 0, 0, "Use inverse quadratic proportion");
+ uiDefButS(block, TOG|BIT|6, REDRAWVIEW3D,"Sphere", 10,130,100,19,&la->mode, 0, 0, 0, 0, "Lamp only shines inside a sphere");
+ uiDefButS(block, TOG|BIT|2, 0,"Layer", 10,90,100,19,&la->mode, 0, 0, 0, 0, "Illuminate objects in the same layer only");
+ uiDefButS(block, TOG|BIT|4, B_MATPRV,"Negative", 10,70,100,19,&la->mode, 0, 0, 0, 0, "Cast negative light");
+ uiDefButS(block, TOG|BIT|11, 0,"No Diffuse", 10,30,100,19,&la->mode, 0, 0, 0, 0, "No diffuse shading of material");
+ uiDefButS(block, TOG|BIT|12, 0,"No Specular", 10,10,100,19,&la->mode, 0, 0, 0, 0, "No specular shading of material");
+
+
+ uiBlockSetCol(block, BUTGREY);
+ uiDefButF(block, NUMSLI,B_MATPRV,"Energy ", 120,150,180,20, &(la->energy), 0.0, 10.0, 0, 0, "Set the intensity of the light");
+
+ uiDefButF(block, NUMSLI,B_MATPRV,"R ", 120,120,180,20,&la->r, 0.0, 1.0, B_COLLAMP, 0, "Set the red component of the light");
+ uiDefButF(block, NUMSLI,B_MATPRV,"G ", 120,100,180,20,&la->g, 0.0, 1.0, B_COLLAMP, 0, "Set the green component of the light");
+ uiDefButF(block, NUMSLI,B_MATPRV,"B ", 120,80,180,20,&la->b, 0.0, 1.0, B_COLLAMP, 0, "Set the blue component of the light");
+ uiDefButF(block, COL, B_COLLAMP, "", 120,55,180,24, &la->r, 0, 0, 0, 0, "");
+
+ uiDefButF(block, NUMSLI,B_MATPRV,"Quad1 ", 120,30,180,19,&la->att1, 0.0, 1.0, 0, 0, "Set the light intensity value 1 for a quad lamp");
+ uiDefButF(block, NUMSLI,B_MATPRV,"Quad2 ", 120,10,180,19,&la->att2, 0.0, 1.0, 0, 0, "Set the light intensity value 2 for a quad lamp");
+
+}
+
+
+static void lamp_panel_preview(Object *ob, Lamp *la)
+{
+ uiBlock *block;
+
+ /* name "Preview" is abused to detect previewrender offset panel */
+ block= uiNewBlock(&curarea->uiblocks, "lamp_panel_preview", UI_EMBOSSX, UI_HELV, curarea->win);
+ if(uiNewPanel(curarea, block, "Preview", "Lamp", 0, 0, 318, 204)==0) return;
+
+ uiSetButLock(la->id.lib!=0, "Can't edit library data");
+
+ 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);
+ uiDefButS(block, ROW,B_LAMPREDRAW,"Lamp", 200,175,80,25,&la->type,1.0,(float)LA_LOCAL, 0, 0, "Use a point light source");
+ uiDefButS(block, ROW,B_LAMPREDRAW,"Spot", 200,150,80,25,&la->type,1.0,(float)LA_SPOT, 0, 0, "Restrict lamp to conical space");
+ uiDefButS(block, ROW,B_LAMPREDRAW,"Sun", 200,125,80,25,&la->type,1.0,(float)LA_SUN, 0, 0, "Light shines from constant direction");
+ uiDefButS(block, ROW,B_LAMPREDRAW,"Hemi", 200,100,80,25,&la->type,1.0,(float)LA_HEMI, 0, 0, "Light shines as half a sphere");
+
+}
+
+
+/* ****************** MATERIAL ***************** */
+
void do_matbuts(unsigned short event)
{
static short mtexcopied=0;
@@ -162,7 +678,7 @@ void do_matbuts(unsigned short event)
}
}
-void material_panel_map_to(Material *ma)
+static void material_panel_map_to(Material *ma)
{
uiBlock *block;
MTex *mtex;
@@ -228,7 +744,7 @@ void material_panel_map_to(Material *ma)
}
-void material_panel_map_input(Material *ma)
+static void material_panel_map_input(Material *ma)
{
uiBlock *block;
MTex *mtex;
@@ -290,7 +806,7 @@ void material_panel_map_input(Material *ma)
}
-void material_panel_texture(Material *ma)
+static void material_panel_texture(Material *ma)
{
uiBlock *block;
MTex *mtex;
@@ -352,7 +868,7 @@ void material_panel_texture(Material *ma)
}
-void material_panel_shading(Material *ma)
+static void material_panel_shading(Material *ma)
{
uiBlock *block;
@@ -442,7 +958,7 @@ void material_panel_shading(Material *ma)
}
-void material_panel_material(Object *ob, Material *ma)
+static void material_panel_material(Object *ob, Material *ma)
{
uiBlock *block;
ID *id, *idn, *idfrom;
@@ -457,7 +973,6 @@ void material_panel_material(Object *ob, Material *ma)
/* first do the browse but */
buttons_active_id(&id, &idfrom);
-
uiBlockSetCol(block, BUTPURPLE);
xco= std_libbuttons(block, 8, 200, 0, NULL, B_MATBROWSE, id, idfrom, &(G.buts->menunr), B_MATALONE, B_MATLOCAL, B_MATDELETE, B_AUTOMATNAME, B_KEEPDATA);
@@ -563,7 +1078,7 @@ void material_panel_material(Object *ob, Material *ma)
}
-void material_panel_preview(Material *ma)
+static void material_panel_preview(Material *ma)
{
uiBlock *block;
@@ -609,6 +1124,36 @@ void material_panels()
}
}
+void lamp_panels()
+{
+ Object *ob= OBACT;
+
+ if(ob==NULL || ob->type!= OB_LAMP) return;
+
+ lamp_panel_preview(ob, ob->data);
+ lamp_panel_lamp(ob, ob->data);
+ lamp_panel_spot(ob, ob->data);
+ lamp_panel_texture(ob, ob->data);
+ lamp_panel_mapto(ob, ob->data);
+
+}
+
+void world_panels()
+{
+ World *wrld;
+
+ wrld= G.scene->world;
+
+ world_panel_preview(wrld);
+ world_panel_world(wrld);
+
+ if(wrld) {
+ world_panel_mistaph(wrld);
+ world_panel_texture(wrld);
+ world_panel_mapto(wrld);
+ }
+}
+
\ No newline at end of file
diff --git a/source/blender/src/editscreen.c b/source/blender/src/editscreen.c
index c51dbcd8e2a..7384278da93 100644
--- a/source/blender/src/editscreen.c
+++ b/source/blender/src/editscreen.c
@@ -972,8 +972,12 @@ void screenmain(void)
set_cursor(newactarea->cursor);
g_activearea= newactarea;
}
-
+ /* when you move mouse from header to window, buttons can remain hilited otherwise */
+ if(newactwin != G.curscreen->winakt) {
+ if (g_activearea) scrarea_queue_headredraw(g_activearea);
+ }
G.curscreen->winakt= newactwin;
+
if (G.curscreen->winakt) {
areawinset(G.curscreen->winakt);
set_cursor(choose_cursor(g_activearea));
diff --git a/source/blender/src/header_buttonswin.c b/source/blender/src/header_buttonswin.c
index ff442ddf66e..07777e6b28e 100644
--- a/source/blender/src/header_buttonswin.c
+++ b/source/blender/src/header_buttonswin.c
@@ -452,29 +452,10 @@ void buts_buttons(void)
G.buts->lockpoin= id;
if(G.buts->mainb==CONTEXT_SHADING) {
+#if 0
int tab= G.buts->tab[CONTEXT_SHADING];
if(tab==TAB_SHADING_MAT) {
-#if 0
-moved to buttonswin!
-
- if(ob && (ob->type<OB_LAMP) && ob->type) {
- xco= std_libbuttons(block, xco, 0, 0, NULL, B_MATBROWSE, id, idfrom, &(G.buts->menunr), B_MATALONE, B_MATLOCAL, B_MATDELETE, B_AUTOMATNAME, B_KEEPDATA);
- }
-
- /* COPY PASTE */
- if(curarea->headertype==HEADERTOP) {
- uiDefIconBut(block, BUT, B_MATCOPY, ICON_COPYUP, xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Copies Material to the buffer");
- uiSetButLock(id && id->lib, "Can't edit library data");
- uiDefIconBut(block, BUT, B_MATPASTE, ICON_PASTEUP, xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Pastes Material from the buffer");
- }
- else {
- uiDefIconBut(block, BUT, B_MATCOPY, ICON_COPYDOWN, xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Copies Material to the buffer");
- uiSetButLock(id && id->lib, "Can't edit library data");
- uiDefIconBut(block, BUT, B_MATPASTE, ICON_PASTEDOWN, xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Pastes Material from the buffer");
- }
- xco+=XIC;
-#endif
}
else if(tab==TAB_SHADING_TEX) {
if(G.buts->texfrom==0) {
@@ -501,6 +482,7 @@ moved to buttonswin!
else if(tab==TAB_SHADING_WORLD) {
xco= std_libbuttons(block, xco, 0, 0, NULL, B_WORLDBROWSE, id, idfrom, &(G.buts->menunr), B_WORLDALONE, B_WORLDLOCAL, B_WORLDDELETE, 0, B_KEEPDATA);
}
+#endif
}
else if(G.buts->mainb==CONTEXT_EDITING) {
diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c
index 1b5e2246a63..4da6bc34b61 100644
--- a/source/blender/src/interface.c
+++ b/source/blender/src/interface.c
@@ -4723,15 +4723,16 @@ static int ui_do_block(uiBlock *block, uiEvent *uevent)
}
else if(but->type==BLOCK || but->type==MENU) { // automatic opens block button (pulldown)
int time;
- if(uevent->event!=LEFTMOUSE) {
- if(block->auto_open) time= 14;
- else time= 0;
+ if(uevent->event!=LEFTMOUSE ) {
+ if(block->auto_open) time= 5*U.menuthreshold2;
+ else if(U.uiflag & MENUOPENAUTO) time= 5*U.menuthreshold1;
+ else time= -1;
- for (; time<20; time++) {
+ for (; time>0; time--) {
if (anyqtest()) break;
else PIL_sleep_ms(20);
}
- if(time==20) ui_do_button(block, but, uevent);
+ if(time==0) ui_do_button(block, but, uevent);
}
}
if(but->flag & UI_ACTIVE) active= 1;
diff --git a/source/blender/src/previewrender.c b/source/blender/src/previewrender.c
index f1c28601103..318b61d0785 100644
--- a/source/blender/src/previewrender.c
+++ b/source/blender/src/previewrender.c
@@ -331,9 +331,8 @@ void BIF_previewdraw(void)
set_previewrect(sbuts->area->win, PR_XMIN, PR_YMIN, PR_XMAX, PR_YMAX);
- if (sbuts->rect==0 || sbuts->cury==0) {
- BIF_preview_changed(sbuts);
- } else {
+ if (sbuts->rect==0) BIF_preview_changed(sbuts);
+ else {
int y;
for (y=0; y<PR_RECTY; y++) {
@@ -344,7 +343,7 @@ void BIF_previewdraw(void)
draw_tex_crop(sbuts->lockpoin);
}
}
-
+ if(sbuts->cury==0) BIF_preview_changed(sbuts);
}
static void sky_preview_pixel(float lens, int x, int y, char *rect)
@@ -1098,9 +1097,10 @@ void BIF_previewrender(SpaceButs *sbuts)
draw_tex_crop(sbuts->lockpoin);
glDrawBuffer(GL_BACK);
- uiPanelPop(block);
-
+ /* draw again for clean swapbufers */
BIF_previewdraw();
+
+ uiPanelPop(block);
if(mat) {
end_render_material(mat);
diff --git a/source/blender/src/space.c b/source/blender/src/space.c
index 59e04af5b9a..3050fcbe57d 100644
--- a/source/blender/src/space.c
+++ b/source/blender/src/space.c
@@ -1476,7 +1476,7 @@ void drawinfospace(ScrArea *sa, void *spacedata)
if(curarea->win==0) return;
- glClearColor(0.5, 0.5, 0.5, 0.0);
+ glClearColor(0.6, 0.6, 0.6, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
fac= ((float)curarea->winx)/1280.0;
@@ -1581,17 +1581,40 @@ void drawinfospace(ScrArea *sa, void *spacedata)
&(U.flag), 0, 0, 0, 0,
"Move objects to grid units");
+ uiDefButS(block, TOG|BIT|3, 0, "Size",
+ (xpos+edgespace+medprefbut+midspace),y1,smallprefbut,buth,
+ &(U.flag), 0, 0, 0, 0,
+ "Scale objects to grid units");
+
uiDefButS(block, TOG|BIT|2, 0, "Rotate",
(xpos+edgespace+medprefbut+(2*midspace)+smallprefbut),y2,smallprefbut,buth,
&(U.flag), 0, 0, 0, 0,
"Rotate objects to grid units");
- uiDefButS(block, TOG|BIT|3, 0, "Size",
+
+
+ uiBlockSetCol(block, BUTGREEN);
+
+ uiDefBut(block, LABEL,0,"Menu Buttons:",
+ (xpos+edgespace+medprefbut+(3*midspace)+(2*smallprefbut)),y3label,medprefbut,buth,
+ 0, 0, 0, 0, 0, "");
+
+ uiDefButS(block, TOG|BIT|9, 0, "Auto Open",
(xpos+edgespace+medprefbut+(3*midspace)+(2*smallprefbut)),y2,smallprefbut,buth,
- &(U.flag), 0, 0, 0, 0,
- "Scale objects to grid units");
+ &(U.uiflag), 0, 0, 0, 0,
+ "Automatic opening of menu buttons");
+ uiBlockSetCol(block, BUTGREY);
+
+ uiDefButS(block, NUM, 0, "ThresA:",
+ (xpos+edgespace+medprefbut+(3*midspace)+(2*smallprefbut)),y1,smallprefbut,buth,
+ &(U.menuthreshold1), 1, 40, 0, 0,
+ "Time in 1/10 seconds for auto open");
+ uiDefButS(block, NUM, 0, "ThresB:",
+ (xpos+edgespace+medprefbut+(4*midspace)+(3*smallprefbut)),y1,smallprefbut,buth,
+ &(U.menuthreshold2), 1, 40, 0, 0,
+ "Time in 1/10 seconds for auto open sublevels");
uiBlockSetCol(block, BUTGREEN);
@@ -2047,7 +2070,6 @@ void winqreadbutspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
if (nr>=0) {
sbuts->align= nr;
if(nr) {
- //uiAnimatePanels(sa);
uiAlignPanelStep(sa, 1.0);
do_buts_buttons(B_BUTSHOME);
}
@@ -2173,12 +2195,19 @@ void extern_set_butspace(int fkey)
sbuts= sa->spacedata.first;
if(fkey==F4KEY) {
- sbuts->mainb= CONTEXT_SHADING;
- sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_LAMP;
+ sbuts->mainb= CONTEXT_LOGIC;
}
else if(fkey==F5KEY) {
sbuts->mainb= CONTEXT_SHADING;
- sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_MAT;
+ if(OBACT) {
+ if(OBACT->type==OB_CAMERA)
+ sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_WORLD;
+ else if(OBACT->type==OB_LAMP)
+ sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_LAMP;
+ else
+ sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_MAT;
+ }
+ else sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_MAT;
}
else if(fkey==F6KEY) {
sbuts->mainb= CONTEXT_SHADING;