diff options
author | Ton Roosendaal <ton@blender.org> | 2003-10-12 23:46:17 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2003-10-12 23:46:17 +0400 |
commit | f729cbdf52e2463161321b89e7e34290f442e89e (patch) | |
tree | e293e5c842ed3b857a96753bd0d5f30d41e398ac | |
parent | e4d86c85c3d4614b3ff251cca4fcc48967b18bde (diff) |
- added radiobuttons
- cleaned unused calls and defines
-rw-r--r-- | source/blender/include/BIF_interface.h | 7 | ||||
-rw-r--r-- | source/blender/include/butspace.h | 2 | ||||
-rw-r--r-- | source/blender/src/butspace.c | 4 | ||||
-rw-r--r-- | source/blender/src/buttons.txt | 529 | ||||
-rw-r--r-- | source/blender/src/buttons_object.c | 9 | ||||
-rw-r--r-- | source/blender/src/buttons_shading.c | 242 | ||||
-rw-r--r-- | source/blender/src/header_sound.c | 1 | ||||
-rw-r--r-- | source/blender/src/interface.c | 12 |
8 files changed, 257 insertions, 549 deletions
diff --git a/source/blender/include/BIF_interface.h b/source/blender/include/BIF_interface.h index 5cc4e0decf9..8f65505443f 100644 --- a/source/blender/include/BIF_interface.h +++ b/source/blender/include/BIF_interface.h @@ -144,16 +144,15 @@ short pupmenu_col(char *instr, int maxrow); extern void uiFreePanels(struct ListBase *lb); extern void uiNewPanelTabbed(char *, char *); extern int uiNewPanel(struct ScrArea *sa, struct uiBlock *block, char *panelname, char *tabname, int ofsx, int ofsy, int sizex, int sizey); -extern void uiScalePanelBlock(struct uiBlock *block); -extern int uiIsPanelClosed(struct uiBlock *block); -extern void uiAnimatePanels(struct ScrArea *sa); + extern void uiSetPanel_view2d(struct ScrArea *sa); +extern void uiMatchPanel_view2d(struct ScrArea *sa); + extern void uiDrawBlocksPanels(struct ScrArea *sa, int re_align); extern void uiNewPanelHeight(struct uiBlock *block, int sizey); void uiPanelPush(uiBlock *block); void uiPanelPop(uiBlock *block); extern uiBlock *uiFindOpenPanelBlockName(ListBase *lb, char *name); -extern void uiMatchPanel_view2d(struct ScrArea *sa); extern int uiAlignPanelStep(struct ScrArea *sa, float fac); diff --git a/source/blender/include/butspace.h b/source/blender/include/butspace.h index 570403ae6a9..6247dbd97ac 100644 --- a/source/blender/include/butspace.h +++ b/source/blender/include/butspace.h @@ -79,6 +79,8 @@ extern void lamp_panels(void); extern void do_lampbuts(unsigned short event); extern void world_panels(void); extern void do_worldbuts(unsigned short event); +extern void radio_panels(void); +extern void do_radiobuts(unsigned short event); /* logic */ extern void do_logic_buts(unsigned short event); diff --git a/source/blender/src/butspace.c b/source/blender/src/butspace.c index e8eef1e6130..067f5af40c7 100644 --- a/source/blender/src/butspace.c +++ b/source/blender/src/butspace.c @@ -299,7 +299,7 @@ void do_butspace(unsigned short event) do_fpaintbuts(event); } else if(event<=B_RADIOBUTS) { - //do_radiobuts(event); + do_radiobuts(event); } else if(event<=B_SCRIPTBUTS) { //do_scriptbuts(event); @@ -408,6 +408,8 @@ void drawbutspace(ScrArea *sa, void *spacedata) lamp_panels(); else if(tab==TAB_SHADING_WORLD) world_panels(); + else if(tab==TAB_SHADING_RAD) + radio_panels(); break; diff --git a/source/blender/src/buttons.txt b/source/blender/src/buttons.txt index c300c5066e4..c11ff2d3795 100644 --- a/source/blender/src/buttons.txt +++ b/source/blender/src/buttons.txt @@ -571,8 +571,7 @@ enum { static char *physics_pup(void) { /* the number needs to match defines in KX_PhysicsBlenderSceneConverter.cpp */ - return "Physics %t|None %x1|Sumo %x2|" - "ODE %x3 |Dynamo %x4|"; + return ; } @@ -597,532 +596,6 @@ static int packdummy = 0; // Bish made it to here. (reviewing tooltips) -/* *************************** RADIO ******************************** */ - -void do_radiobuts(short event) -{ - Radio *rad; - int phase; - - phase= rad_phase(); - rad= G.scene->radio; - - switch(event) { - case B_RAD_ADD: - add_radio(); - allqueue(REDRAWBUTSRADIO, 0); - allqueue(REDRAWVIEW3D, 0); - break; - case B_RAD_DELETE: - delete_radio(); - allqueue(REDRAWBUTSRADIO, 0); - allqueue(REDRAWVIEW3D, 0); - break; - case B_RAD_FREE: - freeAllRad(); - allqueue(REDRAWBUTSRADIO, 0); - allqueue(REDRAWVIEW3D, 0); - break; - case B_RAD_COLLECT: - rad_collect_meshes(); - allqueue(REDRAWBUTSRADIO, 0); - allqueue(REDRAWVIEW3D, 0); - break; - case B_RAD_INIT: - if(phase==RAD_PHASE_PATCHES) { - rad_limit_subdivide(); - allqueue(REDRAWBUTSRADIO, 0); - allqueue(REDRAWVIEW3D, 0); - } - break; - case B_RAD_SHOOTP: - if(phase==RAD_PHASE_PATCHES) { - waitcursor(1); - rad_subdivshootpatch(); - allqueue(REDRAWBUTSRADIO, 0); - allqueue(REDRAWVIEW3D, 0); - waitcursor(0); - } - break; - case B_RAD_SHOOTE: - if(phase==RAD_PHASE_PATCHES) { - waitcursor(1); - rad_subdivshootelem(); - allqueue(REDRAWBUTSRADIO, 0); - allqueue(REDRAWVIEW3D, 0); - waitcursor(0); - } - break; - case B_RAD_GO: - if(phase==RAD_PHASE_PATCHES) { - waitcursor(1); - rad_go(); - waitcursor(0); - allqueue(REDRAWBUTSRADIO, 0); - allqueue(REDRAWVIEW3D, 0); - } - break; - case B_RAD_LIMITS: - rad_setlimits(); - allqueue(REDRAWVIEW3D, 0); - allqueue(REDRAWBUTSRADIO, 0); - break; - case B_RAD_FAC: - set_radglobal(); - if(phase & RAD_PHASE_FACES) make_face_tab(); - else make_node_display(); - allqueue(REDRAWVIEW3D, 0); - break; - case B_RAD_NODELIM: - if(phase & RAD_PHASE_FACES) { - set_radglobal(); - removeEqualNodes(rad->nodelim); - make_face_tab(); - allqueue(REDRAWVIEW3D, 0); - allqueue(REDRAWBUTSRADIO, 0); - } - break; - case B_RAD_NODEFILT: - if(phase & RAD_PHASE_FACES) { - set_radglobal(); - filterNodes(); - make_face_tab(); - allqueue(REDRAWVIEW3D, 0); - } - break; - case B_RAD_FACEFILT: - if(phase & RAD_PHASE_FACES) { - filterFaces(); - allqueue(REDRAWVIEW3D, 0); - } - break; - case B_RAD_DRAW: - set_radglobal(); - allqueue(REDRAWVIEW3D, 0); - break; - case B_RAD_ADDMESH: - if(phase & RAD_PHASE_FACES) rad_addmesh(); - allqueue(REDRAWVIEW3D, 0); - break; - case B_RAD_REPLACE: - if(phase & RAD_PHASE_FACES) rad_replacemesh(); - allqueue(REDRAWVIEW3D, 0); - break; - } - -} - - -void radiobuts(void) -{ - Radio *rad; - uiBlock *block; - int flag; - char str[128]; - - rad= G.scene->radio; - if(rad==0) { - add_radio(); - rad= G.scene->radio; - } - - sprintf(str, "buttonswin %d", curarea->win); - block= uiNewBlock(&curarea->uiblocks, str, UI_EMBOSSX, UI_HELV, curarea->win); - - flag= rad_phase(); - - if(flag & RAD_PHASE_PATCHES) { - uiBlockSetCol(block, BUTSALMON); - uiDefBut(block, BUT, B_RAD_INIT, "Limit Subdivide", 10, 70, 190, 40, NULL, 0, 0, 0, 0, "Subdivide patches"); - } - if(flag & RAD_PHASE_PATCHES) uiBlockSetCol(block, BUTPURPLE); - else uiBlockSetCol(block, BUTSALMON); - uiDefBut(block, BUT, B_RAD_COLLECT, "Collect Meshes", 10, 30, 190, 40, NULL, 0, 0, 0, 0, "Convert selected and visible meshes to patches"); - uiDrawBlock(block); - - if(flag==0) { - - sprintf(str, "buttonswin1 %d", curarea->win); - block= uiNewBlock(&curarea->uiblocks, str, UI_EMBOSSX, UI_HELV, curarea->win); - uiAutoBlock(block, 210, 30, 230, 150, UI_BLOCK_ROWS); - uiBlockSetCol(block, BUTGREY); - uiDefButS(block, NUM, B_RAD_LIMITS, "Hemires:", 0, 0, 10, 10, &rad->hemires, 100.0, 1000.0, 100, 0, "Set the size of a hemicube"); - uiDefButS(block, NUM, 0, "Max Iterations:", 1, 0, 10, 10, &rad->maxiter, 0.0, 10000.0, 0, 0, "Maximum number of radiosity rounds"); - uiDefButF(block, NUM, B_RAD_FAC, "Mult:", 2, 0, 50, 10, &rad->radfac, 0.001, 250.0, 100, 0, "Mulitply the energy values"); - uiDefButF(block, NUM, B_RAD_FAC, "Gamma:", 2, 0, 50, 10, &rad->gamma, 0.2, 10.0, 10, 0, "Change the contrast of the energy values"); - uiDefButF(block, NUM, 0, "Convergence:", 3, 0, 10, 10, &rad->convergence, 0.0, 1.0, 10, 0, "Set the lower threshold of unshot energy"); - uiDrawBlock(block); - } - else { - - - sprintf(str, "buttonswin1 %d", curarea->win); - block= uiNewBlock(&curarea->uiblocks, str, UI_EMBOSSX, UI_HELV, curarea->win); - uiAutoBlock(block, 210, 30, 230, 150, UI_BLOCK_ROWS); - - uiBlockSetCol(block, BUTGREEN); - uiDefButS(block, ROW, B_RAD_DRAW, "Wire", 0, 0, 10, 10, &rad->drawtype, 0.0, 0.0, 0, 0, "Enable wireframe drawmode"); - uiDefButS(block, ROW, B_RAD_DRAW, "Solid", 0, 0, 10, 10, &rad->drawtype, 0.0, 1.0, 0, 0, "Enable solid drawmode"); - uiDefButS(block, ROW, B_RAD_DRAW, "Gour", 0, 0, 10, 10, &rad->drawtype, 0.0, 2.0, 0, 0, "Enable Gourad drawmode"); - uiBlockSetCol(block, BUTGREY); - uiDefButS(block, TOG|BIT|0, B_RAD_DRAW, "ShowLim", 1, 0, 10, 10, &rad->flag, 0, 0, 0, 0, "Visualize patch and element limits"); - uiDefButS(block, TOG|BIT|1, B_RAD_DRAW, "Z", 1, 0, 3, 10, &rad->flag, 0, 0, 0, 0, "Draw limits different"); - uiBlockSetCol(block, BUTGREY); - uiDefButS(block, NUM, B_RAD_LIMITS, "ElMax:", 2, 0, 10, 10, &rad->elma, 1.0, 500.0, 0, 0, "Set maximum size of an element"); - uiDefButS(block, NUM, B_RAD_LIMITS, "ElMin:", 2, 0, 10, 10, &rad->elmi, 1.0, 100.0, 0, 0, "Set minimum size of an element"); - uiDefButS(block, NUM, B_RAD_LIMITS, "PaMax:", 3, 0, 10, 10, &rad->pama, 10.0, 1000.0, 0, 0, "Set maximum size of a patch"); - uiDefButS(block, NUM, B_RAD_LIMITS, "PaMin:", 3, 0, 10, 10, &rad->pami, 10.0, 1000.0, 0, 0, "Set minimum size of a patch"); - uiDrawBlock(block); - - sprintf(str, "buttonswin2 %d", curarea->win); - block= uiNewBlock(&curarea->uiblocks, str, UI_EMBOSSX, UI_HELV, curarea->win); - uiAutoBlock(block, 450, 30, 180, 150, UI_BLOCK_ROWS); - - if(flag == RAD_PHASE_PATCHES) uiBlockSetCol(block, BUTSALMON); - else uiBlockSetCol(block, BUTGREY); - uiDefBut(block, BUT, B_RAD_SHOOTE, "Subdiv Shoot Element", 0, 0, 12, 10, NULL, 0, 0, 0, 0, ""); - uiDefBut(block, BUT, B_RAD_SHOOTP, "Subdiv Shoot Patch", 1, 0, 12, 10, NULL, 0, 0, 0, 0, "Detect high energy changes"); - uiBlockSetCol(block, BUTGREY); - uiDefButS(block, NUM, 0, "Max Subdiv Shoot:", 2, 0, 10, 10, &rad->maxsublamp, 1.0, 250.0, 0, 0, "Set the maximum number of shoot patches that are evaluated"); - uiDefButI(block, NUM, 0, "MaxEl:", 3, 0, 10, 10, &rad->maxnode, 1.0, 250000.0, 0, 0, "Set the maximum allowed number of elements"); - uiDefButS(block, NUM, B_RAD_LIMITS, "Hemires:", 4, 0, 10, 10, &rad->hemires, 100.0, 1000.0, 100, 0, "Set the size of a hemicube"); - uiDrawBlock(block); - - sprintf(str, "buttonswin3 %d", curarea->win); - block= uiNewBlock(&curarea->uiblocks, str, UI_EMBOSSX, UI_HELV, curarea->win); - uiAutoBlock(block, 640, 30, 200, 150, UI_BLOCK_ROWS); - - uiBlockSetCol(block, BUTGREY); - uiDefButS(block, NUM, 0, "Max Iterations:", 0, 0, 10, 10, &rad->maxiter, 0.0, 10000.0, 0, 0, "Maximum number of radiosity rounds"); - uiDefButF(block, NUM, 0, "Convergence:", 1, 0, 10, 10, &rad->convergence, 0.0, 1.0, 10, 0, "Set the lower threshold of unshot energy"); - uiDefButS(block, NUM, 0, "SubSh P:", 2, 0, 10, 10, &rad->subshootp, 0.0, 10.0, 0, 0, "Set the number of times the environment is tested to detect pathes"); - uiDefButS(block, NUM, 0, "SubSh E:", 2, 0, 10, 10, &rad->subshoote, 0.0, 10.0, 0, 0, "Set the number of times the environment is tested to detect elements"); - if(flag == RAD_PHASE_PATCHES) uiBlockSetCol(block, BUTSALMON); - uiDefBut(block, BUT, B_RAD_GO, "GO", 3, 0, 10, 15, NULL, 0, 0, 0, 0, "Start the radiosity simulation"); - uiDrawBlock(block); - - sprintf(str, "buttonswin4 %d", curarea->win); - block= uiNewBlock(&curarea->uiblocks, str, UI_EMBOSSX, UI_HELV, curarea->win); - uiAutoBlock(block, 850, 30, 200, 150, UI_BLOCK_ROWS); - - uiBlockSetCol(block, BUTGREY); - uiDefButF(block, NUM, B_RAD_FAC, "Mult:", 0, 0, 50, 17, &rad->radfac, 0.001, 250.0, 100, 0, "Mulitply the energy values"); - uiDefButF(block, NUM, B_RAD_FAC, "Gamma:", 0, 0, 50, 17, &rad->gamma, 0.2, 10.0, 10, 0, "Change the contrast of the energy values"); - if(flag & RAD_PHASE_FACES) uiBlockSetCol(block, BUTSALMON); - else uiBlockSetCol(block, BUTGREY); - uiDefBut(block, BUT, B_RAD_FACEFILT, "FaceFilter", 1, 0, 10, 10, NULL, 0, 0, 0, 0, "Force an extra smoothing"); - if(flag & RAD_PHASE_FACES) uiBlockSetCol(block, BUTSALMON); - else uiBlockSetCol(block, BUTGREY); - uiDefBut(block, BUT, B_RAD_NODELIM, "RemoveDoubles", 2, 0, 30, 10, NULL, 0.0, 50.0, 0, 0, "Join elements which differ less than 'Lim'"); - uiBlockSetCol(block, BUTGREY); - uiDefButS(block, NUM, 0, "Lim:", 2, 0, 10, 10, &rad->nodelim, 0.0, 50.0, 0, 0, "Set the range for removing doubles"); - if(flag & RAD_PHASE_FACES) uiBlockSetCol(block, BUTSALMON); - else uiBlockSetCol(block, BUTGREY); - uiDefBut(block, BUT, B_RAD_NODEFILT, "Element Filter", 3, 0, 10, 10, NULL, 0, 0, 0, 0, "Filter elements to remove aliasing artefacts"); - uiDrawBlock(block); - - sprintf(str, "buttonswin5 %d", curarea->win); - block= uiNewBlock(&curarea->uiblocks, str, UI_EMBOSSX, UI_HELV, curarea->win); - uiAutoBlock(block, 1060, 30, 190, 150, UI_BLOCK_ROWS); - - if(flag & RAD_PHASE_PATCHES) uiBlockSetCol(block, BUTSALMON); - else uiBlockSetCol(block, BUTGREY); - uiDefBut(block, BUT, B_RAD_FREE, "Free Radio Data", 0, 0, 10, 10, NULL, 0, 0, 0, 0, "Release all memory used by Radiosity"); - if(flag & RAD_PHASE_FACES) uiBlockSetCol(block, BUTSALMON); - else uiBlockSetCol(block, BUTGREY); - uiDefBut(block, BUT, B_RAD_REPLACE, "Replace Meshes", 1, 0, 10, 10, NULL, 0, 0, 0, 0, "Convert meshes to Mesh objects with vertex colours, changing input-meshes"); - uiDefBut(block, BUT, B_RAD_ADDMESH, "Add new Meshes", 2, 0, 10, 10, NULL, 0, 0, 0, 0, "Convert meshes to Mesh objects with vertex colours, unchanging input-meshes"); - uiDrawBlock(block); - - rad_status_str(str); - cpack(0); - glRasterPos2i(210, 189); - BMF_DrawString(uiBlockGetCurFont(block), str); - } -} - - - -/* *************************** SCRIPT ******************************** */ - -static void extend_scriptlink(ScriptLink *slink) -{ - void *stmp, *ftmp; - - if (!slink) return; - - stmp= slink->scripts; - slink->scripts= MEM_mallocN(sizeof(ID*)*(slink->totscript+1), "scriptlistL"); - - ftmp= slink->flag; - slink->flag= MEM_mallocN(sizeof(short*)*(slink->totscript+1), "scriptlistF"); - - if (slink->totscript) { - memcpy(slink->scripts, stmp, sizeof(ID*)*(slink->totscript)); - MEM_freeN(stmp); - - memcpy(slink->flag, ftmp, sizeof(short)*(slink->totscript)); - MEM_freeN(ftmp); - } - - slink->scripts[slink->totscript]= NULL; - slink->flag[slink->totscript]= SCRIPT_FRAMECHANGED; - - slink->totscript++; - - if(slink->actscript<1) slink->actscript=1; -} - -static void delete_scriptlink(ScriptLink *slink) -{ - int i; - - if (!slink) return; - - if (slink->totscript>0) { - for (i=slink->actscript-1; i<slink->totscript-1; i++) { - slink->flag[i]= slink->flag[i+1]; - slink->scripts[i]= slink->scripts[i+1]; - } - - slink->totscript--; - } - - CLAMP(slink->actscript, 1, slink->totscript); - - if (slink->totscript==0) { - if (slink->scripts) MEM_freeN(slink->scripts); - if (slink->flag) MEM_freeN(slink->flag); - - slink->scripts= NULL; - slink->flag= NULL; - slink->totscript= slink->actscript= 0; - } -} - -void do_scriptbuts(short event) -{ - Object *ob=NULL; - ScriptLink *script=NULL; - Material *ma; - - switch (event) { - case B_SSCRIPT_ADD: - extend_scriptlink(&G.scene->scriptlink); - break; - case B_SSCRIPT_DEL: - delete_scriptlink(&G.scene->scriptlink); - break; - - case B_SCRIPT_ADD: - case B_SCRIPT_DEL: - ob= OBACT; - - if (ob && G.buts->scriptblock==ID_OB) { - script= &ob->scriptlink; - - } else if (ob && G.buts->scriptblock==ID_MA) { - ma= give_current_material(ob, ob->actcol); - if (ma) script= &ma->scriptlink; - - } else if (ob && G.buts->scriptblock==ID_CA) { - if (ob->type==OB_CAMERA) - script= &((Camera *)ob->data)->scriptlink; - - } else if (ob && G.buts->scriptblock==ID_LA) { - if (ob->type==OB_LAMP) - script= &((Lamp *)ob->data)->scriptlink; - - } else if (G.buts->scriptblock==ID_WO) { - if (G.scene->world) - script= &(G.scene->world->scriptlink); - } - - if (event==B_SCRIPT_ADD) extend_scriptlink(script); - else delete_scriptlink(script); - - break; - default: - break; - } - - allqueue(REDRAWBUTSSCRIPT, 0); -} - -void draw_scriptlink(uiBlock *block, ScriptLink *script, int sx, int sy, int scene) -{ - char str[256]; - - uiBlockSetCol(block, BUTGREY); - - if (script->totscript) { - strcpy(str, "FrameChanged%x 1|"); - strcat(str, "Redraw%x 4|"); - if (scene) { - strcat(str, "OnLoad%x 2"); - } - - uiDefButS(block, MENU, 1, str, (short)sx, (short)sy, 148, 19, &script->flag[script->actscript-1], 0, 0, 0, 0, "Script links for the Frame changed event"); - - uiDefIDPoinBut(block, test_scriptpoin_but, 1, "", (short)(sx+150),(short)sy, 98, 19, &script->scripts[script->actscript-1], "Name of Script to link"); - } - - sprintf(str,"%d Scr:", script->totscript); - uiDefButS(block, NUM, REDRAWBUTSSCRIPT, str, (short)(sx+250), (short)sy,98,19, &script->actscript, 1, script->totscript, 0, 0, "Total / Active Script link (LeftMouse + Drag to change)"); - - uiBlockSetCol(block, BUTSALMON); - - if (scene) { - if (script->totscript<32767) - uiDefBut(block, BUT, B_SSCRIPT_ADD, "New", (short)(sx+350), (short)sy, 38, 19, 0, 0, 0, 0, 0, "Add a new Script link"); - if (script->totscript) - uiDefBut(block, BUT, B_SSCRIPT_DEL, "Del", (short)(sx+390), (short)sy, 38, 19, 0, 0, 0, 0, 0, "Delete the current Script link"); - } else { - if (script->totscript<32767) - uiDefBut(block, BUT, B_SCRIPT_ADD, "New", (short)(sx+350), (short)sy, 38, 19, 0, 0, 0, 0, 0, "Add a new Script link"); - if (script->totscript) - uiDefBut(block, BUT, B_SCRIPT_DEL, "Del", (short)(sx+390), (short)sy, 38, 19, 0, 0, 0, 0, 0, "Delete the current Script link"); - } -} - -void scriptbuts(void) -{ - Object *ob=NULL; - ScriptLink *script=NULL; - Material *ma; - uiBlock *block; - char str[64]; - - ob= OBACT; - - sprintf(str, "buttonswin %d", curarea->win); - block= uiNewBlock(&curarea->uiblocks, str, UI_EMBOSSX, UI_HELV, curarea->win); - - if (ob && G.buts->scriptblock==ID_OB) { - script= &ob->scriptlink; - - } else if (ob && G.buts->scriptblock==ID_MA) { - ma= give_current_material(ob, ob->actcol); - if (ma) script= &ma->scriptlink; - - } else if (ob && G.buts->scriptblock==ID_CA) { - if (ob->type==OB_CAMERA) - script= &((Camera *)ob->data)->scriptlink; - - } else if (ob && G.buts->scriptblock==ID_LA) { - if (ob->type==OB_LAMP) - script= &((Lamp *)ob->data)->scriptlink; - - } else if (G.buts->scriptblock==ID_WO) { - if (G.scene->world) - script= &(G.scene->world->scriptlink); - } - - if (script) draw_scriptlink(block, script, 25, 180, 0); - - /* EVENTS */ - draw_buttons_edge(curarea->win, 540); - - draw_scriptlink(block, &G.scene->scriptlink, 600, 180, 1); - - uiDrawBlock(block); -} - -/* *************************** IKA ******************************** */ -/* is this number used elsewhere? */ -/* static int ika_del_number; */ -void do_ikabuts(unsigned short event) -{ - Base *base; - Object *ob; - - ob= OBACT; - - switch(event) { - case B_IKASETREF: - base= FIRSTBASE; - while(base) { - if TESTBASELIB(base) { - if(base->object->type==OB_IKA) init_defstate_ika(base->object); - } - base= base->next; - } - break; - case B_IKARECALC: - itterate_ika(ob); - break; - } -} - -void ikabuts(void) -{ - Ika *ika; - Object *ob; - Limb *li; - Deform *def; - uiBlock *block; - int nr, cury, nlimbs; - char str[32]; - - ob= OBACT; - if(ob==0) return; - - sprintf(str, "editbuttonswin %d", curarea->win); - block= uiNewBlock(&curarea->uiblocks, str, UI_EMBOSSX, UI_HELV, curarea->win); - - ika= ob->data; - - uiBlockSetCol(block, BUTSALMON); - uiDefBut(block, BUT, B_IKASETREF, "Set Reference",470,180,200,20, 0, 0, 0, 0, 0, ""); - - uiBlockSetCol(block, BUTGREEN); - uiDefButS(block, TOG|BIT|1, B_DIFF, "Lock XY Plane", 470,140,200,20, &ika->flag, 0.0, 1.0, 0, 0, "New IK option: allows both X and Y axes to rotate"); - uiBlockSetCol(block, BUTGREY); - uiDefButF(block, NUM, B_DIFF, "XY constraint ", 470,120,200,20, &ika->xyconstraint, 0.0, 1.0, 100, 0, "Constrain in radians"); - - uiDefButF(block, NUMSLI, B_DIFF, "Mem ", 470,80,200,20, &ika->mem, 0.0, 1.0, 0, 0, ""); - uiDefButS(block, NUM, B_DIFF, "Iter: ", 470,60,200,20, &ika->iter, 2.0, 16.0, 0, 0, ""); - - - uiBlockSetCol(block, BUTGREY); - - uiDefBut(block, LABEL, 0, "Limb Weight", 680, 200, 150, 19, 0, 0, 0, 0, 0, ""); - cury= 180; - li= ika->limbbase.first; - - nlimbs= BLI_countlist(&ika->limbbase); - - for (nr = 0; nr < nlimbs; nr++) { - sprintf(str, "Limb %d:", nr); - uiDefButF(block, NUM, B_DIFF, str, 680, (short)cury, 150, 19, &li->fac, 0.01, 1.0, 10, 0, ""); - cury-= 20; - li= li->next; - } - - - - uiDefBut(block, LABEL, 0, "Deform Max Dist", 955, 200, 140, 19, 0, 0, 0, 0, 0, ""); - uiDefBut(block, LABEL, 0, "Deform Weight", 1095, 200, 140, 19, 0, 0, 0, 0, 0, ""); - - - cury= 180; - def= ika->def; - for (nr = 0; nr < ika->totdef; nr++) { - def = ika->def+nr; - if(def->ob) { - if(def->ob->type!=OB_IKA) sprintf(str, "%s :", def->ob->id.name+2); - else sprintf(str, "%s (%d):", def->ob->id.name+2, def->par1); - } - - uiDefBut(block, LABEL, 0, str, 855, (short)cury, 100, 19, 0, 0.01, 0.0, 0, 0, ""); - uiDefButF(block, NUM, B_DIFF, "", 955, (short)cury, 140, 19, &def->dist, 0.0, 40.0, 100, 0, "Beyond this distance the Limb doesn't influence deformation. '0.0' is global influence."); - uiDefButF(block, NUM, B_DIFF, "", 1095,(short)cury, 140, 19, &def->fac, 0.01, 10.0, 10, 0, ""); - - cury-= 20; - } - uiDrawBlock(block); -} - /* *************************** TEXTURE ******************************** */ Tex *cur_imatex=0; diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c index 7448df3d6ff..74752792379 100644 --- a/source/blender/src/buttons_object.c +++ b/source/blender/src/buttons_object.c @@ -442,9 +442,6 @@ void object_panel_draw(Object *ob) uiBlockSetCol(block, BUTGREY); - uiScalePanelBlock(block); // scales and centers - uiDrawBlock(block); - } @@ -775,9 +772,6 @@ void object_panel_effects(Object *ob) } } - - uiScalePanelBlock(block); // scales and centers - uiDrawBlock(block); } static void object_panel_anim(Object *ob) @@ -882,9 +876,6 @@ static void object_panel_anim(Object *ob) #endif - - uiScalePanelBlock(block); // scales and centers - uiDrawBlock(block); } void object_panels() diff --git a/source/blender/src/buttons_shading.c b/source/blender/src/buttons_shading.c index 41555f7c162..87f1a198418 100644 --- a/source/blender/src/buttons_shading.c +++ b/source/blender/src/buttons_shading.c @@ -62,8 +62,10 @@ #include "BKE_material.h" #include "BKE_texture.h" #include "BKE_displist.h" +#include "DNA_radio_types.h" #include "BLI_blenlib.h" +#include "BMF_Api.h" #include "BSE_filesel.h" #include "BSE_headerbuttons.h" @@ -86,6 +88,7 @@ #include "interface.h" #include "mydevice.h" #include "blendef.h" +#include "radio.h" /* -----includes for this file specific----- */ @@ -94,6 +97,226 @@ static MTex mtexcopybuf; static MTex emptytex; +/* *************************** RADIO ******************************** */ + +void do_radiobuts(unsigned short event) +{ + Radio *rad; + int phase; + + phase= rad_phase(); + rad= G.scene->radio; + + switch(event) { + case B_RAD_ADD: + add_radio(); + allqueue(REDRAWBUTSSHADING, 0); + allqueue(REDRAWVIEW3D, 0); + break; + case B_RAD_DELETE: + delete_radio(); + allqueue(REDRAWBUTSSHADING, 0); + allqueue(REDRAWVIEW3D, 0); + break; + case B_RAD_FREE: + freeAllRad(); + allqueue(REDRAWBUTSSHADING, 0); + allqueue(REDRAWVIEW3D, 0); + break; + case B_RAD_COLLECT: + rad_collect_meshes(); + allqueue(REDRAWBUTSSHADING, 0); + allqueue(REDRAWVIEW3D, 0); + break; + case B_RAD_INIT: + if(phase==RAD_PHASE_PATCHES) { + rad_limit_subdivide(); + allqueue(REDRAWBUTSSHADING, 0); + allqueue(REDRAWVIEW3D, 0); + } + break; + case B_RAD_SHOOTP: + if(phase==RAD_PHASE_PATCHES) { + waitcursor(1); + rad_subdivshootpatch(); + allqueue(REDRAWBUTSSHADING, 0); + allqueue(REDRAWVIEW3D, 0); + waitcursor(0); + } + break; + case B_RAD_SHOOTE: + if(phase==RAD_PHASE_PATCHES) { + waitcursor(1); + rad_subdivshootelem(); + allqueue(REDRAWBUTSSHADING, 0); + allqueue(REDRAWVIEW3D, 0); + waitcursor(0); + } + break; + case B_RAD_GO: + if(phase==RAD_PHASE_PATCHES) { + waitcursor(1); + rad_go(); + waitcursor(0); + allqueue(REDRAWBUTSSHADING, 0); + allqueue(REDRAWVIEW3D, 0); + } + break; + case B_RAD_LIMITS: + rad_setlimits(); + allqueue(REDRAWVIEW3D, 0); + allqueue(REDRAWBUTSSHADING, 0); + break; + case B_RAD_FAC: + set_radglobal(); + if(phase & RAD_PHASE_FACES) make_face_tab(); + else make_node_display(); + allqueue(REDRAWVIEW3D, 0); + break; + case B_RAD_NODELIM: + if(phase & RAD_PHASE_FACES) { + set_radglobal(); + removeEqualNodes(rad->nodelim); + make_face_tab(); + allqueue(REDRAWVIEW3D, 0); + allqueue(REDRAWBUTSSHADING, 0); + } + break; + case B_RAD_NODEFILT: + if(phase & RAD_PHASE_FACES) { + set_radglobal(); + filterNodes(); + make_face_tab(); + allqueue(REDRAWVIEW3D, 0); + } + break; + case B_RAD_FACEFILT: + if(phase & RAD_PHASE_FACES) { + filterFaces(); + allqueue(REDRAWVIEW3D, 0); + } + break; + case B_RAD_DRAW: + set_radglobal(); + allqueue(REDRAWVIEW3D, 0); + break; + case B_RAD_ADDMESH: + if(phase & RAD_PHASE_FACES) rad_addmesh(); + allqueue(REDRAWVIEW3D, 0); + break; + case B_RAD_REPLACE: + if(phase & RAD_PHASE_FACES) rad_replacemesh(); + allqueue(REDRAWVIEW3D, 0); + break; + } + +} + + +#if 0 + char str[128]; + + rad_status_str(str); + cpack(0); + glRasterPos2i(210, 189); + BMF_DrawString(uiBlockGetCurFont(block), str); + +#endif + +static void radio_panel_calculation(Radio *rad, int flag) +{ + uiBlock *block; + + block= uiNewBlock(&curarea->uiblocks, "radio_panel_calculation", UI_EMBOSSX, UI_HELV, curarea->win); + if(uiNewPanel(curarea, block, "Calculation", "Radio", 640, 0, 318, 204)==0) return; + uiAutoBlock(block, 10, 10, 300, 200, UI_BLOCK_ROWS); + + if(flag == RAD_PHASE_PATCHES) uiBlockSetCol(block, BUTSALMON); + uiDefBut(block, BUT, B_RAD_GO, "GO", 0, 0, 10, 15, NULL, 0, 0, 0, 0, "Start the radiosity simulation"); + + uiBlockSetCol(block, BUTGREY); + uiDefButS(block, NUM, 0, "SubSh Patch:", 1, 0, 10, 10, &rad->subshootp, 0.0, 10.0, 0, 0, "Set the number of times the environment is tested to detect pathes"); + uiDefButS(block, NUM, 0, "SubSh Element:", 1, 0, 10, 10, &rad->subshoote, 0.0, 10.0, 0, 0, "Set the number of times the environment is tested to detect elements"); + + if(flag == RAD_PHASE_PATCHES) uiBlockSetCol(block, BUTSALMON); + else uiBlockSetCol(block, BUTGREY); + uiDefBut(block, BUT, B_RAD_SHOOTE, "Subdiv Shoot Element", 2, 0, 10, 10, NULL, 0, 0, 0, 0, "For pre-subdivision, detect high energy changes and subdivide Elements"); + uiDefBut(block, BUT, B_RAD_SHOOTP, "Subdiv Shoot Patch", 2, 0, 10, 10, NULL, 0, 0, 0, 0, "For pre-subdivision, Detect high energy changes and subdivide Patches"); + + uiBlockSetCol(block, BUTGREY); + uiDefButI(block, NUM, 0, "MaxEl:", 3, 0, 10, 10, &rad->maxnode, 1.0, 250000.0, 0, 0, "Set the maximum allowed number of elements"); + uiDefButS(block, NUM, 0, "Max Subdiv Shoot:", 3, 0, 10, 10, &rad->maxsublamp, 1.0, 250.0, 0, 0, "Set the maximum number of initial shoot patches that are evaluated"); + + if(flag & RAD_PHASE_FACES) uiBlockSetCol(block, BUTSALMON); + else uiBlockSetCol(block, BUTGREY); + uiDefBut(block, BUT, B_RAD_FACEFILT, "FaceFilter", 4, 0, 10, 10, NULL, 0, 0, 0, 0, "Force an extra smoothing"); + uiDefBut(block, BUT, B_RAD_NODEFILT, "Element Filter", 4, 0, 10, 10, NULL, 0, 0, 0, 0, "Filter elements to remove aliasing artefacts"); + + uiDefBut(block, BUT, B_RAD_NODELIM, "RemoveDoubles", 5, 0, 30, 10, NULL, 0.0, 50.0, 0, 0, "Join elements which differ less than 'Lim'"); + uiBlockSetCol(block, BUTGREY); + uiDefButS(block, NUM, 0, "Lim:", 5, 0, 10, 10, &rad->nodelim, 0.0, 50.0, 0, 0, "Set the range for removing doubles"); + + +} + +static void radio_panel_tool(Radio *rad, int flag) +{ + uiBlock *block; + + block= uiNewBlock(&curarea->uiblocks, "radio_panel_tool", UI_EMBOSSX, UI_HELV, curarea->win); + if(uiNewPanel(curarea, block, "Radio Tool", "Radio", 320, 0, 318, 204)==0) return; + uiAutoBlock(block, 10, 10, 300, 200, UI_BLOCK_ROWS); + + if(flag & RAD_PHASE_PATCHES) uiBlockSetCol(block, BUTPURPLE); + else uiBlockSetCol(block, BUTSALMON); + uiDefBut(block, BUT, B_RAD_COLLECT, "Collect Meshes", 0, 0, 10, 15, NULL, 0, 0, 0, 0, "Convert selected and visible meshes to patches"); + + if(flag & RAD_PHASE_PATCHES) uiBlockSetCol(block, BUTSALMON); + else uiBlockSetCol(block, BUTGREY); + uiDefBut(block, BUT, B_RAD_FREE, "Free Radio Data", 0, 0, 10, 15, NULL, 0, 0, 0, 0, "Release all memory used by Radiosity"); + + if(flag & RAD_PHASE_FACES) uiBlockSetCol(block, BUTSALMON); + else uiBlockSetCol(block, BUTGREY); + uiDefBut(block, BUT, B_RAD_REPLACE, "Replace Meshes", 1, 0, 10, 12, NULL, 0, 0, 0, 0, "Convert meshes to Mesh objects with vertex colours, changing input-meshes"); + uiDefBut(block, BUT, B_RAD_ADDMESH, "Add new Meshes", 1, 0, 10, 12, NULL, 0, 0, 0, 0, "Convert meshes to Mesh objects with vertex colours, unchanging input-meshes"); + + uiBlockSetCol(block, BUTGREEN); + uiDefButS(block, ROW, B_RAD_DRAW, "Wire", 2, 0, 10, 10, &rad->drawtype, 0.0, 0.0, 0, 0, "Enable wireframe drawmode"); + uiDefButS(block, ROW, B_RAD_DRAW, "Solid", 2, 0, 10, 10, &rad->drawtype, 0.0, 1.0, 0, 0, "Enable solid drawmode"); + uiDefButS(block, ROW, B_RAD_DRAW, "Gour", 2, 0, 10, 10, &rad->drawtype, 0.0, 2.0, 0, 0, "Enable Gourad drawmode"); + uiBlockSetCol(block, BUTGREY); + uiDefButS(block, TOG|BIT|0, B_RAD_DRAW, "ShowLim", 2, 0, 10, 10, &rad->flag, 0, 0, 0, 0, "Visualize patch and element limits"); + uiDefButS(block, TOG|BIT|1, B_RAD_DRAW, "Z", 2, 0, 3, 10, &rad->flag, 0, 0, 0, 0, "Draw limits different"); + + uiBlockSetCol(block, BUTGREY); + uiDefButS(block, NUM, B_RAD_LIMITS, "ElMax:", 3, 0, 10, 10, &rad->elma, 1.0, 500.0, 0, 0, "Set maximum size of an element"); + uiDefButS(block, NUM, B_RAD_LIMITS, "ElMin:", 3, 0, 10, 10, &rad->elmi, 1.0, 100.0, 0, 0, "Set minimum size of an element"); + uiDefButS(block, NUM, B_RAD_LIMITS, "PaMax:", 3, 0, 10, 10, &rad->pama, 10.0, 1000.0, 0, 0, "Set maximum size of a patch"); + uiDefButS(block, NUM, B_RAD_LIMITS, "PaMin:", 3, 0, 10, 10, &rad->pami, 10.0, 1000.0, 0, 0, "Set minimum size of a patch"); + + + + uiBlockSetCol(block, BUTSALMON); + uiDefBut(block, BUT, B_RAD_INIT, "Limit Subdivide", 5, 0, 10, 10, NULL, 0, 0, 0, 0, "Subdivide patches"); +} + + +static void radio_panel_render(Radio *rad) +{ + uiBlock *block; + + block= uiNewBlock(&curarea->uiblocks, "radio_panel_render", UI_EMBOSSX, UI_HELV, curarea->win); + if(uiNewPanel(curarea, block, "Radio Render", "Radio", 0, 0, 318, 204)==0) return; + uiAutoBlock(block, 210, 30, 230, 150, UI_BLOCK_ROWS); + + uiBlockSetCol(block, BUTGREY); + uiDefButS(block, NUMSLI, B_RAD_LIMITS, "Hemires:", 0, 0, 10, 10, &rad->hemires, 100.0, 1000.0, 100, 0, "Set the size of a hemicube"); + uiDefButS(block, NUM, 0, "Max Iterations:", 2, 0, 10, 15, &rad->maxiter, 0.0, 10000.0, 0, 0, "Maximum number of radiosity rounds"); + uiDefButF(block, NUM, B_RAD_FAC, "Mult:", 3, 0, 10, 15, &rad->radfac, 0.001, 250.0, 100, 0, "Mulitply the energy values"); + uiDefButF(block, NUM, B_RAD_FAC, "Gamma:", 3, 0, 10, 15, &rad->gamma, 0.2, 10.0, 10, 0, "Change the contrast of the energy values"); + uiDefButF(block, NUMSLI, 0, "Convergence:", 5, 0, 10, 10, &rad->convergence, 0.0, 1.0, 10, 0, "Set the lower threshold of unshot energy"); +} + /* ***************************** WORLD ************************** */ @@ -1154,6 +1377,23 @@ void world_panels() } } +void radio_panels() +{ + Radio *rad; + int flag; + + rad= G.scene->radio; + if(rad==0) { + add_radio(); + rad= G.scene->radio; + } + radio_panel_render(rad); + + flag= rad_phase(); + + radio_panel_tool(rad, flag); + if(flag) radio_panel_calculation(rad, flag); -
\ No newline at end of file + +} diff --git a/source/blender/src/header_sound.c b/source/blender/src/header_sound.c index 09e1a78c8f2..883e101d1ad 100644 --- a/source/blender/src/header_sound.c +++ b/source/blender/src/header_sound.c @@ -36,6 +36,7 @@ */ #include <stdlib.h> +#include <string.h> #ifdef HAVE_CONFIG_H #include <config.h> diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c index 4da6bc34b61..53b9643dca1 100644 --- a/source/blender/src/interface.c +++ b/source/blender/src/interface.c @@ -2585,7 +2585,6 @@ static void ui_autofill(uiBlock *block) float totmaxh; int rows=0, /* cols=0, */ i, lasti; - /* first count rows */ but= block->buttons.last; rows= but->x1+1; @@ -6211,7 +6210,7 @@ static int panel_has_tabs(Panel *panel) return 0; } -void uiScalePanelBlock(uiBlock *block) +static void ui_scale_panel_block(uiBlock *block) { uiBut *but; float facx= 1.0, facy= 1.0; @@ -6219,6 +6218,7 @@ void uiScalePanelBlock(uiBlock *block) if(block->panel==NULL) return; + if(block->autofill) ui_autofill(block); /* buttons min/max centered, offset calculated */ uiBoundsBlock(block, 0); @@ -6643,7 +6643,7 @@ int uiAlignPanelStep(ScrArea *sa, float fac) } -void uiAnimatePanels(ScrArea *sa) +static void ui_animate_panels(ScrArea *sa) { double time=0, ltime; float result= 0.0, fac= 0.2; @@ -6692,7 +6692,7 @@ void uiDrawBlocksPanels(ScrArea *sa, int re_align) /* scaling contents */ block= sa->uiblocks.first; while(block) { - if(block->panel) uiScalePanelBlock(block); + if(block->panel) ui_scale_panel_block(block); block= block->next; } @@ -6891,7 +6891,7 @@ static void ui_drag_panel(uiBlock *block) check_panel_overlap(curarea, NULL); // clears if(sbuts->align==0) addqueue(block->win, REDRAW, 1); - else uiAnimatePanels(curarea); + else ui_animate_panels(curarea); } @@ -7031,7 +7031,7 @@ static void ui_do_panel(uiBlock *block, uiEvent *uevent) } } if(sbuts->align==0) addqueue(block->win, REDRAW, 1); - else uiAnimatePanels(curarea); + else ui_animate_panels(curarea); } else { |