~ubuntu-branches/ubuntu/gutsy/blender/gutsy-security

« back to all changes in this revision

Viewing changes to source/blender/src/buttons_editing.c

  • Committer: Bazaar Package Importer
  • Author(s): Florian Ernst
  • Date: 2005-11-06 12:40:03 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051106124003-3pgs7tcg5rox96xg
Tags: 2.37a-1.1
* Non-maintainer upload.
* Split out parts of 01_SConstruct_debian.dpatch again: root_build_dir
  really needs to get adjusted before the clean target runs - closes: #333958,
  see #288882 for reference

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
#endif
41
41
 
42
42
#ifdef WIN32
43
 
#include "BLI_winstuff.h"
44
43
#ifndef snprintf
45
44
#define snprintf _snprintf
46
45
#endif
68
67
#include "DNA_mesh_types.h"
69
68
#include "DNA_meshdata_types.h"
70
69
#include "DNA_object_types.h"
 
70
#include "DNA_object_force.h"
71
71
#include "DNA_radio_types.h"
72
72
#include "DNA_screen_types.h"
73
 
#include "DNA_sound_types.h"
74
73
#include "DNA_texture_types.h"
75
74
#include "DNA_userdef_types.h"
76
75
#include "DNA_vfont_types.h"
86
85
#include "BLI_blenlib.h"
87
86
#include "BLI_arithb.h"
88
87
#include "BLI_vfontdata.h"
 
88
#include "BLI_editVert.h"
89
89
 
90
90
#include "BSE_filesel.h"
91
91
 
95
95
#include "BIF_editdeform.h"
96
96
#include "BIF_editfont.h"
97
97
#include "BIF_editmesh.h"
98
 
#include "BIF_editsound.h"
99
98
#include "BIF_interface.h"
 
99
#include "BIF_meshtools.h"
100
100
#include "BIF_mywindow.h"
101
101
#include "BIF_renderwin.h"
102
102
#include "BIF_resources.h"
117
117
#include "BKE_constraint.h"
118
118
#include "BKE_curve.h"
119
119
#include "BKE_displist.h"
 
120
#include "BKE_DerivedMesh.h"
120
121
#include "BKE_effect.h"
121
122
#include "BKE_font.h"
122
123
#include "BKE_ika.h"
127
128
#include "BKE_mball.h"
128
129
#include "BKE_mesh.h"
129
130
#include "BKE_object.h"
130
 
#include "BKE_sound.h"
131
131
#include "BKE_texture.h"
132
132
#include "BKE_utildefines.h"
133
133
 
136
136
#include "BDR_editface.h"
137
137
#include "BDR_editobject.h"
138
138
#include "BDR_vpaint.h"
 
139
#include "BDR_unwrapper.h"
139
140
 
140
141
#include "BSE_drawview.h"
141
142
#include "BSE_editipo.h"
150
151
#include "LOD_DependKludge.h"
151
152
#include "LOD_decimation.h"
152
153
 
 
154
#include "RE_renderconverter.h"         // make_sticky
 
155
 
153
156
#include "butspace.h" // own module
154
157
 
155
158
static int decim_faces=0;
157
160
static float extr_offs= 1.0;
158
161
static float editbutweight=1.0;
159
162
short editbutflag= 1;
160
 
float doublimit= 0.001, editbutvweight=1, editbutsize=0.1;
 
163
float doublimit= 0.001, editbutvweight=1;
161
164
float uv_calc_radius= 1.0, uv_calc_cubesize= 1.0;
162
165
short uv_calc_mapdir= 1, uv_calc_mapalign= 1, facesel_draw_edges= 0;
163
166
 
 
167
extern ListBase editNurb;
 
168
 
 
169
 
 
170
/* *************************** static functions prototypes ****************** */
 
171
void validate_editbonebutton(EditBone *);
 
172
VFont *exist_vfont(char *str);
164
173
 
165
174
/* *************************** MESH DECIMATE ******************************** */
166
175
 
204
213
        me= ob->data;
205
214
 
206
215
        /* add warning for vertex col and tfaces */
207
 
        if(me->tface || me->mcol || me->dvert) {
208
 
                if(okee("This will remove UV coordinates, vertexcolors, and deform weights")==0) return;
 
216
        if(me->tface || me->mcol || me->dvert || me->medge) {
 
217
                if(okee("This will remove UV coordinates, vertexcolors, deform weights and edge data")==0) return;
209
218
                if(me->tface) MEM_freeN(me->tface);
210
219
                if(me->mcol) MEM_freeN(me->mcol);
211
220
                if(me->dvert) free_dverts(me->dvert, me->totvert);
258
267
 
259
268
        if(LOD_LoadMesh(&lod) ) {
260
269
                if( LOD_PreprocessMesh(&lod) ) {
261
 
                        DispList *dl;
262
270
                        DispListMesh *dlm;
263
271
                        MFace *mfaceint;
264
272
 
269
277
                        }
270
278
 
271
279
                        /* ok, put back the stuff in a displist */
272
 
                        freedisplist(&(ob->disp));
273
 
                        dl= MEM_callocN(sizeof(DispList), "disp");
274
 
                        BLI_addtail(&ob->disp, dl);
275
 
                        dl->type= DL_MESH;
276
 
                        dlm=dl->mesh= MEM_callocN(sizeof(DispListMesh), "dispmesh");
 
280
                        if (me->decimated) {
 
281
                                displistmesh_free(me->decimated);
 
282
                        }
 
283
 
 
284
                        dlm= me->decimated= MEM_callocN(sizeof(DispListMesh), "dispmesh");
277
285
                        dlm->mvert= MEM_callocN(lod.vertex_num*sizeof(MVert), "mvert");
278
286
                        dlm->mface= MEM_callocN(lod.face_num*sizeof(MFace), "mface");
279
287
                        dlm->totvert= lod.vertex_num;
314
322
 
315
323
        ob= OBACT;
316
324
        if(ob) {
317
 
                freedisplist(&ob->disp);
318
 
                makeDispList(ob);
 
325
                if (ob->type==OB_MESH) {
 
326
                        Mesh *me = ob->data;
 
327
                        
 
328
                        if (me->decimated) {
 
329
                                displistmesh_free(me->decimated);
 
330
                                me->decimated = NULL;
 
331
                        }
 
332
                }
319
333
        }
320
334
        allqueue(REDRAWVIEW3D, 0);
321
335
}
323
337
static void decimate_apply(void)
324
338
{
325
339
        Object *ob;
326
 
        DispList *dl;
327
 
        DispListMesh *dlm;
328
 
        Mesh *me;
329
340
        MFace *mface;
330
341
        MFace *mfaceint;
331
342
        int a;
333
344
        if(G.obedit) return;
334
345
 
335
346
        ob= OBACT;
336
 
        if(ob) {
337
 
                dl= ob->disp.first;
338
 
                if(dl && dl->mesh) {
339
 
                        dlm= dl->mesh;
340
 
                        me= ob->data;
 
347
        if(ob && ob->type==OB_MESH) {
 
348
                Mesh *me = ob->data;
 
349
 
 
350
                if (me->decimated) {
 
351
                        DispListMesh *dlm= me->decimated;
341
352
 
342
353
                        // vertices
343
354
                        if(me->mvert) MEM_freeN(me->mvert);
345
356
                        dlm->mvert= NULL;
346
357
                        me->totvert= dlm->totvert;
347
358
 
 
359
                        // edges
 
360
                        if(me->medge) MEM_freeN(me->medge);
 
361
                        me->medge = NULL;
 
362
                        me->totedge = 0;
 
363
 
348
364
                        // faces
349
365
                        if(me->mface) MEM_freeN(me->mface);
350
366
                        me->mface= MEM_callocN(dlm->totface*sizeof(MFace), "mface");
358
374
                                test_index_mface(mface, 3);
359
375
                        }
360
376
 
361
 
                        freedisplist(&ob->disp);
 
377
                        displistmesh_free(me->decimated);
 
378
                        me->decimated= NULL;
362
379
 
363
380
                        G.obedit= ob;
364
381
                        make_editMesh();
365
382
                        load_editMesh();
366
 
                        free_editMesh();
 
383
                        free_editMesh(G.editMesh);
367
384
                        G.obedit= NULL;
368
385
                        tex_space_mesh(me);
369
386
 
370
387
                        if (mesh_uses_displist(me)) {
371
388
                                makeDispList(ob);
372
389
                        }
 
390
                        BIF_undo_push("Apply decimation");
373
391
                }
374
392
                else error("Not a decimated Mesh");
375
393
        }
376
394
}
377
395
 
 
396
/* *************** */
 
397
 
 
398
void do_common_editbuts(unsigned short event) // old name, is a mix of object and editing events.... 
 
399
{
 
400
        EditMesh *em = G.editMesh;
 
401
        EditFace *efa;
 
402
        Base *base;
 
403
        Object *ob;
 
404
        Mesh *me;
 
405
        Nurb *nu;
 
406
        Curve *cu;
 
407
        BezTriple *bezt;
 
408
        BPoint *bp;
 
409
        unsigned int local;
 
410
        int a, bit, index= -1;
 
411
 
 
412
        switch(event) {
 
413
                
 
414
        case B_MATWICH:
 
415
                if(G.obedit && G.obedit->actcol>0) {
 
416
                        if(G.obedit->type == OB_MESH) {
 
417
                                efa= em->faces.first;
 
418
                                while(efa) {
 
419
                                        if(efa->f & SELECT) {
 
420
                                                if(index== -1) index= efa->mat_nr;
 
421
                                                else if(index!=efa->mat_nr) {
 
422
                                                        error("Mixed colors");
 
423
                                                        return;
 
424
                                                }
 
425
                                        }
 
426
                                        efa= efa->next;
 
427
                                }
 
428
                        }
 
429
                        else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
 
430
                                nu= editNurb.first;
 
431
                                while(nu) {
 
432
                                        if( isNurbsel(nu) ) {
 
433
                                                if(index== -1) index= nu->mat_nr;
 
434
                                                else if(index!=nu->mat_nr) {
 
435
                                                        error("Mixed colors");
 
436
                                                        return;
 
437
                                                }
 
438
                                        }
 
439
                                        nu= nu->next;
 
440
                                }                               
 
441
                        }
 
442
                        if(index>=0) {
 
443
                                G.obedit->actcol= index+1;
 
444
                                scrarea_queue_winredraw(curarea);
 
445
                        }
 
446
                }
 
447
                break;
 
448
        case B_MATNEW:
 
449
                new_material_to_objectdata((G.scene->basact) ? (G.scene->basact->object) : 0);
 
450
                scrarea_queue_winredraw(curarea);
 
451
                BIF_undo_push("New material");
 
452
                allqueue(REDRAWBUTSSHADING, 0);
 
453
                allqueue(REDRAWVIEW3D_Z, 0);
 
454
                allqueue(REDRAWOOPS, 0);
 
455
                break;
 
456
        case B_MATDEL:
 
457
                delete_material_index();
 
458
                scrarea_queue_winredraw(curarea);
 
459
                BIF_undo_push("Delete material index");
 
460
                allqueue(REDRAWBUTSSHADING, 0);
 
461
                allqueue(REDRAWVIEW3D_Z, 0);
 
462
                allqueue(REDRAWOOPS, 0);
 
463
                break;
 
464
        case B_MATASS:
 
465
                if(G.obedit && G.obedit->actcol>0) {
 
466
                        if(G.obedit->type == OB_MESH) {
 
467
                                efa= em->faces.first;
 
468
                                while(efa) {
 
469
                                        if(efa->f & SELECT)
 
470
                                                efa->mat_nr= G.obedit->actcol-1;
 
471
                                        efa= efa->next;
 
472
                                }
 
473
                        }
 
474
                        else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
 
475
                                nu= editNurb.first;
 
476
                                while(nu) {
 
477
                                        if( isNurbsel(nu) )
 
478
                                                nu->mat_nr= G.obedit->actcol-1;
 
479
                                        nu= nu->next;
 
480
                                }
 
481
                        }
 
482
                        allqueue(REDRAWVIEW3D_Z, 0);
 
483
                        makeDispList(G.obedit);
 
484
                        BIF_undo_push("Assign material index");
 
485
                }
 
486
                break;
 
487
        case B_MATSEL:
 
488
        case B_MATDESEL:
 
489
                if(G.obedit) {
 
490
                        if(G.obedit->type == OB_MESH) {
 
491
                                if (event==B_MATSEL) {
 
492
                                        editmesh_select_by_material(G.obedit->actcol-1);
 
493
                                } else {
 
494
                                        editmesh_deselect_by_material(G.obedit->actcol-1);
 
495
                                }
 
496
                                allqueue(REDRAWVIEW3D, 0);
 
497
                        }
 
498
                        else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
 
499
                                nu= editNurb.first;
 
500
                                while(nu) {
 
501
                                        if(nu->mat_nr==G.obedit->actcol-1) {
 
502
                                                if(nu->bezt) {
 
503
                                                        a= nu->pntsu;
 
504
                                                        bezt= nu->bezt;
 
505
                                                        while(a--) {
 
506
                                                                if(bezt->hide==0) {
 
507
                                                                        if(event==B_MATSEL) {
 
508
                                                                                bezt->f1 |= 1;
 
509
                                                                                bezt->f2 |= 1;
 
510
                                                                                bezt->f3 |= 1;
 
511
                                                                        }
 
512
                                                                        else {
 
513
                                                                                bezt->f1 &= ~1;
 
514
                                                                                bezt->f2 &= ~1;
 
515
                                                                                bezt->f3 &= ~1;
 
516
                                                                        }
 
517
                                                                }
 
518
                                                                bezt++;
 
519
                                                        }
 
520
                                                }
 
521
                                                else if(nu->bp) {
 
522
                                                        a= nu->pntsu*nu->pntsv;
 
523
                                                        bp= nu->bp;
 
524
                                                        while(a--) {
 
525
                                                                if(bp->hide==0) {
 
526
                                                                        if(event==B_MATSEL) bp->f1 |= 1;
 
527
                                                                        else bp->f1 &= ~1;
 
528
                                                                }
 
529
                                                                bp++;
 
530
                                                        }
 
531
                                                }
 
532
                                        }
 
533
                                        nu= nu->next;
 
534
                                }
 
535
                                BIF_undo_push("Select material index");
 
536
                                allqueue(REDRAWVIEW3D, 0);
 
537
                        }
 
538
                }
 
539
                break;
 
540
        case B_HIDE:
 
541
                if(G.obedit) {
 
542
                        if(G.obedit->type == OB_MESH) hide_mesh(0);
 
543
                        else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) hideNurb(0);
 
544
                }
 
545
                break;
 
546
        case B_REVEAL:
 
547
                if(G.obedit) {
 
548
                        if(G.obedit->type == OB_MESH) reveal_mesh();
 
549
                        else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) revealNurb();
 
550
                }
 
551
                else if(G.f & G_FACESELECT) reveal_tface();
 
552
                
 
553
                break;
 
