diff options
Diffstat (limited to 'source/blender/src/buttons.txt')
-rw-r--r-- | source/blender/src/buttons.txt | 3423 |
1 files changed, 0 insertions, 3423 deletions
diff --git a/source/blender/src/buttons.txt b/source/blender/src/buttons.txt index b32ad5ea201..1b209c3515e 100644 --- a/source/blender/src/buttons.txt +++ b/source/blender/src/buttons.txt @@ -593,1839 +593,10 @@ static void draw_buttons_edge(int win, float x1) static int packdummy = 0; -void test_scriptpoin_but(char *name, ID **idpp) -{ - ID *id; - - id= G.main->text.first; - while(id) { - if( strcmp(name, id->name+2)==0 ) { - *idpp= id; - return; - } - id= id->next; - } - *idpp= 0; -} -#ifdef __NLA -void test_actionpoin_but(char *name, ID **idpp) -{ - ID *id; - - id= G.main->action.first; - while(id) { - if( strcmp(name, id->name+2)==0 ) { - *idpp= id; - return; - } - id= id->next; - } - *idpp= 0; -} -#endif - -void test_obpoin_but(char *name, ID **idpp) -{ - ID *id; - - if(idpp == (ID **)&(emptytex.object)) { - error("You must add a Texture first!"); - *idpp= 0; - return; - } - - id= G.main->object.first; - while(id) { - if( strcmp(name, id->name+2)==0 ) { - *idpp= id; - return; - } - id= id->next; - } - *idpp= 0; -} - -void test_obcurpoin_but(char *name, ID **idpp) -{ - ID *id; - - if(idpp == (ID **)&(emptytex.object)) { - error("You must add a Texture first!"); - *idpp= 0; - return; - } - - id= G.main->object.first; - while(id) { - if( strcmp(name, id->name+2)==0 ) { - if (((Object *)id)->type != OB_CURVE) { - error ("Bevel object must be a Curve."); - break; - } - *idpp= id; - return; - } - id= id->next; - } - *idpp= 0; -} - -void test_meshpoin_but(char *name, ID **idpp) -{ - ID *id; - - if( *idpp ) (*idpp)->us--; - - id= G.main->mesh.first; - while(id) { - if( strcmp(name, id->name+2)==0 ) { - *idpp= id; - id_us_plus(id); - return; - } - id= id->next; - } - *idpp= 0; -} - -void test_matpoin_but(char *name, ID **idpp) -{ - ID *id; - - if( *idpp ) (*idpp)->us--; - - id= G.main->mat.first; - while(id) { - if( strcmp(name, id->name+2)==0 ) { - *idpp= id; - id_us_plus(id); - return; - } - id= id->next; - } - *idpp= 0; -} - -void test_scenepoin_but(char *name, ID **idpp) -{ - ID *id; - - if( *idpp ) (*idpp)->us--; - - id= G.main->scene.first; - while(id) { - if( strcmp(name, id->name+2)==0 ) { - *idpp= id; - id_us_plus(id); - return; - } - id= id->next; - } - *idpp= 0; -} - - - -/* ************************************* */ - -static void do_common_editbuts(unsigned short event) -{ - EditVlak *evl; - Base *base; - Object *ob; - Mesh *me; - Nurb *nu; - Curve *cu; - MFace *mface; - BezTriple *bezt; - BPoint *bp; - unsigned int local; - int a, bit, index= -1; - - switch(event) { - - case B_MATWICH: - if(G.obedit && G.obedit->actcol>0) { - if(G.obedit->type == OB_MESH) { - evl= G.edvl.first; - while(evl) { - if( vlakselectedAND(evl, 1) ) { - if(index== -1) index= evl->mat_nr; - else if(index!=evl->mat_nr) { - error("Mixed colors"); - return; - } - } - evl= evl->next; - } - } - else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) { - nu= editNurb.first; - while(nu) { - if( isNurbsel(nu) ) { - if(index== -1) index= nu->mat_nr; - else if(index!=nu->mat_nr) { - error("Mixed colors"); - return; - } - } - nu= nu->next; - } - } - if(index>=0) { - G.obedit->actcol= index+1; - scrarea_queue_winredraw(curarea); - } - } - break; - case B_MATNEW: - new_material_to_objectdata((G.scene->basact) ? (G.scene->basact->object) : 0); - scrarea_queue_winredraw(curarea); - allqueue(REDRAWVIEW3D_Z, 0); - break; - case B_MATDEL: - delete_material_index(); - scrarea_queue_winredraw(curarea); - allqueue(REDRAWVIEW3D_Z, 0); - break; - case B_MATASS: - if(G.obedit && G.obedit->actcol>0) { - if(G.obedit->type == OB_MESH) { - evl= G.edvl.first; - while(evl) { - if( vlakselectedAND(evl, 1) ) - evl->mat_nr= G.obedit->actcol-1; - evl= evl->next; - } - allqueue(REDRAWVIEW3D_Z, 0); - makeDispList(G.obedit); - } - else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) { - nu= editNurb.first; - while(nu) { - if( isNurbsel(nu) ) - nu->mat_nr= G.obedit->actcol-1; - nu= nu->next; - } - } - } - break; - case B_MATSEL: - case B_MATDESEL: - if(G.obedit) { - if(G.obedit->type == OB_MESH) { - evl= G.edvl.first; - while(evl) { - if(evl->mat_nr== G.obedit->actcol-1) { - if(event==B_MATSEL) { - if(evl->v1->h==0) evl->v1->f |= 1; - if(evl->v2->h==0) evl->v2->f |= 1; - if(evl->v3->h==0) evl->v3->f |= 1; - if(evl->v4 && evl->v4->h==0) evl->v4->f |= 1; - } - else { - if(evl->v1->h==0) evl->v1->f &= ~1; - if(evl->v2->h==0) evl->v2->f &= ~1; - if(evl->v3->h==0) evl->v3->f &= ~1; - if(evl->v4 && evl->v4->h==0) evl->v4->f &= ~1; - } - } - evl= evl->next; - } - tekenvertices_ext( event==B_MATSEL ); - } - else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) { - nu= editNurb.first; - while(nu) { - if(nu->mat_nr==G.obedit->actcol-1) { - if(nu->bezt) { - a= nu->pntsu; - bezt= nu->bezt; - while(a--) { - if(bezt->hide==0) { - if(event==B_MATSEL) { - bezt->f1 |= 1; - bezt->f2 |= 1; - bezt->f3 |= 1; - } - else { - bezt->f1 &= ~1; - bezt->f2 &= ~1; - bezt->f3 &= ~1; - } - } - bezt++; - } - } - else if(nu->bp) { - a= nu->pntsu*nu->pntsv; - bp= nu->bp; - while(a--) { - if(bp->hide==0) { - if(event==B_MATSEL) bp->f1 |= 1; - else bp->f1 &= ~1; - } - bp++; - } - } - } - nu= nu->next; - } - allqueue(REDRAWVIEW3D, 0); - } - } - break; - case B_HIDE: - if(G.obedit) { - if(G.obedit->type == OB_MESH) hide_mesh(0); - else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) hideNurb(0); - } - break; - case B_REVEAL: - if(G.obedit) { - if(G.obedit->type == OB_MESH) reveal_mesh(); - else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) revealNurb(); - } - else if(G.f & G_FACESELECT) reveal_tface(); - - break; - case B_SELSWAP: - if(G.obedit) { - if(G.obedit->type == OB_MESH) selectswap_mesh(); - else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) selectswapNurb(); - } - break; - case B_AUTOTEX: - ob= OBACT; - if(ob && G.obedit==0) { - if(ob->type==OB_MESH) tex_space_mesh(ob->data); - else if(ob->type==OB_MBALL) ; - else tex_space_curve(ob->data); - } - break; - case B_DOCENTRE: - docentre(); - break; - case B_DOCENTRENEW: - docentre_new(); - break; - case B_DOCENTRECURSOR: - docentre_cursor(); - break; - case B_SETSMOOTH: - case B_SETSOLID: - if(G.obedit) { - if(G.obedit->type == OB_MESH) { - evl= G.edvl.first; - while(evl) { - if( vlakselectedAND(evl, 1) ) { - if(event==B_SETSMOOTH) evl->flag |= ME_SMOOTH; - else evl->flag &= ~ME_SMOOTH; - } - evl= evl->next; - } - - makeDispList(G.obedit); - allqueue(REDRAWVIEW3D, 0); - } - else { - nu= editNurb.first; - while(nu) { - if(isNurbsel(nu)) { - if(event==B_SETSMOOTH) nu->flag |= ME_SMOOTH; - else nu->flag &= ~ME_SMOOTH; - } - nu= nu->next; - } - - } - } - else { - base= FIRSTBASE; - while(base) { - if(TESTBASELIB(base)) { - if(base->object->type==OB_MESH) { - me= base->object->data; - mface= me->mface; - for(a=0; a<me->totface; a++, mface++) { - if(event==B_SETSMOOTH) mface->flag |= ME_SMOOTH; - else mface->flag &= ~ME_SMOOTH; - } - - makeDispList(base->object); - } - else if ELEM(base->object->type, OB_SURF, OB_CURVE) { - cu= base->object->data; - nu= cu->nurb.first; - while(nu) { - if(event==B_SETSMOOTH) nu->flag |= ME_SMOOTH; - else nu->flag &= ~ME_SMOOTH; - nu= nu->next; - } - } - } - base= base->next; - } - allqueue(REDRAWVIEW3D, 0); - } - break; - - default: - if(event>=B_OBLAY && event<=B_OBLAY+31) { - local= BASACT->lay & 0xFF000000; - BASACT->lay -= local; - if(BASACT->lay==0 || (G.qual & LR_SHIFTKEY)==0) { - bit= event-B_OBLAY; - BASACT->lay= 1<<bit; - scrarea_queue_winredraw(curarea); - } - BASACT->lay += local; - /* optimal redraw */ - if( (OBACT->lay & G.vd->lay) && (BASACT->lay & G.vd->lay) ); - else if( (OBACT->lay & G.vd->lay)==0 && (BASACT->lay & G.vd->lay)==0 ); - else allqueue(REDRAWVIEW3D, 0); - - OBACT->lay= BASACT->lay; - } - } - -} - -void common_editbuts(void) -{ - Object *ob; - ID *id; - Material *ma; - uiBlock *block; - void *poin; - float min; - int xco, a, dx, dy; - char str[32]; - - ob= OBACT; - if(ob==0) return; - - sprintf(str, "buttonswin %d", curarea->win); - block= uiNewBlock(&curarea->uiblocks, str, UI_EMBOSSX, UI_HELV, curarea->win); - - /* LAYERS */ - xco= 291; - dx= 32; - dy= 30; - for(a=0; a<10; a++) { - /* the (a+10) evaluates correctly because of - precedence... brackets aren't a bad idea though */ - uiDefButI(block, TOG|BIT|(a+10), B_OBLAY+a+10, "", (short)(xco+a*(dx/2)), 180, (short)(dx/2), (short)(dy/2), &(BASACT->lay), 0, 0, 0, 0, ""); - uiDefButI(block, TOG|BIT|a, B_OBLAY+a, "",(short)(xco+a*(dx/2)), (short)(180+dy/2), (short)(dx/2), (short)(1+dy/2), &(BASACT->lay), 0, 0, 0, 0, ""); - if(a==4) xco+= 5; - } - - id= ob->data; - if(id && id->lib) uiSetButLock(1, "Can't edit library data"); - - uiBlockSetCol(block, BUTGREY); - uiDefBut(block, LABEL, 0, "Drawtype", 28,200,100,18, 0, 0, 0, 0, 0, ""); - uiDefButC(block, MENU, REDRAWVIEW3D, "Drawtype%t|Bounds %x1|Wire %x2|Solid %x3|Shaded %x4", - 28,180,100,18, &ob->dt, 0, 0, 0, 0, "Sets the drawing type of the active object"); - uiDefBut(block, LABEL, 0, "Draw Extra", 28,160,100,18, 0, 0, 0, 0, 0, ""); - uiDefButC(block, TOG|BIT|0, REDRAWVIEW3D, "Bounds", 28, 140, 100, 18, &ob->dtx, 0, 0, 0, 0, "Displays the active object's bounds"); - uiDefButS(block, MENU, REDRAWVIEW3D, "Boundary Display%t|Box%x0|Sphere%x1|Cylinder%x2|Cone%x3|Polyheder", - 28, 120, 100, 18, &ob->boundtype, 0, 0, 0, 0, "Selects the boundary display type"); - uiDefButC(block, TOG|BIT|5, REDRAWVIEW3D, "Wire", 28, 100, 100, 18, &ob->dtx, 0, 0, 0, 0, "Displays the active object's wireframe in shaded drawing modes"); - uiDefButC(block, TOG|BIT|1, REDRAWVIEW3D, "Axis", 28, 80, 100, 18, &ob->dtx, 0, 0, 0, 0, "Displays the active object's centre and axis"); - uiDefButC(block, TOG|BIT|2, REDRAWVIEW3D, "TexSpace", 28, 60, 100, 18, &ob->dtx, 0, 0, 0, 0, "Displays the active object's texture space"); - uiDefButC(block, TOG|BIT|3, REDRAWVIEW3D, "Name", 28, 40, 100, 18, &ob->dtx, 0, 0, 0, 0, "Displays the active object's name"); - - uiBlockSetCol(block, BUTGREY); - - /* material and select swap and hide */ - if ELEM5(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL) { - - if(ob->type==OB_MESH) poin= &( ((Mesh *)ob->data)->texflag ); - else if(ob->type==OB_MBALL) poin= &( ((MetaBall *)ob->data)->texflag ); - else poin= &( ((Curve *)ob->data)->texflag ); - uiDefButI(block, TOG|BIT|0, B_AUTOTEX, "AutoTexSpace", 143,180,130,19, poin, 0, 0, 0, 0, "Adjusts active object's texture space automatically when transforming object"); - - sprintf(str,"%d Mat:", ob->totcol); - if(ob->totcol) min= 1.0; else min= 0.0; - ma= give_current_material(ob, ob->actcol); - - if(ma) { - uiDefButF(block, COL, 0, "", 291,123,24,30, &(ma->r), 0, 0, 0, 0, ""); - uiDefBut(block, LABEL, 0, ma->id.name+2, 318,146, 103, 30, 0, 0, 0, 0, 0, ""); - } - uiDefButC(block, NUM, B_REDR, str, 318,123,103,30, &ob->actcol, min, (float)(ob->totcol), 0, 0, "Displays total number of material indices and the current index"); - uiDefBut(block, BUT,B_MATWICH, "?", 423,123,31,30, 0, 0, 0, 0, 0, "In EditMode, sets the active material index from selected faces"); - - uiBlockSetCol(block, BUTSALMON); - uiDefBut(block, BUT,B_MATNEW, "New", 292,101,80,21, 0, 0, 0, 0, 0, "Adds a new Material index"); - uiDefBut(block, BUT,B_MATDEL, "Delete", 374,101,80,21, 0, 0, 0, 0, 0, "Deletes this Material index"); - uiDefBut(block, BUT,B_MATASS, "Assign", 291,47,162,26, 0, 0, 0, 0, 0, "In EditMode, assigns the active index to selected faces"); - - uiBlockSetCol(block, BUTGREY); - uiDefBut(block, BUT,B_MATSEL, "Select", 292,76,79,22, 0, 0, 0, 0, 0, "In EditMode, selects faces that have the active index"); - uiDefBut(block, BUT,B_MATDESEL, "Deselect", 373,76,79,21, 0, 0, 0, 0, 0, "Deselects everything with current indexnumber"); - - if(ob->type!=OB_FONT) { - uiDefBut(block, BUT,B_HIDE, "Hide", 1091,152,77,18, 0, 0, 0, 0, 0, "Hides selected faces"); - uiDefBut(block, BUT,B_REVEAL, "Reveal", 1171,152,86,18, 0, 0, 0, 0, 0, "Reveals selected faces"); - uiDefBut(block, BUT,B_SELSWAP, "Select Swap", 1091,129,166,18, 0, 0, 0, 0, 0, "Selects unselected faces, and deselects selected faces"); - } - uiDefBut(block, BUT,B_SETSMOOTH, "Set Smooth", 291,15,80,20, 0, 0, 0, 0, 0, "In EditMode, sets 'smooth' rendering of selected faces"); - uiDefBut(block, BUT,B_SETSOLID, "Set Solid", 373,15,80,20, 0, 0, 0, 0, 0, "In EditMode, sets 'solid' rendering of selected faces"); - - } - - if ELEM3(ob->type, OB_MESH, OB_SURF, OB_CURVE) { - uiBlockSetCol(block, BUTSALMON); - uiDefBut(block, BUT,B_DOCENTRE, "Centre", 961, 115, 100, 19, 0, 0, 0, 0, 0, "Shifts object data to be centered about object's origin"); - uiDefBut(block, BUT,B_DOCENTRENEW, "Centre New", 961, 95, 100, 19, 0, 0, 0, 0, 0, "Shifts object's origin to center of object data"); - uiDefBut(block, BUT,B_DOCENTRECURSOR, "Centre Cursor", 961, 75, 100, 19, 0, 0, 0, 0, 0, "Shifts object's origin to cursor location"); - } - - - uiDrawBlock(block); - -} - - - -/* *************************** MESH ******************************** */ - -#ifdef NAN_DECIMATION - -static int decimate_count_tria(Object *ob) -{ - int tottria; - MFace *mface; - Mesh *me; - int a; - - me= ob->data; - - /* count number of trias, since decimator doesnt allow quads */ - tottria= 0; - mface= me->mface; - for(a=0; a<me->totface; a++, mface++) { - if(mface->v4) tottria++; - if(mface->v3) tottria++; - } - - return tottria; -} - -static void decimate_faces(void) -{ - Object *ob; - Mesh *me; - MVert *mvert; - MFace *mface; - LOD_Decimation_Info lod; - float *vb=NULL; - float *vnb=NULL; - int *tib=NULL; - int a, tottria; - - /* we assume the active object being decimated */ - ob= OBACT; - if(ob==NULL || ob->type!=OB_MESH) return; - me= ob->data; - - /* add warning for vertex col and tfaces */ - if(me->tface || me->mcol) { - if(okee("This will remove UV coordinates and vertexcolors")==0) return; - if(me->tface) MEM_freeN(me->tface); - if(me->mcol) MEM_freeN(me->mcol); - me->tface= NULL; - me->mcol= NULL; - } - - /* count number of trias, since decimator doesnt allow quads */ - tottria= decimate_count_tria(ob); - - if(tottria<3) { - error("You must have more than 3 input faces selected."); - return; - } - /* allocate and init */ - lod.vertex_buffer= MEM_mallocN(3*sizeof(float)*me->totvert, "vertices"); - lod.vertex_normal_buffer= MEM_mallocN(3*sizeof(float)*me->totvert, "normals"); - lod.triangle_index_buffer= MEM_mallocN(3*sizeof(int)*tottria, "trias"); - lod.vertex_num= me->totvert; - lod.face_num= tottria; - - /* fill vertex buffer */ - vb= lod.vertex_buffer; - vnb= lod.vertex_normal_buffer; - mvert= me->mvert; - for(a=0; a<me->totvert; a++, mvert++, vb+=3, vnb+=3) { - VECCOPY(vb, mvert->co); - VECCOPY(vnb, mvert->no); - Normalise(vnb); - } - - /* fill index buffer */ - mface= me->mface; - tib= lod.triangle_index_buffer; - for(a=0; a<me->totface; a++, mface++) { - if(mface->v4) { - tib[0]= mface->v1; - tib[1]= mface->v3; - tib[2]= mface->v4; - tib+= 3; - } - if(mface->v3) { - tib[0]= mface->v1; - tib[1]= mface->v2; - tib[2]= mface->v3; - tib+= 3; - } - } - - if(LOD_LoadMesh(&lod) ) { - if( LOD_PreprocessMesh(&lod) ) { - DispList *dl; - DispListMesh *dlm; - MFaceInt *mfaceint; - - /* we assume the decim_faces tells how much to reduce */ - - while(lod.face_num > decim_faces) { - if( LOD_CollapseEdge(&lod)==0) break; - } - - /* ok, put back the stuff in a displist */ - freedisplist(&(ob->disp)); - dl= MEM_callocN(sizeof(DispList), "disp"); - BLI_addtail(&ob->disp, dl); - dl->type= DL_MESH; - dlm=dl->mesh= MEM_callocN(sizeof(DispListMesh), "dispmesh"); - dlm->mvert= MEM_callocN(lod.vertex_num*sizeof(MVert), "mvert"); - dlm->mface= MEM_callocN(lod.face_num*sizeof(MFaceInt), "mface"); - dlm->totvert= lod.vertex_num; - dlm->totface= lod.face_num; - - mvert= dlm->mvert; - vb= lod.vertex_buffer; - for(a=0; a<lod.vertex_num; a++, vb+=3, mvert++) { - VECCOPY(mvert->co, vb); - } - - mfaceint= dlm->mface; - tib= lod.triangle_index_buffer; - for(a=0; a<lod.face_num; a++, mfaceint++, tib+=3) { - mfaceint->v1= tib[0]; - mfaceint->v2= tib[1]; - mfaceint->v3= tib[2]; - } - } - else error("No memory"); - - LOD_FreeDecimationData(&lod); - } - else error("No manifold Mesh"); - - MEM_freeN(lod.vertex_buffer); - MEM_freeN(lod.vertex_normal_buffer); - MEM_freeN(lod.triangle_index_buffer); - - allqueue(REDRAWVIEW3D, 0); -} - - - -static void decimate_cancel(void) -{ - Object *ob; - - ob= OBACT; - if(ob) { - freedisplist(&ob->disp); - makeDispList(ob); - } - allqueue(REDRAWVIEW3D, 0); -} - -static void decimate_apply(void) -{ - Object *ob; - DispList *dl; - DispListMesh *dlm; - Mesh *me; - MFace *mface; - MFaceInt *mfaceint; - int a; - - if(G.obedit) return; - - ob= OBACT; - if(ob) { - dl= ob->disp.first; - if(dl && dl->mesh) { - dlm= dl->mesh; - me= ob->data; - - // vertices - if(me->mvert) MEM_freeN(me->mvert); - me->mvert= dlm->mvert; - dlm->mvert= NULL; - me->totvert= dlm->totvert; - - // faces - if(me->mface) MEM_freeN(me->mface); - me->mface= MEM_callocN(dlm->totface*sizeof(MFace), "mface"); - me->totface= dlm->totface; - mface= me->mface; - mfaceint= dlm->mface; - for(a=0; a<me->totface; a++, mface++, mfaceint++) { - mface->v1= mfaceint->v1; - mface->v2= mfaceint->v2; - mface->v3= mfaceint->v3; - test_index_mface(mface, 3); - } - - freedisplist(&ob->disp); - - G.obedit= ob; - make_editMesh(); - load_editMesh(); - free_editMesh(); - G.obedit= NULL; - tex_space_mesh(me); - } - else error("Not a decimated Mesh"); - } -} - -#endif - -void do_meshbuts(unsigned short event) -{ - Object *ob; - Mesh *me; - float fac; - short randfac; - - ob= OBACT; - if(ob && ob->type==OB_MESH) { - - me= get_mesh(ob); - if(me==0) return; - - switch(event) { -#ifdef __NLA - case B_AUTOVGROUP: - if (!get_armature(ob->parent)){ - error ("Mesh must be the child of an armature"); - break; - } - /* Verify that there are vertex groups for bones in armature */ - /* Remove selected vertices from all defgroups */ - /* Perform assignment for selected vertices */ - - allqueue (REDRAWVIEW3D, 1); - break; - case B_NEWVGROUP: - add_defgroup (G.obedit); - scrarea_queue_winredraw(curarea); - break; - case B_DELVGROUP: - del_defgroup (G.obedit); - allqueue (REDRAWVIEW3D, 1); - break; - case B_ASSIGNVGROUP: - assign_verts_defgroup (); - allqueue (REDRAWVIEW3D, 1); - break; - case B_REMOVEVGROUP: - remove_verts_defgroup (0); - allqueue (REDRAWVIEW3D, 1); - break; - case B_SELVGROUP: - sel_verts_defgroup(1); - allqueue (REDRAWVIEW3D, 1); - break; - case B_DESELVGROUP: - sel_verts_defgroup(0); - allqueue (REDRAWVIEW3D, 1); - break; -#endif - case B_DELSTICKY: - - if(me->msticky) MEM_freeN(me->msticky); - me->msticky= 0; - allqueue(REDRAWBUTSEDIT, 0); - break; - case B_MAKESTICKY: - make_sticky(); - break; - case B_MAKEVERTCOL: - make_vertexcol(); - break; - case B_DELVERTCOL: - if(me->mcol) MEM_freeN(me->mcol); - me->mcol= 0; - G.f &= ~G_VERTEXPAINT; - freedisplist(&(ob->disp)); - allqueue(REDRAWBUTSEDIT, 0); - allqueue(REDRAWVIEW3D, 0); - break; - - case B_MAKE_TFACES: - make_tfaces(me); - allqueue(REDRAWBUTSEDIT, 0); - break; - - case B_DEL_TFACES: - if(me->tface) MEM_freeN(me->tface); - me->tface= 0; - G.f &= ~G_FACESELECT; - allqueue(REDRAWBUTSEDIT, 0); - allqueue(REDRAWVIEW3D, 0); - allqueue(REDRAWIMAGE, 0); - break; - - case B_FLIPNORM: - if(G.obedit) { - flip_editnormals(); - } - else flipnorm_mesh( get_mesh(ob) ); - - allqueue(REDRAWVIEW3D, 0); - break; - - case B_DECIM_FACES: - decimate_faces(); - break; - case B_DECIM_CANCEL: - decimate_cancel(); - break; - case B_DECIM_APPLY: - decimate_apply(); - break; - - case B_SLOWERDRAW: - slowerdraw(); - break; - case B_FASTERDRAW: - fasterdraw(); - break; - } - } - - if(G.obedit==0 || (G.obedit->type!=OB_MESH)) return; - - switch(event) { - case B_SPIN: - if( select_area(SPACE_VIEW3D)) spin_mesh(step, degr, 0, 0); - break; - case B_SPINDUP: - if( select_area(SPACE_VIEW3D)) spin_mesh(step, degr, 0, 1); - break; - case B_EXTR: - G.f |= G_DISABLE_OK; - if( select_area(SPACE_VIEW3D)) extrude_mesh(); - G.f -= G_DISABLE_OK; - break; - case B_SCREW: - if( select_area(SPACE_VIEW3D)) screw_mesh(step, turn); - break; - case B_EXTREP: - if( select_area(SPACE_VIEW3D)) extrude_repeat_mesh(step, extr_offs); - break; - case B_SPLIT: - G.f |= G_DISABLE_OK; - split_mesh(); - G.f -= G_DISABLE_OK; - break; - case B_REMDOUB: - notice("Removed: %d", removedoublesflag(1, doublimit)); - allqueue(REDRAWVIEW3D, 0); - break; - case B_SUBDIV: - waitcursor(1); - subdivideflag(1, 0.0, editbutflag & B_BEAUTY); - countall(); - waitcursor(0); - allqueue(REDRAWVIEW3D, 0); - break; - case B_FRACSUBDIV: - randfac= 10; - if(button(&randfac, 1, 100, "Rand fac:")==0) return; - waitcursor(1); - fac= -( (float)randfac )/100; - subdivideflag(1, fac, editbutflag & B_BEAUTY); - countall(); - waitcursor(0); - allqueue(REDRAWVIEW3D, 0); - break; - case B_XSORT: - if( select_area(SPACE_VIEW3D)) xsortvert_flag(1); - break; - case B_HASH: - hashvert_flag(1); - break; - case B_TOSPHERE: - vertices_to_sphere(); - break; - case B_VERTEXNOISE: - vertexnoise(); - break; - case B_VERTEXSMOOTH: - vertexsmooth(); - break; - } - /* WATCH IT: previous events only in editmode! */ -} - -static void verify_vertexgroup_name_func(void *datav, void *data2_unused) -{ - unique_vertexgroup_name((bDeformGroup*)datav, OBACT); -} - -void meshbuts(void) -{ - Object *ob; - Mesh *me; - uiBlock *block; - uiBut *but; - float val; - char str[64]; -#ifdef __NLA - int by; - float min; - int defCount; - bDeformGroup *defGroup; -#endif - - ob= OBACT; - if(ob==0) return; - - sprintf(str, "editbuttonswin %d", curarea->win); - block= uiNewBlock(&curarea->uiblocks, str, UI_EMBOSSX, UI_HELV, curarea->win); - - me= get_mesh(ob); - - if(me) { - uiDefButS(block, TOG|BIT|1, REDRAWVIEW3D, "No V.Normal Flip", 143,160,130,18, &me->flag, 0, 0, 0, 0, "Disables flipping of vertexnormals during render"); - uiBlockSetCol(block, BUTGREEN); - uiDefButS(block, TOG|BIT|5, REDRAWVIEW3D, "Auto Smooth", 143,140,130,18, &me->flag, 0, 0, 0, 0, "Treats all faces with angles less than Degr: as 'smooth' during render"); - uiBlockSetCol(block, BUTGREY); - uiDefButS(block, NUM, B_DIFF, "Degr:", 143, 120, 130, 18, &me->smoothresh, 1, 80, 0, 0, "Defines maximum angle between face normals that 'Auto Smooth' will operate on"); - uiBlockSetCol(block, BUTGREEN); - uiDefButS(block, TOG|BIT|7, B_MAKEDISP, "SubSurf", 143,100,130,18, &me->flag, 0, 0, 0, 0, "Treats the active object as a Catmull-Clark Subdivision Surface"); - uiBlockSetCol(block, BUTGREY); - uiDefButS(block, NUM, B_MAKEDISP, "Subdiv:", 143, 80, 100, 18, &me->subdiv, 0, 12, 0, 0, "Defines the level of subdivision to display in real time interactively"); - uiDefButS(block, NUM, B_MAKEDISP, "", 243, 80, 30, 18, &me->subdivr, 0, 12, 0, 0, "Defines the level of subdivision to apply during rendering"); - uiDefButS(block, TOG|BIT|2, REDRAWVIEW3D, "Double Sided", 1090,184,164,19, &me->flag, 0, 0, 0, 0, "Toggles selected faces as doublesided or single-sided"); - - uiBlockSetCol(block, BUTSALMON); - - if(me->msticky) val= 1.0; else val= 0.0; - uiDefBut(block, LABEL, 0, "Sticky", 137,55,70,20, 0, val, 0, 0, 0, ""); - if(me->msticky==0) { - uiDefBut(block, BUT, B_MAKESTICKY, "Make", 210,58,63,19, 0, 0, 0, 0, 0, "Creates Sticky coordinates for the active object from the current camera view background picture"); - } - else uiDefBut(block, BUT, B_DELSTICKY, "Delete", 210,58,63,19, 0, 0, 0, 0, 0, "Deletes Sticky texture coordinates"); - - if(me->mcol) val= 1.0; else val= 0.0; - uiDefBut(block, LABEL, 0, "VertCol", 140,33,70,20, 0, val, 0, 0, 0, ""); - if(me->mcol==0) { - uiDefBut(block, BUT, B_MAKEVERTCOL, "Make", 209,36,64,19, 0, 0, 0, 0, 0, "Enables vertex colour painting on active object"); - } - else uiDefBut(block, BUT, B_DELVERTCOL, "Delete", 209,36,64,19, 0, 0, 0, 0, 0, "Deletes vertex colours on active object"); - - if(me->tface) val= 1.0; else val= 0.0; - uiDefBut(block, LABEL, 0, "TexFace", 142,13,70,20, 0, val, 0, 0, 0, ""); - if(me->tface==0) { - uiDefBut(block, BUT, B_MAKE_TFACES, "Make", 209,14,64,20, 0, 0, 0, 0, 0, "Enables the active object's faces for UV coordinate mapping"); - } - else uiDefBut(block, BUT, B_DEL_TFACES, "Delete", 209,14,64,20, 0, 0, 0, 0, 0, "Deletes UV coordinates for active object's faces"); - - uiBlockSetCol(block, BUTGREY); - - uiDefIDPoinBut(block, test_meshpoin_but, 0, "TexMesh: ", 477,185,249,19, &me->texcomesh, "Enter the name of a Meshblock"); - } - - - /* EDIT */ - - if(me) { -#ifdef NAN_DECIMATION - int tottria= decimate_count_tria(ob); - DispList *dl; - - // wacko, wait for new displist system (ton) - if( (dl=ob->disp.first) && dl->mesh); - else decim_faces= tottria; - - uiBlockSetCol(block, BUTPURPLE); - uiDefButI(block, NUMSLI,B_DECIM_FACES, "Decimator: ", 477,155,249,20, &decim_faces, 4.0, tottria, 10, 10, "Defines the number of triangular faces to decimate the active Mesh object to"); - uiBlockSetCol(block, BUTSALMON); - uiDefBut(block, BUT,B_DECIM_CANCEL, "Cancel", 477,135,124,19, 0, 0, 0, 0, 0, "Restores the Mesh to its original number of faces"); - uiDefBut(block, BUT,B_DECIM_APPLY, "Apply", 602,135,124,19, 0, 0, 0, 0, 0, "Applies the decimation to the active Mesh object"); -#endif - - uiBlockSetCol(block, BUTSALMON); - uiDefBut(block, BUT,B_EXTR,"Extrude", 477,100,249,24, 0, 0, 0, 0, 0, "Converts selected edges to faces and selects the new vertices"); - uiDefBut(block, BUT,B_SPINDUP,"Spin Dupe", 639,75,87,24, 0, 0, 0, 0, 0, "Creates copies of the selected vertices in a circle around the cursor in the indicated viewport"); - uiDefBut(block, BUT,B_SPIN, "Spin", 558,75,78,24, 0, 0, 0, 0, 0, "Extrudes the selected vertices in a circle around the cursor in the indicated viewport"); - uiDefBut(block, BUT,B_SCREW,"Screw", 477,75,79,24, 0, 0, 0, 0, 0, "Activates the screw tool"); // Bish - This could use some more definition - uiDefBut(block, BUT,B_EXTREP, "Extrude Dupe",477,15,128,19, 0, 0, 0, 0, 0, "Creates copies of the selected vertices in a straight line away from the current viewport"); - - uiBlockSetCol(block, BUTGREY); - uiDefButS(block, NUM, B_DIFF, "Degr:", 477,55,78,19, °r,10.0,360.0, 0, 0, "Specifies the number of degrees 'Spin' revolves"); - uiDefButS(block, NUM, B_DIFF, "Steps:", 558,55,78,19, &step,1.0,180.0, 0, 0, "Specifies the total number of 'Spin' slices"); - uiDefButS(block, NUM, B_DIFF, "Turns:", 639,55,86,19, &turn,1.0,360.0, 0, 0, "Specifies the number of revolutions the screw turns"); - uiDefButS(block, TOG|BIT|0, B_DIFF, "Clockwise", 639,35,86,19, &editbutflag, 0, 0, 0, 0, "Specifies the direction for 'Screw' and 'Spin'"); - uiDefButS(block, TOG|BIT|1, B_DIFF, "Keep Original", 477,35,156,19, &editbutflag, 0, 0, 0, 0, "Keeps a copy of the original vertices and faces after executing tools"); - uiDefButF(block, NUM, B_DIFF, "Offset:", 608,15,117,19, &extr_offs, 0.01, 10.0, 100, 0, "Sets the distance between each copy for 'Extrude Dupe'"); - } - - by=206; - - uiBlockSetCol(block, BUTGREEN); - uiDefButS(block, TOG|BIT|2, 0, "Beauty", 847,by-=20,94,19, &editbutflag, 0, 0, 0, 0, "Causes 'Subdivide' to split faces in halves instead of quarters"); - uiBlockSetCol(block, BUTSALMON); - - uiDefBut(block, BUT,B_SPLIT,"Split", 847,by-=19,94,18, 0, 0, 0, 0, 0, "Separates selected faces from unselected faces"); - uiDefBut(block, BUT,B_TOSPHERE,"To Sphere", 847,by-=19,94,18, 0, 0, 0, 0, 0, "Moves selected vertices outwards into a spherical shape"); - uiDefBut(block, BUT,B_SUBDIV,"Subdivide", 847,by-=19,94,18, 0, 0, 0, 0, 0, "Splits selected faces into halves or quarters"); - uiDefBut(block, BUT,B_FRACSUBDIV, "Fract Subd",847,by-=19,94,18, 0, 0, 0, 0, 0, "Subdivides selected faces with a random factor"); - - uiDefBut(block, BUT,B_VERTEXNOISE,"Noise", 847,by-=19,94,18, 0, 0, 0, 0, 0, "Use vertex coordinate as texture coordinate"); - uiDefBut(block, BUT,B_VERTEXSMOOTH,"Smooth", 847,by-=19,94,18, 0, 0, 0, 0, 0, "Flattens angles of selected faces"); - uiDefBut(block, BUT,B_XSORT,"Xsort", 847,by-=19,94,18, 0, 0, 0, 0, 0, "Sorts selected vertice data in the X direction"); - uiDefBut(block, BUT,B_HASH,"Hash", 847,by-=19,94,18, 0, 0, 0, 0, 0, "Randomizes selected vertice sequence data"); - - uiBlockSetCol(block, BUTGREY); - uiDefButF(block, NUM, B_DIFF, "Limit:", 959,151,100,19, &doublimit, 0.0001, 1.0, 10, 0, "Specifies the max distance 'Rem Doubles' will consider vertices as 'doubled'"); - - uiBlockSetCol(block, BUTSALMON); - - uiDefBut(block, BUT,B_REMDOUB,"Rem Doubles", 958,173,101,32, 0, 0, 0, 0, 0, "Removes duplicates from selected vertices"); - - uiDefBut(block, BUT,B_FLIPNORM,"Flip Normals", 961,55,100,19, 0, 0, 0, 0, 0, "Toggles the direction of the selected face's normals"); - - uiDefBut(block, BUT, B_SLOWERDRAW,"SlowerDraw", 961,35,100,19, 0, 0, 0, 0, 0, "Displays the active object with all possible edges shown"); - uiDefBut(block, BUT, B_FASTERDRAW,"FasterDraw", 961,15,100,19, 0, 0, 0, 0, 0, "Displays the active object faster by omitting some edges when drawing"); - -#ifdef __NLA - - /* Draw Vertex grouping buttons if we're in editmode*/ - if (ob){ - char *s, *menustr; - bDeformGroup *dg; - int index; - - by = 210; - uiBlockSetCol(block, BUTGREY); - uiDefBut(block, LABEL,0,"Vertex Groups", 740,by-=19,93,18, 0, 0, 0, 0, 0, ""); - - defCount=BLI_countlist(&ob->defbase); - - if (!defCount) - min=0; - else - min=1; - -#if 0 - sprintf (str, "%d Group:", defCount); - uiDefButS(block, NUM, REDRAWBUTSEDIT, str, 740, by-=22,93,18, &ob->actdef, min, defCount, 0, 0, ""); -#else - s= menustr = MEM_callocN((32 * defCount)+20, "menustr"); - - for (index = 1, dg = ob->defbase.first; dg; index++, dg=dg->next){ - int cnt= sprintf (s, "%s%%x%d|", dg->name, index); - - if (cnt>0) - s+= cnt; - } - - by-=22; - if (defCount) - uiDefButS(block, MENU, REDRAWBUTSEDIT, menustr, 740, by,18,18, &ob->actdef, min, defCount, 0, 0, "Browses available vertex groups"); - MEM_freeN (menustr); -#endif - if (ob->actdef){ - defGroup = BLI_findlink(&ob->defbase, ob->actdef-1); - but= uiDefBut(block, TEX,REDRAWBUTSEDIT,"", 758,by,93-18,18, defGroup->name, 0, 32, 0, 0, "Displays current vertex group name. Click to change. (Match bone name for deformation.)"); - uiButSetFunc(but, verify_vertexgroup_name_func, defGroup, NULL); - } - uiDefButF(block, NUM, REDRAWVIEW3D, "Weight:", 740, by-=22, 93, 18, &editbutvweight, 0, 1, 10, 0, "Sets the current vertex group's bone deformation strength"); - - } - - if (G.obedit && G.obedit==ob){ - - uiBlockSetCol(block, BUTSALMON); -/* uiDefBut(block, BUT,B_AUTOVGROUP,"Auto Weight", 740,by-=22,93,18, 0, 0, 0, 0, 0, "Automatically assigns deformation groups"); */ - uiDefBut(block, BUT,B_NEWVGROUP,"New", 740,by-=22,45,18, 0, 0, 0, 0, 0, "Creates a new vertex group"); - uiDefBut(block, BUT,B_DELVGROUP,"Delete", 788,by,45,18, 0, 0, 0, 0, 0, "Removes the current vertex group"); - - uiBlockSetCol(block, BUTSALMON); - uiDefBut(block, BUT,B_ASSIGNVGROUP,"Assign", 740,by-=22,93,18, 0, 0, 0, 0, 0, "Assigns selected vertices to the current vertex group"); - uiDefBut(block, BUT,B_REMOVEVGROUP,"Remove", 740,by-=22,93,18, 0, 0, 0, 0, 0, "Removes selected vertices from the current vertex group"); - - uiBlockSetCol(block, BUTGREY); - uiDefBut(block, BUT,B_SELVGROUP,"Select", 740,by-=22,93,18, 0, 0, 0, 0, 0, "Selects vertices belonging to the current vertex group"); - uiDefBut(block, BUT,B_DESELVGROUP,"Deselect", 740,by-=22,93,18, 0, 0, 0, 0, 0, "Deselects vertices belonging to the current vertex group"); - -} -#endif - - uiBlockSetCol(block, BUTGREY); - uiDefButF(block, NUM, REDRAWVIEW3D, "NSize:", 1090, 90, 164, 19, &editbutsize, 0.001, 2.0, 10, 0, "Sets the length to use when displaying face normals"); - uiDefButI(block, TOG|BIT|6, REDRAWVIEW3D, "Draw Normals", 1090,70,164,19, &G.f, 0, 0, 0, 0, "Displays face normals as lines"); - uiDefButI(block, TOG|BIT|7, REDRAWVIEW3D, "Draw Faces", 1090,50,164,19, &G.f, 0, 0, 0, 0, "Displays all faces as shades"); - uiDefButI(block, TOG|BIT|18, REDRAWVIEW3D, "Draw Edges", 1090,30,164,19, &G.f, 0, 0, 0, 0, "Displays selected edges using hilights"); - uiDefButI(block, TOG|BIT|11, 0, "All edges", 1090,10,164,19, &G.f, 0, 0, 0, 0, "Displays all edges in object mode without optimization"); - - uiDrawBlock(block); -} // Bish made it to here. (reviewing tooltips) -/* *************************** FONT ******************************** */ - -short give_vfontnr(VFont *vfont) -{ - VFont *vf; - short nr= 1; - - vf= G.main->vfont.first; - while(vf) { - if(vf==vfont) return nr; - nr++; - vf= vf->id.next; - } - return -1; -} - -VFont *give_vfontpointer(int nr) /* nr= button */ -{ - VFont *vf; - short tel= 1; - - vf= G.main->vfont.first; - while(vf) { - if(tel==nr) return vf; - tel++; - vf= vf->id.next; - } - return G.main->vfont.first; -} - -VFont *exist_vfont(char *str) -{ - VFont *vf; - - vf= G.main->vfont.first; - while(vf) { - if(strcmp(vf->name, str)==0) return vf; - vf= vf->id.next; - } - return 0; -} - -static char *give_vfontbutstr(void) -{ - VFont *vf; - int len= 0; - char *str, di[FILE_MAXDIR], fi[FILE_MAXFILE]; - - vf= G.main->vfont.first; - while(vf) { - strcpy(di, vf->name); - BLI_splitdirstring(di, fi); - len+= strlen(fi)+4; - vf= vf->id.next; - } - - str= MEM_callocN(len+21, "vfontbutstr"); - strcpy(str, "FONTS %t"); - vf= G.main->vfont.first; - while(vf) { - - if(vf->id.us==0) strcat(str, "|0 "); - else strcat(str, "| "); - - strcpy(di, vf->name); - BLI_splitdirstring(di, fi); - - strcat(str, fi); - vf= vf->id.next; - } - return str; -} - -void load_buts_vfont(char *name) -{ - VFont *vf; - Curve *cu; - - if(OBACT && OBACT->type==OB_FONT) cu= OBACT->data; - else return; - - vf= exist_vfont(name); - if(vf==0) { - vf= load_vfont(name); - if(vf==0) return; - } - else id_us_plus((ID *)vf); - - if(cu->vfont) cu->vfont->id.us--; - cu->vfont= vf; - - text_to_curve(OBACT, 0); - makeDispList(OBACT); - allqueue(REDRAWVIEW3D, 0); - allqueue(REDRAWBUTSEDIT, 0); -} - -void do_fontbuts(unsigned short event) -{ - Curve *cu; - VFont *vf; - Object *ob; - ScrArea *sa; - char str[80]; - - ob= OBACT; - - switch(event) { - case B_MAKEFONT: - text_to_curve(ob, 0); - makeDispList(ob); - allqueue(REDRAWVIEW3D, 0); - break; - case B_TOUPPER: - to_upper(); - break; - case B_LOADFONT: - vf= give_vfontpointer(G.buts->texnr); - if(vf && vf->id.prev!=vf->id.next) strcpy(str, vf->name); - else strcpy(str, U.fontdir); - - sa= closest_bigger_area(); - areawinset(sa->win); - - activate_fileselect(FILE_SPECIAL, "SELECT FONT", str, load_buts_vfont); - - break; - case B_PACKFONT: - if (ob) { - cu= ob->data; - if(cu && cu->vfont) { - if (cu->vfont->packedfile) { - if (G.fileflags & G_AUTOPACK) { - if (okee("Disable AutoPack ?")) { - G.fileflags &= ~G_AUTOPACK; - } - } - - if ((G.fileflags & G_AUTOPACK) == 0) { - if (unpackVFont(cu->vfont, PF_ASK) == RET_OK) { - text_to_curve(ob, 0); - makeDispList(ob); - allqueue(REDRAWVIEW3D, 0); - } - } - } else { - cu->vfont->packedfile = newPackedFile(cu->vfont->name); - } - } - } - allqueue(REDRAWHEADERS, 0); - allqueue(REDRAWBUTSEDIT, 0); - break; - - case B_SETFONT: - if(ob) { - cu= ob->data; - - vf= give_vfontpointer(G.buts->texnr); - if(vf) { - id_us_plus((ID *)vf); - cu->vfont->id.us--; - cu->vfont= vf; - text_to_curve(ob, 0); - makeDispList(ob); - allqueue(REDRAWVIEW3D, 0); - allqueue(REDRAWBUTSEDIT, 0); - } - } - break; - case B_TEXTONCURVE: - if(ob) { - cu= ob->data; - if(cu->textoncurve && cu->textoncurve->type!=OB_CURVE) { - error("Only Curve Objects"); - cu->textoncurve= 0; - allqueue(REDRAWBUTSEDIT, 0); - } - text_to_curve(ob, 0); - makeDispList(ob); - } - } -} - - - -void fontbuts(void) -{ - Curve *cu; - uiBlock *block; - char *strp, str[64]; - - if(OBACT==0) return; - - sprintf(str, "editbuttonswin1 %d", curarea->win); - block= uiNewBlock(&curarea->uiblocks, str, UI_EMBOSSX, UI_HELV, curarea->win); - - cu= OBACT->data; - - uiBlockSetCol(block, BUTGREEN); - uiDefButS(block, ROW,B_MAKEFONT, "Left", 484,139,53,18, &cu->spacemode, 0.0,0.0, 0, 0, ""); - uiDefButS(block, ROW,B_MAKEFONT, "Middle", 604,139,61,18, &cu->spacemode, 0.0,1.0, 0, 0, ""); - uiDefButS(block, ROW,B_MAKEFONT, "Right", 540,139,62,18, &cu->spacemode, 0.0,2.0, 0, 0, ""); - uiDefButS(block, ROW,B_MAKEFONT, "Flush", 665,139,61,18, &cu->spacemode, 0.0,3.0, 0, 0, ""); - - uiBlockSetCol(block, BUTGREY); - - uiDefIDPoinBut(block, test_obpoin_but, B_TEXTONCURVE, "TextOnCurve:", 484,115,243,19, &cu->textoncurve, ""); - - uiDefButF(block, NUM,B_MAKEFONT, "Size:", 482,56,121,19, &cu->fsize, 0.1,10.0, 10, 0, ""); - uiDefButF(block, NUM,B_MAKEFONT, "Linedist:", 605,56,121,19, &cu->linedist, 0.0,10.0, 10, 0, ""); - uiDefButF(block, NUM,B_MAKEFONT, "Spacing:", 482,34,121,19, &cu->spacing, 0.0,10.0, 10, 0, ""); - uiDefButF(block, NUM,B_MAKEFONT, "Y offset:", 605,34,121,19, &cu->yof, -50.0,50.0, 10, 0, ""); - uiDefButF(block, NUM,B_MAKEFONT, "Shear:", 482,12,121,19, &cu->shear, -1.0,1.0, 10, 0, ""); - uiDefButF(block, NUM,B_MAKEFONT, "X offset:", 605,12,121,19, &cu->xof, -50.0,50.0, 10, 0, ""); - - uiDefBut(block, TEX,REDRAWVIEW3D, "Ob Family:", 752,192,164,19, cu->family, 0.0, 20.0, 0, 0, ""); - - uiBlockSetCol(block, BUTSALMON); - uiDefBut(block, BUT, B_TOUPPER, "ToUpper", 623,163,103,23, 0, 0, 0, 0, 0, ""); - - uiBlockSetCol(block, BUTGREY); - - G.buts->texnr= give_vfontnr(cu->vfont); - - strp= give_vfontbutstr(); - - uiDefButS(block, MENU, B_SETFONT, strp, 484,191,220,20, &G.buts->texnr, 0, 0, 0, 0, ""); - - if (cu->vfont->packedfile) { - packdummy = 1; - } else { - packdummy = 0; - } - - uiBlockSetCol(block, BUTYELLOW); - uiDefIconButI(block, TOG|BIT|0, B_PACKFONT, ICON_PACKAGE, 706,191,20,20, &packdummy, 0, 0, 0, 0, "Pack/Unpack this Vectorfont"); - - MEM_freeN(strp); - - uiBlockSetCol(block, BUTSALMON); - uiDefBut(block, BUT,B_LOADFONT, "Load Font", 484,163,103,23, 0, 0, 0, 0, 0, ""); - - uiDrawBlock(block); -} - -/* *************************** CURVE ******************************** */ - - -void do_curvebuts(unsigned short event) -{ - extern Nurb *lastnu; - Object *ob; - Curve *cu; - Nurb *nu; - - ob= OBACT; - if(ob==0) return; - - switch(event) { - - case B_CONVERTPOLY: - case B_CONVERTBEZ: - case B_CONVERTBSPL: - case B_CONVERTCARD: - case B_CONVERTNURB: - if(G.obedit) { - setsplinetype(event-B_CONVERTPOLY); - makeDispList(G.obedit); - allqueue(REDRAWVIEW3D, 0); - } - break; - case B_UNIFU: - case B_ENDPU: - case B_BEZU: - case B_UNIFV: - case B_ENDPV: - case B_BEZV: - if(G.obedit) { - nu= editNurb.first; - while(nu) { - if(isNurbsel(nu)) { - if((nu->type & 7)==CU_NURBS) { - if(event<B_UNIFV) { - nu->flagu &= 1; - nu->flagu += ((event-B_UNIFU)<<1); - makeknots(nu, 1, nu->flagu>>1); - } - else if(nu->pntsv>1) { - nu->flagv &= 1; - nu->flagv += ((event-B_UNIFV)<<1); - makeknots(nu, 2, nu->flagv>>1); - } - } - } - nu= nu->next; - } - makeDispList(G.obedit); - allqueue(REDRAWVIEW3D, 0); - } - break; - case B_SETWEIGHT: - if(G.obedit) { - weightflagNurb(1, editbutweight, 0); - makeDispList(G.obedit); - allqueue(REDRAWVIEW3D, 0); - } - break; - case B_SETW1: - editbutweight= 1.0; - scrarea_queue_winredraw(curarea); - break; - case B_SETW2: - editbutweight= sqrt(2.0)/4.0; - scrarea_queue_winredraw(curarea); - break; - case B_SETW3: - editbutweight= 0.25; - scrarea_queue_winredraw(curarea); - break; - case B_SETW4: - editbutweight= sqrt(0.5); - scrarea_queue_winredraw(curarea); - break; - case B_SETORDER: - if(G.obedit) { - nu= lastnu; - if(nu && (nu->type & 7)==CU_NURBS ) { - if(nu->orderu>nu->pntsu) { - nu->orderu= nu->pntsu; - scrarea_queue_winredraw(curarea); - } - makeknots(nu, 1, nu->flagu>>1); - if(nu->orderv>nu->pntsv) { - nu->orderv= nu->pntsv; - scrarea_queue_winredraw(curarea); - } - makeknots(nu, 2, nu->flagv>>1); - } - makeDispList(G.obedit); - allqueue(REDRAWVIEW3D, 0); - } - break; - case B_MAKEDISP: - if(ob->type==OB_FONT) text_to_curve(ob, 0); - makeDispList(ob); - allqueue(REDRAWVIEW3D, 0); - allqueue(REDRAWINFO, 1); /* 1, because header->win==0! */ - break; - - case B_SUBDIVCURVE: - subdivideNurb(); - break; - case B_SPINNURB: - /* bad bad bad!!! use brackets!!! In case you wondered: - {==,!=} goes before & goes before || */ - if( (G.obedit==0) || - (G.obedit->type!=OB_SURF) || - ((G.obedit->lay & G.vd->lay) == 0) ) return; - spinNurb(0, 0); - countall(); - makeDispList(G.obedit); - allqueue(REDRAWVIEW3D, 0); - break; - case B_CU3D: /* allow 3D curve */ - if(G.obedit) { - cu= G.obedit->data; - nu= editNurb.first; - while(nu) { - nu->type &= ~CU_2D; - if((cu->flag & CU_3D)==0) nu->type |= CU_2D; - test2DNurb(nu); - nu= nu->next; - } - } - if(ob->type==OB_CURVE) { - cu= ob->data; - nu= cu->nurb.first; - while(nu) { - nu->type &= ~CU_2D; - if((cu->flag & CU_3D)==0) nu->type |= CU_2D; - test2DNurb(nu); - nu= nu->next; - } - } - break; - case B_SETRESOLU: - if(ob->type==OB_CURVE) { - cu= ob->data; - if(ob==G.obedit) nu= editNurb.first; - else nu= cu->nurb.first; - - while(nu) { - nu->resolu= cu->resolu; - nu= nu->next; - } - } - else if(ob->type==OB_FONT) text_to_curve(ob, 0); - - makeDispList(ob); - allqueue(REDRAWVIEW3D, 0); - - break; - } -} - -void curvebuts(void) -{ - Object *ob; - Curve *cu; - Nurb *nu; - extern Nurb *lastnu; - uiBlock *block; - short *sp; - char str[64]; - - ob= OBACT; - if(ob==0) return; - - sprintf(str, "editbuttonswin %d", curarea->win); - block= uiNewBlock(&curarea->uiblocks, str, UI_EMBOSSX, UI_HELV, curarea->win); - - cu= ob->data; - - if(ob->type==OB_CURVE || ob->type==OB_SURF) { - uiBlockSetCol(block, BUTSALMON); - uiDefBut(block, LABEL, 0, "Convert", 463,173,72, 18, 0, 0, 0, 0, 0, ""); - uiDefBut(block, BUT,B_CONVERTPOLY,"Poly", 467,152,72, 18, 0, 0, 0, 0, 0, ""); - uiDefBut(block, BUT,B_CONVERTBEZ,"Bezier", 467,132,72, 18, 0, 0, 0, 0, 0, ""); - uiDefBut(block, BUT,B_CONVERTBSPL,"Bspline", 467,112,72, 18, 0, 0, 0, 0, 0, ""); - uiDefBut(block, BUT,B_CONVERTCARD,"Cardinal", 467,92,72, 18, 0, 0, 0, 0, 0, ""); - uiDefBut(block, BUT,B_CONVERTNURB,"Nurb", 467,72,72, 18, 0, 0, 0, 0, 0, ""); - - uiDefBut(block, LABEL, 0, "Make Knots",562,173,102, 18, 0, 0, 0, 0, 0, ""); - uiDefBut(block, BUT,B_UNIFU,"Uniform U", 565,152,102, 18, 0, 0, 0, 0, 0, ""); - uiDefBut(block, BUT,B_ENDPU,"Endpoint U", 565,132,102, 18, 0, 0, 0, 0, 0, ""); - uiDefBut(block, BUT,B_BEZU,"Bezier U", 565,112,102, 18, 0, 0, 0, 0, 0, ""); - uiDefBut(block, BUT,B_UNIFV,"V", 670,152,50, 18, 0, 0, 0, 0, 0, ""); - uiDefBut(block, BUT,B_ENDPV,"V", 670,132,50, 18, 0, 0, 0, 0, 0, ""); - uiDefBut(block, BUT,B_BEZV,"V", 670,112,50, 18, 0, 0, 0, 0, 0, ""); - - uiDefBut(block, BUT,B_SETWEIGHT,"Set Weight", 465,11,95,49, 0, 0, 0, 0, 0, ""); - uiBlockSetCol(block, BUTGREY); - uiDefButF(block, NUM,0,"Weight:", 564,36,102,22, &editbutweight, 0.01, 10.0, 10, 0, ""); - uiDefBut(block, BUT,B_SETW1,"1.0", 669,36,50,22, 0, 0, 0, 0, 0, ""); - uiDefBut(block, BUT,B_SETW2,"sqrt(2)/4", 564,11,57,20, 0, 0, 0, 0, 0, ""); - uiDefBut(block, BUT,B_SETW3,"0.25", 621,11,43,20, 0, 0, 0, 0, 0, ""); - uiDefBut(block, BUT,B_SETW4,"sqrt(0.5)", 664,11,57,20, 0, 0, 0, 0, 0, ""); - - if(ob==G.obedit) { - nu= lastnu; - if(nu==NULL) nu= editNurb.first; - if(nu) { - sp= &(nu->orderu); - uiDefButS(block, NUM, B_SETORDER, "Order U:", 565,91,102, 18, sp, 2.0, 6.0, 0, 0, ""); - sp= &(nu->orderv); - uiDefButS(block, NUM, B_SETORDER, "V:", 670,91,50, 18, sp, 2.0, 6.0, 0, 0, ""); - sp= &(nu->resolu); - uiDefButS(block, NUM, B_MAKEDISP, "Resol U:", 565,70,102, 18, sp, 1.0, 128.0, 0, 0, ""); - sp= &(nu->resolv); - uiDefButS(block, NUM, B_MAKEDISP, "V:", 670,70,50, 18, sp, 1.0, 128.0, 0, 0, ""); - } - } - - uiBlockSetCol(block, BUTSALMON); - uiDefBut(block, BUT, B_SUBDIVCURVE, "Subdivide", 1092,105,165,20, 0, 0, 0, 0, 0, ""); - } - - if(ob->type==OB_SURF) { - uiDefBut(block, BUT, B_SPINNURB, "Spin", 808,92,101,36, 0, 0, 0, 0, 0, ""); - - uiBlockSetCol(block, BUTGREY); - uiDefButS(block, TOG|BIT|5, 0, "UV Orco", 143,160,130,18, &cu->flag, 0, 0, 0, 0, ""); - uiDefButS(block, TOG|BIT|6, REDRAWVIEW3D, "No Puno Flip", 143,140,130,18, &cu->flag, 0, 0, 0, 0, ""); - } - else { - - uiBlockSetCol(block, BUTGREY); - uiDefButS(block, TOG|BIT|5, 0, "UV Orco", 143,160,130,18, &cu->flag, 0, 0, 0, 0, ""); - - uiDefButS(block, NUM, B_MAKEDISP, "DefResolU:", 752,163,132,21, &cu->resolu, 1.0, 128.0, 0, 0, ""); - uiBlockSetCol(block, BUTSALMON); - uiDefBut(block, BUT, B_SETRESOLU, "Set", 887,163,29,21, 0, 0, 0, 0, 0, ""); - - uiBlockSetCol(block, BUTGREY); - uiDefButS(block, NUM, B_MAKEDISP, "BevResol:", 753,30,163,18, &cu->bevresol, 0.0, 10.0, 0, 0, ""); - - uiDefIDPoinBut(block, test_obcurpoin_but, B_MAKEDISP, "BevOb:", 753,10,163,18, &cu->bevobj, ""); - uiDefButF(block, NUM, B_MAKEDISP, "Width:", 753,90,163,18, &cu->width, 0.0, 2.0, 1, 0, ""); - uiDefButF(block, NUM, B_MAKEDISP, "Ext1:", 753,70,163,18, &cu->ext1, 0.0, 5.0, 10, 0, ""); - uiDefButF(block, NUM, B_MAKEDISP, "Ext2:", 753,50,163,18, &cu->ext2, 0.0, 2.0, 1, 0, ""); - uiBlockSetCol(block, BUTBLUE); - if(ob->type==OB_FONT) { - uiDefButS(block, TOG|BIT|1, B_MAKEDISP, "Front", 833,130,79,18, &cu->flag, 0, 0, 0, 0, ""); - uiDefButS(block, TOG|BIT|2, B_MAKEDISP, "Back", 753,130,76,18, &cu->flag, 0, 0, 0, 0, ""); - } - else { - uiDefButS(block, TOG|BIT|0, B_CU3D, "3D", 867,130,47,18, &cu->flag, 0, 0, 0, 0, ""); - uiDefButS(block, TOG|BIT|1, B_MAKEDISP, "Front", 810,130,55,18, &cu->flag, 0, 0, 0, 0, ""); - uiDefButS(block, TOG|BIT|2, B_MAKEDISP, "Back", 753,130,53,18, &cu->flag, 0, 0, 0, 0, ""); - } - uiBlockSetCol(block, BUTGREY); - } - - uiDefButF(block, NUM, REDRAWVIEW3D, "NSize:", 1090, 80, 164, 19, &editbutsize, 0.001, 1.0, 10, 0, ""); - - uiDrawBlock(block); -} - - -/* *************************** CAMERA ******************************** */ - - -void camerabuts(void) -{ - Camera *cam; - Object *ob; - uiBlock *block; - float grid=0.0; - char str[64]; - - if(G.vd) grid= G.vd->grid; - if(grid<1.0) grid= 1.0; - - ob= OBACT; - if(ob==0) return; - - sprintf(str, "editbuttonswin %d", curarea->win); - block= uiNewBlock(&curarea->uiblocks, str, UI_EMBOSSX, UI_HELV, curarea->win); - - cam= ob->data; - uiDefButF(block, NUM,REDRAWVIEW3D, "Lens:", 470,178,160,20, &cam->lens, 1.0, 250.0, 100, 0, "Specify the lens of the camera"); - uiDefButF(block, NUM,REDRAWVIEW3D, "ClipSta:", 470,147,160,20, &cam->clipsta, 0.001*grid, 100.0*grid, 10, 0, "Specify the startvalue of the the field of view"); - uiDefButF(block, NUM,REDRAWVIEW3D, "ClipEnd:", 470,125,160,20, &cam->clipend, 1.0, 5000.0*grid, 100, 0, "Specify the endvalue of the the field of view"); - uiDefButF(block, NUM,REDRAWVIEW3D, "DrawSize:", 470,90,160,20, &cam->drawsize, 0.1*grid, 10.0, 10, 0, "Specify the drawsize of the camera"); - - uiBlockSetCol(block, BUTGREEN); - uiDefButS(block, TOG, REDRAWVIEW3D, "Ortho", 470,49,61,40, &cam->type, 0, 0, 0, 0, "Render orthogonally"); - - uiDefButS(block, TOG|BIT|0,REDRAWVIEW3D, "ShowLimits", 533,69,97,20, &cam->flag, 0, 0, 0, 0, "Draw the field of view"); - uiDefButS(block, TOG|BIT|1,REDRAWVIEW3D, "Show Mist", 533,49,97,20, &cam->flag, 0, 0, 0, 0, "Draw a line that indicates the mist area"); - - if(G.special1 & G_HOLO) { - uiBlockSetCol(block, BUTGREY); - if(cam->netend==0.0) cam->netend= EFRA; - uiDefButF(block, NUM, REDRAWVIEW3D, "Anim len", 670,80,100,20, &cam->netend, 1.0, 2500.0, 0, 0, ""); - uiDefButF(block, NUM, REDRAWVIEW3D, "Path len:", 670,160,100,20, &cam->hololen, 0.1, 25.0, 10, 0, ""); - uiDefButF(block, NUM, REDRAWVIEW3D, "Shear fac:", 670,140,100,20, &cam->hololen1, 0.1, 5.0, 10, 0, ""); - uiBlockSetCol(block, BUTGREEN); - uiDefButS(block, TOG|BIT|4, REDRAWVIEW3D, "Holo 1", 670,120,100,20, &cam->flag, 0.0, 0.0, 0, 0, ""); - uiDefButS(block, TOG|BIT|5, REDRAWVIEW3D, "Holo 2", 670,100,100,20, &cam->flag, 0.0, 0.0, 0, 0, ""); - - } - uiDrawBlock(block); -} - -/* *************************** FACE/PAINT *************************** */ - -void do_fpaintbuts(unsigned short event) -{ - Mesh *me; - Object *ob; - extern TFace *lasttface; /* caches info on tface bookkeeping ?*/ - - ob= OBACT; - if(ob==0) return; - - switch(event) { - - case B_VPGAMMA: - vpaint_dogamma(); - break; - case B_COPY_TF_MODE: - case B_COPY_TF_UV: - case B_COPY_TF_COL: - case B_COPY_TF_TEX: - me= get_mesh(ob); - if(me && me->tface) { -/* extern TFace *lasttface; */ - TFace *tface= me->tface; - int a= me->totface; - - set_lasttface(); - if(lasttface) { - - while(a--) { - if(tface!=lasttface && (tface->flag & TF_SELECT)) { - if(event==B_COPY_TF_MODE) { - tface->mode= lasttface->mode; - tface->transp= lasttface->transp; - } - else if(event==B_COPY_TF_UV) { - memcpy(tface->uv, lasttface->uv, sizeof(tface->uv)); - tface->tpage= lasttface->tpage; - tface->tile= lasttface->tile; - - if(lasttface->mode & TF_TILES) tface->mode |= TF_TILES; - else tface->mode &= ~TF_TILES; - - } - else if(event==B_COPY_TF_TEX) { - tface->tpage= lasttface->tpage; - tface->tile= lasttface->tile; - - if(lasttface->mode & TF_TILES) tface->mode |= TF_TILES; - else tface->mode &= ~TF_TILES; - } - else if(event==B_COPY_TF_COL) memcpy(tface->col, lasttface->col, sizeof(tface->col)); - } - tface++; - } - } - do_shared_vertexcol(me); - allqueue(REDRAWVIEW3D, 0); - allqueue(REDRAWIMAGE, 0); - } - break; - case B_SET_VCOL: - clear_vpaint_selectedfaces(); - break; - case B_REDR_3D_IMA: - allqueue(REDRAWVIEW3D, 0); - allqueue(REDRAWIMAGE, 0); - break; - case B_ASSIGNMESH: - - test_object_materials(ob->data); - allqueue(REDRAWVIEW3D, 0); - allqueue(REDRAWBUTSGAME, 0); - break; - - case B_TFACE_HALO: - set_lasttface(); - if(lasttface) { - lasttface->mode &= ~TF_BILLBOARD2; - allqueue(REDRAWBUTSGAME, 0); - } - break; - - case B_TFACE_BILLB: - set_lasttface(); - if(lasttface) { - lasttface->mode &= ~TF_BILLBOARD; - allqueue(REDRAWBUTSGAME, 0); - } - break; - } -} - -void fpaintbuts(void) -{ -/* extern VPaint Gvp; already in the top of the file */ - Object *ob; - uiBlock *block; - char str[32]; - - ob= OBACT; - if(ob==0) return; - - sprintf(str, "buttonswin %d", curarea->win); - block= uiNewBlock(&curarea->uiblocks, str, UI_EMBOSSX, UI_HELV, curarea->win); - - /* VPAINT BUTTONS */ - uiBlockSetCol(block, BUTGREY); - - if (G.f & G_VERTEXPAINT) { - uiDefBut(block, LABEL, 0, "Vertex Paint", 1037,180,194,18, 0, 0, 0, 0, 0, ""); - } else if (G.f & G_TEXTUREPAINT) { - uiDefBut(block, LABEL, 0, "Texture Paint", 1037,180,194,18, 0, 0, 0, 0, 0, ""); - } - - uiDefButF(block, NUMSLI, 0, "R ", 979,160,194,19, &Gvp.r, 0.0, 1.0, B_VPCOLSLI, 0, "The amount of red used for painting"); - uiDefButF(block, NUMSLI, 0, "G ", 979,140,194,19, &Gvp.g, 0.0, 1.0, B_VPCOLSLI, 0, "The amount of green used for painting"); - uiDefButF(block, NUMSLI, 0, "B ", 979,120,194,19, &Gvp.b, 0.0, 1.0, B_VPCOLSLI, 0, "The amount of blue used for painting"); - uiDefButF(block, NUMSLI, 0, "Opacity ", 979,100,194,19, &Gvp.a, 0.0, 1.0, 0, 0, "The amount of pressure on the brush"); - uiDefButF(block, NUMSLI, 0, "Size ", 979,80,194,19, &Gvp.size, 2.0, 64.0, 0, 0, "The size of the brush"); - - uiDefButF(block, COL, B_VPCOLSLI, "", 1176,100,28,80, &(Gvp.r), 0, 0, 0, 0, ""); - - uiDefButS(block, ROW, B_DIFF, "Mix", 1212,160,63,19, &Gvp.mode, 1.0, 0.0, 0, 0, "Mix the vertex colours"); - uiDefButS(block, ROW, B_DIFF, "Add", 1212,140,63,19, &Gvp.mode, 1.0, 1.0, 0, 0, "Add the vertex colour"); - uiDefButS(block, ROW, B_DIFF, "Sub", 1212, 120,63,19, &Gvp.mode, 1.0, 2.0, 0, 0, "Subtract from the vertex colour"); - uiDefButS(block, ROW, B_DIFF, "Mul", 1212, 100,63,19, &Gvp.mode, 1.0, 3.0, 0, 0, "Multiply the vertex colour"); - uiDefButS(block, ROW, B_DIFF, "Filter", 1212, 80,63,19, &Gvp.mode, 1.0, 4.0, 0, 0, "Mix the colours with an alpha factor"); - - uiBlockSetCol(block, BUTGREEN); - uiDefButS(block, TOG|BIT|1, 0, "Area", 980,50,80,19, &Gvp.flag, 0, 0, 0, 0, "Set the area the brush covers"); - uiDefButS(block, TOG|BIT|2, 0, "Soft", 1061,50,112,19, &Gvp.flag, 0, 0, 0, 0, "Use a soft brush"); - uiDefButS(block, TOG|BIT|3, 0, "Normals", 1174,50,102,19, &Gvp.flag, 0, 0, 0, 0, "Use vertex normal for painting"); - - uiBlockSetCol(block, BUTSALMON); - uiDefBut(block, BUT, B_VPGAMMA, "Set", 980,30,80,19, 0, 0, 0, 0, 0, "Apply Mul and Gamma to vertex colours"); - uiBlockSetCol(block, BUTGREY); - uiDefButF(block, NUM, B_DIFF, "Mul:", 1061,30,112,19, &Gvp.mul, 0.1, 50.0, 10, 0, "Set the number to multiply vertex colours with"); - uiDefButF(block, NUM, B_DIFF, "Gamma:", 1174,30,102,19, &Gvp.gamma, 0.1, 5.0, 10, 0, "Change the clarity of the vertex colours"); - - uiDefBut(block, LABEL, 0, "Face Select", 600,180,194,18, 0, 0, 0, 0, 0, ""); - if(G.f & G_FACESELECT) { - extern TFace *lasttface; - - set_lasttface(); - if(lasttface) { - - uiBlockSetCol(block, BUTGREEN); - uiDefButS(block, TOG|BIT|2, B_REDR_3D_IMA, "Tex", 600,160,60,19, &lasttface->mode, 0, 0, 0, 0, "Render face with texture"); - uiDefButS(block, TOG|BIT|7, B_REDR_3D_IMA, "Tiles", 660,160,60,19, &lasttface->mode, 0, 0, 0, 0, "Use tilemode for face"); - uiDefButS(block, TOG|BIT|4, REDRAWVIEW3D, "Light", 720,160,60,19, &lasttface->mode, 0, 0, 0, 0, "Use light for face"); - uiDefButS(block, TOG|BIT|10, REDRAWVIEW3D, "Invisible",780,160,60,19, &lasttface->mode, 0, 0, 0, 0, "Make face invisible"); - uiDefButS(block, TOG|BIT|0, REDRAWVIEW3D, "Collision", 840,160,60,19, &lasttface->mode, 0, 0, 0, 0, "Use face for collision detection"); - - uiDefButS(block, TOG|BIT|6, REDRAWVIEW3D, "Shared", 600,140,60,19, &lasttface->mode, 0, 0, 0, 0, "Blend vertex colours across face when vertices are shared"); - uiDefButS(block, TOG|BIT|9, REDRAWVIEW3D, "Twoside", 660,140,60,19, &lasttface->mode, 0, 0, 0, 0, "Render face twosided"); - uiDefButS(block, TOG|BIT|11, REDRAWVIEW3D, "ObColor",720,140,60,19, &lasttface->mode, 0, 0, 0, 0, "Use ObColor instead of vertex colours"); - - uiDefButS(block, TOG|BIT|8, B_TFACE_HALO, "Halo", 600,120,60,19, &lasttface->mode, 0, 0, 0, 0, "Screen aligned billboard"); - uiDefButS(block, TOG|BIT|12, B_TFACE_BILLB, "Billboard",660,120,60,19, &lasttface->mode, 0, 0, 0, 0, "Billboard with Z-axis constraint"); - uiDefButS(block, TOG|BIT|13, REDRAWVIEW3D, "Shadow", 720,120,60,19, &lasttface->mode, 0, 0, 0, 0, "Face is used for shadow"); - uiDefButS(block, TOG|BIT|14, REDRAWVIEW3D, "Text", 780,120,60,19, &lasttface->mode, 0, 0, 0, 0, "Enable bitmap text on face"); - - uiBlockSetCol(block, BUTPURPLE); - uiDefButC(block, ROW, REDRAWVIEW3D, "Opaque", 600,100,60,19, &lasttface->transp, 2.0, 0.0, 0, 0, "Render colour of textured face as colour"); - uiDefButC(block, ROW, REDRAWVIEW3D, "Add", 660,100,60,19, &lasttface->transp, 2.0, 1.0, 0, 0, "Render face transparent and add colour of face"); - uiDefButC(block, ROW, REDRAWVIEW3D, "Alpha", 720,100,60,19, &lasttface->transp, 2.0, 2.0, 0, 0, "Render polygon transparent, depending on alpha channel of the texture"); - /* uiDefButC(block, ROW, REDRAWVIEW3D, "Sub", 780,100,60,19, &lasttface->transp, 2.0, 3.0, 0, 0); ,""*/ - - } - } - uiBlockSetCol(block, BUTSALMON); - if(G.f & G_FACESELECT) { - uiDefBut(block, BUT, B_SET_VCOL, "Set VertCol", 859,37,103,28, 0, 0, 0, 0, 0, "Set Vertex colour of selection to current (Shift+K)"); - - } - uiDefBut(block, BUT, B_COPY_TF_MODE, "Copy DrawMode", 650,7,117,28, 0, 0, 0, 0, 0, "Copy the drawmode"); - uiDefBut(block, BUT, B_COPY_TF_UV, "Copy UV+tex", 771,7,85,28, 0, 0, 0, 0, 0, "Copy UV information and textures"); - uiDefBut(block, BUT, B_COPY_TF_COL, "Copy VertCol", 859,7,103,28, 0, 0, 0, 0, 0, "Copy vertex colours"); - - uiDrawBlock(block); -} - /* *************************** RADIO ******************************** */ void do_radiobuts(short event) @@ -2671,67 +842,6 @@ void radiobuts(void) } -/* *************************** MBALL ******************************** */ - -void do_mballbuts(unsigned short event) -{ - switch(event) { - case B_RECALCMBALL: - makeDispList(OBACT); - allqueue(REDRAWVIEW3D, 0); - break; - } -} - -void mballbuts(void) -{ - extern MetaElem *lastelem; - MetaBall *mb; - Object *ob; - uiBlock *block; - char str[64]; - - ob= OBACT; - if(ob==0) return; - - sprintf(str, "editbuttonswin %d", curarea->win); - block= uiNewBlock(&curarea->uiblocks, str, UI_EMBOSSX, UI_HELV, curarea->win); - - mb= ob->data; - if (ob==find_basis_mball(ob)) { - uiDefButF(block, NUMSLI, B_RECALCMBALL, "Wiresize:", 470,178,250,19, &mb->wiresize, 0.05, 1.0, 0, 0, ""); - uiDefButF(block, NUMSLI, 0, "Rendersize:", 470,158,250,19, &mb->rendersize, 0.05, 1.0, 0, 0, ""); - uiDefButF(block, NUMSLI, B_RECALCMBALL, "Threshold:", 470,138,250,19, &mb->thresh, 0.0001, 5.0, 0, 0, ""); - - uiBlockSetCol(block, BUTBLUE); - uiDefBut(block, LABEL, 0, "Update:", 471,108,120,19, 0, 0, 0, 0, 0, ""); - uiDefButS(block, ROW, B_DIFF, "Always", 471, 85, 120, 19, &mb->flag, 0.0, 0.0, 0, 0, ""); - uiDefButS(block, ROW, B_DIFF, "Half Res", 471, 65, 120, 19, &mb->flag, 0.0, 1.0, 0, 0, ""); - uiDefButS(block, ROW, B_DIFF, "Fast", 471, 45, 120, 19, &mb->flag, 0.0, 2.0, 0, 0, ""); - uiBlockSetCol(block, BUTGREY); - } - - if(ob==G.obedit && lastelem) { - uiDefButF(block, NUMSLI, B_RECALCMBALL, "Stiffness:", 750,178,250,19, &lastelem->s, 0.0, 10.0, 0, 0, ""); - if(lastelem->type!=MB_BALL) - uiDefButF(block, NUMSLI, B_RECALCMBALL, "dx:", 750,158,250,19, &lastelem->expx, 0.0, 20.0, 0, 0, ""); - if((lastelem->type!=MB_BALL)&&(lastelem->type!=MB_TUBE)) - uiDefButF(block, NUMSLI, B_RECALCMBALL, "dy:", 750,138,250,19, &lastelem->expy, 0.0, 20.0, 0, 0, ""); - - if((lastelem->type==MB_CUBE)||(lastelem->type==MB_ELIPSOID)) - uiDefButF(block, NUMSLI, B_RECALCMBALL, "dz:", 750,118,250,19, &lastelem->expz, 0.0, 20.0, 0, 0, ""); - - uiBlockSetCol(block, BUTGREEN); - uiDefButS(block, TOG|BIT|1, B_RECALCMBALL, "Negative",753,16,60,19, &lastelem->flag, 0, 0, 0, 0, ""); - - uiDefButS(block, ROW, B_RECALCMBALL, "Ball", 753,83,60,19, &lastelem->type, 1.0, 0.0, 0, 0, ""); - uiDefButS(block, ROW, B_RECALCMBALL, "Tube", 753,62,60,19, &lastelem->type, 1.0, 4.0, 0, 0, ""); - uiDefButS(block, ROW, B_RECALCMBALL, "Plane", 814,62,60,19, &lastelem->type, 1.0, 5.0, 0, 0, ""); - uiDefButS(block, ROW, B_RECALCMBALL, "Elipsoid", 876,62,60,19, &lastelem->type, 1.0, 6.0, 0, 0, ""); - uiDefButS(block, ROW, B_RECALCMBALL, "Cube", 938,62,60,19, &lastelem->type, 1.0, 7.0, 0, 0, ""); - } - uiDrawBlock(block); -} /* *************************** SCRIPT ******************************** */ @@ -3013,86 +1123,6 @@ void ikabuts(void) uiDrawBlock(block); } -/* *************************** LATTICE ******************************** */ - -void do_latticebuts(unsigned short event) -{ - Object *ob; - Lattice *lt; - - ob= OBACT; - - switch(event) { - case B_RESIZELAT: - if(ob) { - if(ob==G.obedit) resizelattice(editLatt); - else resizelattice(ob->data); - } - allqueue(REDRAWVIEW3D, 0); - break; - case B_DRAWLAT: - if(ob==G.obedit) calc_lattverts_ext(); - allqueue(REDRAWVIEW3D, 0); - break; - case B_LATTCHANGED: - - lt= ob->data; - if(lt->flag & LT_OUTSIDE) outside_lattice(lt); - - make_displists_by_parent(ob); - - allqueue(REDRAWVIEW3D, 0); - - break; - } -} - -void latticebuts(void) -{ - Lattice *lt; - Object *ob; - uiBlock *block; - char str[64]; - - ob= OBACT; - if(ob==0) return; - - sprintf(str, "editbuttonswin %d", curarea->win); - block= uiNewBlock(&curarea->uiblocks, str, UI_EMBOSSX, UI_HELV, curarea->win); - - if(ob==G.obedit) lt= editLatt; - else lt= ob->data; - - uiSetButLock(lt->key!=0, "Not with VertexKeys"); - uiSetButLock(ob==G.obedit, "Unable to perform function in EditMode"); - uiDefButS(block, NUM, B_RESIZELAT, "U:", 470,178,100,19, <->pntsu, 1.0, 64.0, 0, 0, ""); - uiDefButS(block, NUM, B_RESIZELAT, "V:", 470,158,100,19, <->pntsv, 1.0, 64.0, 0, 0, ""); - uiDefButS(block, NUM, B_RESIZELAT, "W:", 470,138,100,19, <->pntsw, 1.0, 64.0, 0, 0, ""); - uiClearButLock(); - - uiBlockSetCol(block, BUTGREEN); - uiDefButC(block, ROW, B_LATTCHANGED, "Lin", 572, 178, 40, 19, <->typeu, 1.0, (float)KEY_LINEAR, 0, 0, ""); - uiDefButC(block, ROW, B_LATTCHANGED, "Card", 612, 178, 40, 19, <->typeu, 1.0, (float)KEY_CARDINAL, 0, 0, ""); - uiDefButC(block, ROW, B_LATTCHANGED, "B", 652, 178, 40, 19, <->typeu, 1.0, (float)KEY_BSPLINE, 0, 0, ""); - - uiDefButC(block, ROW, B_LATTCHANGED, "Lin", 572, 158, 40, 19, <->typev, 2.0, (float)KEY_LINEAR, 0, 0, ""); - uiDefButC(block, ROW, B_LATTCHANGED, "Card", 612, 158, 40, 19, <->typev, 2.0, (float)KEY_CARDINAL, 0, 0, ""); - uiDefButC(block, ROW, B_LATTCHANGED, "B", 652, 158, 40, 19, <->typev, 2.0, (float)KEY_BSPLINE, 0, 0, ""); - - uiDefButC(block, ROW, B_LATTCHANGED, "Lin", 572, 138, 40, 19, <->typew, 3.0, (float)KEY_LINEAR, 0, 0, ""); - uiDefButC(block, ROW, B_LATTCHANGED, "Card", 612, 138, 40, 19, <->typew, 3.0, (float)KEY_CARDINAL, 0, 0, ""); - uiDefButC(block, ROW, B_LATTCHANGED, "B", 652, 138, 40, 19, <->typew, 3.0, (float)KEY_BSPLINE, 0, 0, ""); - - uiBlockSetCol(block, BUTSALMON); - uiDefBut(block, BUT, B_RESIZELAT, "Make Regular", 470,101,99,32, 0, 0, 0, 0, 0, ""); - - uiBlockSetCol(block, BUTGREEN); - uiDefButS(block, TOG|BIT|1, B_LATTCHANGED, "Outside", 571,101,120,31, <->flag, 0, 0, 0, 0, ""); - - uiDrawBlock(block); -} - - /* *************************** TEXTURE ******************************** */ Tex *cur_imatex=0; @@ -5164,518 +3194,6 @@ void lampbuts(void) uiDrawBlock(block); } -/* ***************************** ANIM ************************** */ - -void do_animbuts(unsigned short event) -{ - Object *ob; - Base *base; - Effect *eff, *effn; - int type; - - ob= OBACT; - - switch(event) { - - case B_RECALCPATH: - calc_curvepath(OBACT); - allqueue(REDRAWVIEW3D, 0); - break; - case B_MUL_IPO: - scale_editipo(); - allqueue(REDRAWBUTSANIM, 0); - break; - case B_AUTOTIMEOFS: - auto_timeoffs(); - break; - case B_FRAMEMAP: - G.scene->r.framelen= G.scene->r.framapto; - G.scene->r.framelen/= G.scene->r.images; - break; - case B_NEWEFFECT: - if(ob) { - if (BLI_countlist(&ob->effect)==MAX_EFFECT) - error("Unable to add: effect limit reached"); - else - copy_act_effect(ob); - } - allqueue(REDRAWBUTSANIM, 0); - break; - case B_DELEFFECT: - if(ob==0 || ob->type!=OB_MESH) break; - eff= ob->effect.first; - while(eff) { - effn= eff->next; - if(eff->flag & SELECT) { - BLI_remlink(&ob->effect, eff); - free_effect(eff); - break; - } - eff= effn; - } - allqueue(REDRAWBUTSANIM, 0); - allqueue(REDRAWVIEW3D, 0); - break; - case B_NEXTEFFECT: - if(ob==0 || ob->type!=OB_MESH) break; - eff= ob->effect.first; - while(eff) { - if(eff->flag & SELECT) { - if(eff->next) { - eff->flag &= ~SELECT; - eff->next->flag |= SELECT; - } - break; - } - eff= eff->next; - } - allqueue(REDRAWBUTSANIM, 0); - break; - case B_PREVEFFECT: - if(ob==0 || ob->type!=OB_MESH) break; - eff= ob->effect.first; - while(eff) { - if(eff->flag & SELECT) { - if(eff->prev) { - eff->flag &= ~SELECT; - eff->prev->flag |= SELECT; - } - break; - } - eff= eff->next; - } - allqueue(REDRAWBUTSANIM, 0); - break; - case B_CHANGEEFFECT: - if(ob==0 || ob->type!=OB_MESH) break; - eff= ob->effect.first; - while(eff) { - if(eff->flag & SELECT) { - if(eff->type!=eff->buttype) { - BLI_remlink(&ob->effect, eff); - type= eff->buttype; - free_effect(eff); - eff= add_effect(type); - BLI_addtail(&ob->effect, eff); - } - break; - } - eff= eff->next; - } - allqueue(REDRAWBUTSANIM, 0); - allqueue(REDRAWVIEW3D, 0); - break; - case B_CALCEFFECT: - if(ob==0 || ob->type!=OB_MESH) break; - eff= ob->effect.first; - while(eff) { - if(eff->flag & SELECT) { - if(eff->type==EFF_PARTICLE) build_particle_system(ob); - else if(eff->type==EFF_WAVE) object_wave(ob); - } - eff= eff->next; - } - allqueue(REDRAWVIEW3D, 0); - allqueue(REDRAWBUTSANIM, 0); - break; - case B_RECALCAL: - base= FIRSTBASE; - while(base) { - if(base->lay & G.vd->lay) { - ob= base->object; - eff= ob->effect.first; - while(eff) { - if(eff->flag & SELECT) { - if(eff->type==EFF_PARTICLE) build_particle_system(ob); - } - eff= eff->next; - } - } - base= base->next; - } - allqueue(REDRAWVIEW3D, 0); - break; - case B_SETSPEED: - set_speed_editipo(hspeed); - break; - case B_PRINTSPEED: - ob= OBACT; - if(ob) { - float vec[3]; - CFRA++; - do_ob_ipo(ob); - where_is_object(ob); - VECCOPY(vec, ob->obmat[3]); - CFRA--; - do_ob_ipo(ob); - where_is_object(ob); - VecSubf(vec, vec, ob->obmat[3]); - prspeed= Normalise(vec); - scrarea_queue_winredraw(curarea); - } - break; - case B_PRINTLEN: - ob= OBACT; - if(ob && ob->type==OB_CURVE) { - Curve *cu=ob->data; - - if(cu->path) prlen= cu->path->totdist; else prlen= -1.0; - scrarea_queue_winredraw(curarea); - } - break; - case B_RELKEY: - allspace(REMAKEIPO, 0); - allqueue(REDRAWBUTSANIM, 0); - allqueue(REDRAWIPO, 0); - break; - - default: - if(event>=B_SELEFFECT && event<B_SELEFFECT+MAX_EFFECT) { - ob= OBACT; - if(ob) { - int a=B_SELEFFECT; - - eff= ob->effect.first; - while(eff) { - if(event==a) eff->flag |= SELECT; - else eff->flag &= ~SELECT; - - a++; - eff= eff->next; - } - allqueue(REDRAWBUTSANIM, 0); - } - } - } -} - -void animbuts(void) -{ - Object *ob; - Mesh *me; - Lattice *lt; - Effect *eff; - Curve *cu; - ScrArea *sa; - uiBlock *block; - int a, ok; - char str[32]; - short x, y; - - sprintf(str, "buttonswin %d", curarea->win); - block= uiNewBlock(&curarea->uiblocks, str, UI_EMBOSSX, UI_HELV, curarea->win); - - uiDefButS(block, NUM,REDRAWSEQ,"Sta:", 320,17,93,27,&G.scene->r.sfra,1.0,18000.0, 0, 0, "Specify the start frame of the animation"); - uiDefButS(block, NUM,REDRAWSEQ,"End:", 416,17,95,27,&G.scene->r.efra,1.0,18000.0, 0, 0, "Specify the end frame of the animation"); - - uiDefButS(block, NUM,B_FRAMEMAP,"Map Old:", 320,69,93,22,&G.scene->r.framapto,1.0,900.0, 0, 0, "Specify old map value in frames"); - uiDefButS(block, NUM,B_FRAMEMAP,"Map New:", 416,69,95,22,&G.scene->r.images,1.0,900.0, 0, 0, "Specify new map value in frames"); - - uiDefButS(block, NUM,REDRAWSEQ,"Frs/sec:", 320,47,93,19, &G.scene->r.frs_sec, 1.0, 120.0, 100.0, 0, "Frames per second"); - - uiBlockSetCol(block, BUTGREEN); - uiDefButS(block, TOG|BIT|1, B_SOUND_CHANGED, "Sync", 416,47,95,19, &G.scene->audio.flag, 0, 0, 0, 0, "Use sample clock for syncing animation to audio"); - -/* intrr: obsoleted, replaced by frs/sec */ -/* uiDefButS(block, NUM, 0, "AnimSpeed:", 320,47,192,19, &G.animspeed, 1.0, 9.0, 0, 0, "Set the maximum speed of the animation");*/ - - - ob= OBACT; - if(ob) { - - uiBlockSetCol(block, BUTGREEN); -/* uiDefButC(block, TOG|BIT|1, REDRAWVIEW3D, "Quaternions", 320,190,192,19, &ob->transflag, 0.0, 0.0, 0, 0, "Use quaternions for rotation"); */ - uiBlockSetCol(block, BUTGREY); - - uiDefButF(block, NUM, REDRAWALL, "TimeOffset:", 23,18,114,30, &ob->sf, -9000.0, 9000.0, 100, 0, "Specify an offset in frames"); - - uiBlockSetCol(block, BUTGREEN); - uiDefButC(block, TOG|BIT|0, REDRAWVIEW3D, "Draw Key", 25,144,84,19, &ob->ipoflag, 0, 0, 0, 0, "Draw object as key position"); - uiDefButC(block, TOG|BIT|1, REDRAWVIEW3D, "Draw Key Sel", 25,123,84,19, &ob->ipoflag, 0, 0, 0, 0, "Limit the drawing of object keys"); - - uiDefButC(block, TOG|BIT|2, REDRAWALL, "Offs Ob", 25,64,60,20, &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on its own objectipo"); - uiDefButC(block, TOG|BIT|6, REDRAWALL, "Offs Par", 85,64,60,20, &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on the parent"); - uiDefButC(block, TOG|BIT|7, REDRAWALL, "Offs Parti", 145,64,60,20, &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on the particle effect"); - - uiDefButS(block, TOG|BIT|4, 0, "SlowPar", 205,64,60,20, &ob->partype, 0, 0, 0, 0, "Create a delay in the parent relationship"); - - /* uiDefButC(block, TOG|BIT|5, REDRAWALL, "Offs Path", 85,64,60,20, &ob->ipoflag, 0, 0, 0, 0); ,""*/ - /* uiDefButC(block, TOG|BIT|3, REDRAWALL, "Offs Mat", 145,64,60,20, &ob->ipoflag, 0, 0, 0, 0); ,""*/ - /* uiDefButC(block, TOG|BIT|4, REDRAWALL, "Offs VertKey", 205,64,60,20, &ob->ipoflag, 0, 0, 0, 0); ,""*/ - - - uiBlockSetCol(block, BUTGREY); - uiDefButC(block, TOG|BIT|3, REDRAWVIEW3D, "DupliFrames", 112,144,106,19, &ob->transflag, 0, 0, 0, 0, "Make copy of object for every frame"); - uiDefButC(block, TOG|BIT|4, REDRAWVIEW3D, "DupliVerts", 112,123,80,19, &ob->transflag, 0, 0, 0, 0, "Duplicate child objects on all vertices"); - uiBlockSetCol(block, BUTGREEN); - uiDefButC(block, TOG|BIT|5, REDRAWVIEW3D, "Rot", 194,123,24,19, &ob->transflag, 0, 0, 0, 0, "Rotate dupli according to facenormal"); - - uiBlockSetCol(block, BUTGREY); - uiDefButS(block, NUM, REDRAWVIEW3D, "DupSta:", 220,144,93,19, &ob->dupsta, 1.0, 1500.0, 0, 0, "Specify startframe for Dupliframes"); - uiDefButS(block, NUM, REDRAWVIEW3D, "DupEnd", 315,144,93,19, &ob->dupend, 1.0, 2500.0, 0, 0, "Specify endframe for Dupliframes"); - uiDefButS(block, NUM, REDRAWVIEW3D, "DupOn:", 220,123,93,19, &ob->dupon, 1.0, 1500.0, 0, 0, ""); - uiDefButS(block, NUM, REDRAWVIEW3D, "DupOff", 315,123,93,19, &ob->dupoff, 0.0, 1500.0, 0, 0, ""); - uiBlockSetCol(block, BUTGREEN); - uiDefButC(block, TOG|BIT|6, REDRAWVIEW3D, "No Speed", 410,144,93,19, &ob->transflag, 0, 0, 0, 0, "Set dupliframes to still, regardless of frame"); - uiDefButC(block, TOG|BIT|7, REDRAWVIEW3D, "Powertrack", 410,123,93,19, &ob->transflag, 0, 0, 0, 0, "Switch objects rotation off"); - - uiBlockSetCol(block, BUTSALMON); - uiDefBut(block, BUT, B_AUTOTIMEOFS, "Automatic Time", 140,18,104,31, 0, 0, 0, 0, 0, "Generate automatic timeoffset values for all selected frames"); - uiBlockSetCol(block, BUTGREY); - sprintf(str, "%.4f", prspeed); - uiDefBut(block, LABEL, 0, str, 247,40,63,31, 0, 1.0, 0, 0, 0, ""); - uiDefBut(block, BUT, B_PRINTSPEED, "PrSpeed", 247,18,63,31, 0, 0, 0, 0, 0, "Print objectspeed"); - - if(ob->type==OB_MESH) { - me= ob->data; - if(me->key) { - uiDefButS(block, NUM, B_DIFF, "Slurph:", 125,101,93,19, &(me->key->slurph), -500.0, 500.0, 0, 0, ""); - uiDefButS(block, TOG, B_RELKEY, "Relative Keys", 220,100,93,19, &me->key->type, 0, 0, 0, 0, ""); - } - } - if(ob->type==OB_CURVE) { - cu= ob->data; - uiDefButS(block, NUM, B_RECALCPATH, "PathLen:", 34,100,90,19, &cu->pathlen, 1.0, 9000.0, 0, 0, ""); - /* if(cu->key==0) { */ - uiDefButS(block, TOG|BIT|3, B_RECALCPATH, "CurvePath", 125,100,90,19 , &cu->flag, 0, 0, 0, 0, ""); - uiDefButS(block, TOG|BIT|4, REDRAWVIEW3D, "CurveFollow", 216,100,90,19, &cu->flag, 0, 0, 0, 0, ""); - /* } */ - sprintf(str, "%.4f", prlen); - uiDefBut(block, LABEL, 0, str, 396,100,90,19, 0, 1.0, 0, 0, 0, ""); - uiDefBut(block, BUT, B_PRINTLEN, "PrintLen", 306,100,90,19, 0, 0, 0, 0, 0, ""); - } - if(ob->type==OB_SURF) { - cu= ob->data; - - if(cu->key) { - /* uiDefButS(block, NUM, B_DIFF, "Slurph:", 124,100,93,19, &(cu->key->slurph), -500.0, 500.0,0,0); ,""*/ - uiDefButS(block, TOG, B_RELKEY, "Relative Keys", 220,100,93,19, &cu->key->type, 0, 0, 0, 0, ""); - } - } - if(ob->type==OB_LATTICE) { - lt= ob->data; - if(lt->key) { - uiDefButS(block, NUM, B_DIFF, "Slurph:", 124,100,93,19, &(lt->key->slurph), -500.0, 500.0, 0, 0, ""); - uiDefButS(block, TOG, B_RELKEY, "Relative Keys", 370,190,133,19, <->key->type, 0, 0, 0, 0, ""); - } - } - - uiBlockSetCol(block, BUTGREEN); - uiDefButC(block, ROW,REDRAWVIEW3D,"TrackX", 27,190,58,17, &ob->trackflag, 12.0, 0.0, 0, 0, "Specify the axis that points to another object"); - uiDefButC(block, ROW,REDRAWVIEW3D,"Y", 85,190,19,17, &ob->trackflag, 12.0, 1.0, 0, 0, "Specify the axis that points to another object"); - uiDefButC(block, ROW,REDRAWVIEW3D,"Z", 104,190,19,17, &ob->trackflag, 12.0, 2.0, 0, 0, "Specify the axis that points to another object"); - uiDefButC(block, ROW,REDRAWVIEW3D,"-X", 123,190,24,17, &ob->trackflag, 12.0, 3.0, 0, 0, "Specify the axis that points to another object"); - uiDefButC(block, ROW,REDRAWVIEW3D,"-Y", 147,190,24,17, &ob->trackflag, 12.0, 4.0, 0, 0, "Specify the axis that points to another object"); - uiDefButC(block, ROW,REDRAWVIEW3D,"-Z", 171,190,24,17, &ob->trackflag, 12.0, 5.0, 0, 0, "Specify the axis that points to another object"); - uiDefButC(block, ROW,REDRAWVIEW3D,"UpX", 205,190,40,17, &ob->upflag, 13.0, 0.0, 0, 0, "Specify the axis that points up"); - uiDefButC(block, ROW,REDRAWVIEW3D,"Y", 245,190,20,17, &ob->upflag, 13.0, 1.0, 0, 0, "Specify the axis that points up"); - uiDefButC(block, ROW,REDRAWVIEW3D,"Z", 265,190,19,17, &ob->upflag, 13.0, 2.0, 0, 0, "Specify the axis that points up"); - - uiBlockSetCol(block, BUTSALMON); - - /* EFFECTS */ - - draw_buttons_edge(curarea->win, 540); - draw_buttons_edge(curarea->win, 1010); - - if (ob->type == OB_MESH) { - uiDefBut(block, BUT, B_NEWEFFECT, "NEW Effect", 550,187,124,27, 0, 0, 0, 0, 0, "Create a new effect"); - uiDefBut(block, BUT, B_DELEFFECT, "Delete", 676,187,62,27, 0, 0, 0, 0, 0, "Delete the effect"); - } - - uiBlockSetCol(block, BUTGREY); - - /* select effs */ - eff= ob->effect.first; - a= 0; - while(eff) { - - x= 15 * a + 550; - y= 172; // - 12*( abs(a/10) ) ; - uiDefButS(block, TOG|BIT|0, B_SELEFFECT+a, "", x, y, 15, 12, &eff->flag, 0, 0, 0, 0, ""); - - a++; - if(a==MAX_EFFECT) break; - eff= eff->next; - } - - eff= ob->effect.first; - while(eff) { - if(eff->flag & SELECT) break; - eff= eff->next; - } - - if(eff) { - uiDefButS(block, MENU, B_CHANGEEFFECT, "Build %x0|Particles %x1|Wave %x2", 895,187,107,27, &eff->buttype, 0, 0, 0, 0, "Start building the effect"); - - if(eff->type==EFF_BUILD) { - BuildEff *bld; - - bld= (BuildEff *)eff; - - uiDefButF(block, NUM, 0, "Len:", 649,138,95,21, &bld->len, 1.0, 9000.0, 100, 0, "Specify the total time the building requires"); - uiDefButF(block, NUM, 0, "Sfra:", 746,138,94,22, &bld->sfra, 1.0, 9000.0, 100, 0, "Specify the startframe of the effect"); - } - else if(eff->type==EFF_WAVE) { - WaveEff *wav; - - wav= (WaveEff *)eff; - - uiBlockSetCol(block, BUTGREEN); - uiDefButS(block, TOG|BIT|1, B_CALCEFFECT, "X", 782,135,54,23, &wav->flag, 0, 0, 0, 0, "Enable X axis"); - uiDefButS(block, TOG|BIT|2, B_CALCEFFECT, "Y", 840,135,47,23, &wav->flag, 0, 0, 0, 0, "Enable Y axis"); - uiDefButS(block, TOG|BIT|3, B_CALCEFFECT, "Cycl", 890,135,111,23, &wav->flag, 0, 0, 0, 0, "Enable cyclic wave efefct"); - - uiBlockSetCol(block, BUTGREY); - uiDefButF(block, NUM, B_CALCEFFECT, "Sta x:", 550,135,113,24, &wav->startx, -100.0, 100.0, 100, 0, "Starting position for the X axis"); - uiDefButF(block, NUM, B_CALCEFFECT, "Sta y:", 665,135,104,24, &wav->starty, -100.0, 100.0, 100, 0, "Starting position for the Y axis"); - - uiDefButF(block, NUMSLI, B_CALCEFFECT, "Speed:", 550,100,216,20, &wav->speed, -2.0, 2.0, 0, 0, "Specify the wave speed"); - uiDefButF(block, NUMSLI, B_CALCEFFECT, "Heigth:", 550,80,216,20, &wav->height, -2.0, 2.0, 0, 0, "Specify the amplitude of the wave"); - uiDefButF(block, NUMSLI, B_CALCEFFECT, "Width:", 550,60,216,20, &wav->width, 0.0, 5.0, 0, 0, "Specify the width of the wave"); - uiDefButF(block, NUMSLI, B_CALCEFFECT, "Narrow:", 550,40,216,20, &wav->narrow, 0.0, 10.0, 0, 0, "Specify how narrow the wave follows"); - - uiDefButF(block, NUM, B_CALCEFFECT, "Time sta:", 780,100,219,20, &wav->timeoffs, -1000.0, 1000.0, 100, 0, "Specify startingframe of the wave"); - - uiDefButF(block, NUM, B_CALCEFFECT, "Lifetime:", 780,80,219,20, &wav->lifetime, -1000.0, 1000.0, 100, 0, "Specify the lifespan of the wave"); - uiDefButF(block, NUM, B_CALCEFFECT, "Damptime:", 780,60,219,20, &wav->damp, -1000.0, 1000.0, 100, 0, "Specify the dampingtime of the wave"); - - } - else if(eff->type==EFF_PARTICLE) { - PartEff *paf; - - paf= (PartEff *)eff; - - uiDefBut(block, BUT, B_RECALCAL, "RecalcAll", 741,187,67,27, 0, 0, 0, 0, 0, "Update the particle system"); - uiBlockSetCol(block, BUTGREEN); - uiDefButS(block, TOG|BIT|2, B_CALCEFFECT, "Static", 825,187,67,27, &paf->flag, 0, 0, 0, 0, "Make static particles"); - uiBlockSetCol(block, BUTGREY); - - uiDefButI(block, NUM, B_CALCEFFECT, "Tot:", 550,146,91,20, &paf->totpart, 1.0, 100000.0, 0, 0, "Set the total number of particles"); - if(paf->flag & PAF_STATIC) { - uiDefButS(block, NUM, REDRAWVIEW3D, "Step:", 644,146,84,20, &paf->staticstep, 1.0, 100.0, 10, 0, ""); - } - else { - uiDefButF(block, NUM, B_CALCEFFECT, "Sta:", 644,146,84,20, &paf->sta, -250.0, 9000.0, 100, 0, "Specify the startframe"); - uiDefButF(block, NUM, B_CALCEFFECT, "End:", 731,146,97,20, &paf->end, 1.0, 9000.0, 100, 0, "Specify the endframe"); - } - uiDefButF(block, NUM, B_CALCEFFECT, "Life:", 831,146,88,20, &paf->lifetime, 1.0, 9000.0, 100, 0, "Specify the life span of the particles"); - uiDefButI(block, NUM, B_CALCEFFECT, "Keys:", 922,146,80,20, &paf->totkey, 1.0, 32.0, 0, 0, "Specify the number of key positions"); - - uiBlockSetCol(block, BUTGREEN); - uiDefButS(block, NUM, B_REDR, "CurMul:", 550,124,91,20, &paf->curmult, 0.0, 3.0, 0, 0, "Multiply the particles"); - uiBlockSetCol(block, BUTGREY); - uiDefButS(block, NUM, B_CALCEFFECT, "Mat:", 644,124,84,20, paf->mat+paf->curmult, 1.0, 8.0, 0, 0, "Specify the material used for the particles"); - uiDefButF(block, NUM, B_CALCEFFECT, "Mult:", 730,124,98,20, paf->mult+paf->curmult, 0.0, 1.0, 10, 0, "Probability \"dying\" particle spawns a new one."); - uiDefButS(block, NUM, B_CALCEFFECT, "Child:", 922,124,80,20, paf->child+paf->curmult, 1.0, 600.0, 100, 0, "Specify the number of children of a particle that multiply itself"); - uiDefButF(block, NUM, B_CALCEFFECT, "Life:", 831,124,89,20, paf->life+paf->curmult, 1.0, 600.0, 100, 0, "Specify the lifespan of the next generation particles"); - - uiDefButF(block, NUM, B_CALCEFFECT, "Randlife:", 550,96,96,20, &paf->randlife, 0.0, 2.0, 10, 0, "Give the particlelife a random variation"); - uiDefButI(block, NUM, B_CALCEFFECT, "Seed:", 652,96,80,20, &paf->seed, 0.0, 255.0, 0, 0, "Set an offset in the random table"); - - uiDefButF(block, NUM, B_DIFF, "VectSize", 885,96,116,20, &paf->vectsize, 0.0, 1.0, 10, 0, "Set the speed for Vect"); - uiBlockSetCol(block, BUTGREEN); - uiDefButS(block, TOG|BIT|3, B_CALCEFFECT, "Face", 735,96,46,20, &paf->flag, 0, 0, 0, 0, "Emit particles also from faces"); - uiDefButS(block, TOG|BIT|1, B_CALCEFFECT, "Bspline", 782,96,54,20, &paf->flag, 0, 0, 0, 0, "Use B spline formula for particle interpolation"); - uiDefButS(block, TOG, REDRAWVIEW3D, "Vect", 837,96,45,20, &paf->stype, 0, 0, 0, 0, "Give the particles a rotation direction"); - - uiBlockSetCol(block, BUTPURPLE); - uiDefButF(block, NUM, B_CALCEFFECT, "Norm:", 550,67,96,20, &paf->normfac, -2.0, 2.0, 10, 0, "Let the mesh give the particle a starting speed"); - uiDefButF(block, NUM, B_CALCEFFECT, "Ob:", 649,67,86,20, &paf->obfac, -1.0, 1.0, 10, 0, "Let the object give the particle a starting speed"); - uiDefButF(block, NUM, B_CALCEFFECT, "Rand:", 738,67,86,20, &paf->randfac, 0.0, 2.0, 10, 0, "Give the startingspeed a random variation"); - uiDefButF(block, NUM, B_CALCEFFECT, "Tex:", 826,67,85,20, &paf->texfac, 0.0, 2.0, 10, 0, "Let the texture give the particle a starting speed"); - uiDefButF(block, NUM, B_CALCEFFECT, "Damp:", 913,67,89,20, &paf->damp, 0.0, 1.0, 10, 0, "Specify the damping factor"); - - uiBlockSetCol(block, BUTGREY); - uiDefButF(block, NUM, B_CALCEFFECT, "X:", 550,31,72,20, paf->force, -1.0, 1.0, 1, 0, "Specify the X axis of a continues force"); - uiDefButF(block, NUM, B_CALCEFFECT, "Y:", 624,31,78,20, paf->force+1,-1.0, 1.0, 1, 0, "Specify the Y axis of a continues force"); - uiDefBut(block, LABEL, 0, "Force:", 550,9,72,20, 0, 1.0, 0, 0, 0, ""); - uiDefButF(block, NUM, B_CALCEFFECT, "Z:", 623,9,79,20, paf->force+2, -1.0, 1.0, 1, 0, "Specify the Z axis of a continues force"); - - uiDefBut(block, LABEL, 0, "Texture:", 722,9,74,20, 0, 1.0, 0, 0, 0, ""); - uiBlockSetCol(block, BUTGREEN); - uiDefButS(block, ROW, B_CALCEFFECT, "Int", 875,9,32,43, &paf->texmap, 14.0, 0.0, 0, 0, "Use texture intensity as a factor for texture force"); - uiDefButS(block, ROW, B_CALCEFFECT, "RGB", 911,31,45,20, &paf->texmap, 14.0, 1.0, 0, 0, "Use RGB values as a factor for particle speed"); - uiDefButS(block, ROW, B_CALCEFFECT, "Grad", 958,31,44,20, &paf->texmap, 14.0, 2.0, 0, 0, "Use texture gradient as a factor for particle speed"); - uiBlockSetCol(block, BUTGREY); - uiDefButF(block, NUM, B_CALCEFFECT, "Nabla:", 911,9,91,20, &paf->nabla, 0.0001, 1.0, 1, 0, "Specify the dimension of the area for gradient calculation"); - uiDefButF(block, NUM, B_CALCEFFECT, "X:", 722,31,74,20, paf->defvec, -1.0, 1.0, 1, 0, "Specify the X axis of a force, determined by the texture"); - uiDefButF(block, NUM, B_CALCEFFECT, "Y:", 798,31,74,20, paf->defvec+1,-1.0, 1.0, 1, 0, "Specify the Y axis of a force, determined by the texture"); - uiDefButF(block, NUM, B_CALCEFFECT, "Z:", 797,9,75,20, paf->defvec+2, -1.0, 1.0, 1, 0, "Specify the Z axis of a force, determined by the texture"); - - } - } - } - - /* IPO BUTTONS AS LAST */ - ok= 0; - if(G.sipo) { - /* do these exist? */ - sa= G.curscreen->areabase.first; - while(sa) { - if(sa->spacetype==SPACE_IPO && sa->spacedata.first==G.sipo) break; - sa= sa->next; - } - if(sa) { - if(G.sipo->ipo && G.sipo->ipo->curve.first) ok= 1; - } - } - - uiBlockSetCol(block, BUTGREEN); - // RMGRP uiDefButC(block, ROW, B_REDR, "Ipo settings", 1020, 180, 100, 19, &G.buts->showgroup, 15.0, 0.0, 0, 0, ""); - // RMGRP uiDefButC(block, ROW, B_REDR, "Group settings", 1120, 180, 100, 19, &G.buts->showgroup, 15.0, 1.0, 0, 0, ""); - uiBlockSetCol(block, BUTGREY); - - if(ok && G.buts->showgroup==0) { - sprintf(str, "%.3f", G.sipo->v2d.tot.xmin); - uiDefBut(block, LABEL, 0, str, 1020, 140, 100, 19, 0, 0, 0, 0, 0, ""); - sprintf(str, "%.3f", G.sipo->v2d.tot.xmax); - uiDefBut(block, LABEL, 0, str, 1120, 140, 100, 19, 0, 0, 0, 0, 0, ""); - - uiDefButF(block, NUM, B_DIFF, "Xmin:", 1020, 120, 100, 19, &G.sipo->tot.xmin, -G.sipo->v2d.max[0], G.sipo->v2d.max[0], 100, 0, ""); - uiDefButF(block, NUM, B_DIFF, "Xmax:", 1120, 120, 100, 19, &G.sipo->tot.xmax, -G.sipo->v2d.max[0], G.sipo->v2d.max[0], 100, 0, ""); - - sprintf(str, "%.3f", G.sipo->v2d.tot.ymin); - uiDefBut(block, LABEL, 0, str, 1020, 100, 100, 19, 0, 0, 0, 0, 0, ""); - sprintf(str, "%.3f", G.sipo->v2d.tot.ymax); - uiDefBut(block, LABEL, 0, str, 1120, 100, 100, 19, 0, 0, 0, 0, 0, ""); - - uiDefButF(block, NUM, B_DIFF, "Ymin:", 1020, 80, 100, 19, &G.sipo->tot.ymin, -G.sipo->v2d.max[1], G.sipo->v2d.max[1], 100, 0, ""); - uiDefButF(block, NUM, B_DIFF, "Ymax:", 1120, 80, 100, 19, &G.sipo->tot.ymax, -G.sipo->v2d.max[1], G.sipo->v2d.max[1], 100, 0, ""); - - uiBlockSetCol(block, BUTSALMON); - uiDefBut(block, BUT, B_MUL_IPO, "SET", 1220,79,50,62, 0, 0, 0, 0, 0, ""); - - - /* SPEED BUTTON */ - uiBlockSetCol(block, BUTGREY); - uiDefButF(block, NUM, B_DIFF, "Speed:", 1020,23,164,28, &hspeed, 0.0, 180.0, 1, 0, ""); - - uiBlockSetCol(block, BUTSALMON); - uiDefBut(block, BUT, B_SETSPEED, "SET", 1185,23,83,29, 0, 0, 0, 0, 0, ""); - } - - if(G.buts->showgroup && G.scene->group) { - GroupKey *gk; - short yco= 140; - - gk= G.scene->group->gkey.first; - while(gk) { - if(gk==G.scene->group->active) uiBlockSetCol(block, BUTPURPLE); - else uiBlockSetCol(block, BUTGREY); - uiDefBut(block, TEX, B_DIFF, "Name:", 1020, yco, 140, 19, &gk->name, 0.0, 31.0, 10, 0, ""); - uiDefButS(block, NUM, B_DIFF, "Sta:", 1160, yco, 60, 19, &gk->sfra, 0.0, 5000.0, 10, 0, ""); - uiDefButS(block, NUM, B_DIFF, "End:", 1220, yco, 50, 19, &gk->efra, 0.0, 5000.0, 10, 0, ""); - yco-= 20; - gk= gk->next; - } - } - - uiDrawBlock(block); -} - - - /* ***************************** WORLD ************************** */ @@ -6082,729 +3600,6 @@ static void scene_change_set(Scene *sc, Scene *set) { } } -static void run_playanim(char *file) { - extern char bprogname[]; /* usiblender.c */ - char str[FILE_MAXDIR+FILE_MAXFILE]; - int pos[2], size[2]; - - calc_renderwin_rectangle(R.winpos, pos, size); - - sprintf(str, "%s -a -p %d %d \"%s\"", bprogname, pos[0], pos[1], file); - system(str); -} - -void do_renderbuts(unsigned short event) -{ - ScrArea *sa; - ID *id; - char file[FILE_MAXDIR+FILE_MAXFILE]; - - switch(event) { - - case B_DORENDER: - BIF_do_render(0); - break; - case B_RTCHANGED: - allqueue(REDRAWALL, 0); - break; - case B_PLAYANIM: -#ifdef WITH_QUICKTIME - if(G.scene->r.imtype == R_QUICKTIME) - makeqtstring(file); - else -#endif - makeavistring(file); - if(BLI_exist(file)) { - run_playanim(file); - } - else { - makepicstring(file, G.scene->r.sfra); - if(BLI_exist(file)) { - run_playanim(file); - } - else error("Can't find image: %s", file); - } - break; - - case B_DOANIM: - BIF_do_render(1); - break; - - case B_FS_PIC: - sa= closest_bigger_area(); - areawinset(sa->win); - activate_fileselect(FILE_SPECIAL, "SELECT OUTPUT PICTURES", G.scene->r.pic, output_pic); - break; - case B_FS_BACKBUF: - sa= closest_bigger_area(); - areawinset(sa->win); - activate_fileselect(FILE_SPECIAL, "SELECT BACKBUF PICTURE", G.scene->r.backbuf, backbuf_pic); - break; - case B_IS_BACKBUF: - sa= closest_bigger_area(); - areawinset(sa->win); - activate_imageselect(FILE_SPECIAL, "SELECT BACKBUF PICTURE", G.scene->r.backbuf, backbuf_pic); - break; - case B_FS_FTYPE: - sa= closest_bigger_area(); - areawinset(sa->win); - activate_fileselect(FILE_SPECIAL, "SELECT FTYPE", G.scene->r.ftype, ftype_pic); - break; - case B_IS_FTYPE: - sa= closest_bigger_area(); - areawinset(sa->win); - activate_imageselect(FILE_SPECIAL, "SELECT FTYPE", G.scene->r.ftype, ftype_pic); - break; - - case B_PR_PAL: - G.scene->r.xsch= 720; - G.scene->r.ysch= 576; - G.scene->r.xasp= 54; - G.scene->r.yasp= 51; - G.scene->r.size= 100; - G.scene->r.frs_sec= 25; - G.scene->r.mode &= ~R_PANORAMA; - G.scene->r.xparts= G.scene->r.yparts= 1; - - BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9); - allqueue(REDRAWBUTSRENDER, 0); - allqueue(REDRAWVIEWCAM, 0); - break; - -#ifdef WITH_QUICKTIME - case B_FILETYPEMENU: - allqueue(REDRAWBUTSRENDER, 0); -#if defined (_WIN32) || defined (__APPLE__) - // fall through to codec settings if this is the first - // time R_AVICODEC is selected for this scene. - if (((G.scene->r.imtype == R_AVICODEC) - && (G.scene->r.avicodecdata == NULL)) || - ((G.scene->r.imtype == R_QUICKTIME) - && (G.scene->r.qtcodecdata == NULL))) { - } else { - break; - } -#else /* libquicktime */ - if(G.scene->r.imtype == R_QUICKTIME) { - /* i'm not sure if this should be here... */ - /* set default quicktime codec */ - if (!G.scene->r.qtcodecdata) { - G.scene->r.qtcodecdata = MEM_callocN(sizeof(QtCodecData), - "QtCodecData"); - qtcodec_idx = 1; - } - - qt_init_codecs(); - if (qtcodec_idx < 1) qtcodec_idx = 1; - - G.scene->r.qtcodecdata->fourcc = - qtcodecidx_to_fcc(qtcodec_idx-1); - qt_init_codecdata(G.scene->r.qtcodecdata); -/* I'm not sure if this is really needed, so don't remove it yet */ -#if 0 - /* get index of codec that can handle a given fourcc */ - if (qtcodec_idx < 1) - qtcodec_idx = get_qtcodec_idx(G.scene->r.qtcodecdata->fourcc)+1; - - /* no suitable codec found, alert user */ - if (qtcodec_idx < -1) { - error("no suitable codec found!"); - qtcodec_idx = 1; - } -#endif /* 0 */ - } -#endif /*_WIN32 || __APPLE__ */ - - case B_SELECTCODEC: -#if defined (_WIN32) || defined (__APPLE__) - if ((G.scene->r.imtype == R_QUICKTIME)) /* || (G.scene->r.qtcodecdata)) */ - get_qtcodec_settings(); -#ifdef _WIN32 - else - get_avicodec_settings(); -#endif /* _WIN32 */ -#else /* libquicktime */ - if (!G.scene->r.qtcodecdata) { - G.scene->r.qtcodecdata = MEM_callocN(sizeof(QtCodecData), - "QtCodecData"); - qtcodec_idx = 1; - } - if (qtcodec_idx < 1) { - qtcodec_idx = 1; - qt_init_codecs(); - } - - G.scene->r.qtcodecdata->fourcc = qtcodecidx_to_fcc(qtcodec_idx-1); - /* if the selected codec differs from the previous one, reinit it */ - qt_init_codecdata(G.scene->r.qtcodecdata); - allqueue(REDRAWBUTSRENDER, 0); -#endif /* _WIN32 || __APPLE__ */ - break; -#endif /* WITH_QUICKTIME */ - - case B_PR_FULL: - G.scene->r.xsch= 1280; - G.scene->r.ysch= 1024; - G.scene->r.xasp= 1; - G.scene->r.yasp= 1; - G.scene->r.size= 100; - G.scene->r.mode &= ~R_PANORAMA; - G.scene->r.xparts= G.scene->r.yparts= 1; - - BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9); - allqueue(REDRAWBUTSRENDER, 0); - allqueue(REDRAWVIEWCAM, 0); - break; - case B_PR_PRV: - G.scene->r.xsch= 640; - G.scene->r.ysch= 512; - G.scene->r.xasp= 1; - G.scene->r.yasp= 1; - G.scene->r.size= 50; - G.scene->r.mode &= ~R_PANORAMA; - G.scene->r.xparts= G.scene->r.yparts= 1; - - BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9); - allqueue(REDRAWVIEWCAM, 0); - allqueue(REDRAWBUTSRENDER, 0); - break; - case B_PR_CDI: - G.scene->r.xsch= 384; - G.scene->r.ysch= 280; - G.scene->r.xasp= 1; - G.scene->r.yasp= 1; - G.scene->r.size= 100; - G.scene->r.mode &= ~R_PANORAMA; - G.scene->r.xparts= G.scene->r.yparts= 1; - - BLI_init_rctf(&G.scene->r.safety, 0.15, 0.85, 0.15, 0.85); - allqueue(REDRAWVIEWCAM, 0); - allqueue(REDRAWBUTSRENDER, 0); - break; - case B_PR_PAL169: - G.scene->r.xsch= 720; - G.scene->r.ysch= 576; - G.scene->r.xasp= 64; - G.scene->r.yasp= 45; - G.scene->r.size= 100; - G.scene->r.frs_sec= 25; - G.scene->r.mode &= ~R_PANORAMA; - G.scene->r.xparts= G.scene->r.yparts= 1; - - BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9); - allqueue(REDRAWVIEWCAM, 0); - allqueue(REDRAWBUTSRENDER, 0); - break; - case B_PR_D2MAC: - G.scene->r.xsch= 1024; - G.scene->r.ysch= 576; - G.scene->r.xasp= 1; - G.scene->r.yasp= 1; - G.scene->r.size= 50; - G.scene->r.mode &= ~R_PANORAMA; - G.scene->r.xparts= G.scene->r.yparts= 1; - - BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9); - allqueue(REDRAWVIEWCAM, 0); - allqueue(REDRAWBUTSRENDER, 0); - break; - case B_PR_MPEG: - G.scene->r.xsch= 368; - G.scene->r.ysch= 272; - G.scene->r.xasp= 105; - G.scene->r.yasp= 100; - G.scene->r.size= 100; - G.scene->r.mode &= ~R_PANORAMA; - G.scene->r.xparts= G.scene->r.yparts= 1; - - BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9); - allqueue(REDRAWVIEWCAM, 0); - allqueue(REDRAWBUTSRENDER, 0); - break; - case B_PR_PC: - G.scene->r.xsch= 640; - G.scene->r.ysch= 480; - G.scene->r.xasp= 100; - G.scene->r.yasp= 100; - G.scene->r.size= 100; - G.scene->r.mode &= ~R_PANORAMA; - G.scene->r.xparts= G.scene->r.yparts= 1; - - BLI_init_rctf(&G.scene->r.safety, 0.0, 1.0, 0.0, 1.0); - allqueue(REDRAWVIEWCAM, 0); - allqueue(REDRAWBUTSRENDER, 0); - break; - case B_PR_PRESET: - G.scene->r.xsch= 720; - G.scene->r.ysch= 576; - G.scene->r.xasp= 54; - G.scene->r.yasp= 51; - G.scene->r.size= 100; - G.scene->r.mode= R_OSA+R_SHADOW+R_FIELDS; - G.scene->r.imtype= R_TARGA; - G.scene->r.xparts= G.scene->r.yparts= 1; - - BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9); - allqueue(REDRAWVIEWCAM, 0); - allqueue(REDRAWBUTSRENDER, 0); - break; - case B_PR_PANO: - G.scene->r.xsch= 36; - G.scene->r.ysch= 176; - G.scene->r.xasp= 115; - G.scene->r.yasp= 100; - G.scene->r.size= 100; - G.scene->r.mode |= R_PANORAMA; - G.scene->r.xparts= 16; - G.scene->r.yparts= 1; - - BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9); - allqueue(REDRAWVIEWCAM, 0); - allqueue(REDRAWBUTSRENDER, 0); - break; - case B_PR_NTSC: - G.scene->r.xsch= 720; - G.scene->r.ysch= 480; - G.scene->r.xasp= 10; - G.scene->r.yasp= 11; - G.scene->r.size= 100; - G.scene->r.frs_sec= 30; - G.scene->r.mode &= ~R_PANORAMA; - G.scene->r.xparts= G.scene->r.yparts= 1; - - BLI_init_rctf(&G.scene->r.safety, 0.1, 0.9, 0.1, 0.9); - allqueue(REDRAWBUTSRENDER, 0); - allqueue(REDRAWVIEWCAM, 0); - break; - - case B_SETBROWSE: - id= (ID*) G.scene->set; - - if (G.buts->menunr==-2) { - activate_databrowse(id, ID_SCE, 0, B_SETBROWSE, &G.buts->menunr, do_renderbuts); - } else if (G.buts->menunr>0) { - Scene *newset= (Scene*) BLI_findlink(&G.main->scene, G.buts->menunr-1); - - if (newset==G.scene) - error("Not allowed"); - else if (newset) - scene_change_set(G.scene, newset); - } - break; - case B_CLEARSET: - scene_change_set(G.scene, NULL); - break; - } -} - -uiBlock *edge_render_menu(void *arg_unused) -{ - uiBlock *block; - - block= uiNewBlock(&curarea->uiblocks, - "edge render", UI_EMBOSSX, UI_HELV, - curarea->win); - - /* use this for a fake extra empy space around the buttons */ - uiDefBut(block, LABEL, 0, "", -/* 285, -20, 230, 100, NULL, */ - 285, -20, 230, 120, NULL, - 0, 0, 0, 0, ""); - - uiDefButS(block, NUM, 0,"Eint:", - 295,50,70,19, - &G.scene->r.edgeint, 0.0, 255.0, 0, 0, - "Sets edge intensity for Toon shading"); - uiBlockSetCol(block, BUTGREEN); - uiDefButI(block, TOG, 0,"Shift", - 365,50,70,19, - &G.compat, 0, 0, 0, 0, - "For unified renderer: use old offsets for edges"); - uiDefButI(block, TOG, 0,"All", 435,50,70,19, - &G.notonlysolid, 0, 0, 0, 0, - "For unified renderer: also consider transparent " - "faces for toon shading"); - - /* colour settings for the toon shading */ - uiBlockSetCol(block, BUTGREY); - uiDefButF(block, COL, B_EDGECOLSLI, "", - 295,-10,30,60, - &(G.scene->r.edgeR), 0, 0, 0, 0, - ""); - - uiDefButF(block, NUMSLI, 0, "R ", - 325, 30, 180,19, - &G.scene->r.edgeR, 0.0, 1.0, B_EDGECOLSLI, 0, - "For unified renderer: Colour for edges in toon shading mode."); - uiDefButF(block, NUMSLI, 0, "G ", - 325, 10, 180,19, - &G.scene->r.edgeG, 0.0, 1.0, B_EDGECOLSLI, 0, - "For unified renderer: Colour for edges in toon shading mode."); - uiDefButF(block, NUMSLI, 0, "B ", - 325, -10, 180,19, - &G.scene->r.edgeB, 0.0, 1.0, B_EDGECOLSLI, 0, - "For unified renderer: Colour for edges in toon shading mode."); - - uiDefButS(block, NUM, 0,"AntiShift", - 365,70,140,19, - &(G.scene->r.same_mat_redux), 0, 255.0, 0, 0, - "For unified renderer: reduce intensity on boundaries " - "with identical materials with this number."); - - uiBlockSetDirection(block, UI_TOP); - - return block; -} - -static uiBlock *post_render_menu(void *arg_unused) -{ - uiBlock *block; - - block= uiNewBlock(&curarea->uiblocks, "post render", UI_EMBOSSX, UI_HELV, curarea->win); - - /* use this for a fake extra empy space around the buttons */ - uiDefBut(block, LABEL, 0, "", -10, 10, 200, 80, NULL, 0, 0, 0, 0, ""); - - uiDefButF(block, NUMSLI, 0,"Add:", 0,60,180,19, - &G.scene->r.postadd, -1.0, 1.0, 0, 0, ""); - uiDefButF(block, NUMSLI, 0,"Mul:", 0,40,180,19, - &G.scene->r.postmul, 0.01, 4.0, 0, 0, ""); - uiDefButF(block, NUMSLI, 0,"Gamma:", 0,20,180,19, - &G.scene->r.postgamma, 0.2, 2.0, 0, 0, ""); - - uiBlockSetDirection(block, UI_TOP); - - return block; -} - - -static uiBlock *framing_render_menu(void *arg_unused) -{ - uiBlock *block; - short yco = 60, xco = 0; - int randomcolorindex = 1234; - - block= uiNewBlock(&curarea->uiblocks, "framing_options", UI_EMBOSSX, UI_HELV, curarea->win); - - /* use this for a fake extra empy space around the buttons */ - uiDefBut(block, LABEL, 0, "", -10, -10, 300, 100, NULL, 0, 0, 0, 0, ""); - - uiDefBut(block, LABEL, B_NOP, "Framing:", xco, yco, 68,19, 0, 0, 0, 0, 0, ""); - uiDefButC(block, ROW, 0, "Stretch", xco += 70, yco, 68, 19, &G.scene->framing.type, 1.0, SCE_GAMEFRAMING_SCALE , 0, 0, "Stretch or squeeze the viewport to fill the display window"); - uiDefButC(block, ROW, 0, "Expose", xco += 70, yco, 68, 19, &G.scene->framing.type, 1.0, SCE_GAMEFRAMING_EXTEND, 0, 0, "Show the entire viewport in the display window, viewing more horizontally or vertically"); - uiDefButC(block, ROW, 0, "Bars", xco += 70, yco, 68, 19, &G.scene->framing.type, 1.0, SCE_GAMEFRAMING_BARS , 0, 0, "Show the entire viewport in the display window, using bar horizontally or vertically"); - - yco -= 20; - xco = 35; - - uiDefButF(block, COL, randomcolorindex, "", 0, yco - 58 + 18, 33, 58, &G.scene->framing.col[0], 0, 0, 0, 0, ""); - - uiDefButF(block, NUMSLI, 0, "R ", xco,yco,243,18, &G.scene->framing.col[0], 0.0, 1.0, randomcolorindex, 0, "Set the red component of the bars"); - yco -= 20; - uiDefButF(block, NUMSLI, 0, "G ", xco,yco,243,18, &G.scene->framing.col[1], 0.0, 1.0, randomcolorindex, 0, "Set the green component of the bars"); - yco -= 20; - uiDefButF(block, NUMSLI, 0, "B ", xco,yco,243,18, &G.scene->framing.col[2], 0.0, 1.0, randomcolorindex, 0, "Set the blue component of the bars"); - - uiBlockSetDirection(block, UI_TOP); - - return block; -} - - -static char *imagetype_pup(void) -{ - static char string[1024]; - char formatstring[1024]; - - strcpy(formatstring, "Save image as: %%t|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d|%s %%x%d"); - -#ifdef __sgi - strcat(formatstring, "|%s %%x%d"); // add space for Movie -#endif - - strcat(formatstring, "|%s %%x%d"); // add space for PNG - -#ifdef _WIN32 - strcat(formatstring, "|%s %%x%d"); // add space for AVI Codec -#endif - -#ifdef WITH_QUICKTIME - if(G.have_quicktime) - strcat(formatstring, "|%s %%x%d"); // add space for Quicktime -#endif - - if(G.have_quicktime) { - sprintf(string, formatstring, - "AVI Raw", R_AVIRAW, - "AVI Jpeg", R_AVIJPEG, -#ifdef _WIN32 - "AVI Codec", R_AVICODEC, -#endif -#ifdef WITH_QUICKTIME - "QuickTime", R_QUICKTIME, -#endif - "Targa", R_TARGA, - "Targa Raw", R_RAWTGA, - "PNG", R_PNG, - "Jpeg", R_JPEG90, - "HamX", R_HAMX, - "Iris", R_IRIS, - "Iris + Zbuffer", R_IRIZ, - "Ftype", R_FTYPE, - "Movie", R_MOVIE - ); - } else { - sprintf(string, formatstring, - "AVI Raw", R_AVIRAW, - "AVI Jpeg", R_AVIJPEG, -#ifdef _WIN32 - "AVI Codec", R_AVICODEC, -#endif - "Targa", R_TARGA, - "Targa Raw", R_RAWTGA, - "PNG", R_PNG, - "Jpeg", R_JPEG90, - "HamX", R_HAMX, - "Iris", R_IRIS, - "Iris + Zbuffer", R_IRIZ, - "Ftype", R_FTYPE, - "Movie", R_MOVIE - ); - } - - return (string); -} - - -static char *avicodec_str(void) -{ - static char string[1024]; - - sprintf(string, "Codec: %s", G.scene->r.avicodecdata->avicodecname); - - return string; -} - - -void renderbuts(void) -{ - ID *id; - int a,b; - uiBlock *block; - char *strp; - char str[64]; - int yofs; - - sprintf(str, "buttonswin %d", curarea->win); - block= uiNewBlock(&curarea->uiblocks, str, UI_EMBOSSX, UI_HELV, curarea->win); - - uiDefBut(block, TEX,0,"", 34,172,257,19,G.scene->r.pic, 0.0,79.0, 0, 0, "Directory/name to save rendered Pics to"); - uiDefBut(block, BUT,B_FS_PIC," ", 10,172,22,19, 0, 0, 0, 0, 0, "Open Fileselect to get Pics dir/name"); - uiDefBut(block, TEX,0,"", 34,149,257,19,G.scene->r.backbuf, 0.0,79.0, 0, 0, "Image to use as background for rendering"); - uiDefBut(block, BUT,B_FS_BACKBUF," ", 21,149,11,19, 0, 0, 0, 0, 0, "Open Fileselect to get Backbuf image"); - uiDefBut(block, TEX,0,"", 34,126,257,19,G.scene->r.ftype,0.0,79.0, 0, 0, "Image to use with FTYPE Image type"); - uiDefBut(block, BUT,B_FS_FTYPE," ", 21,126,11,19, 0, 0, 0, 0, 0, "Open Fileselect to get Ftype image"); - uiDefIconBut(block, BUT, B_CLEARSET, ICON_X, 267,102,24,21, 0, 0, 0, 0, 0, "Remove Set link"); - - /* SET BUTTON */ - id= (ID *)G.scene->set; - IDnames_to_pupstring(&strp, NULL, NULL, &(G.main->scene), id, &(G.buts->menunr)); - if(strp[0]) - uiDefButS(block, MENU, B_SETBROWSE, strp, 10,103,22,19, &(G.buts->menunr), 0, 0, 0, 0, "Scene to link as a Set"); - MEM_freeN(strp); - - uiDefBut(block, LABEL, 0, "Set", 295,103,63,19, 0, 0, 0, 0, 0, ""); - - uiBlockSetCol(block, BUTBLUE); - - if(G.scene->set) { - uiSetButLock(1, NULL); - uiDefIDPoinBut(block, test_scenepoin_but, 0, "", 34,103,231,19, &(G.scene->set), "Name of the Set"); - uiClearButLock(); - } - - uiBlockSetCol(block, BUTSALMON); - uiDefBut(block, BUT,B_IS_BACKBUF," ", 10,149,11,19, 0, 0, 0, 0, 0, "Open Imageselect to get Backbuf image"); - uiDefBut(block, BUT,B_IS_FTYPE," ", 10,126,11,19, 0, 0, 0, 0, 0, "Open Imageselect to get Ftype image"); - uiBlockSetCol(block, BUTGREY); - - uiDefBut(block, LABEL,0,"Pics", 295,172,63,19, 0, 0, 0, 0, 0, ""); - uiDefButS(block, TOG|BIT|0, 0,"Backbuf", 295,149,63,19, &G.scene->r.bufflag, 0, 0, 0, 0, "Enable/Disable use of Backbuf image"); - uiDefBut(block, LABEL,0,"Ftype", 295,126,63,19, 0, 0, 0, 0, 0, ""); - - uiBlockSetCol(block, BUTGREY); - - for(b=0; b<3; b++) - for(a=0; a<3; a++) - uiDefButS(block, TOG|BIT|(3*b+a),800,"", (short)(34+18*a),(short)(11+12*b),16,10, &R.winpos, 0, 0, 0, 0, "Render window placement on screen"); - - uiDefButS(block, ROW, B_REDR, "DispView", 99,28,77,18, &R.displaymode, 0.0, (float)R_DISPLAYVIEW, 0, 0, "Sets render output to display in 3D view"); - uiDefButS(block, ROW, B_REDR, "DispWin", 99,10,78,18, &R.displaymode, 0.0, (float)R_DISPLAYWIN, 0, 0, "Sets render output to display in a seperate window"); - - uiDefButS(block, TOG|BIT|4, 0, "Extensions", 190,10,95,18, &G.scene->r.scemode, 0.0, 0.0, 0, 0, "Adds extensions to the output when rendering animations"); - - uiBlockSetCol(block, BUTSALMON); - - uiDefBut(block, BUT,B_DORENDER,"RENDER", 369,142,192,47, 0, 0, 0, 0, 0, "Start the rendering"); - - uiBlockSetCol(block, BUTGREY); - uiDefButS(block, TOG|BIT|1,0,"Shadow", 565,167,61,22, &G.scene->r.mode, 0, 0, 0, 0, "Enable shadow calculation"); - uiDefButS(block, TOG|BIT|4,0,"EnvMap", 626,167,61,22, &G.scene->r.mode, 0, 0, 0, 0, "Enable shadow calculation"); - uiDefButS(block, TOG|BIT|10,0,"Pano", 565,142,61,22, &G.scene->r.mode, 0, 0, 0, 0, "Enable panorama rendering (output width is multiplied by Xparts)"); - uiDefButS(block, TOG|BIT|8,0,"Radio", 626,142,61,22, &G.scene->r.mode, 0, 0, 0, 0, "Enable radiosity rendering"); - - uiDefButS(block, ROW,B_DIFF,"100%", 565,114,121,20,&G.scene->r.size,1.0,100.0, 0, 0, "Set render size to defined size"); - uiDefButS(block, ROW,B_DIFF,"75%", 565,90,36,20,&G.scene->r.size,1.0,75.0, 0, 0, "Set render size to 3/4 of defined size"); - uiDefButS(block, ROW,B_DIFF,"50%", 604,90,40,20,&G.scene->r.size,1.0,50.0, 0, 0, "Set render size to 1/2 of defined size"); - uiDefButS(block, ROW,B_DIFF,"25%", 647,90,39,20,&G.scene->r.size,1.0,25.0, 0, 0, "Set render size to 1/4 of defined size"); - - uiDefButS(block, TOG|BIT|0, 0, "OSA", 369,114,124,20,&G.scene->r.mode, 0, 0, 0, 0, "Enables Oversampling (Anti-aliasing)"); - uiDefButF(block, NUM,B_DIFF,"Bf:", 495,90,65,20,&G.scene->r.blurfac, 0.01, 5.0, 10, 0, "Sets motion blur factor"); - uiDefButS(block, TOG|BIT|14, 0, "MBLUR", 495,114,66,20,&G.scene->r.mode, 0, 0, 0, 0, "Enables Motion Blur calculation"); - - uiDefButS(block, ROW,B_DIFF,"5", 369,90,29,20,&G.scene->r.osa,2.0,5.0, 0, 0, "Sets oversample level to 5"); - uiDefButS(block, ROW,B_DIFF,"8", 400,90,29,20,&G.scene->r.osa,2.0,8.0, 0, 0, "Sets oversample level to 8 (Recommended)"); - uiDefButS(block, ROW,B_DIFF,"11", 431,90,33,20,&G.scene->r.osa,2.0,11.0, 0, 0, "Sets oversample level to 11"); - uiDefButS(block, ROW,B_DIFF,"16", 466,90,28,20,&G.scene->r.osa,2.0,16.0, 0, 0, "Sets oversample level to 16"); - - uiDefButS(block, NUM,B_DIFF,"Xparts:", 369,42,99,31,&G.scene->r.xparts,1.0, 64.0, 0, 0, "Sets the number of horizontal parts to render image in (For panorama sets number of camera slices)"); - uiDefButS(block, NUM,B_DIFF,"Yparts:", 472,42,86,31,&G.scene->r.yparts,1.0, 64.0, 0, 0, "Sets the number of vertical parts to render image in"); - - uiDefButS(block, TOG|BIT|6,0,"Fields",564,42,90,31,&G.scene->r.mode, 0, 0, 0, 0, "Enables field rendering"); - - uiDefButS(block, TOG|BIT|13,0,"Odd", 655,57,30,16,&G.scene->r.mode, 0, 0, 0, 0, "Enables Odd field first rendering (Default: Even field)"); - uiDefButS(block, TOG|BIT|7,0,"x", 655,42,30,15,&G.scene->r.mode, 0, 0, 0, 0, "Disables time difference in field calculations"); - - uiDefButS(block, ROW,800,"Sky", 369,11,38,24,&G.scene->r.alphamode,3.0,0.0, 0, 0, "Fill background with sky"); - uiDefButS(block, ROW,800,"Premul", 410,11,54,24,&G.scene->r.alphamode,3.0,1.0, 0, 0, "Multiply alpha in advance"); - uiDefButS(block, ROW,800,"Key", 467,11,44,24,&G.scene->r.alphamode,3.0,2.0, 0, 0, "Alpha and colour values remain unchanged"); - - /* Toon shading buttons */ - uiDefButS(block, TOG|BIT|5, 0,"Edge", 295,70,70,19, - &G.scene->r.mode, 0, 0, 0, 0, "Enable Toon shading"); - uiDefBlockBut(block, edge_render_menu, NULL, "Edge Settings |>> ", 155, 70, 138, 19, "Display edge settings"); - - /* unified render buttons */ - if(G.scene->r.mode & R_UNIFIED) { - uiDefBlockBut(block, post_render_menu, NULL, "Post process |>> ", 15, 70, 138, 19, "Only for unified render"); - if (G.scene->r.mode & R_GAMMA) { - uiDefButF(block, NUMSLI, 0,"Gamma:", 15, 50, 280, 19, - &(G.scene->r.gamma), 0.2, 5.0, B_GAMMASLI, 0, - "The gamma value for blending oversampled images (1.0 = no correction)."); - } - } - - - uiDefButS(block, TOG|BIT|9,REDRAWVIEWCAM, "Border", 565,11,58,24, &G.scene->r.mode, 0, 0, 0, 0, "Render a small cut-out of the image"); - uiDefButS(block, TOG|BIT|2,0, "Gamma", 626,11,58,24, &G.scene->r.mode, 0, 0, 0, 0, "Enable gamma correction"); - - uiBlockSetCol(block, BUTSALMON); - uiDefBut(block, BUT,B_DOANIM,"ANIM", 692,142,192,47, 0, 0, 0, 0, 0, "Start rendering a sequence"); - - uiBlockSetCol(block, BUTBLUE); - - uiDefButS(block, TOG|BIT|0, 0, "Do Sequence", 692,114,192,20, &G.scene->r.scemode, 0, 0, 0, 0, "Enables sequence output rendering (Default: 3D rendering)"); - uiDefButS(block, TOG|BIT|1, 0, "Render Daemon", 692,90,192,20, &G.scene->r.scemode, 0, 0, 0, 0, "Let external network render current scene"); - - uiBlockSetCol(block, BUTGREY); - uiDefBut(block, BUT,B_PLAYANIM, "PLAY", 692,40,94,33, 0, 0, 0, 0, 0, "Play animation of rendered images/avi (searches Pics: field)"); - - uiDefButS(block, NUM, B_RTCHANGED, "rt:", 790,40,95,33, &G.rt, 0.0, 256.0, 0, 0, "General testing/debug button"); - - uiDefButS(block, ROW,B_DIFF,"BW", 892, 10,74,20, &G.scene->r.planes, 5.0,(float)R_PLANESBW, 0, 0, "Images are saved with BW (grayscale) data"); - uiDefButS(block, ROW,B_DIFF,"RGB", 968, 10,74,20, &G.scene->r.planes, 5.0,(float)R_PLANES24, 0, 0, "Images are saved with RGB (color) data"); - uiDefButS(block, ROW,B_DIFF,"RGBA", 1044, 10,75,20, &G.scene->r.planes, 5.0,(float)R_PLANES32, 0, 0, "Images are saved with RGB and Alpha data (if supported)"); - - yofs = 54; - -#ifdef __sgi - yofs = 76; - uiDefButS(block, NUM,B_DIFF,"MaxSize:", 892,32,165,20, &G.scene->r.maximsize, 0.0, 500.0, 0, 0, "Maximum size per frame to save in an SGI movie"); - uiBlockSetCol(block, BUTGREEN); - uiDefButS(block, TOG|BIT|12,0,"Cosmo", 1059,32,60,20, &G.scene->r.mode, 0, 0, 0, 0, "Attempt to save SGI movies using Cosmo hardware"); - uiBlockSetCol(block, BUTGREY); -#endif - - uiDefButS(block, MENU,B_FILETYPEMENU,imagetype_pup(), 892,yofs,174,20, &G.scene->r.imtype, 0, 0, 0, 0, "Images are saved in this file format"); - uiBlockSetCol(block, BUTGREEN); - uiDefButS(block, TOG|BIT|11,0, "Crop", 1068,yofs,51,20, &G.scene->r.mode, 0, 0, 0, 0, "Exclude border rendering from total image"); - uiBlockSetCol(block, BUTGREY); - - yofs -= 22; - - if(G.scene->r.quality==0) G.scene->r.quality= 90; - -#ifdef WITH_QUICKTIME - if (G.scene->r.imtype == R_AVICODEC || G.scene->r.imtype == R_QUICKTIME) { -#else /* WITH_QUICKTIME */ - if (0) { -#endif - if(G.scene->r.imtype == R_QUICKTIME) { -#ifdef WITH_QUICKTIME -#if defined (_WIN32) || defined (__APPLE__) - glColor3f(0.65, 0.65, 0.7); - glRecti(892,yofs+46,892+225,yofs+45+20); - if(G.scene->r.qtcodecdata == NULL) - uiDefBut(block, LABEL, 0, "Codec: not set", 892,yofs+44,225,20, 0, 0, 0, 0, 0, ""); - else - uiDefBut(block, LABEL, 0, G.scene->r.qtcodecdata->qtcodecname, 892,yofs+44,225,20, 0, 0, 0, 0, 0, ""); - uiDefBut(block, BUT,B_SELECTCODEC, "Set codec", 892,yofs,112,20, 0, 0, 0, 0, 0, "Set codec settings for Quicktime"); -#else /* libquicktime */ - if (!G.scene->r.qtcodecdata) G.scene->r.qtcodecdata = MEM_callocN(sizeof(QtCodecData), "QtCodecData"); - uiDefButI(block, MENU, B_SELECTCODEC, qtcodecs_pup(), 892,yofs, 112, 20, &qtcodec_idx, 0, 0, 0, 0, "Codec"); - /* make sure the codec stored in G.scene->r.qtcodecdata matches the selected - * one, especially if it's not set.. */ - if (!G.scene->r.qtcodecdata->fourcc) { - G.scene->r.qtcodecdata->fourcc = qtcodecidx_to_fcc(qtcodec_idx-1); - qt_init_codecdata(G.scene->r.qtcodecdata); - } - - yofs -= 22; - uiDefBlockBut(block, qtcodec_menu, NULL, "Codec Settings |>> ", 892,yofs, 227, 20, "Edit Codec settings for QuickTime"); - yofs +=22; - -#endif /* libquicktime */ -#endif /* WITH_QUICKTIME */ - } else { -#ifdef _WIN32 - glColor3f(0.65, 0.65, 0.7); - glRecti(892,yofs+46,892+225,yofs+45+20); - if(G.scene->r.avicodecdata == NULL) - uiDefBut(block, LABEL, 0, "Codec: not set.", 892,yofs+43,225,20, 0, 0, 0, 0, 0, ""); - else - uiDefBut(block, LABEL, 0, avicodec_str(), 892,yofs+43,225,20, 0, 0, 0, 0, 0, ""); -#endif - uiDefBut(block, BUT,B_SELECTCODEC, "Set codec", 892,yofs,112,20, 0, 0, 0, 0, 0, "Set codec settings for AVI"); - } - } else { - uiDefButS(block, NUM,0, "Quality:", 892,yofs,112,20, &G.scene->r.quality, 10.0, 100.0, 0, 0, "Quality setting for JPEG images, AVI Jpeg and SGI movies"); - } - uiDefButS(block, NUM,REDRAWSEQ,"Frs/sec:", 1006,yofs,113,20, &G.scene->r.frs_sec, 1.0, 120.0, 100.0, 0, "Frames per second"); - - uiDefButS(block, NUM,REDRAWSEQ,"Sta:", 692,10,94,24, &G.scene->r.sfra,1.0,18000.0, 0, 0, "The start frame of the animation"); - uiDefButS(block, NUM,REDRAWSEQ,"End:", 790,10,95,24, &G.scene->r.efra,1.0,18000.0, 0, 0, "The end frame of the animation"); - - uiDefBlockBut(block, framing_render_menu, NULL, "Game framing settings |>> ", 892, 169, 227, 20, "Display game framing settings"); - - uiDefButS(block, NUM,REDRAWVIEWCAM,"SizeX:", 892 ,136,112,27, &G.scene->r.xsch, 4.0, 10000.0, 0, 0, "The image width in pixels"); - uiDefButS(block, NUM,REDRAWVIEWCAM,"SizeY:", 1007,136,112,27, &G.scene->r.ysch, 4.0,10000.0, 0, 0, "The image height in scanlines"); - uiDefButS(block, NUM,REDRAWVIEWCAM,"AspX:", 892 ,114,112,20, &G.scene->r.xasp, 1.0,200.0, 0, 0, "The horizontal aspect ratio"); - uiDefButS(block, NUM,REDRAWVIEWCAM,"AspY:", 1007,114,112,20, &G.scene->r.yasp, 1.0,200.0, 0, 0, "The vertical aspect ratio"); - - uiDefBut(block, BUT,B_PR_PAL, "PAL", 1146,170,133,18, 0, 0, 0, 0, 0, "Size preset: Image size - 720x576, Aspect ratio - 54x51, 25 fps"); - uiDefBut(block, BUT,B_PR_NTSC, "NTSC", 1146,150,133,18, 0, 0, 0, 0, 0, "Size preset: Image size - 720x480, Aspect ratio - 10x11, 30 fps"); - uiDefBut(block, BUT,B_PR_PRESET, "Default", 1146,130,133,18, 0, 0, 0, 0, 0, "Same as PAL, with render settings (OSA, Shadows, Fields)"); - uiDefBut(block, BUT,B_PR_PRV, "Preview", 1146,110,133,18, 0, 0, 0, 0, 0, "Size preset: Image size - 640x512, Render size 50%"); - uiDefBut(block, BUT,B_PR_PC, "PC", 1146,90,133,18, 0, 0, 0, 0, 0, "Size preset: Image size - 640x480, Aspect ratio - 100x100"); - uiDefBut(block, BUT,B_PR_PAL169, "PAL 16:9",1146,70,133,18, 0, 0, 0, 0, 0, "Size preset: Image size - 720x576, Aspect ratio - 64x45"); - uiDefBut(block, BUT,B_PR_PANO, "PANO", 1146,50,133,18, 0, 0, 0, 0, 0, "Standard panorama settings"); - uiDefBut(block, BUT,B_PR_FULL, "FULL", 1146,30,133,18, 0, 0, 0, 0, 0, "Size preset: Image size - 1280x1024, Aspect ratio - 1x1"); - uiDefButS(block, TOG|BIT|15, B_REDR, "Unified Renderer", 1146,10,133,18, - &G.scene->r.mode, 0, 0, 0, 0, - "Use the unified renderer."); - - uiDrawBlock(block); -} /* ********************* CONSTRAINT ***************************** */ @@ -7293,221 +4088,3 @@ static void do_constraintbuts(unsigned short event) } } -/* ********************* GAME ***************************** */ - -/* in editsca.c */ - -/* ***************************<>******************************** */ - -void drawbutspace_old(ScrArea *sa, void *spacedata) -{ - SpaceButs *sbuts= curarea->spacedata.first; - View2D *v2d= &sbuts->v2d; - ID *id; - Object *ob; - float vec[2]; - - if(curarea->headertype==0) { - ID *id, *idfrom; - - buttons_active_id(&id, &idfrom); - G.buts->lockpoin= id; - } - - ob= OBACT; - -// myortho2(v2d->cur.xmin, v2d->cur.xmax, v2d->cur.ymin-0.6, v2d->cur.ymax+0.6); - myortho2(v2d->cur.xmin, v2d->cur.xmax, v2d->cur.ymin, v2d->cur.ymax); - - glShadeModel(GL_SMOOTH); - glBegin(GL_QUADS); - cpack(0x909090); - vec[0]= v2d->cur.xmin; - vec[1]= v2d->cur.ymax-15; - glVertex2fv(vec); - vec[0]= v2d->cur.xmax; - glVertex2fv(vec); - cpack(0x646464); - vec[1]= v2d->cur.ymax; - glVertex2fv(vec); - vec[0]= v2d->cur.xmin; - glVertex2fv(vec); - glEnd(); - glShadeModel(GL_FLAT); - - cpack(0x909090); - glRectf(v2d->cur.xmin, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax-15); - - uiSetButLock(G.scene->id.lib!=0, "Can't edit library data"); - uiFreeBlocksWin(&curarea->uiblocks, curarea->win); - - switch(G.buts->mainb) { - case BUTS_VIEW: - viewbuts(); - break; - case BUTS_LAMP: - lampbuts(); - break; - case BUTS_MAT: - if(ob==0) return; - if(ob->type>=OB_LAMP) return; - - matbuts(); - break; - case BUTS_TEX: - texbuts(); - break; - case BUTS_ANIM: - animbuts(); - break; - case BUTS_WORLD: - worldbuts(); - break; - case BUTS_RENDER: - renderbuts(); - break; - case BUTS_GAME: - gamebuts(); - break; - case BUTS_FPAINT: - fpaintbuts(); - break; - case BUTS_RADIO: - radiobuts(); - break; - case BUTS_SOUND: - soundbuts(); - break; - case BUTS_CONSTRAINT: - constraintbuts(); - break; - case BUTS_SCRIPT: - scriptbuts(); - break; - case BUTS_EDIT: - if(ob==0) return; - - common_editbuts(); - - id= ob->data; - if(id && id->lib) uiSetButLock(1, "Can't edit library data"); - - if(ob->type==OB_MESH) meshbuts(); - else if ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT) { - curvebuts(); - if(ob->type==OB_FONT) fontbuts(); - } - else if(ob->type==OB_CAMERA) camerabuts(); - else if(ob->type==OB_MBALL) mballbuts(); - else if(ob->type==OB_LATTICE) latticebuts(); - else if(ob->type==OB_IKA) ikabuts(); -#ifdef __NLA - else if(ob->type==OB_ARMATURE) armaturebuts(); -#endif - - break; - } - - uiClearButLock(); - - test_butspace(); - - curarea->win_swap= WIN_BACK_OK; -} - - -void clever_numbuts_buts() -{ - Material *ma; - Lamp *la; - World *wo; - static char hexrgb[8]; /* Uh... */ - static char hexspec[8]; /* Uh... */ - static char hexmir[8]; /* Uh... */ - static char hexho[8]; - static char hexze[8]; - int rgb[3]; - - switch (G.buts->mainb){ - case BUTS_FPAINT: - - sprintf(hexrgb, "%02X%02X%02X", (int)(Gvp.r*255), (int)(Gvp.g*255), (int)(Gvp.b*255)); - - add_numbut(0, TEX, "RGB:", 0, 6, hexrgb, "HTML Hex value for the RGB color"); - do_clever_numbuts("Vertex Paint RGB Hex Value", 1, REDRAW); - - /* Assign the new hex value */ - sscanf(hexrgb, "%02X%02X%02X", &rgb[0], &rgb[1], &rgb[2]); - Gvp.r= (rgb[0]/255.0 >= 0.0 && rgb[0]/255.0 <= 1.0 ? rgb[0]/255.0 : 0.0) ; - Gvp.g = (rgb[1]/255.0 >= 0.0 && rgb[1]/255.0 <= 1.0 ? rgb[1]/255.0 : 0.0) ; - Gvp.b = (rgb[2]/255.0 >= 0.0 && rgb[2]/255.0 <= 1.0 ? rgb[2]/255.0 : 0.0) ; - - break; - case BUTS_LAMP: - la= G.buts->lockpoin; - if (la){ - sprintf(hexrgb, "%02X%02X%02X", (int)(la->r*255), (int)(la->g*255), (int)(la->b*255)); - add_numbut(0, TEX, "RGB:", 0, 6, hexrgb, "HTML Hex value for the lamp color"); - do_clever_numbuts("Lamp RGB Hex Values", 1, REDRAW); - sscanf(hexrgb, "%02X%02X%02X", &rgb[0], &rgb[1], &rgb[2]); - la->r = (rgb[0]/255.0 >= 0.0 && rgb[0]/255.0 <= 1.0 ? rgb[0]/255.0 : 0.0) ; - la->g = (rgb[1]/255.0 >= 0.0 && rgb[1]/255.0 <= 1.0 ? rgb[1]/255.0 : 0.0) ; - la->b = (rgb[2]/255.0 >= 0.0 && rgb[2]/255.0 <= 1.0 ? rgb[2]/255.0 : 0.0) ; - BIF_preview_changed(G.buts); - } - break; - case BUTS_WORLD: - wo= G.buts->lockpoin; - if (wo){ - sprintf(hexho, "%02X%02X%02X", (int)(wo->horr*255), (int)(wo->horg*255), (int)(wo->horb*255)); - sprintf(hexze, "%02X%02X%02X", (int)(wo->zenr*255), (int)(wo->zeng*255), (int)(wo->zenb*255)); - add_numbut(0, TEX, "Zen:", 0, 6, hexze, "HTML Hex value for the Zenith color"); - add_numbut(1, TEX, "Hor:", 0, 6, hexho, "HTML Hex value for the Horizon color"); - do_clever_numbuts("World RGB Hex Values", 2, REDRAW); - - sscanf(hexho, "%02X%02X%02X", &rgb[0], &rgb[1], &rgb[2]); - wo->horr = (rgb[0]/255.0 >= 0.0 && rgb[0]/255.0 <= 1.0 ? rgb[0]/255.0 : 0.0) ; - wo->horg = (rgb[1]/255.0 >= 0.0 && rgb[1]/255.0 <= 1.0 ? rgb[1]/255.0 : 0.0) ; - wo->horb = (rgb[2]/255.0 >= 0.0 && rgb[2]/255.0 <= 1.0 ? rgb[2]/255.0 : 0.0) ; - sscanf(hexze, "%02X%02X%02X", &rgb[0], &rgb[1], &rgb[2]); - wo->zenr = (rgb[0]/255.0 >= 0.0 && rgb[0]/255.0 <= 1.0 ? rgb[0]/255.0 : 0.0) ; - wo->zeng = (rgb[1]/255.0 >= 0.0 && rgb[1]/255.0 <= 1.0 ? rgb[1]/255.0 : 0.0) ; - wo->zenb = (rgb[2]/255.0 >= 0.0 && rgb[2]/255.0 <= 1.0 ? rgb[2]/255.0 : 0.0) ; - BIF_preview_changed(G.buts); - - } - break; - case BUTS_MAT: - - ma= G.buts->lockpoin; - - /* Build a hex value */ - if (ma){ - sprintf(hexrgb, "%02X%02X%02X", (int)(ma->r*255), (int)(ma->g*255), (int)(ma->b*255)); - sprintf(hexspec, "%02X%02X%02X", (int)(ma->specr*255), (int)(ma->specg*255), (int)(ma->specb*255)); - sprintf(hexmir, "%02X%02X%02X", (int)(ma->mirr*255), (int)(ma->mirg*255), (int)(ma->mirb*255)); - - add_numbut(0, TEX, "Col:", 0, 6, hexrgb, "HTML Hex value for the RGB color"); - add_numbut(1, TEX, "Spec:", 0, 6, hexspec, "HTML Hex value for the Spec color"); - add_numbut(2, TEX, "Mir:", 0, 6, hexmir, "HTML Hex value for the Mir color"); - do_clever_numbuts("Material RGB Hex Values", 3, REDRAW); - - /* Assign the new hex value */ - sscanf(hexrgb, "%02X%02X%02X", &rgb[0], &rgb[1], &rgb[2]); - ma->r = (rgb[0]/255.0 >= 0.0 && rgb[0]/255.0 <= 1.0 ? rgb[0]/255.0 : 0.0) ; - ma->g = (rgb[1]/255.0 >= 0.0 && rgb[1]/255.0 <= 1.0 ? rgb[1]/255.0 : 0.0) ; - ma->b = (rgb[2]/255.0 >= 0.0 && rgb[2]/255.0 <= 1.0 ? rgb[2]/255.0 : 0.0) ; - sscanf(hexspec, "%02X%02X%02X", &rgb[0], &rgb[1], &rgb[2]); - ma->specr = (rgb[0]/255.0 >= 0.0 && rgb[0]/255.0 <= 1.0 ? rgb[0]/255.0 : 0.0) ; - ma->specg = (rgb[1]/255.0 >= 0.0 && rgb[1]/255.0 <= 1.0 ? rgb[1]/255.0 : 0.0) ; - ma->specb = (rgb[2]/255.0 >= 0.0 && rgb[2]/255.0 <= 1.0 ? rgb[2]/255.0 : 0.0) ; - sscanf(hexmir, "%02X%02X%02X", &rgb[0], &rgb[1], &rgb[2]); - ma->mirr = (rgb[0]/255.0 >= 0.0 && rgb[0]/255.0 <= 1.0 ? rgb[0]/255.0 : 0.0) ; - ma->mirg = (rgb[1]/255.0 >= 0.0 && rgb[1]/255.0 <= 1.0 ? rgb[1]/255.0 : 0.0) ; - ma->mirb = (rgb[2]/255.0 >= 0.0 && rgb[2]/255.0 <= 1.0 ? rgb[2]/255.0 : 0.0) ; - - BIF_preview_changed(G.buts); - } - break; - } -} |