SoftBody:

- on add new SoftBody, it creates automatically edges in Mesh now, gives
  too confusing results otherwise
- if no edges exist in mesh, it also doesnt add diagonals for faces in
  softbody

Transform;

- fixed stupid 'used unitialized' gcc warning (sorry theeth!)
- made dualAxisConstraint() accept string too
- little cleanup of prints in using Manipulators
This commit is contained in:
Ton Roosendaal
2005-04-03 20:13:10 +00:00
parent 8d92e6ced2
commit 9ec8778288
6 changed files with 40 additions and 28 deletions

View File

@@ -710,10 +710,13 @@ static void mesh_to_softbody(Object *ob)
BodyPoint *bp;
BodySpring *bs;
float goalfac;
int a;
int a, totedge;
if (ob->softflag & OB_SB_EDGES) totedge= me->totedge;
else totedge= 0;
/* renew ends with ob->soft with points and edges, also checks & makes ob->soft */
renew_softbody(ob, me->totvert, me->totedge);
renew_softbody(ob, me->totvert, totedge);
/* we always make body points */
sb= ob->soft;
@@ -769,14 +772,15 @@ static void mesh_to_softbody(Object *ob)
bs->strength= 1.0;
bs->len= VecLenf( (bp+bs->v1)->origS, (bp+bs->v2)->origS);
}
}
/* insert *diagonal* springs in quads if desired */
if (ob->softflag & OB_SB_QUADS) {
add_mesh_quad_diag_springs(ob);
}
build_bps_springlist(ob); /* big mesh optimization */
/* insert *diagonal* springs in quads if desired */
if (ob->softflag & OB_SB_QUADS) {
add_mesh_quad_diag_springs(ob);
}
build_bps_springlist(ob); /* big mesh optimization */
}
}
}

View File

@@ -71,7 +71,7 @@ struct ScrArea;
struct TransInfo * BIF_GetTransInfo(void);
void BIF_setSingleAxisConstraint(float vec[3], char *text);
void BIF_setDualAxisConstraint(float vec1[3], float vec2[3]);
void BIF_setDualAxisConstraint(float vec1[3], float vec2[3], char *text);
void BIF_drawConstraint(void);
void BIF_drawPropCircle(void);

View File

@@ -1467,6 +1467,11 @@ static void object_softbodies(Object *ob)
if(sb==NULL) {
sb= ob->soft= sbNew();
ob->softflag |= OB_SB_GOAL|OB_SB_EDGES;
// default add edges for softbody
if(ob->type==OB_MESH) {
Mesh *me= ob->data;
if(me->medge==NULL) make_edges(me);
}
}
/* GENERAL STUFF */

View File

@@ -907,9 +907,9 @@ static void createTransEditVerts(void)
TransData *tob = NULL;
EditMesh *em = G.editMesh;
EditVert *eve;
EditVert **nears;
EditVert **nears = NULL;
float mtx[3][3], smtx[3][3];
float *vectors;
float *vectors = NULL;
int count=0, countsel=0;
int propmode = Trans.flag & T_PROP_EDIT;

View File