554
        case B_SELSWAP:
 
555
                if(G.obedit) {
 
556
                        if(G.obedit->type == OB_MESH) selectswap_mesh();
 
557
                        else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) selectswapNurb();
 
558
                }
 
559
                break;
 
560
        case B_AUTOTEX:
 
561
                ob= OBACT;
 
562
                if(ob && G.obedit==0) {
 
563
                        if(ob->type==OB_MESH) tex_space_mesh(ob->data);
 
564
                        else if(ob->type==OB_MBALL) ;
 
565
                        else tex_space_curve(ob->data);
 
566
                }
 
567
                break;
 
568
        case B_DOCENTRE:
 
569
                docentre(0);
 
570
                break;
 
571
        case B_DOCENTRENEW:
 
572
                docentre_new();
 
573
                break;
 
574
        case B_DOCENTRECURSOR:
 
575
                docentre_cursor();
 
576
                break;
 
577
        case B_SETSMOOTH:
 
578
        case B_SETSOLID:
 
579
                if(G.obedit) {
 
580
                        if(G.obedit->type == OB_MESH) {
 
581
                                efa= em->faces.first;
 
582
                                while(efa) {
 
583
                                        if(efa->f & SELECT) {
 
584
                                                if(event==B_SETSMOOTH) efa->flag |= ME_SMOOTH;
 
585
                                                else efa->flag &= ~ME_SMOOTH;
 
586
                                        }
 
587
                                        efa= efa->next;
 
588
                                }
 
589
                        }
 
590
                        else {
 
591
                                nu= editNurb.first;
 
592
                                while(nu) {
 
593
                                        if(isNurbsel(nu)) {
 
594
                                                if(event==B_SETSMOOTH) nu->flag |= CU_SMOOTH;
 
595
                                                else nu->flag &= ~CU_SMOOTH;
 
596
                                        }
 
597
                                        nu= nu->next;
 
598
                                }
 
599
                        }
 
600
                        makeDispList(G.obedit);
 
601
                        allqueue(REDRAWVIEW3D, 0);
 
602
                }
 
603
                else {
 
604
                        base= FIRSTBASE;
 
605
                        while(base) {
 
606
                                if(TESTBASELIB(base)) {
 
607
                                        if(base->object->type==OB_MESH) {
 
608
                                                me= base->object->data;
 
609
                                                mesh_set_smooth_flag(me, (event==B_SETSMOOTH));
 
610
                                                makeDispList(base->object);
 
611
                                        }
 
612
                                        else if ELEM(base->object->type, OB_SURF, OB_CURVE) {
 
613
                                                cu= base->object->data;
 
614
                                                nu= cu->nurb.first;
 
615
                                                while(nu) {
 
616
                                                        if(event==B_SETSMOOTH) nu->flag |= ME_SMOOTH;
 
617
                                                        else nu->flag &= ~ME_SMOOTH;
 
618
                                                        nu= nu->next;
 
619
                                                }
 
620
                                                makeDispList(base->object);
 
621
                                        }
 
622
                                }
 
623
                                base= base->next;
 
624
                        }
 
625
                        allqueue(REDRAWVIEW3D, 0);
 
626
                }
 
627
                if(event == B_SETSMOOTH) BIF_undo_push("Set Smooth");
 
628
                else BIF_undo_push("Set Solid");
 
629
 
 
630
                break;
 
631
 
 
632
        default:
 
633
                if(event>=B_OBLAY && event<=B_OBLAY+31) {
 
634
                        local= BASACT->lay & 0xFF000000;
 
635
                        BASACT->lay -= local;
 
636
                        if(BASACT->lay==0 || (G.qual & LR_SHIFTKEY)==0) {
 
637
                                bit= event-B_OBLAY;
 
638
                                BASACT->lay= 1<<bit;
 
639
                                scrarea_queue_winredraw(curarea);
 
640
                        }
 
641
                        BASACT->lay += local;
 
642
                        /* optimal redraw */
 
643
                        if( (OBACT->lay & G.vd->lay) && (BASACT->lay & G.vd->lay) );
 
644
                        else if( (OBACT->lay & G.vd->lay)==0 && (BASACT->lay & G.vd->lay)==0 );
 
645
                        else allqueue(REDRAWVIEW3D, 0);
 
646
                        
 
647
                        OBACT->lay= BASACT->lay;
 
648
                }
 
649
        }
 
650
 
 
651
}
 
652
 
378
653
/* *************************** MESH  ******************************** */
379
654
 
380
655
 
389
664
        if( uiNewPanel(curarea, block, "Mesh", "Editing", 320, 0, 318, 204)==0) return;
390
665
 
391
666
        uiBlockBeginAlign(block);
392
 
        uiDefButS(block, TOG|BIT|5, REDRAWVIEW3D, "Auto Smooth",10,180,154,19, &me->flag, 0, 0, 0, 0, "Treats all faces with angles less than Degr: as 'smooth' during render");
393
 
        uiDefButS(block, NUM, B_DIFF, "Degr:",                                  10,160,154,19, &me->smoothresh, 1, 80, 0, 0, "Defines maximum angle between face normals that 'Auto Smooth' will operate on");
 
667
        uiDefButS(block, TOG|BIT|5, REDRAWVIEW3D, "Auto Smooth",10,180,154,19, &me->flag, 0, 0, 0, 0, "Treats all set-smoothed faces with angles less than Degr: as 'smooth' during render");
 
668
        uiDefButS(block, NUM, B_DIFF, "Degr:",                          10,160,154,19, &me->smoothresh, 1, 80, 0, 0, "Defines maximum angle between face normals that 'Auto Smooth' will operate on");
394
669
 
395
670
        uiBlockBeginAlign(block);
396
671
        uiBlockSetCol(block, TH_BUT_SETTING1);
397
 
        uiDefButS(block, TOG|BIT|7, B_MAKEDISP, "SubSurf",              10,124,70,19, &me->flag, 0, 0, 0, 0, "Treats the active object as a Subdivision Surface");
398
 
        uiDefButS(block, MENU, B_MAKEDISP, subsurfmenu,         80,124,84,19, &(me->subsurftype), 0, 0, 0, 0, "Selects type of Subsurf algorithm.");
 
672
        uiDefButS(block, TOG|BIT|7, B_SUBSURFTYPE, "SubSurf",   10,134,70,19, &me->flag, 0, 0, 0, 0, "Treats the active object as a Subdivision Surface");
 
673
        uiDefButS(block, MENU, B_SUBSURFTYPE, subsurfmenu,              80,134,84,19, &(me->subsurftype), 0, 0, 0, 0, "Selects type of Subsurf algorithm.");
399
674
        uiBlockSetCol(block, TH_AUTO);
400
 
        uiDefButS(block, NUM, B_MAKEDISP, "Subdiv:",                    10,104,110,19, &me->subdiv, 0, 6, 0, 0, "Defines the level of subdivision to display in real time interactively");
401
 
        uiDefButS(block, NUM, B_MAKEDISP, "",                                   120, 104, 44, 19, &me->subdivr, 0, 6, 0, 0, "Defines the level of subdivision to apply during rendering");
402
 
        uiDefButS(block, TOG|BIT|8, B_MAKEDISP, "Optimal",              10,84,154,19, &me->flag, 0, 0, 0, 0, "Only draws optimal wireframe");
403
 
 
 
675
        uiDefButS(block, NUM, B_SUBSURFTYPE, "Subdiv:",         10, 114,110,19, &me->subdiv, 0, 6, 0, 0, "Defines the level of subdivision to display in real time interactively");
 
676
        uiDefButS(block, NUM, B_DIFF, "",                               120,114, 44, 19, &me->subdivr, 0, 6, 0, 0, "Defines the level of subdivision to apply during rendering");
 
677
        uiDefButS(block, TOG|BIT|8, B_SUBSURFTYPE, "Optimal",   10, 94,154,19, &me->flag, 0, 0, 0, 0, "Only draws optimal wireframe");
404
678
 
405
679
        uiBlockBeginAlign(block);
406
 
        if(me->msticky) val= 1.0; else val= 0.0;
407
 
        uiDefBut(block, LABEL, 0, "Sticky", 10,50,70,20, 0, val, 0, 0, 0, "");
