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

« back to all changes in this revision

Viewing changes to source/blender/src/buttons_object.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:
39
39
#include <config.h>
40
40
#endif
41
41
 
42
 
#ifdef WIN32
43
 
#include "BLI_winstuff.h"
44
 
#endif
45
 
 
46
42
#include "MEM_guardedalloc.h"
 
43
 
47
44
#include "DNA_screen_types.h"
48
45
#include "DNA_space_types.h"
49
46
#include "DNA_scene_types.h"
51
48
#include "BKE_global.h"
52
49
#include "BKE_main.h"
53
50
#include "BKE_library.h"
 
51
#include "BKE_softbody.h"
54
52
 
55
53
#include "BLI_blenlib.h"
56
54
#include "BLI_arithb.h"
57
55
 
58
56
#include "BSE_filesel.h"
 
57
#include "BSE_headerbuttons.h"
59
58
 
60
59
#include "BIF_gl.h"
61
60
#include "BIF_graphics.h"
68
67
#include "BIF_glutil.h"
69
68
#include "BIF_interface.h"
70
69
#include "BIF_toolbox.h"
71
 
#include "BIF_editmesh.h"
72
70
#include "BDR_editcurve.h"
73
 
#include "BDR_editface.h"
74
71
#include "BDR_drawobject.h"
 
72
 
 
73
//#include "BIF_editsca.h"
 
74
 
75
75
#include "BIF_butspace.h"
76
76
 
77
77
#include "mydevice.h"
96
96
#include "DNA_meta_types.h"
97
97
#include "DNA_mesh_types.h"
98
98
#include "DNA_object_types.h"
 
99
#include "DNA_object_force.h"
99
100
#include "DNA_radio_types.h"
100
101
#include "DNA_screen_types.h"
101
102
#include "DNA_sound_types.h"
134
135
float prlen=0.0;
135
136
 
136
137
 
 
138
/* ********************* function prototypes ******************** */
 
139
void object_panel_draw(Object *);
 
140
void object_panel_hooks(Object *);
 
141
void object_panel_effects(Object *);
137
142
 
138
143
/* ********************* CONSTRAINT ***************************** */
139
144
 
 
145
#if 0
140
146
static void add_influence_key_to_constraint_func (void *arg1v, void *unused)
141
147
{
142
148
        bConstraint *con = arg1v;
143
149
        add_influence_key_to_constraint(con);
144
150
}
 
151
#endif
 
152
 
145
153
static void activate_constraint_ipo_func (void *arg1v, void *unused)
146
154
{
147
155
 
193
201
 
194
202
        BLI_freelinkN(lb, con);
195
203
 
 
204
        BIF_undo_push("Delete constraint");
196
205
        allqueue(REDRAWBUTSOBJECT, 0);
197
206
        allqueue(REDRAWIPO, 0); 
198
207
 
290
299
        case CONSTRAINT_TYPE_FOLLOWPATH:
291
300
                strcpy (str, "Follow Path");
292
301
                return;
 
302
        case CONSTRAINT_TYPE_STRETCHTO:
 
303
                strcpy (str, "Stretch To");
 
304
                return;
293
305
        default:
294
306
                strcpy (str, "Unknown");
295
307
                return;
315
327
                return TH_BUT_SETTING;
316
328
        case CONSTRAINT_TYPE_FOLLOWPATH:
317
329
                return TH_BUT_SETTING2;
 
330
        case CONSTRAINT_TYPE_STRETCHTO:
 
331
                return TH_BUT_SETTING;
318
332
        default:
319
333
                return TH_REDALERT;
320
334
        }
362
376
                uiButSetFunc(but, constraint_changed_func, con, NULL);
363
377
                con->otype = con->type;
364
378
                
365
 
                but = uiDefBut(block, TEX, B_CONSTRAINT_REDRAW, "", *xco+120, *yco-1, 135, 19, con->name, 0.0, 32.0, 0.0, 0.0, "Constraint name"); 
 
379
                but = uiDefBut(block, TEX, B_CONSTRAINT_REDRAW, "", *xco+120, *yco-1, 135, 19, con->name, 0.0, 29.0, 0.0, 0.0, "Constraint name"); 
366
380
                uiButSetFunc(but, verify_constraint_name_func, con, NULL);
367
381
        }       
368
382
        else{
435
449
                                uiDefButI(block, MENU, B_CONSTRAINT_REDRAW, "Key on%t|X Rot%x0|Y Rot%x1|Z Rot%x2", *xco+((width/2)-117), *yco-84, 78, 18, &data->type, 0, 24, 0, 0, "Specify which transformation channel from the target is used to key the action");
436
450
 
437
451
                                uiBlockBeginAlign(block);
438
 
                                uiDefButS(block, NUM, B_CONSTRAINT_CHANGETARGET, "Start:", *xco+((width/2)-36), *yco-64, 78, 18, &data->start, 1, 18000, 0.0, 0.0, "Starting frame of the keyed motion"); 
439
 
                                uiDefButS(block, NUM, B_CONSTRAINT_CHANGETARGET, "End:", *xco+((width/2)-36), *yco-84, 78, 18, &data->end, 1, 18000, 0.0, 0.0, "Ending frame of the keyed motion"); 
 
452
                                uiDefButS(block, NUM, B_CONSTRAINT_CHANGETARGET, "Start:", *xco+((width/2)-36), *yco-64, 78, 18, &data->start, 1, MAXFRAME, 0.0, 0.0, "Starting frame of the keyed motion"); 
 
453
                                uiDefButS(block, NUM, B_CONSTRAINT_CHANGETARGET, "End:", *xco+((width/2)-36), *yco-84, 78, 18, &data->end, 1, MAXFRAME, 0.0, 0.0, "Ending frame of the keyed motion"); 
440
454
                                uiBlockEndAlign(block);
441
455
                                
442
456
                                uiBlockBeginAlign(block);
524
538
                                        strcpy (data->subtarget, "");
525
539
                                uiBlockEndAlign(block);
526
540
        
527
 
                                uiDefButF(block, NUM, B_CONSTRAINT_REDRAW, "Tolerance:", *xco+((width/2)-117), *yco-64, 120, 18, &data->tolerance, 0.0001, 1.0, 0.0, 0.0, "Maximum distance to target after solving"); 
 
541
                                uiDefButF(block, NUM, B_CONSTRAINT_REDRAW, "Tolerance:", *xco+((width/2)-117), *yco-64, 120, 18, &data->tolerance, 0.0001f, 1.0, 0.0, 0.0, "Maximum distance to target after solving"); 
528
542
                                uiDefButI(block, NUM, B_CONSTRAINT_REDRAW, "Iterations:", *xco+((width/2)+3), *yco-64, 120, 18, &data->iterations, 1, 10000, 0.0, 0.0, "Maximum number of solving iterations"); 
529
543
                                
530
544
                        }
656
670
                                uiBlockEndAlign(block);
657
671
                        }
658
672
                        break;
 
673
                case CONSTRAINT_TYPE_STRETCHTO:
 
674
                        {
 
675
                                bStretchToConstraint *data = con->data;
 
676
                                bArmature *arm;
 
677
                                height = 105;
 
678
                                BIF_ThemeColor(curCol);
 
679
 
 
680
                                glRects(*xco+3, *yco-height-39, *xco+width+30, *yco-18);
 
681
                                
 
682
                                uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Target:", *xco+65, *yco-24, 50, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); 
 
683
 
 
684
 
 
685
                                /* Draw target parameters */
 
686
                                uiBlockBeginAlign(block);
 
687
                                uiDefIDPoinBut(block, test_obpoin_but, B_CONSTRAINT_CHANGETARGET, "OB:", *xco+120, *yco-24, 135, 18, &data->tar, "Target Object"); 
 
688
 
 
689
                                arm = get_armature(data->tar);
 
690
                                if (arm){
 
691
                                        but=uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "BO:", *xco+120, *yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Subtarget Bone");
 
692
                                }
 
693
                                else
 
694
                                        strcpy (data->subtarget, "");
 
695
                                uiBlockEndAlign(block);
 
696
 
 
697
                                
 
698
                                uiBlockBeginAlign(block);
 
699
                                uiDefButF(block,BUTM,B_CONSTRAINT_REDRAW,"R",*xco, *yco-60,20,18,&(data->orglength),0.0,0,0,0,"Recalculate RLenght");
 
700
                                uiDefButF(block,NUM,B_CONSTRAINT_REDRAW,"Rest Length:",*xco+18, *yco-60,237,18,&(data->orglength),0.0,100,0.5,0.5,"Lenght at Rest Position");
 
701
                                uiBlockEndAlign(block);
 
702
 
 
703
                                uiDefButF(block,NUM,B_CONSTRAINT_REDRAW,"Volume Variation:",*xco+18, *yco-82,237,18,&(data->bulge),0.0,100,0.5,0.5,"Factor between volume variation and stretching");
 
704
 
 
705
                                uiBlockBeginAlign(block);
 
706
                                uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Vol:",*xco+14, *yco-104,30,18, NULL, 0.0, 0.0, 0.0, 0.0, ""); 
 
707
                                uiDefButI(block, ROW,B_CONSTRAINT_REDRAW,"XZ",   *xco+44, *yco-104,30,18, &data->volmode, 12.0, 0.0, 0, 0, "Keep Volume: Scaling X & Z");
 
708
                                uiDefButI(block, ROW,B_CONSTRAINT_REDRAW,"X",    *xco+74, *yco-104,20,18, &data->volmode, 12.0, 1.0, 0, 0, "Keep Volume: Scaling X");
 
709
                                uiDefButI(block, ROW,B_CONSTRAINT_REDRAW,"Z",    *xco+94, *yco-104,20,18, &data->volmode, 12.0, 2.0, 0, 0, "Keep Volume: Scaling Z");
 
710
                                uiDefButI(block, ROW,B_CONSTRAINT_REDRAW,"NONE", *xco+114, *yco-104,50,18, &data->volmode, 12.0, 3.0, 0, 0, "Ignore Volume");
 
711
                                uiBlockEndAlign(block);
 
712
 
 
713
                                
 
714
                                uiBlockBeginAlign(block);
 
715
                                uiDefBut(block, LABEL, B_CONSTRAINT_TEST,"Plane:",*xco+175, *yco-104,40,18, NULL, 0.0, 0.0, 0.0, 0.0, ""); 
 
716
                                uiDefButI(block, ROW,B_CONSTRAINT_REDRAW,"X",     *xco+215, *yco-104,20,18, &data->plane, 12.0, 0.0, 0, 0, "Keep X axis");
 
717
                                uiDefButI(block, ROW,B_CONSTRAINT_REDRAW,"Z",     *xco+235, *yco-104,20,18, &data->plane, 12.0, 2.0, 0, 0, "Keep Z axis");
 
718
                                uiBlockEndAlign(block);
 
719
                                }
 
720
                        break;
659
721
                case CONSTRAINT_TYPE_NULL:
660
722
                        {
661
723
                                height = 17;
674
736
        }
675
737
 
676
738
        if (con->type!=CONSTRAINT_TYPE_NULL) {
677
 
                uiDefButF(block, NUMSLI, B_CONSTRAINT_REDRAW, "Influence ", *xco+15, *yco, 199, 19, &(con->enforce), 0.0, 1.0, 0.0, 0.0, "Amount of influence this constraint will have on the final solution");
678
 
                but = uiDefBut(block, BUT, B_CONSTRAINT_REDRAW, "Edit", *xco+214, *yco, 41, 19, 0, 0.0, 1.0, 0.0, 0.0, "Show this constraint's ipo in the object's Ipo window");
 
739
                uiDefButF(block, NUMSLI, B_CONSTRAINT_REDRAW, "Influence ", *xco+17, *yco, 197, 19, &(con->enforce), 0.0, 1.0, 0.0, 0.0, "Amount of influence this constraint will have on the final solution");
 
740
                but = uiDefBut(block, BUT, B_CONSTRAINT_REDRAW, "Edit", *xco+215, *yco, 41, 19, 0, 0.0, 1.0, 0.0, 0.0, "Show this constraint's ipo in the object's Ipo window");
679
741
                /* If this is on an object, add the constraint to the object */
680
742
                uiButSetFunc (but, activate_constraint_ipo_func, con, NULL);
681
743
                /* If this is on a bone, add the constraint to the action (if any) */
711
773
        uiDefBut(block, BUTM, B_CONSTRAINT_ADD_LOCKTRACK,"Locked Track",                0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 0, "");
712
774
        uiDefBut(block, BUTM, B_CONSTRAINT_ADD_FOLLOWPATH,"Follow Path",                0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 0, "");
713
775
        
 
776
        uiDefBut(block, SEPR, 0, "",                                    0, yco-=6, 120, 6, NULL, 0.0, 0.0, 0, 0, "");
 
777
        
 
778
        uiDefBut(block, BUTM, B_CONSTRAINT_ADD_STRETCHTO,"Stretch To",          0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 0, "");
 
779
 
714
780
        if (type==TARGET_BONE) {
715
781
        
716
782
                uiDefBut(block, SEPR, 0, "",                                    0, yco-=6, 120, 6, NULL, 0.0, 0.0, 0, 0, "");
719
785
                uiDefBut(block, BUTM, B_CONSTRAINT_ADD_ACTION,"Action",         0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 0, "");
720
786
                
721
787
        }
722
 
        
723
788
        uiDefBut(block, SEPR, 0, "",                                    0, yco-=6, 120, 6, NULL, 0.0, 0.0, 0, 0, "");
724
 
        
 
789
 
725
790
        uiDefBut(block, BUTM, B_CONSTRAINT_ADD_NULL,"Null",             0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 0, "");
726
791
        
727
792
        uiTextBoundsBlock(block, 50);
763
828
                        add_constraint_to_client(con);
764
829
 
765
830
                        test_scene_constraints();
 
831
                        BIF_undo_push("Add constraint");
766
832
                        allqueue (REDRAWVIEW3D, 0);
767
833
                        allqueue (REDRAWBUTSOBJECT, 0);
768
834
                }
775
841
                        add_constraint_to_client(con);
776
842
 
777
843
                        test_scene_constraints();
 
844
                        BIF_undo_push("Add constraint");
778
845
                        allqueue (REDRAWVIEW3D, 0);
779
846
                        allqueue (REDRAWBUTSOBJECT, 0);
780
847
                }
787
854
                        add_constraint_to_client(con);
788
855
 
789
856
                        test_scene_constraints();
 
857
                        BIF_undo_push("Add constraint");
790
858
                        allqueue (REDRAWVIEW3D, 0);
791
859
                        allqueue (REDRAWBUTSOBJECT, 0);
792
860
                }
799
867
                        add_constraint_to_client(con);
800
868
 
801
869
                        test_scene_constraints();
 
870
                        BIF_undo_push("Add constraint");
802
871
                        allqueue (REDRAWVIEW3D, 0);
803
872
                        allqueue (REDRAWBUTSOBJECT, 0);
804
873
                }
811
880
                        add_constraint_to_client(con);
812
881
 
813
882
                        test_scene_constraints();
 
883
                        BIF_undo_push("Add constraint");
814
884
                        allqueue (REDRAWVIEW3D, 0);
815
885
                        allqueue (REDRAWBUTSOBJECT, 0);
816
886
                }
823
893
                        add_constraint_to_client(con);
824
894
 
825
895
                        test_scene_constraints();
 
896
                        BIF_undo_push("Add constraint");
826
897
                        allqueue (REDRAWVIEW3D, 0);
827
898
                        allqueue (REDRAWBUTSOBJECT, 0);
828
899
                }
835
906
                        add_constraint_to_client(con);
836
907
 
837
908
                        test_scene_constraints();
 
909
                        BIF_undo_push("Add constraint");
838
910
                        allqueue (REDRAWVIEW3D, 0);
839
911
                        allqueue (REDRAWBUTSOBJECT, 0);
840
912
                }
851
923
                        allqueue (REDRAWBUTSOBJECT, 0);
852
924
                }
853
925
                break;
 
926
        case B_CONSTRAINT_ADD_STRETCHTO:
 
927
        {
 
928
                bConstraint *con;
 
929
                con = add_new_constraint(CONSTRAINT_TYPE_STRETCHTO);
 
930
                add_constraint_to_client(con);
 
931
                        
 
932
                test_scene_constraints();
 
933
                BIF_undo_push("Add constraint");
 
934
                allqueue(REDRAWVIEW3D,0);
 
935
                allqueue(REDRAWBUTSOBJECT,0);
 
936
        }
 
937
                break;
 
938
 
854
939
        case B_CONSTRAINT_DEL:
855
940
                test_scene_constraints();
856
941
                allqueue (REDRAWVIEW3D, 0);
883
968
        
884
969
        if (conlist) {
885
970
                 
886
 
                uiDefBlockBut(block, add_constraintmenu, NULL, "Add Constraint|>> ", 0, 190, 130, 20, "Add a new constraint");
 
971
                uiDefBlockBut(block, add_constraintmenu, NULL, "Add Constraint", 0, 190, 130, 20, "Add a new constraint");
887
972
                
888
973
                /* print active object or bone */
889
974
                {
921
1006
        }
922
1007
}
923
1008
 
924
 
 
925
 
 
926
 
 
927
 
/* *************** */
928
 
 
929
 
 
930
 
#include "BLI_editVert.h"
931
 
extern ListBase editNurb;
932
 
 
933
 
void do_common_editbuts(unsigned short event) // old name, is a mix of object and editing events.... 
934
 
{
935
 
        EditMesh *em = G.editMesh;
936
 
        EditVlak *evl;
937
 
        Base *base;
938
 
        Object *ob;
939
 
        Mesh *me;
940
 
        Nurb *nu;
941
 
        Curve *cu;
942
 
        BezTriple *bezt;
943
 
        BPoint *bp;
944
 
        unsigned int local;
945
 
        int a, bit, index= -1;
946
 
 
947
 
        switch(event) {
948
 
                
949
 
        case B_MATWICH:
950
 
                if(G.obedit && G.obedit->actcol>0) {
951
 
                        if(G.obedit->type == OB_MESH) {
952
 
                                evl= em->faces.first;
953
 
                                while(evl) {
954
 
                                        if( vlakselectedAND(evl, 1) ) {
955
 
                                                if(index== -1) index= evl->mat_nr;
956
 
                                                else if(index!=evl->mat_nr) {
957
 
                                                        error("Mixed colors");
958
 
                                                        return;
959
 
                                                }
960
 
                                        }
961
 
                                        evl= evl->next;
962
 
                                }
963
 
                        }
964
 
                        else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
965
 
                                nu= editNurb.first;
966
 
                                while(nu) {
967
 
                                        if( isNurbsel(nu) ) {
968
 
                                                if(index== -1) index= nu->mat_nr;
969
 
                                                else if(index!=nu->mat_nr) {
970
 
                                                        error("Mixed colors");
971
 
                                                        return;
972
 
                                                }
973
 
                                        }
974
 
                                        nu= nu->next;
975
 
                                }                               
976
 
                        }
977
 
                        if(index>=0) {
978
 
                                G.obedit->actcol= index+1;
979
 
                                scrarea_queue_winredraw(curarea);
980
 
                        }
981
 
                }
982
 
                break;
983
 
        case B_MATNEW:
984
 
                new_material_to_objectdata((G.scene->basact) ? (G.scene->basact->object) : 0);
985
 
                scrarea_queue_winredraw(curarea);
986
 
                allqueue(REDRAWVIEW3D_Z, 0);
987
 
                break;
988
 
        case B_MATDEL:
989
 
                delete_material_index();
990
 
                scrarea_queue_winredraw(curarea);
991
 
                allqueue(REDRAWVIEW3D_Z, 0);
992
 
                break;
993
 
        case B_MATASS:
994
 
                if(G.obedit && G.obedit->actcol>0) {
995
 
                        if(G.obedit->type == OB_MESH) {
996
 
                                undo_push_mesh("Assign material index");
997
 
                                evl= em->faces.first;
998
 
                                while(evl) {
999
 
                                        if( vlakselectedAND(evl, 1) )
1000
 
                                                evl->mat_nr= G.obedit->actcol-1;
1001
 
                                        evl= evl->next;
1002
 
                                }
1003
 
                                allqueue(REDRAWVIEW3D_Z, 0);
1004
 
                                makeDispList(G.obedit);
1005
 
                        }
1006
 
                        else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
1007
 
                                nu= editNurb.first;
1008
 
                                while(nu) {
1009
 
                                        if( isNurbsel(nu) )
1010
 
                                                nu->mat_nr= G.obedit->actcol-1;
1011
 
                                        nu= nu->next;
1012
 
                                }
1013
 
                        }
1014
 
                }
1015
 
                break;
1016
 
        case B_MATSEL:
1017
 
        case B_MATDESEL:
1018
 
                if(G.obedit) {
1019
 
                        if(G.obedit->type == OB_MESH) {
1020
 
                                if (event==B_MATSEL) {
1021
 
                                        editmesh_select_by_material(G.obedit->actcol-1);
1022
 
                                } else {
1023
 
                                        editmesh_deselect_by_material(G.obedit->actcol-1);
1024
 
                                }
1025
 
                                allqueue(REDRAWVIEW3D, 0);
1026
 
                        }
1027
 
                        else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
1028
 
                                nu= editNurb.first;
1029
 
                                while(nu) {
1030
 
                                        if(nu->mat_nr==G.obedit->actcol-1) {
1031
 
                                                if(nu->bezt) {
1032
 
                                                        a= nu->pntsu;
1033
 
                                                        bezt= nu->bezt;
1034
 
                                                        while(a--) {
1035
 
                                                                if(bezt->hide==0) {
1036
 
                                                                        if(event==B_MATSEL) {
1037
 
                                                                                bezt->f1 |= 1;
1038
 
                                                                                bezt->f2 |= 1;
1039
 
                                                                                bezt->f3 |= 1;
1040
 
                                                                        }
1041
 
                                                                        else {
1042
 
                                                                                bezt->f1 &= ~1;
1043
 
                                                                                bezt->f2 &= ~1;
1044
 
                                                                                bezt->f3 &= ~1;
1045
 
                                                                        }
1046
 
                                                                }
1047
 
                                                                bezt++;
1048
 
                                                        }
1049
 
                                                }
1050
 
                                                else if(nu->bp) {
1051
 
                                                        a= nu->pntsu*nu->pntsv;
1052
 
                                                        bp= nu->bp;
1053
 
                                                        while(a--) {
1054
 
                                                                if(bp->hide==0) {
1055
 
                                                                        if(event==B_MATSEL) bp->f1 |= 1;
1056
 
                                                                        else bp->f1 &= ~1;
1057
 
                                                                }
1058
 
                                                                bp++;
1059
 
                                                        }
1060
 
                                                }
1061
 
                                        }
1062
 
                                        nu= nu->next;
1063
 
                                }
1064
 
                                allqueue(REDRAWVIEW3D, 0);
1065
 
                        }
1066
 
                }
1067
 
                break;
1068
 
        case B_HIDE:
1069
 
                if(G.obedit) {
1070
 
                        if(G.obedit->type == OB_MESH) hide_mesh(0);
1071
 
                        else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) hideNurb(0);
1072
 
                }
1073
 
                break;
1074
 
        case B_REVEAL:
1075
 
                if(G.obedit) {
1076
 
                        if(G.obedit->type == OB_MESH) reveal_mesh();
1077
 
                        else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) revealNurb();
1078
 
                }
1079
 
                else if(G.f & G_FACESELECT) reveal_tface();
1080
 
                
1081
 
                break;
1082
 
        case B_SELSWAP:
1083
 
                if(G.obedit) {
1084
 
                        if(G.obedit->type == OB_MESH) selectswap_mesh();
1085
 
                        else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) selectswapNurb();
1086
 
                }
1087
 
                break;
1088
 
        case B_AUTOTEX:
1089
 
                ob= OBACT;
1090
 
                if(ob && G.obedit==0) {
1091
 
                        if(ob->type==OB_MESH) tex_space_mesh(ob->data);
1092
 
                        else if(ob->type==OB_MBALL) ;
1093
 
                        else tex_space_curve(ob->data);
1094
 
                }
1095
 
                break;
1096
 
        case B_DOCENTRE:
1097
 
                docentre();
1098
 
                break;
1099
 
        case B_DOCENTRENEW:
1100
 
                docentre_new();
1101
 
                break;
1102
 
        case B_DOCENTRECURSOR:
1103
 
                docentre_cursor();
1104
 
                break;
1105
 
        case B_SETSMOOTH:
1106
 
        case B_SETSOLID:
1107
 
                if(G.obedit) {
1108
 
                        if(G.obedit->type == OB_MESH) {
1109
 
                                evl= em->faces.first;
1110
 
                                if (event == B_SETSMOOTH) undo_push_mesh("Set Smooth");
1111
 
                                else if (event==B_SETSOLID) undo_push_mesh("Set Solid");
1112
 
                                while(evl) {
1113
 
                                        if( vlakselectedAND(evl, 1) ) {
1114
 
                                                if(event==B_SETSMOOTH) evl->flag |= ME_SMOOTH;
1115
 
                                                else evl->flag &= ~ME_SMOOTH;
1116
 
                                        }
1117
 
                                        evl= evl->next;
1118
 
                                }
1119
 
 
1120
 
                                makeDispList(G.obedit);
1121
 
                                allqueue(REDRAWVIEW3D, 0);
1122
 
                        }
1123
 
                        else {
1124
 
                                nu= editNurb.first;
1125
 
                                while(nu) {
1126
 
                                        if(isNurbsel(nu)) {
1127
 
                                                if(event==B_SETSMOOTH) nu->flag |= ME_SMOOTH;
1128
 
                                                else nu->flag &= ~ME_SMOOTH;
1129
 
                                        }
1130
 
                                        nu= nu->next;
1131
 
                                }
1132
 
                                
1133
 
                        }
1134
 
                }
1135
 
                else {
1136
 
                        base= FIRSTBASE;
1137
 
                        while(base) {
1138
 
                                if(TESTBASELIB(base)) {
1139
 
                                        if(base->object->type==OB_MESH) {
1140
 
                                                me= base->object->data;
1141
 
                                                mesh_set_smooth_flag(me, (event==B_SETSMOOTH));
1142
 
                                                makeDispList(base->object);
1143
 
                                        }
1144
 
                                        else if ELEM(base->object->type, OB_SURF, OB_CURVE) {
1145
 
                                                cu= base->object->data;
1146
 
                                                nu= cu->nurb.first;
1147
 
                                                while(nu) {
1148
 
                                                        if(event==B_SETSMOOTH) nu->flag |= ME_SMOOTH;
1149
 
                                                        else nu->flag &= ~ME_SMOOTH;
1150
 
                                                        nu= nu->next;
1151
 
                                                }
1152
 
                                        }
1153
 
                                }
1154
 
                                base= base->next;
1155
 
                        }
1156
 
                        allqueue(REDRAWVIEW3D, 0);
1157
 
                }
1158
 
                break;
1159
 
 
1160
 
        default:
1161
 
                if(event>=B_OBLAY && event<=B_OBLAY+31) {
1162
 
                        local= BASACT->lay & 0xFF000000;
1163
 
                        BASACT->lay -= local;
1164
 
                        if(BASACT->lay==0 || (G.qual & LR_SHIFTKEY)==0) {
1165
 
                                bit= event-B_OBLAY;
1166
 
                                BASACT->lay= 1<<bit;
1167
 
                                scrarea_queue_winredraw(curarea);
1168
 
                        }
1169
 
                        BASACT->lay += local;
1170
 
                        /* optimal redraw */
1171
 
                        if( (OBACT->lay & G.vd->lay) && (BASACT->lay & G.vd->lay) );
1172
 
                        else if( (OBACT->lay & G.vd->lay)==0 && (BASACT->lay & G.vd->lay)==0 );
1173
 
                        else allqueue(REDRAWVIEW3D, 0);
1174
 
                        
1175
 
                        OBACT->lay= BASACT->lay;
1176
 
                }
1177
 
        }
1178
 
 
1179
 
}
1180
 
 
1181
1009
void object_panel_draw(Object *ob)
1182
1010
{
1183
1011
        uiBlock *block;
1206
1034
 
1207
1035
        uiBlockEndAlign(block);
1208
1036
 
1209
 
        uiDefBut(block, LABEL, 0, "Drawtype",                                           28,200,100,18, 0, 0, 0, 0, 0, "");
 
1037
        uiDefBut(block, LABEL, 0, "Drawtype",                                           28,200,100,18, NULL, 0, 0, 0, 0, "");
1210
1038
        uiDefButC(block, MENU, REDRAWVIEW3D, "Drawtype%t|Bounds %x1|Wire %x2|Solid %x3|Shaded %x4",     
1211
1039
                                                                                                                                28,180,100,18, &ob->dt, 0, 0, 0, 0, "Sets the drawing type of the active object");
1212
 
        uiDefBut(block, LABEL, 0, "Draw Extra",                                         28,160,100,18, 0, 0, 0, 0, 0, "");
 
1040
        uiDefBut(block, LABEL, 0, "Draw Extra",                                         28,160,100,18, NULL, 0, 0, 0, 0, "");
1213
1041
        uiBlockBeginAlign(block);
1214
1042
        uiDefButC(block, TOG|BIT|0, REDRAWVIEW3D, "Bounds",             28, 140, 100, 18, &ob->dtx, 0, 0, 0, 0, "Displays the active object's bounds");
1215
1043
        uiDefButS(block, MENU, REDRAWVIEW3D, "Boundary Display%t|Box%x0|Sphere%x1|Cylinder%x2|Cone%x3|Polyheder%x4",
1222
1050
        
1223
1051
}
1224
1052
 
1225
 
 
 
1053
void object_panel_hooks(Object *ob)
 
1054
{
 
1055
        uiBlock *block;
 
1056
        ObHook *hook;
 
1057
        int tothook=0, nr, active;
 
1058
        char *cp;
 
1059
        
 
1060
        block= uiNewBlock(&curarea->uiblocks, "object_panel_hooks", UI_EMBOSS, UI_HELV, curarea->win);
 
1061
        uiNewPanelTabbed("Draw", "Object");
 
1062
        if(uiNewPanel(curarea, block, "Hooks", "Object", 320, 0, 318, 204)==0) return;
 
1063
 
 
1064
        if(ob->hooks.first==NULL) {
 
1065
                uiDefBut(block, LABEL, 0, "Add hooks in Editmode", 10,180,300,19, NULL, 0, 0, 0, 0, "");
 
1066
                return;
 
1067
        }
 
1068
        
 
1069
        /* build menu */
 
1070
        for(hook= ob->hooks.first; hook; hook= hook->next) tothook++;
 
1071
        
 
1072
        cp= MEM_callocN(32*tothook+32, "temp string");
 
1073
        strcpy(cp, "Active Hook %t|");
 
1074
 
 
1075
        for(hook= ob->hooks.first; hook; hook= hook->next) {
 
1076
                strcat(cp, hook->name);
 
1077
                strcat(cp, " |");
 
1078
        }
 
1079
        /* active is stored in first hook */
 
1080
        hook= ob->hooks.first;
 
1081
        if(hook->active<1 || hook->active > tothook) hook->active= 1;
 
1082
        active= hook->active;
 
1083
        
 
1084
        uiBlockBeginAlign(block);
 
1085
        uiDefButS(block, MENU, B_REDR, cp,                                      10,180,150,19, &hook->active, 0, 0, 0, 0, "Set active hook");
 
1086
        MEM_freeN(cp);
 
1087
 
 
1088
        for(nr=1, hook= ob->hooks.first; hook; hook= hook->next, nr++) {
 
1089
                if(nr==active) break;
 
1090
        }
 
1091
        if(hook==NULL) printf("error in object_panel_hooks\n");
 
1092
        
 
1093
        uiDefBut(block, TEX, B_REDR, "Name: ",                          160,180,150,19, hook->name, 0, 31, 0, 0, "Set name of hook");
 
1094
 
 
1095
        uiBlockBeginAlign(block);
 
1096
        uiDefButF(block, NUM, B_MAKEDISP, "Falloff: ",          160,140,150,19, &hook->falloff, 0.0, 100.0, 100, 0, "If not zero, the distance from hook where influence ends");
 
1097
        uiDefButF(block, NUMSLI, B_MAKEDISP, "Force: ",         160,120,150,19, &hook->force, 0.0, 1.0, 100, 0, "Set relative force of hook");
 
1098
        uiBlockEndAlign(block);
 
1099
 
 
1100
        uiDefIDPoinBut(block, test_obpoin_but, B_CLR_HOOK, "Parent:",   10, 120, 150, 19, &hook->parent, "Parent Object for hook, also recalculates and clears offset"); 
 
1101
 
 
1102
        uiBlockBeginAlign(block);
 
1103
        uiDefBut(block, BUT, B_DEL_HOOK, "Delete",                              10,80,150,19, NULL, 0.0, 0.0, 0, 0, "Delete hook");
 
1104
        uiDefBut(block, BUT, B_CLR_HOOK, "Clear offset",                160,80,150,19, NULL, 0.0, 0.0, 0, 0, "Recalculate and clear offset (transform) of hook");
 
1105
}
 
1106
 
 
1107
static void softbody_bake(Object *ob)
 
1108
{
 
1109
        SoftBody *sb= ob->soft;
 
1110
        ScrArea *sa;
 
1111
        float frameleno= G.scene->r.framelen;
 
1112
        int cfrao= CFRA;
 
1113
        unsigned short event=0;
 
1114
        short val;
 
1115
        
 
1116
        G.scene->r.framelen= 1.0;       // baking has to be in uncorrected time
 
1117
        CFRA= sb->sfra;
 
1118
        sbObjectToSoftbody(ob);
 
1119
        ob->softflag |= OB_SB_BAKEDO;
 
1120
        
 
1121
        curarea->win_swap= 0;           // clean swapbuffers
 
1122
        
 
1123
        for(; CFRA <= sb->efra; CFRA++) {
 
1124
                set_timecursor(CFRA);
 
1125
                
 
1126
                update_for_newframe_muted();
 
1127
                
 
1128
                for(sa= G.curscreen->areabase.first; sa; sa= sa->next) {
 
1129
                        if(sa->spacetype == SPACE_VIEW3D) {
 
1130
                                scrarea_do_windraw(sa);
 
1131
                        }
 
1132
                }
 
1133
                screen_swapbuffers();
 
1134
                
 
1135
                while(qtest()) {
 
1136
                        
 
1137
                        event= extern_qread(&val);
 
1138
                        if(event==ESCKEY) break;
 
1139
                }
 
1140
                if(event==ESCKEY) break;
 
1141
        }
 
1142
        
 
1143
        if(event==ESCKEY) sbObjectToSoftbody(ob);       // clears all
 
1144
        
 
1145
        /* restore */
 
1146
        waitcursor(0);
 
1147
        ob->softflag &= ~OB_SB_BAKEDO;
 
1148
        CFRA= cfrao;
 
1149
        G.scene->r.framelen= frameleno;
 
1150
        update_for_newframe_muted();
 
1151
        allqueue(REDRAWVIEW3D, 0);
 
1152
        allqueue(REDRAWBUTSOBJECT, 0);
 
1153
}
1226
1154
 
1227
1155
 
1228
1156
void do_object_panels(unsigned short event)
1229
1157
{
1230
1158
        Object *ob;
 
1159
        ObHook *hook;
 
1160
        Effect *eff;
 
1161
        
 
1162
        ob= OBACT;
 
1163
 
 
1164
        switch(event) {
 
1165
        case B_TRACKBUTS:
 
1166
                ob= OBACT;
 
1167
                if(ob && ob->parent && ob->parent->type==OB_CURVE) freedisplist(&ob->disp);
 
1168
                allqueue(REDRAWVIEW3D, 0);
 
1169
                break;
 
1170
        case B_DEL_HOOK:
 
1171
                hook= ob->hooks.first;
 
1172
                if(hook) {
 
1173
                        int active= hook->active, nr;
 
1174
                        for(nr=1, hook=ob->hooks.first; hook; hook=hook->next, nr++) {
 
1175
                                if(active==nr) break;
 
1176
                        }
 
1177
                        if(hook) {
 
1178
                                BLI_remlink(&ob->hooks, hook);
 
1179
                                if(hook->indexar) MEM_freeN(hook->indexar);
 
1180
                                MEM_freeN(hook);
 
1181
                        }
 
1182
                        freedisplist(&ob->disp);
 
1183
                        BIF_undo_push("Delete hook");
 
1184
                        allqueue(REDRAWVIEW3D, 0);
 
1185
                        allqueue(REDRAWBUTSOBJECT, 0);
 
1186
                }
 
1187
                break;
 
1188
        case B_CLR_HOOK:
 
1189
                hook= ob->hooks.first;
 
1190
                if(hook) {
 
1191
                        int active= hook->active, nr;
 
1192
                        for(nr=1, hook=ob->hooks.first; hook; hook=hook->next, nr++) {
 
1193
                                if(active==nr) break;
 
1194
                        }
 
1195
                        if(hook && hook->parent) {
 
1196
                                Mat4Invert(hook->parent->imat, hook->parent->obmat);
 
1197
                                /* apparently this call goes from right to left... */
 
1198
                                Mat4MulSerie(hook->parentinv, hook->parent->imat, ob->obmat, NULL, 
 
1199
                                                        NULL, NULL, NULL, NULL, NULL);
 
1200
                                BIF_undo_push("Clear hook");
 
1201
                                allqueue(REDRAWVIEW3D, 0);
 
1202
                        }
 
1203
                }
 
1204
                break;
 
1205
        case B_RECALCPATH:
 
1206
                calc_curvepath(OBACT);
 
1207
                allqueue(REDRAWVIEW3D, 0);
 
1208
                break;
 
1209
        case B_PRINTSPEED:
 
1210
                ob= OBACT;
 
1211
                if(ob) {
 
1212
                        float vec[3];
 
1213
                        CFRA++;
 
1214
                        do_ob_ipo(ob);
 
1215
                        where_is_object(ob);
 
1216
                        VECCOPY(vec, ob->obmat[3]);
 
1217
                        CFRA--;
 
1218
                        do_ob_ipo(ob);
 
1219
                        where_is_object(ob);
 
1220
                        VecSubf(vec, vec, ob->obmat[3]);
 
1221
                        prspeed= Normalise(vec);
 
1222
                        scrarea_queue_winredraw(curarea);
 
1223
                }
 
1224
                break;
 
1225
        case B_PRINTLEN:
 
1226
                ob= OBACT;
 
1227
                if(ob && ob->type==OB_CURVE) {
 
1228
                        Curve *cu=ob->data;
 
1229
                        
 
1230
                        if(cu->path) prlen= cu->path->totdist; else prlen= -1.0;
 
1231
                        scrarea_queue_winredraw(curarea);
 
1232
                } 
 
1233
                break;
 
1234
        case B_RELKEY:
 
1235
                allspace(REMAKEIPO, 0);
 
1236
                allqueue(REDRAWBUTSOBJECT, 0);
 
1237
                allqueue(REDRAWIPO, 0);
 
1238
                break;
 
1239
        case B_CURVECHECK:
 
1240
                curve_changes_other_objects(OBACT);
 
1241
                allqueue(REDRAWVIEW3D, 0);
 
1242
                break;
 
1243
        
 
1244
        case B_SOFTBODY_CHANGE:
 
1245
                ob= OBACT;
 
1246
                if(ob) {
 
1247
                        ob->softflag |= OB_SB_REDO;
 
1248
                        allqueue(REDRAWBUTSOBJECT, 0);
 
1249
                        allqueue(REDRAWVIEW3D, 0);
 
1250
                }
 
1251
                break;
 
1252
        case B_SOFTBODY_DEL_VG:
 
1253
                ob= OBACT;
 
1254
                if(ob && ob->soft) {
 
1255
                        ob->soft->vertgroup= 0;
 
1256
                        ob->softflag |= OB_SB_REDO;
 
1257
                        allqueue(REDRAWBUTSOBJECT, 0);
 
1258
                        allqueue(REDRAWVIEW3D, 0);
 
1259
                }
 
1260
                break;
 
1261
        case B_SOFTBODY_BAKE:
 
1262
                ob= OBACT;
 
1263
                if(ob && ob->soft) softbody_bake(ob);
 
1264
                break;
 
1265
        case B_SOFTBODY_BAKE_FREE:
 
1266
                ob= OBACT;
 
1267
                if(ob && ob->soft) sbObjectToSoftbody(ob);
 
1268
                allqueue(REDRAWBUTSOBJECT, 0);
 
1269
                allqueue(REDRAWVIEW3D, 0);
 
1270
                break;
 
1271
                
 
1272
        default:
 
1273
                if(event>=B_SELEFFECT && event<B_SELEFFECT+MAX_EFFECT) {
 
1274
                        ob= OBACT;
 
1275
                        if(ob) {
 
1276
                                int a=B_SELEFFECT;
 
1277
                                
 
1278
                                eff= ob->effect.first;
 
1279
                                while(eff) {
 
1280
                                        if(event==a) eff->flag |= SELECT;
 
1281
                                        else eff->flag &= ~SELECT;
 
1282
                                        
 
1283
                                        a++;
 
1284
                                        eff= eff->next;
 
1285
                                }
 
1286
                                allqueue(REDRAWBUTSOBJECT, 0);
 
1287
                        }
 
1288
                }
 
1289
        }
 
1290
 
 
1291
}
 
1292
 
 
1293
static void object_panel_anim(Object *ob)
 
1294
{
 
1295
        uiBlock *block;
 
1296
        char str[32];
 
1297
        
 
1298
        block= uiNewBlock(&curarea->uiblocks, "object_panel_anim", UI_EMBOSS, UI_HELV, curarea->win);
 
1299
        if(uiNewPanel(curarea, block, "Anim settings", "Object", 0, 0, 318, 204)==0) return;
 
1300
        
 
1301
        uiBlockBeginAlign(block);
 
1302
        uiDefButC(block, ROW,B_TRACKBUTS,"TrackX",      24,190,59,19, &ob->trackflag, 12.0, 0.0, 0, 0, "Specify the axis that points to another object");
 
1303
        uiDefButC(block, ROW,B_TRACKBUTS,"Y",           85,190,19,19, &ob->trackflag, 12.0, 1.0, 0, 0, "Specify the axis that points to another object");
 
1304
        uiDefButC(block, ROW,B_TRACKBUTS,"Z",           104,190,19,19, &ob->trackflag, 12.0, 2.0, 0, 0, "Specify the axis that points to another object");
 
1305
        uiDefButC(block, ROW,B_TRACKBUTS,"-X",          124,190,24,19, &ob->trackflag, 12.0, 3.0, 0, 0, "Specify the axis that points to another object");
 
1306
        uiDefButC(block, ROW,B_TRACKBUTS,"-Y",          150,190,24,19, &ob->trackflag, 12.0, 4.0, 0, 0, "Specify the axis that points to another object");
 
1307
        uiDefButC(block, ROW,B_TRACKBUTS,"-Z",          178,190,24,19, &ob->trackflag, 12.0, 5.0, 0, 0, "Specify the axis that points to another object");
 
1308
        uiBlockBeginAlign(block);
 
1309
        uiDefButC(block, ROW,REDRAWVIEW3D,"UpX",        226,190,45,19, &ob->upflag, 13.0, 0.0, 0, 0, "Specify the axis that points up");
 
1310
        uiDefButC(block, ROW,REDRAWVIEW3D,"Y",          274,190,20,19, &ob->upflag, 13.0, 1.0, 0, 0, "Specify the axis that points up");
 
1311
        uiDefButC(block, ROW,REDRAWVIEW3D,"Z",          298,190,19,19, &ob->upflag, 13.0, 2.0, 0, 0, "Specify the axis that points up");
 
1312
        uiBlockBeginAlign(block);
 
1313
        uiDefButC(block, TOG|BIT|0, REDRAWVIEW3D, "Draw Key",           24,160,71,19, &ob->ipoflag, 0, 0, 0, 0, "Draw object as key position");
 
1314
        uiDefButC(block, TOG|BIT|1, REDRAWVIEW3D, "Draw Key Sel",       97,160,81,19, &ob->ipoflag, 0, 0, 0, 0, "Limit the drawing of object keys");
 
1315
        uiDefButC(block, TOG|BIT|7, REDRAWVIEW3D, "Powertrack",         180,160,78,19, &ob->transflag, 0, 0, 0, 0, "Switch objects rotation off");
 
1316
        uiDefButS(block, TOG|BIT|4, 0, "SlowPar",                                       260,160,56,19, &ob->partype, 0, 0, 0, 0, "Create a delay in the parent relationship");
 
1317
        uiBlockBeginAlign(block);
 
1318
        uiDefButC(block, TOG|BIT|3, REDRAWVIEW3D, "DupliFrames",        24,128,89,19, &ob->transflag, 0, 0, 0, 0, "Make copy of object for every frame");
 
1319
        uiDefButC(block, TOG|BIT|4, REDRAWVIEW3D, "DupliVerts",         114,128,82,19, &ob->transflag, 0, 0, 0, 0, "Duplicate child objects on all vertices");
 
1320
        uiDefButC(block, TOG|BIT|5, REDRAWVIEW3D, "Rot",                200,128,31,19, &ob->transflag, 0, 0, 0, 0, "Rotate dupli according to facenormal");
 
1321
        uiDefButC(block, TOG|BIT|6, REDRAWVIEW3D, "No Speed",   234,128,82,19, &ob->transflag, 0, 0, 0, 0, "Set dupliframes to still, regardless of frame");
 
1322
        uiBlockBeginAlign(block);
 
1323
        uiDefButS(block, NUM, REDRAWVIEW3D, "DupSta:",          24,105,141,19, &ob->dupsta, 1.0, (MAXFRAMEF - 1.0f), 0, 0, "Specify startframe for Dupliframes");
 
1324
        uiDefButS(block, NUM, REDRAWVIEW3D, "DupOn:",           170,105,146,19, &ob->dupon, 1.0, 1500.0, 0, 0, "");
 
1325
        uiDefButS(block, NUM, REDRAWVIEW3D, "DupEnd",           24,82,140,19, &ob->dupend, 1.0, MAXFRAMEF, 0, 0, "Specify endframe for Dupliframes");
 
1326
        uiDefButS(block, NUM, REDRAWVIEW3D, "DupOff",           171,82,145,19, &ob->dupoff, 0.0, 1500.0, 0, 0, "");
 
1327
        uiBlockBeginAlign(block);
 
1328
        uiDefButC(block, TOG|BIT|2, REDRAWALL, "Offs Ob",                       24,51,56,20, &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on its own objectipo");
 
1329
        uiDefButC(block, TOG|BIT|6, REDRAWALL, "Offs Par",                      82,51,56,20 , &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on the parent");
 
1330
        uiDefButC(block, TOG|BIT|7, REDRAWALL, "Offs Particle",         140,51,103,20, &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on the particle effect");
 
1331
        
 
1332
        uiBlockBeginAlign(block);
 
1333
        uiDefButF(block, NUM, REDRAWALL, "TimeOffset:",                 24,17,115,30, &ob->sf, -9000.0, 9000.0, 100, 0, "Specify an offset in frames");
 
1334
        uiDefBut(block, BUT, B_AUTOTIMEOFS, "Automatic Time",   139,17,104,31, 0, 0, 0, 0, 0, "Generate automatic timeoffset values for all selected frames");
 
1335
        uiDefBut(block, BUT, B_PRINTSPEED,      "PrSpeed",                      248,17,67,31, 0, 0, 0, 0, 0, "Print objectspeed");
 
1336
        uiBlockEndAlign(block);
 
1337
        
 
1338
        sprintf(str, "%.4f", prspeed);
 
1339
        uiDefBut(block, LABEL, 0, str,                                                  247,40,63,31, NULL, 1.0, 0, 0, 0, "");
 
1340
        
 
1341
}
 
1342
 
 
1343
void do_effects_panels(unsigned short event)
 
1344
{
 
1345
        Object *ob;
1231
1346
        Base *base;
1232
1347
        Effect *eff, *effn;
1233
1348
        int type;
1235
1350
        ob= OBACT;
1236
1351
 
1237
1352
        switch(event) {
1238
 
                
1239
 
        case B_RECALCPATH:
1240
 
                calc_curvepath(OBACT);
1241
 
                allqueue(REDRAWVIEW3D, 0);
1242
 
                break;
1243
 
        case B_AUTOTIMEOFS:
 
1353
 
 
1354
    case B_AUTOTIMEOFS:
1244
1355
                auto_timeoffs();
1245
1356
                break;
1246
1357
        case B_FRAMEMAP:
1247
1358
                G.scene->r.framelen= G.scene->r.framapto;
1248
1359
                G.scene->r.framelen/= G.scene->r.images;
 
1360
                allqueue(REDRAWALL, 0);
1249
1361
                break;
1250
1362
        case B_NEWEFFECT:
1251
1363
                if(ob) {
1254
1366
                        else
1255
1367
                                copy_act_effect(ob);
1256
1368
                }
 
1369
                BIF_undo_push("New effect");
1257
1370
                allqueue(REDRAWBUTSOBJECT, 0);
1258
1371
                break;
1259
1372
        case B_DELEFFECT:
1268
1381
                        }
1269
1382
                        eff= effn;
1270
1383
                }
 
1384
                BIF_undo_push("Delete effect");
 
1385
                allqueue(REDRAWVIEW3D, 0);
1271
1386
                allqueue(REDRAWBUTSOBJECT, 0);
1272
 
                allqueue(REDRAWVIEW3D, 0);
1273
1387
                break;
1274
1388
        case B_NEXTEFFECT:
1275
1389
                if(ob==0 || ob->type!=OB_MESH) break;
1317
1431
                        }
1318
1432
                        eff= eff->next;
1319
1433
                }
 
1434
                allqueue(REDRAWVIEW3D, 0);
1320
1435
                allqueue(REDRAWBUTSOBJECT, 0);
1321
 
                allqueue(REDRAWVIEW3D, 0);
1322
1436
                break;
1323
1437
        case B_CALCEFFECT:
1324
1438
                if(ob==0 || ob->type!=OB_MESH) break;
1326
1440
                while(eff) {
1327
1441
                        if(eff->flag & SELECT) {
1328
1442
                                if(eff->type==EFF_PARTICLE) build_particle_system(ob);
1329
 
                                else if(eff->type==EFF_WAVE) object_wave(ob);
 
1443
                                else if(eff->type==EFF_WAVE) freedisplist(&ob->disp);
1330
1444
                        }
1331
1445
                        eff= eff->next;
1332
1446
                }
1350
1464
                }
1351
1465
                allqueue(REDRAWVIEW3D, 0);
1352
1466
                break;
1353
 
        case B_PRINTSPEED:
1354
 
                ob= OBACT;
1355
 
                if(ob) {
1356
 
                        float vec[3];
1357
 
                        CFRA++;
1358
 
                        do_ob_ipo(ob);
1359
 
                        where_is_object(ob);
1360
 
                        VECCOPY(vec, ob->obmat[3]);
1361
 
                        CFRA--;
1362
 
                        do_ob_ipo(ob);
1363
 
                        where_is_object(ob);
1364
 
                        VecSubf(vec, vec, ob->obmat[3]);
1365
 
                        prspeed= Normalise(vec);
1366
 
                        scrarea_queue_winredraw(curarea);
1367
 
                }
1368
 
                break;
1369
 
        case B_PRINTLEN:
1370
 
                ob= OBACT;
1371
 
                if(ob && ob->type==OB_CURVE) {
1372
 
                        Curve *cu=ob->data;
1373
 
                        
1374
 
                        if(cu->path) prlen= cu->path->totdist; else prlen= -1.0;
1375
 
                        scrarea_queue_winredraw(curarea);
1376
 
                } 
1377
 
                break;
1378
 
        case B_RELKEY:
1379
 
                allspace(REMAKEIPO, 0);
1380
 
                allqueue(REDRAWBUTSOBJECT, 0);
1381
 
                allqueue(REDRAWIPO, 0);
1382
 
                break;
1383
 
                
 
1467
 
1384
1468
        default:
1385
1469
                if(event>=B_SELEFFECT && event<B_SELEFFECT+MAX_EFFECT) {
1386
1470
                        ob= OBACT;
1402
1486
 
1403
1487
}
1404
1488
 
 
1489
/* Panel for particle interaction settings */
 
1490
static void object_panel_deflectors(Object *ob)
 
1491
{
 
1492
        uiBlock *block;
 
1493
 
 
1494
        block= uiNewBlock(&curarea->uiblocks, "object_panel_deflectors", UI_EMBOSS, UI_HELV, curarea->win);
 
1495
        uiNewPanelTabbed("Constraints", "Object");
 
1496
        if(uiNewPanel(curarea, block, "Particle Interaction", "Object", 640, 0, 318, 204)==0) return;
 
1497
 
 
1498
        /* should become button, option? */
 
1499
        if(ob->pd==NULL) {
 
1500
                ob->pd= MEM_callocN(sizeof(PartDeflect), "PartDeflect");
 
1501
                /* and if needed, init here */
 
1502
                ob->pd->pdef_sbdamp = 0.1;
 
1503
                ob->pd->pdef_sbift  = 0.2;
 
1504
                ob->pd->pdef_sboft  = 0.02;
 
1505
        }
 
1506
        
 
1507
        if(ob->pd) {
 
1508
                PartDeflect *pd= ob->pd;
 
1509
                
 
1510
                uiDefBut(block, LABEL, 0, "Fields",             10,180,140,20, NULL, 0.0, 0, 0, 0, "");
 
1511
                
 
1512
                uiBlockBeginAlign(block);
 
1513
                uiDefButS(block, ROW, REDRAWVIEW3D, "None",                     10,160,50,20, &pd->forcefield, 1.0, 0, 0, 0, "No force");
 
1514
                uiDefButS(block, ROW, REDRAWVIEW3D, "Force field",      60,160,90,20, &pd->forcefield, 1.0, PFIELD_FORCE, 0, 0, "Object center attracts or repels particles");
 
1515
                uiDefButS(block, ROW, REDRAWVIEW3D, "Wind",                     10,140,50,20, &pd->forcefield, 1.0, PFIELD_WIND, 0, 0, "Constant force applied in direction of Object Z axis");
 
1516
                uiDefButS(block, ROW, REDRAWVIEW3D, "Vortex field",     60,140,90,20, &pd->forcefield, 1.0, PFIELD_VORTEX, 0, 0, "Particles swirl around Z-axis of the object");
 
1517
 
 
1518
                uiBlockBeginAlign(block);
 
1519
                uiDefButF(block, NUM, REDRAWVIEW3D, "Strength: ",       10,110,140,20, &pd->f_strength, -1000, 1000, 1000, 0, "Strength of force field");
 
1520
                uiDefButF(block, NUM, REDRAWVIEW3D, "Fall-off: ",       10,90,140,20, &pd->f_power, 0, 10, 100, 0, "Falloff power (real gravitational fallof = 2)");
 
1521
                
 
1522
                uiBlockBeginAlign(block);
 
1523
                uiDefButBitS(block, TOG, PFIELD_USEMAX, REDRAWVIEW3D, "Use MaxDist",    10,60,140,20, &pd->flag, 0.0, 0, 0, 0, "Use a maximum distance for the field to work");
 
1524
                uiDefButF(block, NUM, REDRAWVIEW3D, "MaxDist: ",        10,40,140,20, &pd->maxdist, 0, 1000.0, 100, 0, "Maximum distance for the field to work");
 
1525
                uiBlockEndAlign(block);
 
1526
 
 
1527
                if(ob->softflag & OB_SB_ENABLE) {
 
1528
                        uiDefBut(block, LABEL, 0, "Object is Softbody,",                160,160,150,20, NULL, 0.0, 0, 0, 0, "");
 
1529
                        uiDefBut(block, LABEL, 0, "no Deflection possible",             160,140,150,20, NULL, 0.0, 0, 0, 0, "");
 
1530
                        pd->deflect= 0;
 
1531
                }
 
1532
                else {
 
1533
                        
 
1534
                        uiDefBut(block, LABEL, 0, "Deflection", 160,180,140,20, NULL, 0.0, 0, 0, 0, "");
 
1535
                        
 
1536
                        /* only meshes collide now */
 
1537
                        if(ob->type==OB_MESH) {
 
1538
                                uiDefButS(block, TOG|BIT|0, B_REDR, "Deflection",160,160,150,20, &pd->deflect, 0, 0, 0, 0, "Deflects particles based on collision");
 
1539
                                uiDefBut(block, LABEL, 0, "Particles",                  160,140,150,20, NULL, 0.0, 0, 0, 0, "");
 
1540
                                
 
1541
                                uiBlockBeginAlign(block);
 
1542
                                uiDefButF(block, NUM, B_DIFF, "Damping: ",              160,120,150,20, &pd->pdef_damp, 0.0, 1.0, 10, 0, "Amount of damping during particle collision");
 
1543
                                uiDefButF(block, NUM, B_DIFF, "Rnd Damping: ",  160,100,150,20, &pd->pdef_rdamp, 0.0, 1.0, 10, 0, "Random variation of damping");
 
1544
                                uiDefButF(block, NUM, B_DIFF, "Permeability: ", 160,80,150,20, &pd->pdef_perm, 0.0, 1.0, 10, 0, "Chance that the particle will pass through the mesh");
 
1545
                                uiBlockEndAlign(block);
 
1546
                                
 
1547
                                uiDefBut(block, LABEL, 0, "Soft Body",                  160,60,150,20, NULL, 0.0, 0, 0, 0, "");
 
1548
 
 
1549
                                uiBlockBeginAlign(block);
 
1550
                                uiDefButF(block, NUM, B_DIFF, "Damping:",       160,40,150,20, &pd->pdef_sbdamp, 0.0, 1.0, 10, 0, "Amount of damping during softbody collision");
 
1551
                                uiDefButF(block, NUM, B_DIFF, "Inner:", 160,20,150,20, &pd->pdef_sbift, 0.001, 1.0, 10, 0, "Inner face thickness");
 
1552
                                uiDefButF(block, NUM, B_DIFF, "Outer:", 160, 0,150,20, &pd->pdef_sboft, 0.001, 1.0, 10, 0, "Outer face thickness");
 
1553
                        }               
 
1554
                }       
 
1555
        }
 
1556
}
 
1557
 
 
1558
 
 
1559
/* Panel for softbodies */
 
1560
 
 
1561
static void object_softbodies(Object *ob)
 
1562
{
 
1563
        uiBlock *block;
 
1564
        
 
1565
        block= uiNewBlock(&curarea->uiblocks, "object_softbodies", UI_EMBOSS, UI_HELV, curarea->win);
 
1566
        uiNewPanelTabbed("Constraints", "Object");
 
1567
        if(uiNewPanel(curarea, block, "Softbody", "Object", 640, 0, 318, 204)==0) return;
 
1568
 
 
1569
        /* do not allow to combine with force fields */
 
1570
        if(ob->pd) {
 
1571
                PartDeflect *pd= ob->pd;
 
1572
                
 
1573
                if(pd->deflect) {
 
1574
                        uiDefBut(block, LABEL, 0, "Object has Deflection,",             10,160,300,20, NULL, 0.0, 0, 0, 0, "");
 
1575
                        uiDefBut(block, LABEL, 0, "no Softbody possible",               10,140,300,20, NULL, 0.0, 0, 0, 0, "");
 
1576
                        ob->softflag &= ~OB_SB_ENABLE;
 
1577
                        
 
1578
                        return;
 
1579
                }
 
1580
        }
 
1581
        
 
1582
        uiDefButBitS(block, TOG, OB_SB_ENABLE, REDRAWBUTSOBJECT, "Enable Soft Body",    10,200,150,20, &ob->softflag, 0, 0, 0, 0, "Sets object to become soft body");
 
1583
        uiDefBut(block, LABEL, 0, "",   160, 200,150,20, NULL, 0.0, 0.0, 0, 0, "");     // alignment reason
 
1584
        
 
1585
        if(ob->softflag & OB_SB_ENABLE) {
 
1586
                SoftBody *sb= ob->soft;
 
1587
                int defCount;
 
1588
                char *menustr;
 
1589
                
 
1590
                if(sb==NULL) {
 
1591
                        sb= ob->soft= sbNew();
 
1592
                        ob->softflag |= OB_SB_GOAL|OB_SB_EDGES;
 
1593
                        // default add edges for softbody
 
1594
                        if(ob->type==OB_MESH) {
 
1595
                                Mesh *me= ob->data;
 
1596
                                if(me->medge==NULL) make_edges(me);
 
1597
                        }
 
1598
                }
 
1599
                
 
1600
                uiDefButBitS(block, TOG, OB_SB_BAKESET, REDRAWBUTSOBJECT, "Bake settings",      180,200,130,20, &ob->softflag, 0, 0, 0, 0, "To convert simulation into baked (cached) result");
 
1601
                
 
1602
                if(sb->keys) uiSetButLock(1, "SoftBody is baked, free it first");
 
1603
                
 
1604
                if(ob->softflag & OB_SB_BAKESET) {
 
1605
                        uiBlockBeginAlign(block);
 
1606
                        uiDefButS(block, NUM, B_DIFF, "Start:",                 10, 170,100,20, &sb->sfra, 1.0, 10000.0, 10, 0, "Start frame for baking");
 
1607
                        uiDefButS(block, NUM, B_DIFF, "End:",                   110, 170,100,20, &sb->efra, 1.0, 10000.0, 10, 0, "End frame for baking");
 
1608
                        uiDefButS(block, NUM, B_DIFF, "Interval:",              210, 170,100,20, &sb->interval, 1.0, 10.0, 10, 0, "Interval in frames between baked keys");
 
1609
                        
 
1610
                        uiClearButLock();
 
1611
                        
 
1612
                        uiBlockBeginAlign(block);
 
1613
                        if(sb->keys) {
 
1614
                                char str[128];
 
1615
                                uiDefIconTextBut(block, BUT, B_SOFTBODY_BAKE_FREE, ICON_X, "FREE BAKE", 10, 120,300,20, NULL, 0.0, 0.0, 0, 0, "Free baked result");
 
1616
                                sprintf(str, "Stored %d vertices %d keys %.3f MB", sb->totpoint, sb->totkey, ((float)16*sb->totpoint*sb->totkey)/(1024.0*1024.0));
 
1617
                                uiDefBut(block, LABEL, 0, str, 10, 100,300,20, NULL, 0.0, 0.0, 00, 0, "");
 
1618
                        }
 
1619
                        else                            
 
1620
                                uiDefBut(block, BUT, B_SOFTBODY_BAKE, "BAKE",   10, 120,300,20, NULL, 0.0, 0.0, 10, 0, "Start baking. Press ESC to exit without baking");
 
1621
                }
 
1622
                else {
 
1623
                        /* GENERAL STUFF */
 
1624
                        uiBlockBeginAlign(block);
 
1625
                        uiDefButF(block, NUM, B_DIFF, "Friction:",              10, 170,150,20, &sb->mediafrict, 0.0, 10.0, 10, 0, "General media friction for point movements");
 
1626
                        uiDefButF(block, NUM, B_DIFF, "Mass:",                  160, 170,150,20, &sb->nodemass , 0.001, 50.0, 10, 0, "Point Mass, the heavier the slower");
 
1627
                        uiDefButF(block, NUM, B_DIFF, "Grav:",                  10,150,150,20, &sb->grav , 0.0, 10.0, 10, 0, "Apply gravitation to point movement");
 
1628
                        uiDefButF(block, NUM, B_DIFF, "Speed:",                 160,150,150,20, &sb->physics_speed , 0.01, 100.0, 10, 0, "Tweak timing for physics to control frequency and speed");
 
1629
                        uiDefButF(block, NUM, B_DIFF, "Error Limit:",   10,130,150,20, &sb->rklimit , 0.01, 1.0, 10, 0, "The Runge-Kutta ODE solver error limit, low value gives more precision");
 
1630
                        uiDefButBitS(block, TOG, OB_SB_POSTDEF, B_DIFF, "Apply Deform First",   160,130,150,20, &ob->softflag, 0, 0, 0, 0, "Softbody is calculated AFTER Deformation");
 
1631
                        uiBlockEndAlign(block);
 
1632
                        
 
1633
                        /* GOAL STUFF */
 
1634
                        uiBlockBeginAlign(block);
 
1635
                        uiDefButBitS(block, TOG, OB_SB_GOAL, B_SOFTBODY_CHANGE, "Use Goal",     10,100,130,20, &ob->softflag, 0, 0, 0, 0, "Define forces for vertices to stick to animated position");
 
1636
                        
 
1637
                        menustr= get_vertexgroup_menustr(ob);
 
1638
                        defCount=BLI_countlist(&ob->defbase);
 
1639
                        if(defCount==0) sb->vertgroup= 0;
 
1640
                        uiDefButS(block, MENU, B_SOFTBODY_CHANGE, menustr,              140,100,20,20, &sb->vertgroup, 0, defCount, 0, 0, "Browses available vertex groups");
 
1641
                        
 
1642
                        if(sb->vertgroup) {
 
1643
                                bDeformGroup *defGroup = BLI_findlink(&ob->defbase, sb->vertgroup-1);
 
1644
                                if(defGroup)
 
1645
                                        uiDefBut(block, BUT, B_DIFF, defGroup->name,    160,100,130,20, NULL, 0.0, 0.0, 0, 0, "Name of current vertex group");
 
1646
                                else
 
1647
                                        uiDefBut(block, BUT, B_DIFF, "(no group)",      160,100,130,20, NULL, 0.0, 0.0, 0, 0, "Vertex Group doesn't exist anymore");
 
1648
                                uiDefIconBut(block, BUT, B_SOFTBODY_DEL_VG, ICON_X, 290,100,20,20, 0, 0, 0, 0, 0, "Disable use of vertex group");
 
1649
                        }
 
1650
                        else {
 
1651
                                uiDefButF(block, NUM, B_SOFTBODY_CHANGE, "Goal:",       160,100,150,20, &sb->defgoal, 0.0, 1.0, 10, 0, "Default Goal (vertex target position) value, when no Vertex Group used");
 
1652
                        }
 
1653
                        MEM_freeN (menustr);
 
1654
 
 
1655
                        uiDefButF(block, NUM, B_DIFF, "G Stiff:",       10,80,150,20, &sb->goalspring, 0.0, 0.999, 10, 0, "Goal (vertex target position) spring stiffness");
 
1656
                        uiDefButF(block, NUM, B_DIFF, "G Damp:",        160,80,150,20, &sb->goalfrict  , 0.0, 10.0, 10, 0, "Goal (vertex target position) friction");
 
1657
                        uiDefButF(block, NUM, B_SOFTBODY_CHANGE, "G Min:",              10,60,150,20, &sb->mingoal, 0.0, 1.0, 10, 0, "Goal minimum, vertex group weights are scaled to match this range");
 
1658
                        uiDefButF(block, NUM, B_SOFTBODY_CHANGE, "G Max:",              160,60,150,20, &sb->maxgoal, 0.0, 1.0, 10, 0, "Goal maximum, vertex group weights are scaled to match this range");
 
1659
                        uiBlockEndAlign(block);
 
1660
                        
 
1661
                        /* EDGE SPRING STUFF */
 
1662
                        uiBlockBeginAlign(block);
 
1663
                        uiDefButBitS(block, TOG, OB_SB_EDGES, B_SOFTBODY_CHANGE, "Use Edges",           10,30,150,20, &ob->softflag, 0, 0, 0, 0, "Use Edges as springs");
 
1664
                        uiDefButBitS(block, TOG, OB_SB_QUADS, B_SOFTBODY_CHANGE, "Stiff Quads",         160,30,150,20, &ob->softflag, 0, 0, 0, 0, "Adds diagonal springs on 4-gons");
 
1665
                        uiDefButF(block, NUM, B_DIFF, "E Stiff:",       10,10,150,20, &sb->inspring, 0.0,  0.999, 10, 0, "Edge spring stiffness");
 
1666
                        uiDefButF(block, NUM, B_DIFF, "E Damp:",        160,10,150,20, &sb->infrict, 0.0,  10.0, 10, 0, "Edge spring friction");
 
1667
                        uiBlockEndAlign(block);
 
1668
                }
 
1669
        }
 
1670
        uiBlockEndAlign(block);
 
1671
 
 
1672
}
 
1673
 
1405
1674
void object_panel_effects(Object *ob)
1406
1675
{
1407
1676
        Effect *eff;
1411
1680
        
1412
1681
        block= uiNewBlock(&curarea->uiblocks, "object_panel_effects", UI_EMBOSS, UI_HELV, curarea->win);
1413
1682
        uiNewPanelTabbed("Constraints", "Object");
1414
 
        if(uiNewPanel(curarea, block, "Effects", "Object", 640, 0, 418, 204)==0) return;
 
1683
        if(uiNewPanel(curarea, block, "Effects", "Object", 640, 0, 318, 204)==0) return;
1415
1684
 
1416
1685
        /* EFFECTS */
1417
1686
        
1443
1712
        }
1444
1713
        
1445
1714
        if(eff) {
1446
 
                uiDefButS(block, MENU, B_CHANGEEFFECT, "Build %x0|Particles %x1|Wave %x2", 895,187,107,27, &eff->buttype, 0, 0, 0, 0, "Start building the effect");
 
1715
                uiDefButS(block, MENU, B_CHANGEEFFECT, "Build %x0|Particles %x1|Wave %x2", 895,187,107,27, &eff->buttype, 0, 0, 0, 0, "Set effect type");
1447
1716
                
1448
1717
                if(eff->type==EFF_BUILD) {
1449
1718
                        BuildEff *bld;
1450
1719
                        
1451
1720
                        bld= (BuildEff *)eff;
1452
1721
                        
1453
 
                        uiDefButF(block, NUM, 0, "Len:",                        649,138,95,21, &bld->len, 1.0, 9000.0, 100, 0, "Specify the total time the building requires");
 
1722
                        uiDefButF(block, NUM, 0, "Len:",                        649,138,95,21, &bld->len, 1.0, 9000.0, 100, 0, "Specify the total time the build effect requires");
1454
1723
                        uiDefButF(block, NUM, 0, "Sfra:",                       746,138,94,22, &bld->sfra, 1.0, 9000.0, 100, 0, "Specify the startframe of the effect");
1455
1724
                }
1456
1725
                else if(eff->type==EFF_WAVE) {
1458
1727
                        
1459
1728
                        wav= (WaveEff *)eff;
1460
1729
                        uiBlockBeginAlign(block);
1461
 
                        uiDefButS(block, TOG|BIT|1, B_CALCEFFECT, "X",          782,135,54,23, &wav->flag, 0, 0, 0, 0, "Enable X axis");
1462
 
                        uiDefButS(block, TOG|BIT|2, B_CALCEFFECT, "Y",          840,135,47,23, &wav->flag, 0, 0, 0, 0, "Enable Y axis");
1463
 
                        uiDefButS(block, TOG|BIT|3, B_CALCEFFECT, "Cycl",       890,135,111,23, &wav->flag, 0, 0, 0, 0, "Enable cyclic wave efefct");
 
1730
                        uiDefButS(block, TOG|BIT|1, B_CALCEFFECT, "X",          782,135,54,23, &wav->flag, 0, 0, 0, 0, "Enable X axis motion");
 
1731
                        uiDefButS(block, TOG|BIT|2, B_CALCEFFECT, "Y",          840,135,47,23, &wav->flag, 0, 0, 0, 0, "Enable Y axis motion");
 
1732
                        uiDefButS(block, TOG|BIT|3, B_CALCEFFECT, "Cycl",       890,135,111,23, &wav->flag, 0, 0, 0, 0, "Enable cyclic wave effect");
1464
1733
                        uiBlockBeginAlign(block);
1465
1734
                        uiDefButF(block, NUM, B_CALCEFFECT, "Sta x:",           550,135,113,24, &wav->startx, -100.0, 100.0, 100, 0, "Starting position for the X axis");
1466
1735
                        uiDefButF(block, NUM, B_CALCEFFECT, "Sta y:",           665,135,104,24, &wav->starty, -100.0, 100.0, 100, 0, "Starting position for the Y axis");
1482
1751
                        paf= (PartEff *)eff;
1483
1752
                        
1484
1753
                        uiDefBut(block, BUT, B_RECALCAL, "RecalcAll", 741,187,67,27, 0, 0, 0, 0, 0, "Update the particle system");
1485
 
                        uiDefButS(block, TOG|BIT|2, B_CALCEFFECT, "Static",     825,187,67,27, &paf->flag, 0, 0, 0, 0, "Make static particles");
 
1754
                        uiBlockBeginAlign(block);
 
1755
                        uiDefButS(block, TOG|BIT|2, B_CALCEFFECT, "Static",     825,187,67,27, &paf->flag, 0, 0, 0, 0, "Make static particles (deform only works with SubSurf)");
 
1756
                        if(paf->flag & PAF_STATIC)
 
1757
                                uiDefButS(block, TOG|BIT|4, B_DIFF, "Animated",825,167,67,20, &paf->flag, 0, 0, 0, 0, "Static particles are recalculated each rendered frame");
1486
1758
                        
1487
1759
                        uiBlockBeginAlign(block);
1488
1760
                        uiDefButI(block, NUM, B_CALCEFFECT, "Tot:",                     550,146,91,20, &paf->totpart, 1.0, 100000.0, 0, 0, "Set the total number of particles");
1489
1761
                        if(paf->flag & PAF_STATIC) {
1490
 
                                uiDefButS(block, NUM, REDRAWVIEW3D, "Step:",    644,146,84+97,20, &paf->staticstep, 1.0, 100.0, 10, 0, "");
 
1762
                                uiDefButS(block, NUM, REDRAWVIEW3D, "Step:",    644,146,84+97,20, &paf->staticstep, 1.0, 100.0, 10, 0, "For static duplicators, the Step value skips particles");
1491
1763
                        }
1492
1764
                        else {
1493
1765
                                uiDefButF(block, NUM, B_CALCEFFECT, "Sta:",             644,146,84,20, &paf->sta, -250.0, 9000.0, 100, 0, "Specify the startframe");
1494
1766
                                uiDefButF(block, NUM, B_CALCEFFECT, "End:",             731,146,97,20, &paf->end, 1.0, 9000.0, 100, 0, "Specify the endframe");
1495
1767
                        }
1496
1768
                        uiDefButF(block, NUM, B_CALCEFFECT, "Life:",            831,146,88,20, &paf->lifetime, 1.0, 9000.0, 100, 0, "Specify the life span of the particles");
1497
 
                        uiDefButI(block, NUM, B_CALCEFFECT, "Keys:",            922,146,80,20, &paf->totkey, 1.0, 32.0, 0, 0, "Specify the number of key positions");
 
1769
                        uiDefButI(block, NUM, B_CALCEFFECT, "Keys:",            922,146,80,20, &paf->totkey, 1.0, 100.0, 0, 0, "Specify the number of key positions");
1498
1770
                        
1499
1771
                        uiDefButS(block, NUM, B_REDR,           "CurMul:",              550,124,91,20, &paf->curmult, 0.0, 3.0, 0, 0, "Multiply the particles");
1500
1772
                        uiDefButS(block, NUM, B_CALCEFFECT, "Mat:",                     644,124,84,20, paf->mat+paf->curmult, 1.0, 8.0, 0, 0, "Specify the material used for the particles");
1523
1795
                        uiBlockBeginAlign(block);
1524
1796
                        uiDefButF(block, NUM, B_CALCEFFECT, "X:",               550,31,72,20, paf->force, -1.0, 1.0, 1, 0, "Specify the X axis of a continues force");
1525
1797
                        uiDefButF(block, NUM, B_CALCEFFECT, "Y:",               624,31,78,20, paf->force+1,-1.0, 1.0, 1, 0, "Specify the Y axis of a continues force");
1526
 
                        uiDefBut(block, LABEL, 0, "Force:",                             550,9,72,20, 0, 1.0, 0, 0, 0, "");
 
1798
                        uiDefBut(block, LABEL, 0, "Force:",                             550,9,72,20, NULL, 1.0, 0, 0, 0, "");
1527
1799
                        uiDefButF(block, NUM, B_CALCEFFECT, "Z:",               623,9,79,20, paf->force+2, -1.0, 1.0, 1, 0, "Specify the Z axis of a continues force");
1528
1800
 
1529
1801
                        uiBlockBeginAlign(block);
1530
1802
                        uiDefButF(block, NUM, B_CALCEFFECT, "X:",               722,31,74,20, paf->defvec, -1.0, 1.0, 1, 0, "Specify the X axis of a force, determined by the texture");
1531
1803
                        uiDefButF(block, NUM, B_CALCEFFECT, "Y:",               798,31,74,20, paf->defvec+1,-1.0, 1.0, 1, 0, "Specify the Y axis of a force, determined by the texture");
1532
 
                        uiDefBut(block, LABEL, 0, "Texture:",                   722,9,74,20, 0, 1.0, 0, 0, 0, "");
 
1804
                        uiDefBut(block, LABEL, 0, "Texture:",                   722,9,74,20, NULL, 1.0, 0, 0, 0, "");
1533
1805
                        uiDefButF(block, NUM, B_CALCEFFECT, "Z:",               797,9,75,20, paf->defvec+2, -1.0, 1.0, 1, 0, "Specify the Z axis of a force, determined by the texture");
1534
1806
                        uiBlockEndAlign(block);
1535
1807
 
1536
1808
                        uiDefButS(block, ROW, B_CALCEFFECT, "Int",              875,9,32,43, &paf->texmap, 14.0, 0.0, 0, 0, "Use texture intensity as a factor for texture force");
1537
1809
 
1538
1810
                        uiBlockBeginAlign(block);
1539
 
                        uiDefButS(block, ROW, B_CALCEFFECT, "RGB",              911,31,45,20, &paf->texmap, 14.0, 1.0, 0, 0, "Use RGB values as a factor for particle speed");
1540
 
                        uiDefButS(block, ROW, B_CALCEFFECT, "Grad",             958,31,44,20, &paf->texmap, 14.0, 2.0, 0, 0, "Use texture gradient as a factor for particle speed");
1541
 
                        uiDefButF(block, NUM, B_CALCEFFECT, "Nabla:",           911,9,91,20, &paf->nabla, 0.0001, 1.0, 1, 0, "Specify the dimension of the area for gradient calculation");
 
1811
                        uiDefButS(block, ROW, B_CALCEFFECT, "RGB",              911,31,45,20, &paf->texmap, 14.0, 1.0, 0, 0, "Use RGB values as a factor for particle speed vector");
 
1812
                        uiDefButS(block, ROW, B_CALCEFFECT, "Grad",             958,31,44,20, &paf->texmap, 14.0, 2.0, 0, 0, "Use texture gradient as a factor for particle speed vector");
 
1813
                        uiDefButF(block, NUM, B_CALCEFFECT, "Nabla:",           911,9,91,20, &paf->nabla, 0.0001f, 1.0, 1, 0, "Specify the dimension of the area for gradient calculation");
1542
1814
 
1543
1815
                }
1544
1816
        }
1545
1817
}
1546
1818
 