@@ -600,7 +600,7 @@ void BIF_setSingleAxisConstraint(float vec[3], char *text) {
t->redraw = 1;
}
void BIF_setDualAxisConstraint(float vec1[3], float vec2[3]) {
void BIF_setDualAxisConstraint(float vec1[3], float vec2[3], char *text) {
TransInfo *t = BIF_GetTransInfo();
float space[3][3];
@@ -613,6 +613,9 @@ void BIF_setDualAxisConstraint(float vec1[3], float vec2[3]) {
t->con.mode = (CON_AXIS0|CON_AXIS1|CON_APPLY);
getConstraintMatrix(t);
/* start copying with an offset of 1, to reserve a spot for the SPACE char */
if(text) strncpy(t->con.text+1, text, 48); // 50 in struct
t->con.drawExtra = NULL;
t->con.applyVec = applyAxisConstraintVec;
t->con.applySize = applyAxisConstraintSize;

View File

@@ -2030,28 +2030,28 @@ int BIF_do_manipulator(ScrArea *sa)
case MAN_TRANS_X:
if(G.qual & LR_SHIFTKEY) {
drawflags= MAN_TRANS_Y|MAN_TRANS_Z;
BIF_setDualAxisConstraint(v3d->twmat[1], v3d->twmat[2]);
BIF_setDualAxisConstraint(v3d->twmat[1], v3d->twmat[2], " Y+Z");
}
else
BIF_setSingleAxisConstraint(v3d->twmat[0], " dX");
BIF_setSingleAxisConstraint(v3d->twmat[0], " X");
ManipulatorTransform(TFM_TRANSLATION);
break;
case MAN_TRANS_Y:
if(G.qual & LR_SHIFTKEY) {
drawflags= MAN_TRANS_X|MAN_TRANS_Z;
BIF_setDualAxisConstraint(v3d->twmat[0], v3d->twmat[2]);
BIF_setDualAxisConstraint(v3d->twmat[0], v3d->twmat[2], " X+Z");
}
else
BIF_setSingleAxisConstraint(v3d->twmat[1], " dY");
BIF_setSingleAxisConstraint(v3d->twmat[1], " Y");
ManipulatorTransform(TFM_TRANSLATION);
break;
case MAN_TRANS_Z:
if(G.qual & LR_SHIFTKEY) {
drawflags= MAN_TRANS_X|MAN_TRANS_Y;
BIF_setDualAxisConstraint(v3d->twmat[0], v3d->twmat[1]);
BIF_setDualAxisConstraint(v3d->twmat[0], v3d->twmat[1], " X+Y");
}
else
BIF_setSingleAxisConstraint(v3d->twmat[2], " dZ");
BIF_setSingleAxisConstraint(v3d->twmat[2], " Z");
ManipulatorTransform(TFM_TRANSLATION);
break;
@@ -2061,41 +2061,41 @@ int BIF_do_manipulator(ScrArea *sa)
case MAN_SCALE_X:
if(G.qual & LR_SHIFTKEY) {
drawflags= MAN_SCALE_Y|MAN_SCALE_Z;
BIF_setDualAxisConstraint(v3d->twmat[1], v3d->twmat[2]);
BIF_setDualAxisConstraint(v3d->twmat[1], v3d->twmat[2], " Y+Z");
}
else
BIF_setSingleAxisConstraint(v3d->twmat[0], " SizeX");
BIF_setSingleAxisConstraint(v3d->twmat[0], " X");
ManipulatorTransform(TFM_RESIZE);
break;
case MAN_SCALE_Y:
if(G.qual & LR_SHIFTKEY) {
drawflags= MAN_SCALE_X|MAN_SCALE_Z;
BIF_setDualAxisConstraint(v3d->twmat[0], v3d->twmat[2]);
BIF_setDualAxisConstraint(v3d->twmat[0], v3d->twmat[2], " X+Z");
}
else
BIF_setSingleAxisConstraint(v3d->twmat[1], " SizeY");
BIF_setSingleAxisConstraint(v3d->twmat[1], " Y");
ManipulatorTransform(TFM_RESIZE);
break;
case MAN_SCALE_Z:
if(G.qual & LR_SHIFTKEY) {
drawflags= MAN_SCALE_X|MAN_SCALE_Y;
BIF_setDualAxisConstraint(v3d->twmat[0], v3d->twmat[1]);
BIF_setDualAxisConstraint(v3d->twmat[0], v3d->twmat[1], " X+Y");
}
else
BIF_setSingleAxisConstraint(v3d->twmat[2], " SizeZ");
BIF_setSingleAxisConstraint(v3d->twmat[2], " Z");
ManipulatorTransform(TFM_RESIZE);
break;
case MAN_ROT_X:
BIF_setSingleAxisConstraint(v3d->twmat[0], " RotX");
BIF_setSingleAxisConstraint(v3d->twmat[0], " X");
ManipulatorTransform(TFM_ROTATION);
break;
case MAN_ROT_Y:
BIF_setSingleAxisConstraint(v3d->twmat[1], " RotY");
BIF_setSingleAxisConstraint(v3d->twmat[1], " Y");
ManipulatorTransform(TFM_ROTATION);
break;
case MAN_ROT_Z:
BIF_setSingleAxisConstraint(v3d->twmat[2], " RotZ");
BIF_setSingleAxisConstraint(v3d->twmat[2], " Z");
ManipulatorTransform(TFM_ROTATION);
break;
case MAN_ROT_T: