656
670
uiBlockEndAlign(block);
673
case CONSTRAINT_TYPE_STRETCHTO:
675
bStretchToConstraint *data = con->data;
678
BIF_ThemeColor(curCol);
680
glRects(*xco+3, *yco-height-39, *xco+width+30, *yco-18);
682
uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Target:", *xco+65, *yco-24, 50, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
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");
689
arm = get_armature(data->tar);
691
but=uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "BO:", *xco+120, *yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Subtarget Bone");
694
strcpy (data->subtarget, "");
695
uiBlockEndAlign(block);
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);
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");
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);
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);
659
721
case CONSTRAINT_TYPE_NULL:
927
/* *************** */
930
#include "BLI_editVert.h"
931
extern ListBase editNurb;
933
void do_common_editbuts(unsigned short event) // old name, is a mix of object and editing events....
935
EditMesh *em = G.editMesh;
945
int a, bit, index= -1;
950
if(G.obedit && G.obedit->actcol>0) {
951
if(G.obedit->type == OB_MESH) {
952
evl= em->faces.first;
954
if( vlakselectedAND(evl, 1) ) {
955
if(index== -1) index= evl->mat_nr;
956
else if(index!=evl->mat_nr) {
957
error("Mixed colors");
964
else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
967
if( isNurbsel(nu) ) {
968
if(index== -1) index= nu->mat_nr;
969
else if(index!=nu->mat_nr) {
970
error("Mixed colors");
978
G.obedit->actcol= index+1;
979
scrarea_queue_winredraw(curarea);
984
new_material_to_objectdata((G.scene->basact) ? (G.scene->basact->object) : 0);
985
scrarea_queue_winredraw(curarea);
986
allqueue(REDRAWVIEW3D_Z, 0);
989
delete_material_index();
990
scrarea_queue_winredraw(curarea);
991
allqueue(REDRAWVIEW3D_Z, 0);
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;
999
if( vlakselectedAND(evl, 1) )
1000
evl->mat_nr= G.obedit->actcol-1;
1003
allqueue(REDRAWVIEW3D_Z, 0);
1004
makeDispList(G.obedit);
1006
else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
1010
nu->mat_nr= G.obedit->actcol-1;
1019
if(G.obedit->type == OB_MESH) {
1020
if (event==B_MATSEL) {
1021
editmesh_select_by_material(G.obedit->actcol-1);
1023
editmesh_deselect_by_material(G.obedit->actcol-1);
1025
allqueue(REDRAWVIEW3D, 0);
1027
else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
1030
if(nu->mat_nr==G.obedit->actcol-1) {
1036
if(event==B_MATSEL) {
1051
a= nu->pntsu*nu->pntsv;
1055
if(event==B_MATSEL) bp->f1 |= 1;
1064
allqueue(REDRAWVIEW3D, 0);
1070
if(G.obedit->type == OB_MESH) hide_mesh(0);
1071
else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) hideNurb(0);
1076
if(G.obedit->type == OB_MESH) reveal_mesh();
1077
else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) revealNurb();
1079
else if(G.f & G_FACESELECT) reveal_tface();
1084
if(G.obedit->type == OB_MESH) selectswap_mesh();
1085
else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) selectswapNurb();
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);
1102
case B_DOCENTRECURSOR:
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");
1113
if( vlakselectedAND(evl, 1) ) {
1114
if(event==B_SETSMOOTH) evl->flag |= ME_SMOOTH;
1115
else evl->flag &= ~ME_SMOOTH;
1120
makeDispList(G.obedit);
1121
allqueue(REDRAWVIEW3D, 0);
1127
if(event==B_SETSMOOTH) nu->flag |= ME_SMOOTH;
1128
else nu->flag &= ~ME_SMOOTH;
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);
1144
else if ELEM(base->object->type, OB_SURF, OB_CURVE) {
1145
cu= base->object->data;
1148
if(event==B_SETSMOOTH) nu->flag |= ME_SMOOTH;
1149
else nu->flag &= ~ME_SMOOTH;
1156
allqueue(REDRAWVIEW3D, 0);
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) {
1166
BASACT->lay= 1<<bit;
1167
scrarea_queue_winredraw(curarea);
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);
1175
OBACT->lay= BASACT->lay;
1181
1009
void object_panel_draw(Object *ob)
1183
1011
uiBlock *block;
1053
void object_panel_hooks(Object *ob)
1057
int tothook=0, nr, active;
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;
1064
if(ob->hooks.first==NULL) {
1065
uiDefBut(block, LABEL, 0, "Add hooks in Editmode", 10,180,300,19, NULL, 0, 0, 0, 0, "");
1070
for(hook= ob->hooks.first; hook; hook= hook->next) tothook++;
1072
cp= MEM_callocN(32*tothook+32, "temp string");
1073
strcpy(cp, "Active Hook %t|");
1075
for(hook= ob->hooks.first; hook; hook= hook->next) {
1076
strcat(cp, hook->name);
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;
1084
uiBlockBeginAlign(block);
1085
uiDefButS(block, MENU, B_REDR, cp, 10,180,150,19, &hook->active, 0, 0, 0, 0, "Set active hook");
1088
for(nr=1, hook= ob->hooks.first; hook; hook= hook->next, nr++) {
1089
if(nr==active) break;
1091
if(hook==NULL) printf("error in object_panel_hooks\n");
1093
uiDefBut(block, TEX, B_REDR, "Name: ", 160,180,150,19, hook->name, 0, 31, 0, 0, "Set name of hook");
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);
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");
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");
1107
static void softbody_bake(Object *ob)
1109
SoftBody *sb= ob->soft;
1111
float frameleno= G.scene->r.framelen;
1113
unsigned short event=0;
1116
G.scene->r.framelen= 1.0; // baking has to be in uncorrected time
1118
sbObjectToSoftbody(ob);
1119
ob->softflag |= OB_SB_BAKEDO;
1121
curarea->win_swap= 0; // clean swapbuffers
1123
for(; CFRA <= sb->efra; CFRA++) {
1124
set_timecursor(CFRA);
1126
update_for_newframe_muted();
1128
for(sa= G.curscreen->areabase.first; sa; sa= sa->next) {
1129
if(sa->spacetype == SPACE_VIEW3D) {
1130
scrarea_do_windraw(sa);
1133
screen_swapbuffers();
1137
event= extern_qread(&val);
1138
if(event==ESCKEY) break;
1140
if(event==ESCKEY) break;
1143
if(event==ESCKEY) sbObjectToSoftbody(ob); // clears all
1147
ob->softflag &= ~OB_SB_BAKEDO;
1149
G.scene->r.framelen= frameleno;
1150
update_for_newframe_muted();
1151
allqueue(REDRAWVIEW3D, 0);
1152
allqueue(REDRAWBUTSOBJECT, 0);
1228
1156
void do_object_panels(unsigned short event)
1167
if(ob && ob->parent && ob->parent->type==OB_CURVE) freedisplist(&ob->disp);
1168
allqueue(REDRAWVIEW3D, 0);
1171
hook= ob->hooks.first;
1173
int active= hook->active, nr;
1174
for(nr=1, hook=ob->hooks.first; hook; hook=hook->next, nr++) {
1175
if(active==nr) break;
1178
BLI_remlink(&ob->hooks, hook);
1179
if(hook->indexar) MEM_freeN(hook->indexar);
1182
freedisplist(&ob->disp);
1183
BIF_undo_push("Delete hook");
1184
allqueue(REDRAWVIEW3D, 0);
1185
allqueue(REDRAWBUTSOBJECT, 0);
1189
hook= ob->hooks.first;
1191
int active= hook->active, nr;
1192
for(nr=1, hook=ob->hooks.first; hook; hook=hook->next, nr++) {
1193
if(active==nr) break;
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);
1206
calc_curvepath(OBACT);
1207
allqueue(REDRAWVIEW3D, 0);
1215
where_is_object(ob);
1216
VECCOPY(vec, ob->obmat[3]);
1219
where_is_object(ob);
1220
VecSubf(vec, vec, ob->obmat[3]);
1221
prspeed= Normalise(vec);
1222
scrarea_queue_winredraw(curarea);
1227
if(ob && ob->type==OB_CURVE) {
1230
if(cu->path) prlen= cu->path->totdist; else prlen= -1.0;
1231
scrarea_queue_winredraw(curarea);
1235
allspace(REMAKEIPO, 0);
1236
allqueue(REDRAWBUTSOBJECT, 0);
1237
allqueue(REDRAWIPO, 0);
1240
curve_changes_other_objects(OBACT);
1241
allqueue(REDRAWVIEW3D, 0);
1244
case B_SOFTBODY_CHANGE:
1247
ob->softflag |= OB_SB_REDO;
1248
allqueue(REDRAWBUTSOBJECT, 0);
1249
allqueue(REDRAWVIEW3D, 0);
1252
case B_SOFTBODY_DEL_VG:
1254
if(ob && ob->soft) {
1255
ob->soft->vertgroup= 0;
1256
ob->softflag |= OB_SB_REDO;
1257
allqueue(REDRAWBUTSOBJECT, 0);
1258
allqueue(REDRAWVIEW3D, 0);
1261
case B_SOFTBODY_BAKE:
1263
if(ob && ob->soft) softbody_bake(ob);
1265
case B_SOFTBODY_BAKE_FREE:
1267
if(ob && ob->soft) sbObjectToSoftbody(ob);
1268
allqueue(REDRAWBUTSOBJECT, 0);
1269
allqueue(REDRAWVIEW3D, 0);
1273
if(event>=B_SELEFFECT && event<B_SELEFFECT+MAX_EFFECT) {
1278
eff= ob->effect.first;
1280
if(event==a) eff->flag |= SELECT;
1281
else eff->flag &= ~SELECT;
1286
allqueue(REDRAWBUTSOBJECT, 0);
1293
static void object_panel_anim(Object *ob)
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;
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");
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);
1338
sprintf(str, "%.4f", prspeed);
1339
uiDefBut(block, LABEL, 0, str, 247,40,63,31, NULL, 1.0, 0, 0, 0, "");
1343
void do_effects_panels(unsigned short event)
1232
1347
Effect *eff, *effn;
1489
/* Panel for particle interaction settings */
1490
static void object_panel_deflectors(Object *ob)
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;
1498
/* should become button, option? */
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;
1508
PartDeflect *pd= ob->pd;
1510
uiDefBut(block, LABEL, 0, "Fields", 10,180,140,20, NULL, 0.0, 0, 0, 0, "");
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");
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)");
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);
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, "");
1534
uiDefBut(block, LABEL, 0, "Deflection", 160,180,140,20, NULL, 0.0, 0, 0, 0, "");
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, "");
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);
1547
uiDefBut(block, LABEL, 0, "Soft Body", 160,60,150,20, NULL, 0.0, 0, 0, 0, "");
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");
1559
/* Panel for softbodies */
1561
static void object_softbodies(Object *ob)
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;
1569
/* do not allow to combine with force fields */
1571
PartDeflect *pd= ob->pd;
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;
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
1585
if(ob->softflag & OB_SB_ENABLE) {
1586
SoftBody *sb= ob->soft;
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) {
1596
if(me->medge==NULL) make_edges(me);
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");
1602
if(sb->keys) uiSetButLock(1, "SoftBody is baked, free it first");
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");
1612
uiBlockBeginAlign(block);
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, "");
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");
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);
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");
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");
1643
bDeformGroup *defGroup = BLI_findlink(&ob->defbase, sb->vertgroup-1);
1645
uiDefBut(block, BUT, B_DIFF, defGroup->name, 160,100,130,20, NULL, 0.0, 0.0, 0, 0, "Name of current vertex group");
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");
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");
1653
MEM_freeN (menustr);
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);
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);
1670
uiBlockEndAlign(block);
1405
1674
void object_panel_effects(Object *ob)
1482
1751
paf= (PartEff *)eff;
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");
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");
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");
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");
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");
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);
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");
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");
1547
static void object_panel_anim(Object *ob)
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;
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");
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);
1592
sprintf(str, "%.4f", prspeed);
1593
uiDefBut(block, LABEL, 0, str, 247,40,63,31, 0, 1.0, 0, 0, 0, "");
1597
1819
void object_panels()