408
 
        if(me->msticky==0) {
409
 
                uiDefBut(block, BUT, B_MAKESTICKY, "Make",      80,50,84,19, 0, 0, 0, 0, 0, "Creates Sticky coordinates for the active object from the current camera view background picture");
 
680
 
 
681
        if(me->medge) val= 1.0; else val= 0.0;
 
682
        uiDefBut(block, LABEL, 0, "Edges",                                      10,70,70,20, 0, val, 0, 0, 0, "");
 
683
        if(me->medge==NULL) {
 
684
                uiDefBut(block, BUT, B_MAKEEDGES, "Make",               80,70,84,19, 0, 0, 0, 0, 0, "Adds edges data to active Mesh object, enables creases/seams and faster wireframe draw");
410
685
        }
411
 
        else uiDefBut(block, BUT, B_DELSTICKY, "Delete", 80,50,84,19, 0, 0, 0, 0, 0, "Deletes Sticky texture coordinates");
 
686
        else uiDefBut(block, BUT, B_DELEDGES, "Delete",         80,70,84,19, 0, 0, 0, 0, 0, "Deletes edges data from active Mesh object");
412
687
 
413
688
        if(me->mcol) val= 1.0; else val= 0.0;
414
 
        uiDefBut(block, LABEL, 0, "VertCol", 10,30,70,20, 0, val, 0, 0, 0, "");
415
 
        if(me->mcol==0) {
416
 
                uiDefBut(block, BUT, B_MAKEVERTCOL, "Make",     80,30,84,19, 0, 0, 0, 0, 0, "Enables vertex colour painting on active object");
 
689
        uiDefBut(block, LABEL, 0, "VertCol",                            10,50,70,20, 0, val, 0, 0, 0, "");
 
690
        if(me->mcol==NULL) {
 
691
                uiDefBut(block, BUT, B_MAKEVERTCOL, "Make",             80,50,84,19, 0, 0, 0, 0, 0, "Enables vertex colour painting on active object");
417
692
        }
418
 
        else uiDefBut(block, BUT, B_DELVERTCOL, "Delete", 80,30,84,19, 0, 0, 0, 0, 0, "Deletes vertex colours on active object");
 
693
        else uiDefBut(block, BUT, B_DELVERTCOL, "Delete",       80,50,84,19, 0, 0, 0, 0, 0, "Deletes vertex colours on active object");
419
694
 
420
695
        if(me->tface) val= 1.0; else val= 0.0;
421
 
        uiDefBut(block, LABEL, 0, "TexFace", 10,10,70,20, 0, val, 0, 0, 0, "");
422
 
        if(me->tface==0) {
423
 
                uiDefBut(block, BUT, B_MAKE_TFACES, "Make",     80,10,84,19, 0, 0, 0, 0, 0, "Enables the active object's faces for UV coordinate mapping");
424
 
        }
425
 
        else uiDefBut(block, BUT, B_DEL_TFACES, "Delete", 80,10,84,19, 0, 0, 0, 0, 0, "Deletes UV coordinates for active object's faces");
 
696
        uiDefBut(block, LABEL, 0, "TexFace",                            10,30,70,20, 0, val, 0, 0, 0, "");
 
697
        if(me->tface==NULL) {
 
698
                uiDefBut(block, BUT, B_MAKE_TFACES, "Make",             80,30,84,19, 0, 0, 0, 0, 0, "Enables the active object's faces for UV coordinate mapping");
 
699
        }
 
700
        else uiDefBut(block, BUT, B_DEL_TFACES, "Delete",       80,30,84,19, 0, 0, 0, 0, 0, "Deletes UV coordinates for active object's faces");
 
701
 
 
702
        if(me->msticky) val= 1.0; else val= 0.0;
 
703
        uiDefBut(block, LABEL, 0, "Sticky",                             10,10,70,20, 0, val, 0, 0, 0, "");
 
704
        if(me->msticky==NULL) {
 
705
                uiDefBut(block, BUT, B_MAKESTICKY, "Make",              80,10,84,19, 0, 0, 0, 0, 0, "Creates Sticky coordinates for the active object from the current camera view background picture");
 
706
        }
 
707
        else uiDefBut(block, BUT, B_DELSTICKY, "Delete",        80,10,84,19, 0, 0, 0, 0, 0, "Deletes Sticky texture coordinates");
 
708
 
426
709
        uiBlockEndAlign(block);
427
710
 
428
 
 
429
711
        /* decimator */
430
712
        if(G.obedit==NULL) {
431
713
                int tottria= decimate_count_tria(ob);
432
 
                DispList *dl;
 
714
                Mesh *me = ob->data;
433
715
 
434
 
                // wacko, wait for new displist system (ton)
435
 
                if( (dl=ob->disp.first) && dl->mesh);
436
 
                else decim_faces= tottria;
 
716
                if (!me->decimated) {
 
717
                        decim_faces= tottria;
 
718
                }
437
719
 
438
720
                uiBlockBeginAlign(block);
439
721
                uiBlockSetCol(block, TH_BUT_SETTING1);
501
783
        return G.main->vfont.first;
502
784
}
503
785
 
504
 
static VFont *exist_vfont(char *str)
 
786
VFont *exist_vfont(char *str)
505
787
{
506
788
        VFont *vf;
507
789
 
564
846
 
565
847
        text_to_curve(OBACT, 0);
566
848
        makeDispList(OBACT);
 
849
        BIF_undo_push("Load vector font");
567
850
        allqueue(REDRAWVIEW3D, 0);
568
851
        allqueue(REDRAWBUTSEDIT, 0);
569
852
}
636
919
                                cu->vfont= vf;
637
920
                                text_to_curve(ob, 0);
638
921
                                makeDispList(ob);
 
922
                                BIF_undo_push("Set vector font");
639
923
                                allqueue(REDRAWVIEW3D, 0);
640
924
                                allqueue(REDRAWBUTSEDIT, 0);
641
925
                        }
711
995
{
712
996
        extern Nurb *lastnu;
713
997
        extern ListBase editNurb;  /* from editcurve */
 
998
        Base *base;
714
999
        Object *ob;
715
1000
        Curve *cu;
716
1001
        Nurb *nu;
802
1087
                        allqueue(REDRAWVIEW3D, 0);
803
1088
                }
804
1089
                break;
 
1090
        case B_SUBSURFTYPE:
 
1091
                        /* Icky, find better system */
 
1092
                if(ob->type==OB_MESH && G.obedit && ob->data==G.obedit->data) {
 
1093
                        if(G.editMesh->derived) {
 
1094
                                G.editMesh->derived->release(G.editMesh->derived);
 
1095
                                G.editMesh->derived= NULL;
 
1096
                        }
 
1097
                }
 
1098
                /* fallthrough */
805
1099
        case B_MAKEDISP:
806
 
                if(ob->type==OB_FONT) text_to_curve(ob, 0);
807
 
                makeDispList(ob);
808
 
                allqueue(REDRAWVIEW3D, 0);
809
 
                allqueue(REDRAWINFO, 1);        /* 1, because header->win==0! */
 
1100
                if(G.vd) {
 
1101
                        if(ob->type==OB_FONT) text_to_curve(ob, 0);
 
1102
                        makeDispList(ob);
 
1103
                        if(ob!=G.obedit) { // subsurf with linked dupli will crash
 
1104
                                /* we need signal to send to other users of same data to recalc... */
 
1105
                                base= FIRSTBASE;
 
1106
                                while(base) {
 
1107
                                        if(base->lay & G.vd->lay) {
 
1108
                                                if(base->object->data==ob->data && base->object!=ob)
 
1109
                                                        makeDispList(base->object);
 
1110
                                        }
 
1111
                                        base= base->next;
 
1112
                                }
 
1113
                        }
 
1114
                        allqueue(REDRAWVIEW3D, 0);
 
1115
                        allqueue(REDRAWINFO, 1);        /* 1, because header->win==0! */
 
1116
                }
810
1117
                break;
811
1118
 
812
1119
        case B_SUBDIVCURVE:
815
1122
        case B_SPINNURB:
816
1123
                /* bad bad bad!!! use brackets!!! In case you wondered:
817
1124
                  {==,!=} goes before & goes before || */
818
 
                if( (G.obedit==0) ||
819
 
                    (G.obedit->type!=OB_SURF) ||
 
1125
                if( (G.obedit==NULL) || (G.obedit->type!=OB_SURF) || (G.vd==NULL) ||
820
1126
                        ((G.obedit->lay & G.vd->lay) == 0) ) return;
821
1127
                spinNurb(0, 0);
822
1128
                countall();
883
1189
        if(ob->type==OB_CURVE) {
884
1190
                uiDefBut(block, LABEL, 0, "Convert",    463,173,72, 18, 0, 0, 0, 0, 0, "");
885
1191
                uiBlockBeginAlign(block);
886
 
                uiDefBut(block, BUT,B_CONVERTPOLY,"Poly",               467,152,72, 18, 0, 0, 0, 0, 0, "");
887
 
                uiDefBut(block, BUT,B_CONVERTBEZ,"Bezier",      467,132,72, 18, 0, 0, 0, 0, 0, "");
888
 
                uiDefBut(block, BUT,B_CONVERTBSPL,"Bspline",    467,112,72, 18, 0, 0, 0, 0, 0, "");
889
 
                uiDefBut(block, BUT,B_CONVERTCARD,"Cardinal",   467,92,72, 18, 0, 0, 0, 0, 0, "");
890
 
                uiDefBut(block, BUT,B_CONVERTNURB,"Nurb",               467,72,72, 18, 0, 0, 0, 0, 0, "");
 
1192
                uiDefBut(block, BUT,B_CONVERTPOLY,"Poly",               467,152,72, 18, 0, 0, 0, 0, 0, "Converts selected into regular Polygon vertices");
 
1193
                uiDefBut(block, BUT,B_CONVERTBEZ,"Bezier",              467,132,72, 18, 0, 0, 0, 0, 0, "Converts selected to Bezier triples");
 
1194
                uiDefBut(block, BUT,B_CONVERTNURB,"Nurb",               467,112,72, 18, 0, 0, 0, 0, 0, "Converts selected to Nurbs Points");
891
1195
        }
892
1196
        uiBlockBeginAlign(block);
893
 
        uiDefBut(block, BUT,B_UNIFU,"Uniform U",        565,152,102, 18, 0, 0, 0, 0, 0, "");
894
 
        uiDefBut(block, BUT,B_UNIFV,"V",                        670,152,50, 18, 0, 0, 0, 0, 0, "");
895
 
        uiDefBut(block, BUT,B_ENDPU,"Endpoint U",       565,132,102, 18, 0, 0, 0, 0, 0, "");
896
 
        uiDefBut(block, BUT,B_ENDPV,"V",                        670,132,50, 18, 0, 0, 0, 0, 0, "");
897
 
        uiDefBut(block, BUT,B_BEZU,"Bezier U",          565,112,102, 18, 0, 0, 0, 0, 0, "");
898
 
        uiDefBut(block, BUT,B_BEZV,"V",                         670,112,50, 18, 0, 0, 0, 0, 0, "");
 
1197
        uiDefBut(block, BUT,B_UNIFU,"Uniform U",        565,152,102, 18, 0, 0, 0, 0, 0, "Nurbs only; interpolated result doesn't go to end points in U");
 
1198
        uiDefBut(block, BUT,B_UNIFV,"V",                        670,152,50, 18, 0, 0, 0, 0, 0, "Nurbs only; interpolated result doesn't go to end points in V");
 
1199
        uiDefBut(block, BUT,B_ENDPU,"Endpoint U",       565,132,102, 18, 0, 0, 0, 0, 0, "Nurbs only; interpolated result is forced to end points in U");
 
1200
        uiDefBut(block, BUT,B_ENDPV,"V",                        670,132,50, 18, 0, 0, 0, 0, 0, "Nurbs only; interpolated result is forced to end points in V");
 
1201
        uiDefBut(block, BUT,B_BEZU,"Bezier U",          565,112,102, 18, 0, 0, 0, 0, 0, "Nurbs only; make knots array mimic a Bezier in U");
 
1202
        uiDefBut(block, BUT,B_BEZV,"V",                         670,112,50, 18, 0, 0, 0, 0, 0, "Nurbs only; make knots array mimic a Bezier in V");
899
1203
        uiBlockEndAlign(block);
900
1204
 
901
 
        uiDefBut(block, BUT,B_SETWEIGHT,"Set Weight",   465,11,95,49, 0, 0, 0, 0, 0, "");
 
1205
        uiDefBut(block, BUT,B_SETWEIGHT,"Set Weight",   465,11,95,49, 0, 0, 0, 0, 0, "Nurbs only; set weight for select points");
902
1206
 
903
1207
        uiBlockBeginAlign(block);
904
 
        uiDefButF(block, NUM,0,"Weight:",               565,36,102,22, &editbutweight, 0.01, 100.0, 10, 0, "");
 
1208
        uiDefButF(block, NUM,0,"Weight:",               565,36,102,22, &editbutweight, 0.01, 100.0, 10, 0, "The weight you can assign");
905
1209
        uiDefBut(block, BUT,B_SETW1,"1.0",              670,36,50,22, 0, 0, 0, 0, 0, "");
906
1210
        uiDefBut(block, BUT,B_SETW2,"sqrt(2)/4",565,11,55,20, 0, 0, 0, 0, 0, "");
907
1211
        uiDefBut(block, BUT,B_SETW3,"0.25",             620,11,45,20, 0, 0, 0, 0, 0, "");
914
1218
                if(nu) {
915
1219
                        uiBlockBeginAlign(block);
916
1220
                        sp= &(nu->orderu);
917
 
                        uiDefButS(block, NUM, B_SETORDER, "Order U:", 565,90,102, 19, sp, 2.0, 6.0, 0, 0, "");
 
1221
                        uiDefButS(block, NUM, B_SETORDER, "Order U:", 565,90,102, 19, sp, 2.0, 6.0, 0, 0, "Nurbs only; the amount of control points involved");
918
1222
                        sp= &(nu->orderv);
919
 
                        uiDefButS(block, NUM, B_SETORDER, "V:",         670,90,50, 19, sp, 2.0, 6.0, 0, 0, "");
 
1223
                        uiDefButS(block, NUM, B_SETORDER, "V:",         670,90,50, 19, sp, 2.0, 6.0, 0, 0, "Nurbs only; the amount of control points involved");
920
1224
                        sp= &(nu->resolu);
921
 
                        uiDefButS(block, NUM, B_MAKEDISP, "Resol U:", 565,70,102, 19, sp, 1.0, 128.0, 0, 0, "");
 
1225
                        uiDefButS(block, NUM, B_MAKEDISP, "Resol U:", 565,70,102, 19, sp, 1.0, 1024.0, 0, 0, "The amount of new points interpolated per control vertex pair");
922
1226
                        sp= &(nu->resolv);
923
 
                        uiDefButS(block, NUM, B_MAKEDISP, "V:",         670,70,50, 19, sp, 1.0, 128.0, 0, 0, "");
 
1227
                        uiDefButS(block, NUM, B_MAKEDISP, "V:",         670,70,50, 19, sp, 1.0, 1024.0, 0, 0, "The amount of new points interpolated per control vertex pair");
924
1228
                }
925
1229
        }
926
1230
 
934
1238
        block= uiNewBlock(&curarea->uiblocks, "editing_panel_curve_tools1", UI_EMBOSS, UI_HELV, curarea->win);
935
1239
        if(uiNewPanel(curarea, block, "Curve Tools1", "Editing", 960, 0, 318, 204)==0) return;
936
1240
 
937
 
        uiDefBut(block, BUT, B_SUBDIVCURVE, "Subdivide", 400,180,150,20, 0, 0, 0, 0, 0, "");
 
1241
        uiDefBut(block, BUT, B_SUBDIVCURVE, "Subdivide", 400,180,150,20, 0, 0, 0, 0, 0, "Subdivide selected");
938
1242
        if(ob->type==OB_SURF) {
939
 
                uiDefBut(block, BUT, B_SPINNURB, "Spin",         400,160,150,20, 0, 0, 0, 0, 0, "");
 
1243
                uiDefBut(block, BUT, B_SPINNURB, "Spin",         400,160,150,20, 0, 0, 0, 0, 0, "Spin selected 360 degrees");
940
1244
        }
941
1245
        uiBlockBeginAlign(block);
942
1246
        uiDefBut(block, BUT,B_HIDE,             "Hide",                 400,120,150,18, 0, 0, 0, 0, 0, "Hides selected faces");
944
1248
        uiDefBut(block, BUT,B_SELSWAP,  "Select Swap",  400,80,150,18, 0, 0, 0, 0, 0, "Selects unselected faces, and deselects selected faces");
945
1249
        uiBlockEndAlign(block);
946
1250
 
947
 
        uiDefButF(block, NUM,   REDRAWVIEW3D, "NSize:", 400, 40, 150, 19, &editbutsize, 0.001, 1.0, 10, 0, "");
 
1251
        uiDefButF(block, NUM,   REDRAWVIEW3D, "NSize:", 400, 40, 150, 19, &G.scene->editbutsize, 0.001, 1.0, 10, 0, "Normal size for drawing");
948
1252
}
949
1253
 
950
1254
/* for curve, surf and font! */
955
1259
        block= uiNewBlock(&curarea->uiblocks, "editing_panel_curve_type", UI_EMBOSS, UI_HELV, curarea->win);
956
1260
        if(uiNewPanel(curarea, block, "Curve and Surface", "Editing", 320, 0, 318, 204)==0) return;
957
1261
 
958
 
        uiDefButS(block, TOG|BIT|5, 0, "UV Orco",                                       600,160,150,19, &cu->flag, 0, 0, 0, 0, "");
 
1262
        uiDefButS(block, TOG|BIT|5, 0, "UV Orco",                                       600,160,150,19, &cu->flag, 0, 0, 0, 0, "Forces to use UV coordinates for texture mapping 'orco'");
959
1263
        if(ob->type==OB_SURF)
960
 
                uiDefButS(block, TOG|BIT|6, REDRAWVIEW3D, "No Puno Flip",       600,140,150,19, &cu->flag, 0, 0, 0, 0, "");
 
1264
                uiDefButS(block, TOG|BIT|6, REDRAWVIEW3D, "No Puno Flip",       600,140,150,19, &cu->flag, 0, 0, 0, 0, "Don't flip vertex normals while render");
961
1265
 
962
1266
        uiBlockBeginAlign(block);
963
1267
        uiDefBut(block, BUT,B_DOCENTRE, "Centre",                                       600, 115, 150, 19, 0, 0, 0, 0, 0, "Shifts object data to be centered about object's origin");
973
1277
        }
974
1278
 
975
1279
        if(ob->type!=OB_SURF) {
976
 
 
 
1280
        
977
1281
                if(ob->type==OB_CURVE) {
978
1282
                        extern float prlen;             // buttons_object.c, should be moved....
979
1283
                        char str[32];
980
 
                        uiBlockBeginAlign(block);
981
 
                        uiDefButS(block, NUM, B_RECALCPATH, "PathLen:",                 600,50,150,19, &cu->pathlen, 1.0, 9000.0, 0, 0, "");
982
 
                        uiDefButS(block, TOG|BIT|3, B_RECALCPATH, "CurvePath",  600,30,75,19 , &cu->flag, 0, 0, 0, 0, "");
983
 
                        uiDefButS(block, TOG|BIT|4, REDRAWVIEW3D, "CurveFollow",675,30,75,19, &cu->flag, 0, 0, 0, 0, "");
 
1284
                        
984
1285
                        sprintf(str, "%.4f", prlen);
985
 
                        uiDefBut(block, BUT, B_PRINTLEN,                "PrintLen",     600,10,75,19, 0, 0, 0, 0, 0, "");
986
 
                        uiDefBut(block, LABEL, 0, str,                                          675,10,75,19, 0, 1.0, 0, 0, 0, "");
 
1286
                        uiDefBut(block, BUT, B_PRINTLEN,                "PrintLen",     600,135,75,19, 0, 0, 0, 0, 0, "");
 
1287
                        uiDefBut(block, LABEL, 0, str,                                          675,135,75,19, 0, 1.0, 0, 0, 0, "");
 
1288
                        
 
1289
                        uiBlockBeginAlign(block);
 
1290
                        uiDefButS(block, NUM, B_RECALCPATH, "PathLen:",                 600,50,150,19, &cu->pathlen, 1.0, 9000.0, 0, 0, "If no speed Ipo was set, the amount of frames of the path");
 
1291
                        uiDefButS(block, TOG|BIT|3, B_RECALCPATH, "CurvePath",  600,30,75,19 , &cu->flag, 0, 0, 0, 0, "Enables curve to become translation path");
 
1292
                        uiDefButS(block, TOG|BIT|4, REDRAWVIEW3D, "CurveFollow",675,30,75,19, &cu->flag, 0, 0, 0, 0, "Makes curve path children to rotate along path");
 
1293
                        uiDefButS(block, TOG|BIT|7, B_CURVECHECK, "CurveStretch", 600,10,150,19, &cu->flag, 0, 0, 0, 0, "Option for curve-deform: makes deformed child to stretch along entire path");
 
1294
                        uiDefButS(block, TOG|BIT|8, REDRAWVIEW3D, "PathDist Offs", 600,-10,150,19, &cu->flag, 0, 0, 0, 0, "Children will use TimeOffs value as path distance offset");
 
1295
 
 
1296
                        uiBlockEndAlign(block);
987
1297
                }
988
1298
 
989
1299
                uiBlockBeginAlign(block);
990
 
                uiDefButS(block, NUM, B_MAKEDISP, "DefResolU:", 760,160,120,19, &cu->resolu, 1.0, 128.0, 0, 0, "");
991
 
                uiDefBut(block, BUT, B_SETRESOLU, "Set",                880,160,30,19, 0, 0, 0, 0, 0, "");
 
1300
                uiDefButS(block, NUM, B_MAKEDISP, "DefResolU:", 760,160,120,19, &cu->resolu, 1.0, 1024.0, 0, 0, "Default resolution");
 
1301
                uiDefBut(block, BUT, B_SETRESOLU, "Set",                880,160,30,19, 0, 0, 0, 0, 0, "Set resolution for interpolation");
992
1302
 
993
1303
                uiBlockBeginAlign(block);
994
 
                uiDefButF(block, NUM, B_MAKEDISP, "Width:",             760,90,150,19, &cu->width, 0.0, 2.0, 1, 0, "");
995
 
                uiDefButF(block, NUM, B_MAKEDISP, "Ext1:",              760,70,150,19, &cu->ext1, 0.0, 5.0, 10, 0, "");
996
 
                uiDefButF(block, NUM, B_MAKEDISP, "Ext2:",              760,50,150,19, &cu->ext2, 0.0, 2.0, 1, 0, "");
997
 
                uiDefButS(block, NUM, B_MAKEDISP, "BevResol:",  760,30,150,19, &cu->bevresol, 0.0, 10.0, 0, 0, "");
998
 
                uiDefIDPoinBut(block, test_obcurpoin_but, B_MAKEDISP, "BevOb:",         760,10,150,19, &cu->bevobj, "");
 
1304
                uiDefButF(block, NUM, B_MAKEDISP, "Width:",             760,90,150,19, &cu->width, 0.0, 2.0, 1, 0, "Make interpolated result thinner or fatter");
 
1305
                uiDefButF(block, NUM, B_MAKEDISP, "Ext1:",              760,70,150,19, &cu->ext1, 0.0, 5.0, 10, 0, "Extrude depth");
 
1306
                uiDefButF(block, NUM, B_MAKEDISP, "Ext2:",              760,50,150,19, &cu->ext2, 0.0, 2.0, 1, 0, "Extrude beveling depth");
 
1307
                uiDefButS(block, NUM, B_MAKEDISP, "BevResol:",  760,30,150,19, &cu->bevresol, 0.0, 10.0, 0, 0, "Amount of bevels");
 
1308
                uiDefIDPoinBut(block, test_obcurpoin_but, B_MAKEDISP, "BevOb:",         760,10,150,19, &cu->bevobj, "Curve object name that defines the bevel shape");
 
1309
                uiDefIDPoinBut(block, test_obcurpoin_but, B_MAKEDISP, "TaperOb:",               760,-10,150,19, &cu->taperobj, "Curve object name that defines the taper (width)");
999
1310
 
1000
1311
                uiBlockBeginAlign(block);
1001
1312
                uiBlockSetCol(block, TH_BUT_SETTING1);
1002
 
                uiDefButS(block, TOG|BIT|2, B_MAKEDISP, "Back", 760,130,50,19, &cu->flag, 0, 0, 0, 0, "");
1003
 
                uiDefButS(block, TOG|BIT|1, B_MAKEDISP, "Front",810,130,50,19, &cu->flag, 0, 0, 0, 0, "");
1004
 
                uiDefButS(block, TOG|BIT|0, B_CU3D, "3D",               860,130,50,19, &cu->flag, 0, 0, 0, 0, "");
 
1313
                uiDefButS(block, TOG|BIT|2, B_MAKEDISP, "Back", 760,130,50,19, &cu->flag, 0, 0, 0, 0, "Draw filled back for curves");
 
1314
                uiDefButS(block, TOG|BIT|1, B_MAKEDISP, "Front",810,130,50,19, &cu->flag, 0, 0, 0, 0, "Draw filled front for curves");
 
1315
                uiDefButS(block, TOG|BIT|0, B_CU3D, "3D",               860,130,50,19, &cu->flag, 0, 0, 0, 0, "Allow Curve Object to be 3d, it doesn't fill then");
1005
1316
 
1006
1317
 
1007
1318
        }
1023
1334
        block= uiNewBlock(&curarea->uiblocks, "editing_panel_camera_type", UI_EMBOSS, UI_HELV, curarea->win);
1024
1335
        if(uiNewPanel(curarea, block, "Camera", "Editing", 320, 0, 318, 204)==0) return;
1025
1336
 
1026
 
        uiDefButF(block, NUM,REDRAWVIEW3D, "Lens:", 470,178,160,20, &cam->lens, 1.0, 250.0, 100, 0, "Specify the lens of the camera");
 
1337
        if(cam->type==CAM_ORTHO)
 
1338
                uiDefButF(block, NUM,REDRAWVIEW3D, "Scale:", 470,178,160,20, &cam->ortho_scale, 0.01, 1000.0, 50, 0, "Specify the ortho scaling of the used camera");
 
1339
        else
 
1340
                uiDefButF(block, NUM,REDRAWVIEW3D, "Lens:", 470,178,160,20, &cam->lens, 1.0, 250.0, 100, 0, "Specify the lens of the camera");
1027
1341
 
1028
1342
        uiBlockBeginAlign(block);
1029
1343
        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");
1032
1346
 
1033
1347
        uiDefButF(block, NUM,REDRAWVIEW3D, "DrawSize:", 470,90,160,20, &cam->drawsize, 0.1*grid, 10.0, 10, 0, "Specify the drawsize of the camera");
1034
1348
 
1035
 
        uiDefButS(block, TOG, REDRAWVIEW3D, "Ortho", 470,49,61,40, &cam->type, 0, 0, 0, 0, "Render orthogonally");
 
1349
        uiDefButS(block, TOG, REDRAWVIEW3D, "Ortho",            470,29,61,60, &cam->type, 0, 0, 0, 0, "Render orthogonally");
1036
1350
        uiBlockBeginAlign(block);
1037
 
        uiDefButS(block, TOG|BIT|0,REDRAWVIEW3D, "ShowLimits", 533,69,97,20, &cam->flag, 0, 0, 0, 0, "Draw the field of view");
1038
 
        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");
 
1351
        uiDefButS(block, TOG|BIT|0,REDRAWVIEW3D, "ShowLimits", 533,59,97,30, &cam->flag, 0, 0, 0, 0, "Draw the field of view");
 
1352
        uiDefButS(block, TOG|BIT|1,REDRAWVIEW3D, "Show Mist",  533,29,97,30, &cam->flag, 0, 0, 0, 0, "Draw a line that indicates the mist area");
1039
1353
        uiBlockEndAlign(block);
1040
1354
}
1041
1355
 
 
1356
/* yafray: extra camera panel to set Depth-of-Field parameters */
 
1357
static void editing_panel_camera_yafraydof(Object *ob, Camera *cam)
 
1358
{
 
1359
        uiBlock *block;
 
1360
        char *mst1, *mst2;
 
1361
 
 
1362
        block= uiNewBlock(&curarea->uiblocks, "editing_panel_camera_yafraydof", UI_EMBOSS, UI_HELV, curarea->win);
 
1363
        uiNewPanelTabbed("Camera", "Editing");
 
1364
        if(uiNewPanel(curarea, block, "Yafray DoF", "Editing", 320, 0, 318, 204)==0) return;
 
1365
 
 
1366
        uiDefButF(block, NUM, REDRAWVIEW3D, "DoFDist:", 10, 147, 180, 20, &cam->YF_dofdist, 0.0, 5000.0, 50, 0, "Sets distance to point of focus (use camera 'ShowLimits' to make visible in 3Dview)");
 
1367
        uiDefButF(block, NUM, B_DIFF, "Aperture:", 10, 125, 180, 20, &cam->YF_aperture, 0.0, 2.0, 1, 0, "Sets lens aperture, the larger, the more blur (use small values, 0 is no DoF)");
 
1368
 
 
1369
        uiDefButS(block, TOG|BIT|2, B_DIFF, "Random sampling", 10, 90, 180, 20, &cam->flag, 0, 0, 0, 0, "Use noisy random Lens sampling instead of QMC");
 
1370
 
 
1371
        uiDefBut(block, LABEL, 0, "Bokeh", 10, 60, 180, 19, 0, 0.0, 0.0, 0, 0, "");
 
1372
        mst1 = "Bokeh Type%t|Disk1%x0|Disk2%x1|Triangle%x2|Square%x3|Pentagon%x4|Hexagon%x5|Ring%x6";
 
1373
        uiDefButS(block, MENU, B_REDR, mst1, 10, 40, 89, 20, &cam->YF_bkhtype, 0.0, 0.0, 0, 0, "Sets Bokeh type");
 
1374
        
 
1375
        if ((cam->YF_bkhtype!=0) && (cam->YF_bkhtype!=6)) {
 
1376
                mst2 = "Bokeh Bias%t|Uniform%x0|Center%x1|Edge%x2";
 
1377
                uiDefButS(block, MENU, B_REDR, mst2, 100, 40, 90, 20, &cam->YF_bkhbias, 0.0, 0.0, 0, 0, "Sets Bokeh bias");
 
1378
                if (cam->YF_bkhtype>1)
 
1379
                        uiDefButF(block, NUM, B_DIFF, "Rotation:", 10, 15, 180, 20, &cam->YF_bkhrot, 0.0, 360.0, 100, 0, "Shape rotation amount in degrees");
 
1380
        }
 
1381
 
 
1382
}
 
1383
 
 
1384
/* **************************** CAMERA *************************** */
 
1385
 
 
1386
void do_cambuts(unsigned short event)
 
1387
{
 
1388
        Object *ob;
 
1389
        Camera *cam;
 
1390
        
 
1391
        ob= OBACT;
 
1392
        if (ob==0) return;
 
1393
        cam= ob->data;
 
1394
 
 
1395
        switch(event) {
 
1396
        case 0:
 
1397
                ;
 
1398
                break;
 
1399
        }
 
1400
}
 
1401
 
1042
1402
/* *************************** MBALL ******************************** */
1043
1403
 
1044
1404
void do_mballbuts(unsigned short event)
1062
1422
        mb= ob->data;
1063
1423
 
1064
1424
        uiBlockBeginAlign(block);
1065
 
        uiDefButF(block, NUMSLI, B_RECALCMBALL, "Wiresize:",    470,178,250,19, &mb->wiresize, 0.05, 1.0, 0, 0, "");
1066
 
        uiDefButF(block, NUMSLI, 0, "Rendersize:",                      470,158,250,19, &mb->rendersize, 0.05, 1.0, 0, 0, "");
1067
 
        uiDefButF(block, NUMSLI, B_RECALCMBALL, "Threshold:", 470,138,250,19, &mb->thresh, 0.0001, 5.0, 0, 0, "");
 
1425
        uiDefButF(block, NUM, B_RECALCMBALL, "Wiresize:", 470,178,250,19, &mb->wiresize, 0.05, 1.0, 1, 0, "Polygonization resolution in 3d window");
 
1426
        uiDefButF(block, NUM, 0, "Rendersize:", 470,158,250,19, &mb->rendersize, 0.05, 1.0, 1, 0, "Polygonization resolution in rendering");
 
1427
        uiDefButF(block, NUM, B_RECALCMBALL, "Threshold:", 470,138,250,19, &mb->thresh, 0.0001, 5.0, 1, 0, "Defines influence of meta elements");
1068
1428
 
1069
1429
        uiBlockBeginAlign(block);
1070
1430
        uiBlockSetCol(block, TH_BUT_SETTING1);
1071
 
        uiDefBut(block, LABEL, 0, "Update:",            471,108,120,19, 0, 0, 0, 0, 0, "");
1072
 
        uiDefButS(block, ROW, B_DIFF, "Always", 471, 85, 120, 19, &mb->flag, 0.0, 0.0, 0, 0, "");
1073
 
        uiDefButS(block, ROW, B_DIFF, "Half Res",       471, 65, 120, 19, &mb->flag, 0.0, 1.0, 0, 0, "");
1074
 
        uiDefButS(block, ROW, B_DIFF, "Fast",           471, 45, 120, 19, &mb->flag, 0.0, 2.0, 0, 0, "");
 
1431
        uiDefBut(block, LABEL, 0, "Update:", 471,108,120,19, 0, 0, 0, 0, 0, "");
 
1432
        uiDefButS(block, ROW, B_DIFF, "Always", 471, 85, 120, 19, &mb->flag, 0.0, 0.0, 0, 0, "While editing, always updates");
 
1433
        uiDefButS(block, ROW, B_DIFF, "Half Res", 471, 65, 120, 19, &mb->flag, 0.0, 1.0, 0, 0, "While editing, updates in half resolution");
 
1434
        uiDefButS(block, ROW, B_DIFF, "Fast", 471, 45, 120, 19, &mb->flag, 0.0, 2.0, 0, 0, "While editing, updates without polygonization");
 
1435
        uiDefButS(block, ROW, B_DIFF, "Never", 471, 25, 120, 19, &mb->flag, 0.0, 3.0, 0, 0, "While editing, doesn't update");
1075
1436
 
1076
1437
}
1077
1438
 
1085
1446
 
