forked from bartvdbraak/blender
- It is possible to scale radius of MetaElem again.
- It is possible to change dx, dy and dz params in 3Dview with manipulators or with some shortcuts (S-X, S-Y, S-Z). - User can scale stiffness when green circle is selected. - MetaElem is selected with RMB click at green or red circle, then user can grab or rotate with MetaElem as usual. - Screenshot: http://e-learning.vslib.cz/~hnidek/pics/scale_stiffness.jpg - Captured video: http://e-learning.vslib.cz/~hnidek/captured-videos/scale_stiffness.avi
This commit is contained in:
parent
52b7b978e3
commit
78939c0cc0
@ -198,6 +198,7 @@ typedef struct TransInfo {
|
||||
#define TD_NOACTION 2
|
||||
#define TD_USEQUAT 4
|
||||
#define TD_NOTCONNECTED 8
|
||||
#define TD_SINGLESIZE 16 /* used for scaling of MetaElem->rad */
|
||||
|
||||
void initWarp(TransInfo *t);
|
||||
int Warp(TransInfo *t, short mval[2]);
|
||||
|
@ -48,7 +48,7 @@ typedef struct MetaElem {
|
||||
struct BoundBox *bb; /* Bound Box of MetaElem */
|
||||
int i1,j1,k1, i2,j2,k2; /* corners of Bounding Box in lattice */
|
||||
|
||||
short type, lay, flag, selcol;
|
||||
short type, flag, selcol1, selcol2;
|
||||
float x, y, z; /* Position of centre of MetaElem */
|
||||
float quat[4]; /* Rotation of MetaElem */
|
||||
float expx, expy, expz; /* dx, dy, dz parameters */
|
||||
@ -104,6 +104,7 @@ typedef struct MetaBall {
|
||||
/* ml->flag */
|
||||
#define MB_NEGATIVE 2
|
||||
#define MB_HIDE 8
|
||||
#define MB_SCALE_RAD 16
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -410,7 +410,7 @@ static PyObject *Metaball_addMetaelem( BPy_Metaball * self, PyObject * args )
|
||||
{
|
||||
MetaElem *ml;
|
||||
PyObject *listargs = 0;
|
||||
int type, lay;
|
||||
int type;
|
||||
float x, y, z, rad, s, expx, expy, expz;
|
||||
if( !PyArg_ParseTuple( args, "O", &listargs ) )
|
||||
return ( EXPP_ReturnPyObjError
|
||||
@ -425,7 +425,6 @@ static PyObject *Metaball_addMetaelem( BPy_Metaball * self, PyObject * args )
|
||||
y = PyFloat_AsDouble( PyList_GetItem( listargs, 2 ) );
|
||||
z = PyFloat_AsDouble( PyList_GetItem( listargs, 3 ) );
|
||||
rad = PyFloat_AsDouble( PyList_GetItem( listargs, 4 ) );
|
||||
lay = PyInt_AsLong( PyList_GetItem( listargs, 5 ) );
|
||||
s = PyFloat_AsDouble( PyList_GetItem( listargs, 6 ) );
|
||||
expx = PyFloat_AsDouble( PyList_GetItem( listargs, 7 ) );
|
||||
expy = PyFloat_AsDouble( PyList_GetItem( listargs, 8 ) );
|
||||
@ -438,7 +437,6 @@ static PyObject *Metaball_addMetaelem( BPy_Metaball * self, PyObject * args )
|
||||
ml->y = y;
|
||||
ml->z = z;
|
||||
ml->rad = rad;
|
||||
ml->lay = lay;
|
||||
ml->s = s;
|
||||
ml->flag = SELECT;
|
||||
ml->type = type;
|
||||
|
@ -2980,17 +2980,30 @@ static void drawmball(Object *ob, int dt)
|
||||
|
||||
while(ml) {
|
||||
|
||||
/* draw radius */
|
||||
if(ob==G.obedit) {
|
||||
if(ml->flag & SELECT) cpack(0xA0A0F0);
|
||||
if((ml->flag & SELECT) && (ml->flag & MB_SCALE_RAD)) cpack(0xA0A0F0);
|
||||
else cpack(0x3030A0);
|
||||
|
||||
if(G.f & G_PICKSEL) {
|
||||
ml->selcol= code;
|
||||
ml->selcol1= code;
|
||||
glLoadName(code++);
|
||||
}
|
||||
}
|
||||
drawcircball(&(ml->x), ml->rad, imat);
|
||||
|
||||
/* draw stiffness */
|
||||
if(ob==G.obedit) {
|
||||
if((ml->flag & SELECT) && !(ml->flag & MB_SCALE_RAD)) cpack(0xA0F0A0);
|
||||
else cpack(0x30A030);
|
||||
|
||||
if(G.f & G_PICKSEL) {
|
||||
ml->selcol2= code;
|
||||
glLoadName(code++);
|
||||
}
|
||||
}
|
||||
drawcircball(&(ml->x), ml->rad*atan(ml->s)/M_PI_2, imat);
|
||||
|
||||
ml= ml->next;
|
||||
}
|
||||
}
|
||||
|
@ -177,9 +177,8 @@ void add_primitiveMball(int dummy_argument)
|
||||
ml->quat[2]= 0.0;
|
||||
ml->quat[3]= 0.0;
|
||||
ml->rad= 2.0;
|
||||
ml->lay= 1;
|
||||
ml->s= 2.0;
|
||||
ml->flag= SELECT;
|
||||
ml->flag= SELECT | MB_SCALE_RAD;
|
||||
|
||||
switch(dummy_argument) {
|
||||
case 1:
|
||||
@ -258,13 +257,19 @@ void mouse_mball()
|
||||
if(hits>0) {
|
||||
ml= startelem;
|
||||
while(ml) {
|
||||
/* if(base->lay & G.vd->lay) { */
|
||||
|
||||
for(a=0; a<hits; a++) {
|
||||
/* index converted for gl stuff */
|
||||
if(ml->selcol==buffer[ 4 * a + 3 ]) act= ml;
|
||||
if(ml->selcol1==buffer[ 4 * a + 3 ]){
|
||||
ml->flag |= MB_SCALE_RAD;
|
||||
act= ml;
|
||||
}
|
||||
if(ml->selcol2==buffer[ 4 * a + 3 ]){
|
||||
ml->flag &= ~MB_SCALE_RAD;
|
||||
act= ml;
|
||||
}
|
||||
|
||||
}
|
||||
/* } */
|
||||
|
||||
if(act) break;
|
||||
|
||||
|
@ -1400,7 +1400,14 @@ void borderselect(void)
|
||||
|
||||
while(ml) {
|
||||
for(a=0; a<hits; a++) {
|
||||
if(ml->selcol==buffer[ (4 * a) + 3 ]) {
|
||||
if(ml->selcol1==buffer[ (4 * a) + 3 ]) {
|
||||
ml->flag |= MB_SCALE_RAD;
|
||||
if(val==LEFTMOUSE) ml->flag |= SELECT;
|
||||
else ml->flag &= ~SELECT;
|
||||
break;
|
||||
}
|
||||
if(ml->selcol2==buffer[ (4 * a) + 3 ]) {
|
||||
ml->flag &= ~MB_SCALE_RAD;
|
||||
if(val==LEFTMOUSE) ml->flag |= SELECT;
|
||||
else ml->flag &= ~SELECT;
|
||||
break;
|
||||
|
@ -1021,6 +1021,9 @@ int Resize(TransInfo *t, short mval[2])
|
||||
add_tdi_poin(tdi->sizez, tdi->oldsize+2, vec[2]);
|
||||
|
||||
}
|
||||
else if((td->flag & TD_SINGLESIZE) && !(t->con.mode & CON_APPLY)){
|
||||
*td->val = td->ival * fsize[0] * td->factor;
|
||||
}
|
||||
else {
|
||||
td->ext->size[0] = td->ext->isize[0] * (fsize[0]) * td->factor;
|
||||
td->ext->size[1] = td->ext->isize[1] * (fsize[1]) * td->factor;
|
||||
|
@ -591,7 +591,7 @@ static void createTransMBallVerts(TransInfo *t)
|
||||
VECCOPY(td->iloc, td->loc);
|
||||
VECCOPY(td->center, td->loc);
|
||||
|
||||
if(ml->flag & SELECT) td->flag= TD_SELECTED | TD_USEQUAT;
|
||||
if(ml->flag & SELECT) td->flag= TD_SELECTED | TD_USEQUAT | TD_SINGLESIZE;
|
||||
else td->flag= TD_USEQUAT;
|
||||
|
||||
Mat3CpyMat3(td->smtx, smtx);
|
||||
@ -599,13 +599,24 @@ static void createTransMBallVerts(TransInfo *t)
|
||||
|
||||
td->ext = tx;
|
||||
td->tdi = NULL;
|
||||
td->val = NULL;
|
||||
|
||||
/* Radius of MetaElem (mass of MetaElem influence) */
|
||||
if(ml->flag & MB_SCALE_RAD){
|
||||
td->val = &ml->rad;
|
||||
td->ival = ml->rad;
|
||||
}
|
||||
else{
|
||||
td->val = &ml->s;
|
||||
td->ival = ml->s;
|
||||
}
|
||||
|
||||
/* expx/expy/expz determine "shape" of some MetaElem types */
|
||||
tx->size = &ml->expx;
|
||||
tx->isize[0] = ml->expx;
|
||||
tx->isize[1] = ml->expy;
|
||||
tx->isize[2] = ml->expz;
|
||||
|
||||
/* quat is used for rotation of MetaElem */
|
||||
tx->quat = ml->quat;
|
||||
QUATCOPY(tx->iquat, ml->quat);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user