1547
 
static void object_panel_anim(Object *ob)
1548
 
{
1549
 
        uiBlock *block;
1550
 
        char str[32];
1551
 
        
1552
 
        block= uiNewBlock(&curarea->uiblocks, "object_panel_anim", UI_EMBOSS, UI_HELV, curarea->win);
1553
 
        if(uiNewPanel(curarea, block, "Anim settings", "Object", 0, 0, 318, 204)==0) return;
1554
 
        
1555
 
        uiBlockBeginAlign(block);
1556
 
        uiDefButC(block, ROW,REDRAWVIEW3D,"TrackX",     27,190,58,19, &ob->trackflag, 12.0, 0.0, 0, 0, "Specify the axis that points to another object");
1557
 
        uiDefButC(block, ROW,REDRAWVIEW3D,"Y",          85,190,19,19, &ob->trackflag, 12.0, 1.0, 0, 0, "Specify the axis that points to another object");
1558
 
        uiDefButC(block, ROW,REDRAWVIEW3D,"Z",          104,190,19,19, &ob->trackflag, 12.0, 2.0, 0, 0, "Specify the axis that points to another object");
1559
 
        uiDefButC(block, ROW,REDRAWVIEW3D,"-X",         124,190,24,19, &ob->trackflag, 12.0, 3.0, 0, 0, "Specify the axis that points to another object");
1560
 
        uiDefButC(block, ROW,REDRAWVIEW3D,"-Y",         150,190,24,19, &ob->trackflag, 12.0, 4.0, 0, 0, "Specify the axis that points to another object");
1561
 
        uiDefButC(block, ROW,REDRAWVIEW3D,"-Z",         177,190,24,19, &ob->trackflag, 12.0, 5.0, 0, 0, "Specify the axis that points to another object");
1562
 
        uiBlockBeginAlign(block);
1563
 
        uiDefButC(block, ROW,REDRAWVIEW3D,"UpX",        226,190,45,19, &ob->upflag, 13.0, 0.0, 0, 0, "Specify the axis that points up");
1564
 
        uiDefButC(block, ROW,REDRAWVIEW3D,"Y",          274,190,20,19, &ob->upflag, 13.0, 1.0, 0, 0, "Specify the axis that points up");
1565
 
        uiDefButC(block, ROW,REDRAWVIEW3D,"Z",          297,190,19,19, &ob->upflag, 13.0, 2.0, 0, 0, "Specify the axis that points up");
1566
 
        uiBlockBeginAlign(block);
1567
 
        uiDefButC(block, TOG|BIT|0, REDRAWVIEW3D, "Draw Key",           25,160,70,19, &ob->ipoflag, 0, 0, 0, 0, "Draw object as key position");
1568
 
        uiDefButC(block, TOG|BIT|1, REDRAWVIEW3D, "Draw Key Sel",       97,160,81,19, &ob->ipoflag, 0, 0, 0, 0, "Limit the drawing of object keys");
1569
 
        uiDefButC(block, TOG|BIT|7, REDRAWVIEW3D, "Powertrack",         180,160,78,19, &ob->transflag, 0, 0, 0, 0, "Switch objects rotation off");
1570
 
        uiDefButS(block, TOG|BIT|4, 0, "SlowPar",                                       261,160,56,19, &ob->partype, 0, 0, 0, 0, "Create a delay in the parent relationship");
1571
 
        uiBlockBeginAlign(block);
1572
 
        uiDefButC(block, TOG|BIT|3, REDRAWVIEW3D, "DupliFrames",        24,128,88,19, &ob->transflag, 0, 0, 0, 0, "Make copy of object for every frame");
1573
 
        uiDefButC(block, TOG|BIT|4, REDRAWVIEW3D, "DupliVerts",         114,128,82,19, &ob->transflag, 0, 0, 0, 0, "Duplicate child objects on all vertices");
1574
 
        uiDefButC(block, TOG|BIT|5, REDRAWVIEW3D, "Rot",                200,128,31,19, &ob->transflag, 0, 0, 0, 0, "Rotate dupli according to facenormal");
1575
 
        uiDefButC(block, TOG|BIT|6, REDRAWVIEW3D, "No Speed",   234,128,82,19, &ob->transflag, 0, 0, 0, 0, "Set dupliframes to still, regardless of frame");
1576
 
        uiBlockBeginAlign(block);
1577
 
        uiDefButS(block, NUM, REDRAWVIEW3D, "DupSta:",          24,105,141,19, &ob->dupsta, 1.0, 17999.0, 0, 0, "Specify startframe for Dupliframes");
1578
 
        uiDefButS(block, NUM, REDRAWVIEW3D, "DupOn:",           169,105,146,19, &ob->dupon, 1.0, 1500.0, 0, 0, "");
1579
 
        uiDefButS(block, NUM, REDRAWVIEW3D, "DupEnd",           24,82,140,19, &ob->dupend, 1.0, 18000.0, 0, 0, "Specify endframe for Dupliframes");
1580
 
        uiDefButS(block, NUM, REDRAWVIEW3D, "DupOff",           169,82,145,19, &ob->dupoff, 0.0, 1500.0, 0, 0, "");
1581
 
        uiBlockBeginAlign(block);
1582
 
        uiDefButC(block, TOG|BIT|2, REDRAWALL, "Offs Ob",                       23,51,56,20, &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on its own objectipo");
1583
 
        uiDefButC(block, TOG|BIT|6, REDRAWALL, "Offs Par",                      82,51,56,20 , &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on the parent");
1584
 
        uiDefButC(block, TOG|BIT|7, REDRAWALL, "Offs Particle",         141,51,103,20, &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on the particle effect");
1585
 
        
1586
 
        uiBlockBeginAlign(block);
1587
 
        uiDefButF(block, NUM, REDRAWALL, "TimeOffset:",                 23,17,114,30, &ob->sf, -9000.0, 9000.0, 100, 0, "Specify an offset in frames");
1588
 
        uiDefBut(block, BUT, B_AUTOTIMEOFS, "Automatic Time",   139,17,104,31, 0, 0, 0, 0, 0, "Generate automatic timeoffset values for all selected frames");
1589
 
        uiDefBut(block, BUT, B_PRINTSPEED,      "PrSpeed",                      246,17,67,31, 0, 0, 0, 0, 0, "Print objectspeed");
1590
 
        uiBlockEndAlign(block);
1591
 
        
1592
 
        sprintf(str, "%.4f", prspeed);
1593
 
        uiDefBut(block, LABEL, 0, str,                                                  247,40,63,31, 0, 1.0, 0, 0, 0, "");
1594
 
        
1595
 
}
1596
 
 
1597
1819
void object_panels()
1598
1820
{
1599
1821
        Object *ob;
1605
1827
 
1606
1828
                object_panel_anim(ob);
1607
1829
                object_panel_draw(ob);
 
1830
                object_panel_hooks(ob);
1608
1831
                object_panel_constraint();
1609
 
                if(ob->type==OB_MESH) object_panel_effects(ob);
1610
 
                
 
1832
                if(ob->type==OB_MESH) {
 
1833
                        object_panel_effects(ob);
 
1834
                }
 
1835
                object_panel_deflectors(ob);
 
1836
                object_softbodies(ob);
 
1837
 
1611
1838
                uiClearButLock();
1612
1839
        }
1613
1840
}