1086
1447
        if(ob==G.obedit && lastelem) {
1087
1448
                uiBlockBeginAlign(block);
1088
 
                uiDefButF(block, NUMSLI, B_RECALCMBALL, "Stiffness:", 750,178,250,19, &lastelem->s, 0.0, 10.0, 0, 0, "");
 
1449
                uiDefButF(block, NUM, B_RECALCMBALL, "Stiffness:", 750,178,250,19, &lastelem->s, 0.0, 10.0, 1, 0, "Stiffness for active meta");
1089
1450
                if(lastelem->type!=MB_BALL)
1090
 
                uiDefButF(block, NUMSLI, B_RECALCMBALL, "dx:",          750,158,250,19, &lastelem->expx, 0.0, 20.0, 0, 0, "");
 
1451
                uiDefButF(block, NUM, B_RECALCMBALL, "dx:", 750,158,250,19, &lastelem->expx, 0.0, 20.0, 1, 0, "X size for active meta");
1091
1452
                if((lastelem->type!=MB_BALL)&&(lastelem->type!=MB_TUBE))
1092
 
                uiDefButF(block, NUMSLI, B_RECALCMBALL, "dy:",          750,138,250,19, &lastelem->expy, 0.0, 20.0, 0, 0, "");
 
1453
                uiDefButF(block, NUM, B_RECALCMBALL, "dy:", 750,138,250,19, &lastelem->expy, 0.0, 20.0, 1, 0, "Y size for active meta");
1093
1454
 
1094
1455
                if((lastelem->type==MB_CUBE)||(lastelem->type==MB_ELIPSOID))
1095
 
                uiDefButF(block, NUMSLI, B_RECALCMBALL, "dz:",          750,118,250,19, &lastelem->expz, 0.0, 20.0, 0, 0, "");
1096
 
                uiBlockEndAlign(block);
1097
 
 
1098
 
                uiDefButS(block, ROW, B_RECALCMBALL, "Ball",                    753,83,60,19, &lastelem->type, 1.0, 0.0, 0, 0, "");
1099
 
                uiBlockBeginAlign(block);
1100
 
                uiDefButS(block, ROW, B_RECALCMBALL, "Tube",                    753,62,60,19, &lastelem->type, 1.0, 4.0, 0, 0, "");
1101
 
                uiDefButS(block, ROW, B_RECALCMBALL, "Plane",                   814,62,60,19, &lastelem->type, 1.0, 5.0, 0, 0, "");
1102
 
                uiDefButS(block, ROW, B_RECALCMBALL, "Elipsoid",                876,62,60,19, &lastelem->type, 1.0, 6.0, 0, 0, "");
1103
 
                uiDefButS(block, ROW, B_RECALCMBALL, "Cube",                    938,62,60,19, &lastelem->type, 1.0, 7.0, 0, 0, "");
1104
 
                uiBlockEndAlign(block);
1105
 
 
1106
 
                uiDefButS(block, TOG|BIT|1, B_RECALCMBALL, "Negative",753,16,60,19, &lastelem->flag, 0, 0, 0, 0, "");
 
1456
                uiDefButF(block, NUM, B_RECALCMBALL, "dz:", 750,118,250,19, &lastelem->expz, 0.0, 20.0, 1, 0, "Z size for active meta");
 
1457
                uiBlockEndAlign(block);
 
1458
 
 
1459
                uiDefButS(block, ROW, B_RECALCMBALL, "Ball", 753,83,60,19, &lastelem->type, 1.0, 0.0, 0, 0, "Draw active meta as Ball");
 
1460
                uiBlockBeginAlign(block);
 
1461
                uiDefButS(block, ROW, B_RECALCMBALL, "Tube", 753,62,60,19, &lastelem->type, 1.0, 4.0, 0, 0, "Draw active meta as Ball");
 
1462
                uiDefButS(block, ROW, B_RECALCMBALL, "Plane", 814,62,60,19, &lastelem->type, 1.0, 5.0, 0, 0, "Draw active meta as Plane");
 
1463
                uiDefButS(block, ROW, B_RECALCMBALL, "Elipsoid", 876,62,60,19, &lastelem->type, 1.0, 6.0, 0, 0, "Draw active meta as Ellipsoid");
 
1464
                uiDefButS(block, ROW, B_RECALCMBALL, "Cube", 938,62,60,19, &lastelem->type, 1.0, 7.0, 0, 0, "Draw active meta as Cube");
 
1465
                uiBlockEndAlign(block);
 
1466
 
 
1467
                uiBlockBeginAlign(block);
 
1468
                uiDefButS(block, TOG|BIT|1, B_RECALCMBALL, "Negative",753,16,125,19, &lastelem->flag, 0, 0, 0, 0, "Make active meta creating holes");
 
1469
                uiDefButS(block, TOG|BIT|3, B_RECALCMBALL, "Hide",878,16,125,19, &lastelem->flag, 0, 0, 0, 0, "Make active meta invisible");
 
1470
                uiBlockEndAlign(block);
1107
1471
 
1108
1472
        }
1109
1473
 
1125
1489
                if(ob) {
1126
1490
                        if(ob==G.obedit) resizelattice(editLatt);
1127
1491
                        else resizelattice(ob->data);
 
1492
                        ob->softflag |= OB_SB_REDO;
1128
1493
                }
1129
1494
                allqueue(REDRAWVIEW3D, 0);
1130
1495
                break;
1150
1515
        uiBlock *block;
1151
1516
 
1152
1517
        block= uiNewBlock(&curarea->uiblocks, "editing_panel_lattice_type", UI_EMBOSS, UI_HELV, curarea->win);
1153
 
        if(uiNewPanel(curarea, block, "Latice", "Editing", 320, 0, 318, 204)==0) return;
 
1518
        if(uiNewPanel(curarea, block, "Lattice", "Editing", 320, 0, 318, 204)==0) return;
1154
1519
 
1155
1520
 
1156
1521
        uiSetButLock(lt->key!=0, "Not with VertexKeys");
1157
1522
        uiSetButLock(ob==G.obedit, "Unable to perform function in EditMode");
1158
1523
 
1159
1524
        uiBlockBeginAlign(block);
1160
 
        uiDefButS(block, NUM, B_RESIZELAT,      "U:",                           470, 178,100,19, &lt->pntsu, 1.0, 64.0, 0, 0, "Points in U direction");
 
1525
 
 
1526
        uiDefButS(block, NUM, B_RESIZELAT,      "U:",                           469, 178,100,19, &lt->pntsu, 1.0, 64.0, 0, 0, "Points in U direction");
1161
1527
        uiDefButC(block, ROW, B_LATTCHANGED,            "Lin",          572, 178, 40, 19, &lt->typeu, 1.0, (float)KEY_LINEAR, 0, 0, "Set Linear interpolation");
1162
 
        uiDefButC(block, ROW, B_LATTCHANGED,            "Card",         612, 178, 40, 19, &lt->typeu, 1.0, (float)KEY_CARDINAL, 0, 0, "Set Cardinal interpolation");
 
1528
        uiDefButC(block, ROW, B_LATTCHANGED,            "Card",         613, 178, 40, 19, &lt->typeu, 1.0, (float)KEY_CARDINAL, 0, 0, "Set Cardinal interpolation");
1163
1529
        uiDefButC(block, ROW, B_LATTCHANGED,            "B",            652, 178, 40, 19, &lt->typeu, 1.0, (float)KEY_BSPLINE, 0, 0, "Set B-spline interpolation");
1164
1530
 
1165
 
        uiBlockBeginAlign(block);
1166
 
        uiDefButS(block, NUM, B_RESIZELAT,      "V:",                           470, 158,100,19, &lt->pntsv, 1.0, 64.0, 0, 0, "Points in V direction");
1167
 
        uiDefButC(block, ROW, B_LATTCHANGED,            "Lin",          572, 158, 40, 19, &lt->typev, 2.0, (float)KEY_LINEAR, 0, 0, "Set Linear interpolation");
1168
 
        uiDefButC(block, ROW, B_LATTCHANGED,            "Card",         612, 158, 40, 19, &lt->typev, 2.0, (float)KEY_CARDINAL, 0, 0, "Set Cardinal interpolation");
1169
 
        uiDefButC(block, ROW, B_LATTCHANGED,            "B",            652, 158, 40, 19, &lt->typev, 2.0, (float)KEY_BSPLINE, 0, 0, "Set B-spline interpolation");
1170
 
 
1171
 
        uiBlockBeginAlign(block);
1172
 
        uiDefButS(block, NUM, B_RESIZELAT,      "W:",                           470, 138,100,19, &lt->pntsw, 1.0, 64.0, 0, 0, "Points in W direction");
1173
 
        uiDefButC(block, ROW, B_LATTCHANGED,            "Lin",          572, 138, 40, 19, &lt->typew, 3.0, (float)KEY_LINEAR, 0, 0, "Set Linear interpolation");
1174
 
        uiDefButC(block, ROW, B_LATTCHANGED,            "Card",         612, 138, 40, 19, &lt->typew, 3.0, (float)KEY_CARDINAL, 0, 0, "Set Cardinal interpolation");
1175
 
        uiDefButC(block, ROW, B_LATTCHANGED,            "B",            652, 138, 40, 19, &lt->typew, 3.0, (float)KEY_BSPLINE, 0, 0, "Set B-spline interpolation");
 
1531
        uiDefButS(block, NUM, B_RESIZELAT,      "V:",                           469, 156,100,19, &lt->pntsv, 1.0, 64.0, 0, 0, "Points in V direction");
 
1532
        uiDefButC(block, ROW, B_LATTCHANGED,            "Lin",          572, 156, 40, 19, &lt->typev, 2.0, (float)KEY_LINEAR, 0, 0, "Set Linear interpolation");
 
1533
        uiDefButC(block, ROW, B_LATTCHANGED,            "Card",         613, 156, 40, 19, &lt->typev, 2.0, (float)KEY_CARDINAL, 0, 0, "Set Cardinal interpolation");
 
1534
        uiDefButC(block, ROW, B_LATTCHANGED,            "B",            652, 156, 40, 19, &lt->typev, 2.0, (float)KEY_BSPLINE, 0, 0, "Set B-spline interpolation");
 
1535
 
 
1536
        uiDefButS(block, NUM, B_RESIZELAT,      "W:",                           469, 134,100,19, &lt->pntsw, 1.0, 64.0, 0, 0, "Points in W direction");
 
1537
        uiDefButC(block, ROW, B_LATTCHANGED,            "Lin",          572, 134, 40, 19, &lt->typew, 3.0, (float)KEY_LINEAR, 0, 0, "Set Linear interpolation");
 
1538
        uiDefButC(block, ROW, B_LATTCHANGED,            "Card",         613, 134, 40, 19, &lt->typew, 3.0, (float)KEY_CARDINAL, 0, 0, "Set Cardinal interpolation");
 
1539
        uiDefButC(block, ROW, B_LATTCHANGED,            "B",            652, 134, 40, 19, &lt->typew, 3.0, (float)KEY_BSPLINE, 0, 0, "Set B-spline interpolation");
 
1540
 
1176
1541
        uiBlockEndAlign(block);
1177
1542
 
1178
 
        uiDefBut(block, BUT, B_RESIZELAT,       "Make Regular",         470,101,99,32, 0, 0, 0, 0, 0, "Make Lattice regular");
 
1543
        uiDefBut(block, BUT, B_RESIZELAT,       "Make Regular",         469,98,102,31, 0, 0, 0, 0, 0, "Make Lattice regular");
1179
1544
 
1180
1545
        uiClearButLock();
1181
 
        uiDefButS(block, TOG|BIT|1, B_LATTCHANGED, "Outside",   571,101,120,31, &lt->flag, 0, 0, 0, 0, "Only draw, and take into account, the outer vertices");
 
1546
        uiDefButS(block, TOG|BIT|1, B_LATTCHANGED, "Outside",   571,98,122,31, &lt->flag, 0, 0, 0, 0, "Only draw, and take into account, the outer vertices");
1182
1547
 
1183
1548
        if(lt->key) {
1184
 
                uiDefButS(block, NUM, B_DIFF, "Slurph:",                        470,60,120,19, &(lt->key->slurph), -500.0, 500.0, 0, 0, "Set time value to denote 'slurph' (sequential delay) vertices with key framing");
1185
 
                uiDefButS(block, TOG, B_RELKEY, "Relative Keys",        470,40,120,19, &lt->key->type, 0, 0, 0, 0, "Use relative keys (instead of absolute)");
 
1549
                uiDefButS(block, NUM, B_DIFF, "Slurph:",                        469,60,120,19, &(lt->key->slurph), -500.0, 500.0, 0, 0, "Set time value to denote 'slurph' (sequential delay) vertices with key framing");
 
1550
                uiDefButS(block, TOG, B_RELKEY, "Relative Keys",        469,40,120,19, &lt->key->type, 0, 0, 0, 0, "Use relative keys (instead of absolute)");
1186
1551
        }
1187
1552
 
1188
1553
}
1222
1587
        parnr_to_editbone(curBone);
1223
1588
}
1224
1589
 
1225
 
static void build_bonestring (char *string, EditBone *bone){
 
1590
static void build_bonestring (char *string, EditBone *bone)
 
1591
{
1226
1592
        EditBone *curBone;
1227
1593
        EditBone *pBone;
1228
1594
        int             skip=0;
1287
1653
        }
1288
1654
}
1289
1655
 
1290
 
static void validate_editbonebutton(EditBone *eBone){
 
1656
// called in outliner too...
 
1657
void validate_editbonebutton(EditBone *eBone)
 
1658
{
1291
1659
        EditBone        *prev;
1292
1660
        bAction         *act=NULL;
1293
1661
        bActionChannel *chan;
1379
1747
        validate_editbonebutton(curBone);
1380
1748
}
1381
1749
 
1382
 
static void armature_rest_pos_func(void *notused1, void *notused2) {
 
1750
/* called from outliner now, can be used for buttons in posemode too */
 
1751
/* current Armature should be active Object */
 
1752
/* after this function, the Bones in Armature are re-allocced! */
 
1753
void rename_bone_ext(char *oldname, char *newname)
 
1754
{
 
1755
        EditBone *ebone;
 
1756
        int temp_editmode= 0;
 
1757
 
 
1758
        /* since the naming functions work only on editArmature, we have to... */
 
1759
        if(G.obedit!=OBACT) exit_editmode(2);
 
1760
        if(G.obedit==NULL) {
 
1761
                G.obedit= OBACT;
 
1762
                make_editArmature();
 
1763
                temp_editmode= 1;
 
1764
        }
 
1765
        
 
1766
        /* now find the eBone with oldname */
 
1767
        for(ebone= G.edbo.first; ebone; ebone= ebone->next)
 
1768
                if(strcmp(ebone->name, oldname)==0) break;
 
1769
 
 
1770
        if(ebone) {
 
1771
                strcpy(ebone->oldname, oldname);
 
1772
                strcpy(ebone->name, newname);
 
1773
                validate_editbonebutton(ebone); // does exit_editmode... tsk, so armature bones pointers are invalid now
 
1774
        }
 
1775
        if(temp_editmode) exit_editmode(2);
 
1776
        
 
1777
}
 
1778
 
 
1779
 
 
1780
static void armature_rest_pos_func(void *notused1, void *notused2) 
 
1781
{
1383
1782
        clear_object_constraint_status(OBACT);
1384
1783
        make_displists_by_armature(OBACT);
1385
1784
}
1410
1809
static void editing_panel_armature_bones(Object *ob, bArmature *arm)
1411
1810
{
1412
1811
        uiBlock         *block;
 
1812
        uiBut           *but;
1413
1813
        EditBone        *curBone;
1414
 
        uiBut           *but;
1415
1814
        char            *boneString=NULL;
1416
1815
        int                     bx=148, by=180;
1417
1816
        int                     index;
1426
1825
        uiNewPanelHeight(block, 204);
1427
1826
 
1428
1827
 
1429
 
        uiDefBut(block, LABEL, 0, "Selected Bones",                                             bx,by,158,18, 0, 0, 0, 0, 0, "");
 
1828
        uiDefBut(block, LABEL, 0, "Selected Bones", bx,by,158,18, 0, 0, 0, 0, 0, "Only show in Armature Editmode");
1430
1829
        by-=20;
1431
1830
        for (curBone=G.edbo.first, index=0; curBone; curBone=curBone->next, index++){
1432
1831
                if (curBone->flag & (BONE_SELECTED)) {
1441
1840
 
1442
1841
                        uiDefBut(block, LABEL, 0, "child of", bx+107,by,73,18, NULL, 0.0, 0.0, 0.0, 0.0, "");
1443
1842
 
1444
 
                        boneString = malloc((BLI_countlist(&G.edbo) * 64)+64);
 
1843
                        boneString = MEM_mallocN((BLI_countlist(&G.edbo) * 64)+64, "Bone str");
1445
1844
                        build_bonestring (boneString, curBone);
1446
1845
 
1447
1846
                        curBone->parNr = editbone_to_parnr(curBone->parent);
1448
1847
                        but = uiDefButI(block, MENU,REDRAWVIEW3D, boneString, bx+180,by,120,18, &curBone->parNr, 0.0, 0.0, 0.0, 0.0, "Parent");
1449
1848
                        uiButSetFunc(but, parnr_to_editbone_cb, curBone, NULL);
1450
1849
 
1451
 
                        free(boneString);
 
1850
                        MEM_freeN(boneString);
1452
1851
 
1453
1852
                        /* IK to parent flag */
1454
1853
                        if (curBone->parent){
1459
1858
                        /* Dist and weight buttons */
1460
1859
                        uiBlockBeginAlign(block);
1461
1860
                        but=uiDefButS(block, MENU, REDRAWVIEW3D,
1462
 
                                                        "Skinnable %x0|"
1463
 
                                                        "Unskinnable %x1|"
1464
 
                                                        "Head %x2|"
1465
 
                                                        "Neck %x3|"
1466
 
                                                        "Back %x4|"
1467
 
                                                        "Shoulder %x5|"
1468
 
                                                        "Arm %x6|"
1469
 
                                                        "Hand %x7|"
1470
 
                                                        "Finger %x8|"
1471
 
                                                        "Thumb %x9|"
1472
 
                                                        "Pelvis %x10|"
1473
 
                                                        "Leg %x11|"
1474
 
                                                        "Foot %x12|"
1475
 
                                                        "Toe %x13|"
1476
 
                                                        "Tentacle %x14",
1477
 
                                                        bx-10,by-19,117,18,
1478
 
                                                        &curBone->boneclass,
1479
 
                                                        0.0, 0.0, 0.0, 0.0,
 
1861
                                                        "Skinnable %x0|" "Unskinnable %x1|" "Head %x2|"
 
1862
                                                        "Neck %x3|" "Back %x4|" "Shoulder %x5|" "Arm %x6|"
 
1863
                                                        "Hand %x7|" "Finger %x8|" "Thumb %x9|" "Pelvis %x10|"
 
1864
                                                        "Leg %x11|" "Foot %x12|" "Toe %x13|" "Tentacle %x14",
 
1865
                                                        bx-10,by-19,117,18, &curBone->boneclass, 0.0, 0.0, 0.0, 0.0,
1480
1866
                                                        "Classification of armature element");
1481
1867
 
1482
1868
                        /* Dist and weight buttons */
1501
1887
 
1502
1888
/* *************************** MESH ******************************** */
1503
1889
 
1504
 
 
1505
 
 
1506
1890
void do_meshbuts(unsigned short event)
1507
1891
{
1508
 
        void decimate_faces(void);
1509
 
        void decimate_cancel(void);
1510
 
        void decimate_apply(void);
1511
1892
        Object *ob;
1512
1893
        Mesh *me;
1513
1894
        float fac;
1538
1919
                case B_DELVGROUP:
1539
1920
                        del_defgroup (G.obedit);
1540
1921
                        allqueue (REDRAWVIEW3D, 1);
 
1922
                        BIF_undo_push("Delete vertex group");
1541
1923
                        break;
1542
1924
                case B_ASSIGNVGROUP:
1543
 
                        undo_push_mesh("Assign to vertex group");
1544
1925
                        assign_verts_defgroup ();
1545
1926
                        allqueue (REDRAWVIEW3D, 1);
 
1927
                        BIF_undo_push("Assign to vertex group");
1546
1928
                        break;
1547
1929
                case B_REMOVEVGROUP:
1548
 
                        undo_push_mesh("Remove from vertex group");
1549
1930
                        remove_verts_defgroup (0);
1550
1931
                        allqueue (REDRAWVIEW3D, 1);
 
1932
                        BIF_undo_push("Remove from vertex group");
1551
1933
                        break;
1552
1934
                case B_SELVGROUP:
1553
1935
                        sel_verts_defgroup(1);
1560
1942
                case B_DELSTICKY:
1561
1943
 
1562
1944
                        if(me->msticky) MEM_freeN(me->msticky);
1563
 
                        me->msticky= 0;
 
1945
                        me->msticky= NULL;
1564
1946
                        allqueue(REDRAWBUTSEDIT, 0);
1565
1947
                        break;
1566
1948
                case B_MAKESTICKY:
1567
 
                        make_sticky();
1568
 
                        break;
 
1949
                        RE_make_sticky();
 
1950
                        allqueue(REDRAWBUTSEDIT, 0);
 
1951
                        break;
 
1952
                
 
1953
                case B_MAKEEDGES:
 
1954
                        /* in editmode we only have to set edge pointer */
 
1955
                        if(ob==G.obedit) {
 
1956
                                me->medge= MEM_callocN(sizeof(MEdge), "fake mesh edge");
 
1957
                                me->totedge= 1;
 
1958
                        }
 
1959
                        else make_edges(me);
 
1960
                        allqueue(REDRAWBUTSEDIT, 0);
 
1961
                        break;
 
1962
                case B_DELEDGES:
 
1963
                        if(me->medge) MEM_freeN(me->medge);
 
1964
                        me->medge= NULL;
 
1965
                        me->totedge= 0;
 
1966
                        makeDispList(ob);
 
1967
                        allqueue(REDRAWBUTSEDIT, 0);
 
1968
                        allqueue(REDRAWVIEW3D, 0);
 
1969
                        break;
 
1970
                        
1569
1971
                case B_MAKEVERTCOL:
1570
1972
                        make_vertexcol();
1571
1973
                        break;
1572
1974
                case B_DELVERTCOL:
1573
1975
                        if(me->mcol) MEM_freeN(me->mcol);
1574
 
                        me->mcol= 0;
 
1976
                        me->mcol= NULL;
1575
1977
                        G.f &= ~G_VERTEXPAINT;
1576
1978
                        freedisplist(&(ob->disp));
1577
1979
                        allqueue(REDRAWBUTSEDIT, 0);
1646
2048
                G.f -= G_DISABLE_OK;
1647
2049
                break;
1648
2050
        case B_REMDOUB:
1649
 
                undo_push_mesh("Rem Doubles");
1650
2051
                notice("Removed: %d", removedoublesflag(1, doublimit));
1651
2052
                allqueue(REDRAWVIEW3D, 0);
 
2053
                BIF_undo_push("Rem Doubles");
1652
2054
                break;
1653
2055
        case B_SUBDIV:
1654
2056
                waitcursor(1);
1655
 
                undo_push_mesh("Subdivide");
1656
2057
                subdivideflag(1, 0.0, editbutflag & B_BEAUTY);
1657
2058
                countall();
1658
2059
                waitcursor(0);
1659
2060
                allqueue(REDRAWVIEW3D, 0);
 
2061
                BIF_undo_push("Subdivide");
1660
2062
                break;
1661
2063
        case B_FRACSUBDIV:
1662
2064
                randfac= 10;
1663
2065
                if(button(&randfac, 1, 100, "Rand fac:")==0) return;
1664
2066
                waitcursor(1);
1665
 
                undo_push_mesh("Fractal Subdivide");
1666
2067
                fac= -( (float)randfac )/100;
1667
2068
                subdivideflag(1, fac, editbutflag & B_BEAUTY);
1668
2069
                countall();
1669
2070
                waitcursor(0);
1670
2071
                allqueue(REDRAWVIEW3D, 0);
 
2072
                BIF_undo_push("Fractal Subdivide");
1671
2073
                break;
1672
2074
        case B_XSORT:
1673
2075
                if( select_area(SPACE_VIEW3D)) xsortvert_flag(1);
1684
2086
        case B_VERTEXSMOOTH:
1685
2087
                vertexsmooth();
1686
2088
                break;
 
2089
        case B_DRAWEDGES:
 
2090
                G.f &= ~G_DRAWCREASES;
 
2091
                allqueue(REDRAWBUTSEDIT, 0);
 
2092
                allqueue(REDRAWVIEW3D, 0);
 
2093
                break;
 
2094
        case B_DRAWCREASES:
 
2095
                G.f &= ~G_DRAWEDGES;
 
2096
                allqueue(REDRAWBUTSEDIT, 0);
 
2097
                allqueue(REDRAWVIEW3D, 0);
 
2098
                break;
1687
2099
        }
1688
2100
        /* WATCH IT: previous events only in editmode! */
1689
2101
}
1747
2159
        block= uiNewBlock(&curarea->uiblocks, "editing_panel_mesh_tools1", UI_EMBOSS, UI_HELV, curarea->win);
1748
2160
        if(uiNewPanel(curarea, block, "Mesh Tools 1", "Editing", 960, 0, 318, 204)==0) return;
1749
2161
 
1750
 
        uiDefBut(block, BUT,B_DOCENTRE, "Centre",       1091, 200, 166, 19, 0, 0, 0, 0, 0, "Shifts object data to be centered about object's origin");
1751
 
        uiBlockBeginAlign(block);
1752
 
        uiDefBut(block, BUT,B_HIDE,             "Hide",         1091,155,77,24, 0, 0, 0, 0, 0, "Hides selected faces");
1753
 
        uiDefBut(block, BUT,B_REVEAL,   "Reveal",       1171,155,86,24, 0, 0, 0, 0, 0, "Reveals selected faces");
1754
 
        uiBlockEndAlign(block);
1755
 
 
1756
 
        uiDefBut(block, BUT,B_SELSWAP,  "Select Swap",  1091,124,166,24, 0, 0, 0, 0, 0, "Selects unselected faces, and deselects selected faces");
1757
 
 
1758
 
        uiBlockBeginAlign(block);
1759
 
        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");
1760
 
        uiDefButI(block, TOG|BIT|6, REDRAWVIEW3D, "Draw Normals",       1090,70,164,19, &G.f, 0, 0, 0, 0, "Displays face normals as lines");
1761
 
        uiDefButI(block, TOG|BIT|7, REDRAWVIEW3D, "Draw Faces", 1090,50,164,19, &G.f, 0, 0, 0, 0, "Displays all faces as shades");
1762
 
        uiDefButI(block, TOG|BIT|18, REDRAWVIEW3D, "Draw Edges", 1090,30,164,19, &G.f, 0, 0, 0, 0, "Displays selected edges using hilights");
1763
 
        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");
1764
 
        uiBlockEndAlign(block);
1765
 
 
1766
 
}
1767
 
 
 
2162
        uiBlockBeginAlign(block);
 
2163
        uiDefBut(block, BUT,B_DOCENTRE, "Centre",       955, 200, 160, 19, 0, 0, 0, 0, 0, "Shifts object data to be centered about object's origin");
 
2164
        uiDefBut(block, BUT,B_HIDE,             "Hide",         1115, 200,  160, 19, 0, 0, 0, 0, 0, "Hides selected faces");
 
2165
        uiDefBut(block, BUT,B_SELSWAP,  "Select Swap",  955, 180, 160, 19, 0, 0, 0, 0, 0, "Selects unselected faces, and deselects selected faces");
 
2166
        uiDefBut(block, BUT,B_REVEAL,   "Reveal",               1115, 180,  160, 19, 0, 0, 0, 0, 0, "Reveals selected faces");
 
2167
        uiBlockEndAlign(block);
 
2168
 
 
2169
        uiBlockBeginAlign(block);
 
2170
        uiDefButF(block, NUM,             REDRAWVIEW3D, "NSize:",       955, 131, 150, 19, &G.scene->editbutsize, 0.001, 2.0, 10, 0, "Sets the length to use when displaying face normals");
 
2171
        uiDefButI(block, TOG|BIT|6, REDRAWVIEW3D, "Draw Normals",       955,110,150,19, &G.f, 0, 0, 0, 0, "Displays face normals as lines");
 
2172
        uiDefButI(block, TOG|BIT|7, REDRAWVIEW3D, "Draw Faces",         955,88,150,19, &G.f, 0, 0, 0, 0, "Displays all faces as shades");
 
2173
        uiDefButI(block, TOG|BIT|18, REDRAWVIEW3D, "Draw Edges",        955,66,150,19, &G.f, 0, 0, 0, 0, "Displays selected edges using hilights");
 
2174
        uiDefButI(block, TOG|BIT|19, REDRAWVIEW3D, "Draw Creases",      955,44,150,19, &G.f, 0, 0, 0, 0, "Displays creases created for subsurf weighting");
 
2175
        uiDefButI(block, TOG|BIT|20, REDRAWVIEW3D, "Draw Seams",        955,22,150,19, &G.f, 0, 0, 0, 0, "Displays UV unwrapping seams");
 
2176
        uiDefButI(block, TOG|BIT|11, 0, "All Edges",                    955, 0,150,19, &G.f, 0, 0, 0, 0, "Displays all edges in object mode without optimization");
 
2177
        uiBlockEndAlign(block);
 
2178
        
 
2179
        /* Measurement drawing options */
 
2180
        uiBlockBeginAlign(block);
 
2181
        uiDefButI(block, TOG|BIT|22, REDRAWVIEW3D, "Edge Length",       1125,131,150,19, &G.f, 0, 0, 0, 0, "Displays selected edge lengths");
 
2182
        uiDefButI(block, TOG|BIT|24, REDRAWVIEW3D, "Edge Angles",       1125,110,150,19,  &G.f, 0, 0, 0, 0, "Displays the angles in the selected edges in degrees");
 
2183
        uiDefButI(block, TOG|BIT|23, REDRAWVIEW3D, "Face Area",         1125,88,150,19, &G.f, 0, 0, 0, 0, "Displays the area of selected faces");
 
2184
        uiBlockEndAlign(block);
 
2185
 
 
2186
}
 
2187
 
 
2188
char *get_vertexgroup_menustr(Object *ob)
 
2189
{
 
2190
        bDeformGroup *dg;
 
2191
        int defCount, min, index;
 
2192
        char (*qsort_ptr)[32] = NULL;
 
2193
        char *s, *menustr;
 
2194
        
 
2195
        defCount=BLI_countlist(&ob->defbase);
 
2196
        
 
2197
        if (!defCount) min=0;
 
2198
        else min=1;
 
2199
        
 
2200
        if (defCount > 0) {
 
2201
                /*
 
2202
                 * This will hold the group names temporarily
 
2203
                 * so we can sort them
 
2204
                 */
 
2205
                qsort_ptr = MEM_callocN (defCount * sizeof (qsort_ptr[0]),
 
2206
                                                                 "qsort_ptr");
 
2207
                for (index = 1, dg = ob->defbase.first; dg; index++, dg=dg->next) {
 
2208
                        snprintf (qsort_ptr[index - 1], sizeof (qsort_ptr[0]),
 
2209
                                          "%s%%x%d|", dg->name, index);
 
2210
                }
 
2211
                
 
2212
                qsort (qsort_ptr, defCount, sizeof (qsort_ptr[0]),
 
2213
                           ( int (*)(const void *, const void *) ) strcmp);
 
2214
        }
 
2215
        
 
2216
        s= menustr = MEM_callocN((32 * defCount)+30, "menustr");        // plus 30 for when defCount==0
 
2217
        if(defCount) {
 
2218
                for (index = 0; index < defCount; index++) {
 
2219
                        int cnt= sprintf (s, "%s", qsort_ptr[index]);
 
2220
                        if (cnt>0) s+= cnt;
 
2221
                }
 
2222
        }
 
2223
        else strcpy(menustr, "No Vertex Groups in Object");
 
2224
        
 
2225
        if (qsort_ptr)
 
2226
                MEM_freeN (qsort_ptr);
 
2227
        
 
2228
        return menustr;
 
2229
}
1768
2230
 
1769
2231
static void editing_panel_links(Object *ob)
1770
2232
{
1844
2306
        if(ma) uiDefBut(block, LABEL, 0, ma->id.name+2, 318,153, 103, 20, 0, 0, 0, 0, 0, "");
1845
2307
 
1846
2308
        uiBlockBeginAlign(block);
1847
 
        if(ma) uiDefButF(block, COL, 0, "",                     291,123,24,30, &(ma->r), 0, 0, 0, 0, "");
1848
 
        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");
1849
 
        uiDefBut(block, BUT,B_MATWICH,  "?",            423,123,31,30, 0, 0, 0, 0, 0, "In EditMode, sets the active material index from selected faces");
 
2309
        if(ma) uiDefButF(block, COL, B_REDR, "",                        292,123,31,30, &(ma->r), 0, 0, 0, 0, "");
 
2310
        uiDefButC(block, NUM, B_REDR,   str,            324,123,100,30, &ob->actcol, min, (float)(ob->totcol), 0, 0, "Displays total number of material indices and the current index");
 
2311
        uiDefBut(block, BUT,B_MATWICH,  "?",            424,123,30,30, 0, 0, 0, 0, 0, "In EditMode, sets the active material index from selected faces");
1850
2312
 
1851
2313
        uiBlockBeginAlign(block);
1852
2314
        uiDefBut(block, BUT,B_MATNEW,   "New",          292,98,80,20, 0, 0, 0, 0, 0, "Adds a new Material index");
1865
2327
                uiBut *but;
1866
2328
                int     defCount;
1867
2329
                bDeformGroup    *defGroup;
1868
 
                char *s, *menustr;
1869
 
                bDeformGroup *dg;
1870
 
                int min, index;
1871
 
                char (*qsort_ptr)[32] = NULL;
1872
 
 
 
2330
        
1873
2331
                uiDefBut(block, LABEL,0,"Vertex Groups",
1874
2332
                                 143,153,130,20, 0, 0, 0, 0, 0, "");
1875
2333
 
1876
2334
                defCount=BLI_countlist(&ob->defbase);
1877
2335
 
1878
 
                if (!defCount) min=0;
1879
 
                else min=1;
1880
 
 
1881
 
                if (defCount > 0) {
1882
 
                        /*
1883
 
                         * This will hold the group names temporarily
1884
 
                         * so we can sort them
1885
 
                         */
1886
 
                        qsort_ptr = MEM_callocN (defCount * sizeof (qsort_ptr[0]),
1887
 
                                                                         "qsort_ptr");
1888
 
                        for (index = 1, dg = ob->defbase.first; dg; index++, dg=dg->next) {
1889
 
                                snprintf (qsort_ptr[index - 1], sizeof (qsort_ptr[0]),
1890
 
                                                  "%s%%x%d|", dg->name, index);
1891
 
                        }
1892
 
 
1893
 
                        qsort (qsort_ptr, defCount, sizeof (qsort_ptr[0]),
1894
 
                                   ( int (*)(const void *, const void *) ) strcmp);
1895
 
                }
1896
 
 
1897
 
                s= menustr = MEM_callocN((32 * defCount)+20, "menustr");
1898
 
                for (index = 0; index < defCount; index++) {
1899
 
                        int cnt= sprintf (s, "%s", qsort_ptr[index]);
1900
 
                        if (cnt>0) s+= cnt;
1901
 
                }
1902
 
 
1903
 
                if (qsort_ptr)
1904
 
                  MEM_freeN (qsort_ptr);
1905
 
 
1906
2336
                uiBlockBeginAlign(block);
1907
 
                if (defCount)
1908
 
                        uiDefButS(block, MENU, REDRAWBUTSEDIT, menustr,
1909
 
                                          143, 132,18,21, &ob->actdef, min, defCount, 0, 0,
1910
 
                                          "Browses available vertex groups");
1911
 
 
1912
 
                MEM_freeN (menustr);
1913
 
 
 
2337
                if (defCount) {
 
2338
                        char *menustr= get_vertexgroup_menustr(ob);
 
2339
                        
 
2340
                        uiDefButS(block, MENU, REDRAWBUTSEDIT, menustr, 143, 132,18,21, &ob->actdef, 1, defCount, 0, 0, "Browses available vertex groups");
 
2341
                        MEM_freeN (menustr);
 
2342
                }
 
2343
                
1914
2344
                if (ob->actdef){
1915
2345
                        defGroup = BLI_findlink(&ob->defbase, ob->actdef-1);
1916
2346
                        but= uiDefBut(block, TEX,REDRAWBUTSEDIT,"",             161,132,140-18,21, defGroup->name, 0, 32, 0, 0, "Displays current vertex group name. Click to change. (Match bone name for deformation.)");
1945
2375
        Mesh *me;
1946
2376
        Object *ob;
1947
2377
        extern TFace *lasttface; /* caches info on tface bookkeeping ?*/
 
2378
        extern VPaint Gvp;         /* from vpaint */
1948
2379
 
1949
2380
        ob= OBACT;
1950
2381
        if(ob==0) return;
2028
2459
                        allqueue(REDRAWBUTSEDIT, 0);
2029
2460
                }
2030
2461
                break;
 
2462
        case B_WEIGHT0_0:
 
2463
                editbutvweight = 0.0f;
 
2464
                allqueue(REDRAWBUTSEDIT, 0);
 
2465
                break;
 
2466
 
 
2467
        case B_WEIGHT1_4:
 
2468
                editbutvweight = 0.25f;
 
2469
                allqueue(REDRAWBUTSEDIT, 0);
 
2470
                break;
 
2471
        case B_WEIGHT1_2:
 
2472
                editbutvweight = 0.5f;
 
2473
                allqueue(REDRAWBUTSEDIT, 0);
 
2474
                break;
 
2475
        case B_WEIGHT3_4:
 
2476
                editbutvweight = 0.75f;
 
2477
                allqueue(REDRAWBUTSEDIT, 0);
 
2478
                break;
 
2479
        case B_WEIGHT1_0:
 
2480
                editbutvweight = 1.0f;
 
2481
                allqueue(REDRAWBUTSEDIT, 0);
 
2482
                break;
 
2483
                
 
2484
        case B_OPA0_0:
 
2485
                Gvp.a = 0.0f;
 
2486
                allqueue(REDRAWBUTSEDIT, 0);
 
2487
                break;
 
2488
        case B_OPA1_4:
 
2489
                Gvp.a = 0.25f;
 
2490
                allqueue(REDRAWBUTSEDIT, 0);
 
2491
                break;
 
2492
        case B_OPA1_2:
 
2493
                Gvp.a = 0.5f;
 
2494
                allqueue(REDRAWBUTSEDIT, 0);
 
2495
                break;
 
2496
        case B_OPA3_4:
 
2497
                Gvp.a = 0.75f;
 
2498
                allqueue(REDRAWBUTSEDIT, 0);
 
2499
                break;
 
2500
        case B_OPA1_0:
 
2501
                Gvp.a = 1.0f;
 
2502
                allqueue(REDRAWBUTSEDIT, 0);
 
2503
                break;
 
2504
                
 
2505
 
2031
2506
        }
2032
2507
}
2033
2508
 
2034
2509
 
2035
 
/* -------------------- MODE: vpaint faceselect ------------------- */
 
2510
/* -------------------- MODE: vpaint  ------------------- */
2036
2511
 
2037
2512
static void editing_panel_mesh_paint(void)
2038
2513
{
2039
2514
        extern VPaint Gvp;         /* from vpaint */
2040
2515
        uiBlock *block;
2041
 
 
 
2516
        
2042
2517
        block= uiNewBlock(&curarea->uiblocks, "editing_panel_mesh_paint", UI_EMBOSS, UI_HELV, curarea->win);
2043
2518
        if(uiNewPanel(curarea, block, "Paint", "Editing", 640, 0, 318, 204)==0) return;
2044
 
 
2045
 
        uiBlockBeginAlign(block);
2046
 
        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");
2047
 
        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");
2048
 
        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");
2049
 
        uiBlockEndAlign(block);
2050
 
 
2051
 
        uiDefButF(block, NUMSLI, 0, "Opacity ",         979,100,194,19, &Gvp.a, 0.0, 1.0, 0, 0, "The amount of pressure on the brush");
2052
 
        uiDefButF(block, NUMSLI, 0, "Size ",            979,80,194,19, &Gvp.size, 2.0, 64.0, 0, 0, "The size of the brush");
2053
 
 
2054
 
        uiDefButF(block, COL, B_VPCOLSLI, "",           1176,100,28,80, &(Gvp.r), 0, 0, 0, 0, "");
2055
 
        uiBlockBeginAlign(block);
2056
 
        uiDefButS(block, ROW, B_DIFF, "Mix",                    1212,160,63,19, &Gvp.mode, 1.0, 0.0, 0, 0, "Mix the vertex colours");
2057
 
        uiDefButS(block, ROW, B_DIFF, "Add",                    1212,140,63,19, &Gvp.mode, 1.0, 1.0, 0, 0, "Add the vertex colour");
2058
 
        uiDefButS(block, ROW, B_DIFF, "Sub",                    1212, 120,63,19, &Gvp.mode, 1.0, 2.0, 0, 0, "Subtract from the vertex colour");
2059
 
        uiDefButS(block, ROW, B_DIFF, "Mul",                    1212, 100,63,19, &Gvp.mode, 1.0, 3.0, 0, 0, "Multiply the vertex colour");
2060
 
        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");
2061
 
 
2062
 
        uiBlockBeginAlign(block);
2063
 
        uiDefButS(block, TOG|BIT|1, 0, "Area",          980,50,80,19, &Gvp.flag, 0, 0, 0, 0, "Set the area the brush covers");
2064
 
        uiDefButS(block, TOG|BIT|2, 0, "Soft",          1061,50,112,19, &Gvp.flag, 0, 0, 0, 0, "Use a soft brush");
2065
 
        uiDefButS(block, TOG|BIT|3, 0, "Normals",       1174,50,102,19, &Gvp.flag, 0, 0, 0, 0, "Use vertex normal for painting");
2066
 
 
2067
 
        uiBlockBeginAlign(block);
2068
 
        uiDefBut(block, BUT, B_VPGAMMA, "Set",  980,30,80,19, 0, 0, 0, 0, 0, "Apply Mul and Gamma to vertex colours");
2069
 
        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");
2070
 
        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");
2071
 
        uiBlockEndAlign(block);
2072
 
 
2073
 
        uiDefBut(block, BUT, B_SET_VCOL, "Set VertCol", 980,5,80,20, 0, 0, 0, 0, 0, "Set Vertex colour of selection to current (Shift+K)");
2074
 
 
 
2519
        
 
2520
        
 
2521
        if(G.f & ( G_WEIGHTPAINT))
 
2522
        {
 
2523
                Object *ob;
 
2524
            ob= OBACT;
 
2525
        if(ob==NULL) return;
 
2526
 
 
2527
                uiBlockBeginAlign(block);
 
2528
                uiDefButF(block, NUMSLI, REDRAWVIEW3D, "Weight:",979,160,194,19, &editbutvweight, 0, 1, 10, 0, "Sets the current vertex group's bone deformation strength");
 
2529
                uiDefBut(block, BUT, B_WEIGHT0_0 , "0",                 979,140,40,19, 0, 0, 0, 0, 0, "");
 
2530
                uiDefBut(block, BUT, B_WEIGHT1_4 , "1/4",                       1020,140,40,19, 0, 0, 0, 0, 0, "");
 
2531
                uiDefBut(block, BUT, B_WEIGHT1_2 , "1/2",                       1060,140,40,19, 0, 0, 0, 0, 0, "");
 
2532
                uiDefBut(block, BUT, B_WEIGHT3_4 , "3/4",                       1100,140,40,19, 0, 0, 0, 0, 0, "");
 
2533
                uiDefBut(block, BUT, B_WEIGHT1_0 , "1",                 1140,140,33,19, 0, 0, 0, 0, 0, "");
 
2534
                
 
2535
                uiDefButF(block, NUMSLI, 0, "Opacity ",         979,120,194,19, &Gvp.a, 0.0, 1.0, 0, 0, "The amount of pressure on the brush");
 
2536
                uiDefBut(block, BUT, B_OPA0_0 , "0",                    979,100,40,19, 0, 0, 0, 0, 0, "");
 
2537
                uiDefBut(block, BUT, B_OPA1_4 , "1/4",                  1020,100,40,19, 0, 0, 0, 0, 0, "");
 
2538
                uiDefBut(block, BUT, B_OPA1_2 , "1/2",                  1060,100,40,19, 0, 0, 0, 0, 0, "");
 
2539
                uiDefBut(block, BUT, B_OPA3_4 , "3/4",                  1100,100,40,19, 0, 0, 0, 0, 0, "");
 
2540
                uiDefBut(block, BUT, B_OPA1_0 , "1",                    1140,100,33,19, 0, 0, 0, 0, 0, "");
 
2541
                uiDefButF(block, NUMSLI, 0, "Size ",            979,80,194,19, &Gvp.size, 2.0, 64.0, 0, 0, "The size of the brush");
 
2542
                uiBlockEndAlign(block);
 
2543
                if(ob){
 
2544
                uiBlockBeginAlign(block);
 
2545
        uiDefButBitC(block, TOG, OB_DRAWWIRE, REDRAWVIEW3D, "Wire",     979,40,194,19   , &ob->dtx, 0, 0, 0, 0, "Displays the active object's wireframe in shaded drawing modes");
 
2546
                uiBlockEndAlign(block);
 
2547
                }
 
2548
        }
 
2549
        else{
 
2550
                uiBlockBeginAlign(block);
 
2551
                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");
 
2552
                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");
 
2553
                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");
 
2554
                uiBlockEndAlign(block);
 
2555
                uiDefButF(block, NUMSLI, 0, "Opacity ",         979,100,194,19, &Gvp.a, 0.0, 1.0, 0, 0, "The amount of pressure on the brush");
 
2556
                uiDefButF(block, NUMSLI, 0, "Size ",            979,80,194,19, &Gvp.size, 2.0, 64.0, 0, 0, "The size of the brush");
 
2557
                
 
2558
                uiDefButF(block, COL, B_REDR, "",               1176,99,28,80, &(Gvp.r), 0, 0, 0, B_VPCOLSLI, "");
 
2559
                uiBlockBeginAlign(block);
 
2560
                uiDefButS(block, ROW, B_DIFF, "Mix",                    1212,160,63,19, &Gvp.mode, 1.0, 0.0, 0, 0, "Mix the vertex colours");
 
2561
                uiDefButS(block, ROW, B_DIFF, "Add",                    1212,140,63,19, &Gvp.mode, 1.0, 1.0, 0, 0, "Add the vertex colour");
 
2562
                uiDefButS(block, ROW, B_DIFF, "Sub",                    1212, 120,63,19, &Gvp.mode, 1.0, 2.0, 0, 0, "Subtract from the vertex colour");
 
2563
                uiDefButS(block, ROW, B_DIFF, "Mul",                    1212, 100,63,19, &Gvp.mode, 1.0, 3.0, 0, 0, "Multiply the vertex colour");
 
2564
                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");
 
2565
                
 
2566
                uiBlockBeginAlign(block);
 
2567
                uiDefButS(block, TOG|BIT|1, 0, "Area",          979,50,81,19, &Gvp.flag, 0, 0, 0, 0, "Vertex paint evaluates the area of the face the brush covers (otherwise vertices only)");
 
2568
                uiDefButS(block, TOG|BIT|2, 0, "Soft",          1061,50,112,19, &Gvp.flag, 0, 0, 0, 0, "Use a soft brush");
 
2569
                uiDefButS(block, TOG|BIT|3, 0, "Normals",       1174,50,102,19, &Gvp.flag, 0, 0, 0, 0, "Vertex paint applies the vertex normal before painting");
 
2570
                
 
2571
                uiBlockBeginAlign(block);
 
2572
                uiDefBut(block, BUT, B_VPGAMMA, "Set",  979,30,81,19, 0, 0, 0, 0, 0, "Apply Mul and Gamma to vertex colours");
 
2573
                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");
 
2574
                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");
 
2575
                uiBlockEndAlign(block);
 
2576
                
 
2577
                uiDefBut(block, BUT, B_SET_VCOL, "Set VertCol", 979,5,81,20, 0, 0, 0, 0, 0, "Set Vertex colour of selection to current (Shift+K)");
 
2578
        }
 
2579
        
2075
2580
}
2076
2581
 
2077
 
 
2078
2582
static void editing_panel_mesh_texface(void)
2079
2583
{
 
2584
        extern VPaint Gvp;         /* from vpaint */
2080
2585
        uiBlock *block;
2081
2586
        extern TFace *lasttface;
2082
2587
 
2111
2616
                uiDefButC(block, ROW, REDRAWVIEW3D, "Alpha",    720,80,60,19, &lasttface->transp, 2.0, 2.0, 0, 0, "Render polygon transparent, depending on alpha channel of the texture");
2112
2617
 
2113
2618
                uiBlockSetCol(block, TH_AUTO);
2114
 
                uiBlockBeginAlign(block);
2115
 
                uiDefBut(block, BUT, B_COPY_TF_MODE, "Copy DrawMode", 600,7,117,28, 0, 0, 0, 0, 0, "Copy the drawmode");
2116
 
                uiDefBut(block, BUT, B_COPY_TF_UV, "Copy UV+tex",         721,7,85,28, 0, 0, 0, 0, 0, "Copy UV information and textures");
2117
 
                uiDefBut(block, BUT, B_COPY_TF_COL, "Copy VertCol",       809,7,103,28, 0, 0, 0, 0, 0, "Copy vertex colours");
 
2619
 
 
2620
                uiBlockBeginAlign(block);
 
2621
                uiDefButF(block, COL, B_VPCOLSLI, "",                   769,40,40,28, &(Gvp.r), 0, 0, 0, 0, "");
 
2622
                uiDefBut(block, BUT, B_SET_VCOL, "Set VertCol", 809,40,103,28, 0, 0, 0, 0, 0, "Set Vertex colour of selection to current (Shift+K)");
 
2623
 
 
2624
                uiBlockBeginAlign(block);
 
2625
                uiDefBut(block, BUT, B_COPY_TF_MODE, "Copy DrawMode", 600,7,117,28, 0, 0, 0, 0, 0, "Copy the drawmode from active face to selected faces");
 
2626
                uiDefBut(block, BUT, B_COPY_TF_UV, "Copy UV+tex",         721,7,85,28, 0, 0, 0, 0, 0, "Copy UV information and textures from active face to selected faces");
 
2627
                uiDefBut(block, BUT, B_COPY_TF_COL, "Copy VertCol",       809,7,103,28, 0, 0, 0, 0, 0, "Copy vertex colours from active face to selected faces");
2118
2628
        }
2119
 
 
2120
2629
}
2121
2630
 
2122
2631
void do_uvautocalculationbuts(unsigned short event)
2138
2647
        case B_UVAUTO_WINDOW:
2139
2648
                if(select_area(SPACE_VIEW3D)) calculate_uv_map(event);
2140
2649
                break;
 
2650
        case B_UVAUTO_LSCM:
 
2651
                unwrap_lscm();
 
2652
                break;
2141
2653
        }
2142
2654
}
2143
2655
 
2153
2665
                return;
2154
2666
 
2155
2667
        uiBlockBeginAlign(block);
2156
 
        uiDefBut(block, BUT, B_UVAUTO_STD1,"Standard 1/1",100,row,200,butH, 0, 0, 0, 0, 0, "Applies standard UV mapping");
2157
 
        uiDefBut(block, BUT, B_UVAUTO_STD2,"1/2",100,row-butHB,66,butH, 0, 0, 0, 0, 0, "Applies standard UV mapping 1/2");
2158
 
        uiDefBut(block, BUT, B_UVAUTO_STD4,"1/4",166,row-butHB,67,butH, 0, 0, 0, 0, 0, "Applies standard UV mapping 1/4");
2159
 
        uiDefBut(block, BUT, B_UVAUTO_STD8,"1/8",234,row-butHB,66,butH, 0, 0, 0, 0, 0, "Applies standard UV mapping 1/8");
 
2668
        uiDefBut(block, BUT, B_UVAUTO_LSCM,"LSCM Unwrap",100,row,200,butH, 0, 0, 0, 0, 0, "Applies conformal UV mapping, preserving local angles");
 
2669
        uiBlockEndAlign(block);
 
2670
        row-= butHB+butS;
 
2671
 
 
2672
        uiBlockBeginAlign(block);
 
2673
        uiDefBut(block, BUT, B_UVAUTO_STD1,"Standard",100,row,100,butH, 0, 0, 0, 0, 0, "Applies standard UV mapping");
 
2674
        uiDefBut(block, BUT, B_UVAUTO_STD2,"/2",200,row,33,butH, 0, 0, 0, 0, 0, "Applies standard UV mapping 1/2");
 
2675
        uiDefBut(block, BUT, B_UVAUTO_STD4,"/4",233,row,34,butH, 0, 0, 0, 0, 0, "Applies standard UV mapping 1/4");
 
2676
        uiDefBut(block, BUT, B_UVAUTO_STD8,"/8",267,row,33,butH, 0, 0, 0, 0, 0, "Applies standard UV mapping 1/8");
 
2677
        uiBlockEndAlign(block);
 
2678
        row-= butHB+butS;
 
2679
 
 
2680
        uiBlockBeginAlign(block);
 
2681
        uiDefBut(block, BUT, B_UVAUTO_BOUNDS1,"Bounds",100,row,100,butH, 0, 0, 0, 0, 0, "Applies planar UV mapping with bounds 1/1");
 
2682
        uiDefBut(block, BUT, B_UVAUTO_BOUNDS2,"/2",200,row,33,butH, 0, 0, 0, 0, 0, "Applies planar UV mapping with bounds 1/2");
 
2683
        uiDefBut(block, BUT, B_UVAUTO_BOUNDS4,"/4",233,row,34,butH, 0, 0, 0, 0, 0, "Applies planar UV mapping with bounds 1/4");
 
2684
        uiDefBut(block, BUT, B_UVAUTO_BOUNDS8,"/8",267,row,33,butH, 0, 0, 0, 0, 0, "Applies planar UV mapping with bounds 1/8");
 
2685
        uiDefBut(block, BUT, B_UVAUTO_WINDOW,"From Window",100,row-butH,200,butH, 0, 0, 0, 0, 0, "Applies planar UV mapping from window");
2160
2686
        uiBlockEndAlign(block);
2161
2687
        row-= 2*butHB+butS;
2162
2688
 
2163
2689
        uiBlockBeginAlign(block);
2164
 
        uiDefBut(block, BUT, B_UVAUTO_BOUNDS1,"Bounds 1/1",100,row,200,butH, 0, 0, 0, 0, 0, "Applies planar UV mapping with bounds 1/1");
2165
 
        uiDefBut(block, BUT, B_UVAUTO_BOUNDS2,"1/2",100,row-butHB,66,butH, 0, 0, 0, 0, 0, "Applies planar UV mapping with bounds 1/2");
2166
 
        uiDefBut(block, BUT, B_UVAUTO_BOUNDS4,"1/4",166,row-butHB,67,butH, 0, 0, 0, 0, 0, "Applies planar UV mapping with bounds 1/4");
2167
 
        uiDefBut(block, BUT, B_UVAUTO_BOUNDS8,"1/8",234,row-butHB,66,butH, 0, 0, 0, 0, 0, "Applies planar UV mapping with bounds 1/8");
2168
 
        uiDefBut(block, BUT, B_UVAUTO_WINDOW,"From Window",100,row-2*butH,200,butH, 0, 0, 0, 0, 0, "Applies planar UV mapping from window");
2169
 
        uiBlockEndAlign(block);
2170
 
        row-= 3*butHB+butS;
2171
 
 
2172
 
        uiBlockBeginAlign(block);
2173
 
        uiDefButS(block,ROW,REDRAWVIEW3D,"No Edges",100,row,200,butH,&facesel_draw_edges, 2.0, 0, 0, 0,  "Don't draw edges of deselected faces in 3D view");
2174
 
        uiDefButS(block,ROW,REDRAWVIEW3D,"Draw Edges",100,row-butH,200,butH,&facesel_draw_edges, 2.0, 1.0, 0, 0,  "Draw edges of deselected faces z-buffered in 3D view");
2175
 
        uiDefButS(block,ROW,REDRAWVIEW3D,"All Edges",100,row-2*butH,200,butH,&facesel_draw_edges, 2.0, 2.0, 0, 0,  "Draw all edges of deselected faces in 3D view");
2176
 
        uiBlockEndAlign(block);
2177
 
        row-= 3*butHB+butS;
 
2690
        uiDefButI(block, TOG|BIT|7, REDRAWVIEW3D, "Draw Faces", 100,row,200,butH, &G.f, 0, 0, 0, 0, "Displays all faces as shades");
 
2691
        uiDefButI(block,TOG|BIT|18,REDRAWVIEW3D,"Draw Edges",100,row-butHB,200,butH,&G.f, 2.0, 0, 0, 0,  "Displays edges of visible faces");
 
2692
        uiDefButI(block,TOG|BIT|21,REDRAWVIEW3D,"Draw Hidden Edges",100,row-2*butHB,200,butH,&G.f, 2.0, 1.0, 0, 0,  "Displays edges of hidden faces");
 
2693
        uiDefButI(block,TOG|BIT|20,REDRAWVIEW3D,"Draw Seams",100,row-3*butHB,200,butH,&G.f, 2.0, 2.0, 0, 0,  "Displays UV unwrapping seams");
 
2694
        uiBlockEndAlign(block);
 
2695
        row-= 4*butHB+butS;
2178
2696
 
2179
2697
        row= 180;
2180
2698
 
2181
2699
        uiBlockBeginAlign(block);
2182
2700
        uiDefBut(block, BUT, B_UVAUTO_CUBE,"Cube",315,row,200,butH, 0, 0, 0, 0, 0, "Applies cube UV mapping");
2183
 
        uiDefButF(block, NUM,B_UVAUTO_CUBESIZE ,"Size:",315,row-butHB,200,butH, &uv_calc_cubesize, 0.0001, 100.0, 10, 0, "Defines the cubemap size");
 
2701
        uiDefButF(block, NUM,B_UVAUTO_CUBESIZE ,"Size:",315,row-butHB,200,butH, &uv_calc_cubesize, 0.0001, 100.0, 10, 3, "Defines the cubemap size");
2184
2702
        uiBlockEndAlign(block);
2185
2703
        row-= 2*butHB+butS;
2186
2704
 
2191
2709
 
2192
2710
        uiBlockBeginAlign(block);
2193
2711
        uiDefBut(block, BUT, B_UVAUTO_CYLINDER,"Cylinder",315,row,200,butH, 0, 0, 0, 0, 0, "Applies cylindrical UV mapping");
2194
 
        uiDefButF(block, NUM,B_UVAUTO_CYLRADIUS ,"Radius:",315,row-butHB,200,butH, &uv_calc_radius, 0.1, 100.0, 10, 0, "Defines the radius of the UV mapping cylinder");
 
2712
        uiDefButF(block, NUM,B_UVAUTO_CYLRADIUS ,"Radius:",315,row-butHB,200,butH, &uv_calc_radius, 0.1, 100.0, 10, 3, "Defines the radius of the UV mapping cylinder");
2195
2713
        uiBlockEndAlign(block);
2196
2714
        row-= 2*butHB+butS;
2197
2715
 
2222
2740
 
2223
2741
        ob= OBACT;
2224
2742
        if(ob==NULL) return;
2225
 
 
 
2743
        if(ob->id.lib) uiSetButLock(1, "Can't edit library data");
 
2744
        
2226
2745
        switch(ob->type) {
2227
2746
        case OB_MESH:
2228
2747
                editing_panel_links(ob); // no editmode!
2237
2756
                                editing_panel_mesh_texface();
2238
2757
                                editing_panel_mesh_uvautocalculation();
2239
2758
                        }
2240
 
 
2241
 
                        if(G.f & (G_VERTEXPAINT | G_TEXTUREPAINT | G_WEIGHTPAINT) )
 
2759
                        if(G.f & (G_VERTEXPAINT | G_TEXTUREPAINT | G_WEIGHTPAINT) ) {
2242
2760
                                editing_panel_mesh_paint();
 
2761
                        }
2243
2762
                }
2244
2763
                break;
2245
2764
 
2288
2807
                cam= ob->data;
2289
2808
                editing_panel_links(ob); // no editmode!
2290
2809
                editing_panel_camera_type(ob, cam);
 
2810
                /* yafray: extra panel for dof parameters */
 
2811
                if (G.scene->r.renderer==R_YAFRAY) editing_panel_camera_yafraydof(ob, cam);
2291
2812
                break;
2292
2813
 
2293
2814
        case OB_ARMATURE:
2299
2820
                }
2300
2821
                break;
2301
2822
        }
2302
 
 
 
2823
        uiClearButLock();
2303
2824
}