forked from bartvdbraak/blender
- improved polygonization (linear interpolation) of Implicit Surfaces (Meta)
- added new MetaElem types (plane, elipsoid and cube) old TubeX, TubeY and TubeZ will not be supported - new buttons in Edit button window (dx, dy, dz) - added new items into the headers menu and toolbox menu more details at: http://blender.webpark.cz
This commit is contained in:
parent
a09e5a7f2f
commit
5d2f98f440
@ -73,8 +73,6 @@
|
||||
|
||||
/* Functions */
|
||||
|
||||
|
||||
|
||||
void unlink_mball(MetaBall *mb)
|
||||
{
|
||||
int a;
|
||||
@ -91,11 +89,12 @@ void unlink_mball(MetaBall *mb)
|
||||
/* do not free mball itself */
|
||||
void free_mball(MetaBall *mb)
|
||||
{
|
||||
|
||||
MetaElem *ml;
|
||||
unlink_mball(mb);
|
||||
|
||||
if(mb->mat) MEM_freeN(mb->mat);
|
||||
if(mb->bb) MEM_freeN(mb->bb);
|
||||
/* free bounding boxes of MetaElems */
|
||||
BLI_freelistN(&mb->elems);
|
||||
if(mb->disp.first) freedisplist(&mb->disp);
|
||||
}
|
||||
@ -184,7 +183,6 @@ void make_local_mball(MetaBall *mb)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void tex_space_mball(Object *ob)
|
||||
{
|
||||
DispList *dl;
|
||||
@ -407,11 +405,11 @@ typedef struct process { /* parameters, function, storage */
|
||||
* for some reason */
|
||||
|
||||
void freepolygonize(PROCESS *p);
|
||||
void docube(CUBE *cube, PROCESS *p);
|
||||
void docube(CUBE *cube, PROCESS *p, MetaBall *mb);
|
||||
void testface(int i, int j, int k, CUBE* old,
|
||||
int bit, int c1, int c2, int c3, int c4, PROCESS *p);
|
||||
CORNER *setcorner (PROCESS* p, int i, int j, int k);
|
||||
int vertid (CORNER *c1, CORNER *c2, PROCESS *p);
|
||||
int vertid (CORNER *c1, CORNER *c2, PROCESS *p, MetaBall *mb);
|
||||
int setcenter(CENTERLIST *table[], int i, int j, int k);
|
||||
int otherface (int edge, int face);
|
||||
void makecubetable (void);
|
||||
@ -425,14 +423,16 @@ int getedge (EDGELIST *table[],
|
||||
int i2, int j2, int k2);
|
||||
void addtovertices (VERTICES *vertices, VERTEX v);
|
||||
void vnormal (MB_POINT *point, PROCESS *p, MB_POINT *v);
|
||||
void converge (MB_POINT *p1, MB_POINT *p2, float v,
|
||||
float (*function)(float, float, float), MB_POINT *p);
|
||||
void polygonize(PROCESS *mbproc);
|
||||
void converge (MB_POINT *p1, MB_POINT *p2, float v1, float v2,
|
||||
float (*function)(float, float, float), MB_POINT *p, MetaBall *mb);
|
||||
void polygonize(PROCESS *mbproc, MetaBall *mb);
|
||||
float init_meta(Object *ob);
|
||||
|
||||
/* **************** METABALL ************************ */
|
||||
|
||||
/* void converge (MB_POINT *p1, MB_POINT *p2, float v, float (*function)(void), MB_POINT *p); */
|
||||
float thresh= 0.6f;
|
||||
int totelem=0;
|
||||
MetaElem **mainb;
|
||||
|
||||
void calc_mballco(MetaElem *ml, float *vec)
|
||||
{
|
||||
@ -441,11 +441,6 @@ void calc_mballco(MetaElem *ml, float *vec)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
float thresh= 0.6f;
|
||||
int totelem=0;
|
||||
MetaElem **mainb;
|
||||
|
||||
float densfunc(MetaElem *ball, float x, float y, float z)
|
||||
{
|
||||
float dist2 = 0.0, dx, dy, dz;
|
||||
@ -467,48 +462,66 @@ float densfunc(MetaElem *ball, float x, float y, float z)
|
||||
}
|
||||
|
||||
if(ball->type==MB_BALL) {
|
||||
dist2= (dx*dx + dy*dy + dz*dz);
|
||||
}
|
||||
else if(ball->type & MB_TUBEZ) {
|
||||
if(ball->type==MB_TUBEZ) {
|
||||
if( dz > ball->len) dz-= ball->len;
|
||||
else if(dz< -ball->len) dz+= ball->len;
|
||||
else dz= 0.0;
|
||||
}
|
||||
else if(ball->type==MB_TUBEY) {
|
||||
if( dy > ball->len) dy-= ball->len;
|
||||
else if(dy< -ball->len) dy+= ball->len;
|
||||
else dy= 0.0;
|
||||
}
|
||||
else {
|
||||
if( dx > ball->len) dx-= ball->len;
|
||||
else if(dx< -ball->len) dx+= ball->len;
|
||||
else dx= 0.0;
|
||||
}
|
||||
dist2= (dx*dx + dy*dy + dz*dz);
|
||||
else if(ball->type==MB_TUBEX) {
|
||||
if( dx > ball->len) dx-= ball->len;
|
||||
else if(dx< -ball->len) dx+= ball->len;
|
||||
else dx= 0.0;
|
||||
}
|
||||
/* else if(ball->type==MB_CIRCLE) { */
|
||||
/* dist2= 0.5-dz; */
|
||||
/* } */
|
||||
else if(ball->type==MB_TUBEY) {
|
||||
if( dy > ball->len) dy-= ball->len;
|
||||
else if(dy< -ball->len) dy+= ball->len;
|
||||
else dy= 0.0;
|
||||
}
|
||||
else if(ball->type==MB_TUBEZ) {
|
||||
if( dz > ball->len) dz-= ball->len;
|
||||
else if(dz< -ball->len) dz+= ball->len;
|
||||
else dz= 0.0;
|
||||
}
|
||||
else if(ball->type==MB_TUBE) {
|
||||
if( dx > ball->expx) dx-= ball->expx;
|
||||
else if(dx< -ball->expx) dx+= ball->expx;
|
||||
else dx= 0.0;
|
||||
}
|
||||
else if(ball->type==MB_PLANE) {
|
||||
if( dx > ball->expx) dx-= ball->expx;
|
||||
else if(dx< -ball->expx) dx+= ball->expx;
|
||||
else dx= 0.0;
|
||||
if( dy > ball->expy) dy-= ball->expy;
|
||||
else if(dy< -ball->expy) dy+= ball->expy;
|
||||
else dy= 0.0;
|
||||
}
|
||||
else if(ball->type==MB_ELIPSOID) {
|
||||
dx *= 1/ball->expx;
|
||||
dy *= 1/ball->expy;
|
||||
dz *= 1/ball->expz;
|
||||
}
|
||||
else if(ball->type==MB_CUBE) {
|
||||
if( dx > ball->expx) dx-= ball->expx;
|
||||
else if(dx< -ball->expx) dx+= ball->expx;
|
||||
else dx= 0.0;
|
||||
if( dy > ball->expy) dy-= ball->expy;
|
||||
else if(dy< -ball->expy) dy+= ball->expy;
|
||||
else dy= 0.0;
|
||||
if( dz > ball->expz) dz-= ball->expz;
|
||||
else if(dz< -ball->expz) dz+= ball->expz;
|
||||
else dz= 0.0;
|
||||
}
|
||||
|
||||
dist2= (dx*dx + dy*dy + dz*dz);
|
||||
|
||||
if(ball->flag & MB_NEGATIVE) {
|
||||
|
||||
dist2= 1.0f-(dist2/ball->rad2);
|
||||
if(dist2 < 0.0) return 0.5f;
|
||||
|
||||
return 0.5f-ball->s*dist2*dist2*dist2;
|
||||
|
||||
}
|
||||
else {
|
||||
dist2= 1.0f-(dist2/ball->rad2);
|
||||
if(dist2 < 0.0) return -0.5f;
|
||||
|
||||
return ball->s*dist2*dist2*dist2 -0.5f;
|
||||
|
||||
/* return ball->s*sin( dist2); */
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -668,7 +681,7 @@ static int rightface[12] = {
|
||||
|
||||
/* docube: triangulate the cube directly, without decomposition */
|
||||
|
||||
void docube(CUBE *cube, PROCESS *p)
|
||||
void docube(CUBE *cube, PROCESS *p, MetaBall *mb)
|
||||
{
|
||||
INTLISTS *polys;
|
||||
CORNER *c1, *c2;
|
||||
@ -685,7 +698,7 @@ void docube(CUBE *cube, PROCESS *p)
|
||||
c1 = cube->corners[corner1[edges->i]];
|
||||
c2 = cube->corners[corner2[edges->i]];
|
||||
|
||||
indexar[count] = vertid(c1, c2, p);
|
||||
indexar[count] = vertid(c1, c2, p, mb);
|
||||
count++;
|
||||
}
|
||||
if(count>2) {
|
||||
@ -1104,7 +1117,7 @@ void vnormal (MB_POINT *point, PROCESS *p, MB_POINT *v)
|
||||
}
|
||||
|
||||
|
||||
int vertid (CORNER *c1, CORNER *c2, PROCESS *p)
|
||||
int vertid (CORNER *c1, CORNER *c2, PROCESS *p, MetaBall *mb)
|
||||
{
|
||||
VERTEX v;
|
||||
MB_POINT a, b;
|
||||
@ -1118,7 +1131,7 @@ int vertid (CORNER *c1, CORNER *c2, PROCESS *p)
|
||||
b.y = c2->y;
|
||||
b.z = c2->z;
|
||||
|
||||
converge(&a, &b, c1->value, p->function, &v.position); /* position */
|
||||
converge(&a, &b, c1->value, c2->value, p->function, &v.position, mb); /* position */
|
||||
vnormal(&v.position, p, &v.normal);
|
||||
|
||||
addtovertices(&p->vertices, v); /* save vertex */
|
||||
@ -1134,20 +1147,87 @@ int vertid (CORNER *c1, CORNER *c2, PROCESS *p)
|
||||
/* converge: from two points of differing sign, converge to zero crossing */
|
||||
/* watch it: p1 and p2 are used to calculate */
|
||||
|
||||
void converge (MB_POINT *p1, MB_POINT *p2, float v,
|
||||
float (*function)(float, float, float), MB_POINT *p)
|
||||
void converge (MB_POINT *p1, MB_POINT *p2, float v1, float v2,
|
||||
float (*function)(float, float, float), MB_POINT *p, MetaBall *mb)
|
||||
{
|
||||
int i = 0;
|
||||
MB_POINT *pos, *neg;
|
||||
float positive = 0.0f, negative = 0.0f;
|
||||
float dx = 0.0f ,dy = 0.0f ,dz = 0.0f;
|
||||
|
||||
if (v < 0) {
|
||||
if (v1 < 0) {
|
||||
pos= p2;
|
||||
neg= p1;
|
||||
positive = v2;
|
||||
negative = v1;
|
||||
}
|
||||
else {
|
||||
pos= p1;
|
||||
neg= p2;
|
||||
positive = v1;
|
||||
negative = v2;
|
||||
}
|
||||
|
||||
dx = pos->x - neg->x;
|
||||
dy = pos->y - neg->y;
|
||||
dz = pos->z - neg->z;
|
||||
|
||||
/* Aproximation by linear interpolation is faster then binary subdivision,
|
||||
* but it results sometimes (mb->thresh < 0.2) into the strange results */
|
||||
if(mb->thresh >0.2){
|
||||
/*if(mb->flag == MB_UPDATE_LINEAR) ... next possibility of Update*/
|
||||
if((dy == 0.0f) && (dz == 0.0f)){
|
||||
p->x = neg->x - negative*dx/(positive-negative);
|
||||
p->y = neg->y;
|
||||
p->z = neg->z;
|
||||
return;
|
||||
}
|
||||
if((dx == 0.0f) && (dz == 0.0f)){
|
||||
p->x = neg->x;
|
||||
p->y = neg->y - negative*dy/(positive-negative);
|
||||
p->z = neg->z;
|
||||
return;
|
||||
}
|
||||
if((dx == 0.0f) && (dy == 0.0f)){
|
||||
p->x = neg->x;
|
||||
p->y = neg->y;
|
||||
p->z = neg->z - negative*dz/(positive-negative);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*if(mb->thresh <= 0.2) then surface vertex is computed by binary subdivision*/
|
||||
if((dy == 0.0f) && (dz == 0.0f)){
|
||||
p->y = neg->y;
|
||||
p->z = neg->z;
|
||||
while (1) {
|
||||
p->x = 0.5f*(pos->x + neg->x);
|
||||
if (i++ == RES) return;
|
||||
if ((function(p->x,p->y,p->z)) > 0.0) pos->x = p->x; else neg->x = p->x;
|
||||
}
|
||||
}
|
||||
|
||||
if((dx == 0.0f) && (dz == 0.0f)){
|
||||
p->x = neg->x;
|
||||
p->z = neg->z;
|
||||
while (1) {
|
||||
p->y = 0.5f*(pos->y + neg->y);
|
||||
if (i++ == RES) return;
|
||||
if ((function(p->x,p->y,p->z)) > 0.0) pos->y = p->y; else neg->y = p->y;
|
||||
}
|
||||
}
|
||||
|
||||
if((dx == 0.0f) && (dy == 0.0f)){
|
||||
p->x = neg->x;
|
||||
p->y = neg->y;
|
||||
while (1) {
|
||||
p->z = 0.5f*(pos->z + neg->z);
|
||||
if (i++ == RES) return;
|
||||
if ((function(p->x,p->y,p->z)) > 0.0) pos->z = p->z; else neg->z = p->z;
|
||||
}
|
||||
}
|
||||
|
||||
/* This is necessary to find start point */
|
||||
while (1) {
|
||||
p->x = 0.5f*(pos->x + neg->x);
|
||||
p->y = 0.5f*(pos->y + neg->y);
|
||||
@ -1155,23 +1235,22 @@ void converge (MB_POINT *p1, MB_POINT *p2, float v,
|
||||
|
||||
if (i++ == RES) return;
|
||||
|
||||
if ((function(p->x, p->y, p->z)) > 0.0) {
|
||||
if ((function(p->x, p->y, p->z)) > 0.0){
|
||||
pos->x = p->x;
|
||||
pos->y = p->y;
|
||||
pos->z = p->z;
|
||||
}
|
||||
else {
|
||||
else{
|
||||
neg->x = p->x;
|
||||
neg->y = p->y;
|
||||
neg->z = p->z;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ************************************** */
|
||||
|
||||
|
||||
void polygonize(PROCESS *mbproc)
|
||||
void polygonize(PROCESS *mbproc, MetaBall *mb)
|
||||
{
|
||||
MB_POINT in, out;
|
||||
CUBE c;
|
||||
@ -1203,7 +1282,7 @@ void polygonize(PROCESS *mbproc)
|
||||
out.z= in.z + 2.0f*mainb[a]->rad;
|
||||
calc_mballco(mainb[a], (float *)&out);
|
||||
|
||||
converge(&in, &out, -1.0, mbproc->function, &mbproc->start);
|
||||
converge(&in, &out, -1.0, 1.0, mbproc->function, &mbproc->start, mb);
|
||||
|
||||
/* NEW1: make sure correct starting position */
|
||||
i= (int)floor(mbproc->start.x/mbproc->size );
|
||||
@ -1316,7 +1395,7 @@ void polygonize(PROCESS *mbproc)
|
||||
c = mbproc->cubes->cube;
|
||||
|
||||
/* polygonize the cube directly: */
|
||||
docube(&c, mbproc);
|
||||
docube(&c, mbproc, mb);
|
||||
|
||||
/* pop current cube from stack */
|
||||
mbproc->cubes = mbproc->cubes->next;
|
||||
@ -1403,6 +1482,7 @@ float init_meta(Object *ob) /* return totsize */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* totsize (= 'manhattan' radius) */
|
||||
totsize= 0.0;
|
||||
for(a=0; a<totelem; a++) {
|
||||
@ -1411,10 +1491,6 @@ float init_meta(Object *ob) /* return totsize */
|
||||
vec[1]= mainb[a]->y + mainb[a]->rad;
|
||||
vec[2]= mainb[a]->z + mainb[a]->rad;
|
||||
|
||||
if(mainb[a]->type==MB_TUBEX) vec[0]+= mainb[a]->len;
|
||||
if(mainb[a]->type==MB_TUBEY) vec[1]+= mainb[a]->len;
|
||||
if(mainb[a]->type==MB_TUBEZ) vec[2]+= mainb[a]->len;
|
||||
|
||||
calc_mballco(mainb[a], vec);
|
||||
|
||||
size= (float)fabs( vec[0] );
|
||||
@ -1486,7 +1562,7 @@ void metaball_polygonize(Object *ob)
|
||||
mbproc.cubes= 0;
|
||||
mbproc.delta = width/(float)(RES*RES);
|
||||
|
||||
polygonize(&mbproc);
|
||||
polygonize(&mbproc, mb);
|
||||
|
||||
MEM_freeN(mainb);
|
||||
|
||||
|
@ -45,8 +45,11 @@ struct Material;
|
||||
typedef struct MetaElem {
|
||||
struct MetaElem *next, *prev;
|
||||
|
||||
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;
|
||||
float x, y, z;
|
||||
float x, y, z; /* Position of centre of MetaElem */
|
||||
float expx, expy, expz;
|
||||
float rad, rad2, s, len, maxrad2;
|
||||
int pad;
|
||||
@ -89,7 +92,10 @@ typedef struct MetaBall {
|
||||
#define MB_TUBEX 1
|
||||
#define MB_TUBEY 2
|
||||
#define MB_TUBEZ 3
|
||||
#define MB_CIRCLE 4
|
||||
#define MB_TUBE 4
|
||||
#define MB_PLANE 5
|
||||
#define MB_ELIPSOID 6
|
||||
#define MB_CUBE 7
|
||||
|
||||
/* ml->flag */
|
||||
#define MB_NEGATIVE 2
|
||||
|
@ -2711,16 +2711,22 @@ void mballbuts(void)
|
||||
|
||||
if(ob==G.obedit && lastelem) {
|
||||
uiDefButF(block, NUMSLI, B_RECALCMBALL, "Stiffness:", 750,178,250,19, &lastelem->s, 0.0, 10.0, 0, 0, "");
|
||||
uiDefButF(block, NUMSLI, B_RECALCMBALL, "Len:", 750,158,250,19, &lastelem->len, 0.0, 20.0, 0, 0, "");
|
||||
if(lastelem->type!=MB_BALL)
|
||||
uiDefButF(block, NUMSLI, B_RECALCMBALL, "dx:", 750,158,250,19, &lastelem->expx, 0.0, 20.0, 0, 0, "");
|
||||
if((lastelem->type!=MB_BALL)&&(lastelem->type!=MB_TUBE))
|
||||
uiDefButF(block, NUMSLI, B_RECALCMBALL, "dy:", 750,138,250,19, &lastelem->expy, 0.0, 20.0, 0, 0, "");
|
||||
|
||||
if((lastelem->type==MB_CUBE)||(lastelem->type==MB_ELIPSOID))
|
||||
uiDefButF(block, NUMSLI, B_RECALCMBALL, "dz:", 750,118,250,19, &lastelem->expz, 0.0, 20.0, 0, 0, "");
|
||||
|
||||
uiBlockSetCol(block, BUTGREEN);
|
||||
uiDefButS(block, TOG|BIT|1, B_RECALCMBALL, "Negative",752,116,60,19, &lastelem->flag, 0, 0, 0, 0, "");
|
||||
uiDefButS(block, TOG|BIT|1, B_RECALCMBALL, "Negative",753,16,60,19, &lastelem->flag, 0, 0, 0, 0, "");
|
||||
|
||||
uiDefButS(block, ROW, B_RECALCMBALL, "Ball", 753,83,60,19, &lastelem->type, 1.0, 0.0, 0, 0, "");
|
||||
uiDefButS(block, ROW, B_RECALCMBALL, "TubeX", 753,62,60,19, &lastelem->type, 1.0, 1.0, 0, 0, "");
|
||||
uiDefButS(block, ROW, B_RECALCMBALL, "TubeY", 814,62,60,19, &lastelem->type, 1.0, 2.0, 0, 0, "");
|
||||
uiDefButS(block, ROW, B_RECALCMBALL, "TubeZ", 876,62,60,19, &lastelem->type, 1.0, 3.0, 0, 0, "");
|
||||
|
||||
uiDefButS(block, ROW, B_RECALCMBALL, "Tube", 753,62,60,19, &lastelem->type, 1.0, 4.0, 0, 0, "");
|
||||
uiDefButS(block, ROW, B_RECALCMBALL, "Plane", 814,62,60,19, &lastelem->type, 1.0, 5.0, 0, 0, "");
|
||||
uiDefButS(block, ROW, B_RECALCMBALL, "Elipsoid", 876,62,60,19, &lastelem->type, 1.0, 6.0, 0, 0, "");
|
||||
uiDefButS(block, ROW, B_RECALCMBALL, "Cube", 938,62,60,19, &lastelem->type, 1.0, 7.0, 0, 0, "");
|
||||
}
|
||||
uiDrawBlock(block);
|
||||
}
|
||||
|
@ -172,13 +172,38 @@ void add_primitiveMball(int dummy_argument)
|
||||
ml->x= cent[0];
|
||||
ml->y= cent[1];
|
||||
ml->z= cent[2];
|
||||
ml->rad= 1.0;
|
||||
ml->rad= 2.0;
|
||||
ml->lay= 1;
|
||||
ml->s= 2.0;
|
||||
ml->len= 1.0;
|
||||
ml->expx= ml->expy= ml->expz= 2.0;
|
||||
ml->flag= SELECT;
|
||||
|
||||
switch(dummy_argument) {
|
||||
case 1:
|
||||
ml->type = MB_BALL;
|
||||
ml->expx= ml->expy= ml->expz= 1.0;
|
||||
break;
|
||||
case 2:
|
||||
ml->type = MB_TUBE;
|
||||
ml->expx= ml->expy= ml->expz= 1.0;
|
||||
break;
|
||||
case 3:
|
||||
ml->type = MB_PLANE;
|
||||
ml->expx= ml->expy= ml->expz= 1.0;
|
||||
break;
|
||||
case 4:
|
||||
ml->type = MB_ELIPSOID;
|
||||
ml->expx= 1.2f;
|
||||
ml->expy= 0.8f;
|
||||
ml->expz= 1.0;
|
||||
break;
|
||||
case 5:
|
||||
ml->type = MB_CUBE;
|
||||
ml->expx= ml->expy= ml->expz= 1.0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
lastelem= ml;
|
||||
|
||||
allqueue(REDRAWALL, 0);
|
||||
|
@ -3134,6 +3134,59 @@ static uiBlock *info_add_surfacemenu(void *arg_unused)
|
||||
return block;
|
||||
}
|
||||
|
||||
static void do_info_add_metamenu(void *arg, int event)
|
||||
{
|
||||
|
||||
switch(event) {
|
||||
case 0:
|
||||
/* Ball */
|
||||
add_primitiveMball(1);
|
||||
break;
|
||||
case 1:
|
||||
/* Tube */
|
||||
add_primitiveMball(2);
|
||||
break;
|
||||
case 2:
|
||||
/* Plane */
|
||||
add_primitiveMball(3);
|
||||
break;
|
||||
case 3:
|
||||
/* Elipsoid */
|
||||
add_primitiveMball(4);
|
||||
break;
|
||||
case 4:
|
||||
/* Cube */
|
||||
add_primitiveMball(5);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
allqueue(REDRAWINFO, 0);
|
||||
}
|
||||
|
||||
|
||||
static uiBlock *info_add_metamenu(void *arg_unused)
|
||||
{
|
||||
/* static short tog=0; */
|
||||
uiBlock *block;
|
||||
short xco= 0;
|
||||
|
||||
block= uiNewBlock(&curarea->uiblocks, "add_metamenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
|
||||
uiBlockSetButmFunc(block, do_info_add_metamenu, NULL);
|
||||
|
||||
uiDefBut(block, BUTM, 1, "Meta Ball|", 0, xco-=20, 160, 19, NULL, 0.0, 0.0, 1, 0, "Add a ball");
|
||||
uiDefBut(block, BUTM, 1, "Meta Tube|", 0, xco-=20, 160, 19, NULL, 0.0, 0.0, 1, 1, "Add a tube");
|
||||
uiDefBut(block, BUTM, 1, "Meta Plane|", 0, xco-=20, 160, 19, NULL, 0.0, 0.0, 1, 2, "Add a square");
|
||||
uiDefBut(block, BUTM, 1, "Meta Elipsoid|", 0, xco-=20, 160, 19, NULL, 0.0, 0.0, 1, 3, "Add a elipsoid");
|
||||
uiDefBut(block, BUTM, 1, "Meta Cube|", 0, xco-=20, 160, 19, NULL, 0.0, 0.0, 1, 4, "Add a circle");
|
||||
|
||||
uiBlockSetDirection(block, UI_RIGHT);
|
||||
uiTextBoundsBlock(block, 50);
|
||||
|
||||
return block;
|
||||
}
|
||||
|
||||
|
||||
static void do_info_addmenu(void *arg, int event)
|
||||
{
|
||||
|
||||
@ -3148,12 +3201,11 @@ static void do_info_addmenu(void *arg, int event)
|
||||
/* Surface */
|
||||
break;
|
||||
case 3:
|
||||
/* Text (argument is discarded) */
|
||||
add_primitiveFont(event);
|
||||
/* Metaball */
|
||||
break;
|
||||
case 4:
|
||||
/* Metaball (argument is discarded) */
|
||||
add_primitiveMball(event);
|
||||
/* Text (argument is discarded) */
|
||||
add_primitiveFont(event);
|
||||
break;
|
||||
case 5:
|
||||
/* Empty */
|
||||
@ -3194,10 +3246,10 @@ static uiBlock *info_addmenu(void *arg_unused)
|
||||
uiDefBlockBut(block, info_add_meshmenu, NULL, "Mesh|>>", 0, xco-=20, 120, 19, "Opens the Add Mesh menu");
|
||||
uiDefBlockBut(block, info_add_curvemenu, NULL, "Curve|>>", 0, xco-=20, 120, 19, "Opens the Add Curve menu");
|
||||
uiDefBlockBut(block, info_add_surfacemenu, NULL, "Surface|>>", 0, xco-=20, 120, 19, "Opens the Add Surface menu");
|
||||
uiDefBlockBut(block, info_add_metamenu, NULL, "Meta|>>", 0, xco-=20, 120, 19, "Click to open the Add Meta menu");
|
||||
|
||||
uiDefBut(block, SEPR, 0, "", 0, xco-=6, 120, 6, NULL, 0.0, 0.0, 0, 0, "");
|
||||
uiDefBut(block, BUTM, 1, "Text|", 0, xco-=20, 120, 19, NULL, 0.0, 0.0, 1, 3, "Adds a Text object");
|
||||
uiDefBut(block, BUTM, 1, "Metaball|", 0, xco-=20, 120, 19, NULL, 0.0, 0.0, 1, 4, "Adds a Metaball");
|
||||
uiDefBut(block, BUTM, 1, "Empty|", 0, xco-=20, 120, 19, NULL, 0.0, 0.0, 1, 5, "Adds an Empty object");
|
||||
uiDefBut(block, SEPR, 0, "", 0, xco-=6, 120, 6, NULL, 0.0, 0.0, 0, 0, "");
|
||||
uiDefBut(block, BUTM, 1, "Camera|", 0, xco-=20, 120, 19, NULL, 0.0, 0.0, 1, 6, "Adds a Camera");
|
||||
|
@ -167,6 +167,7 @@ void tbox_setinfo(int x, int y)
|
||||
if (addmode==OB_MESH) tbstr= " MESH";
|
||||
else if(addmode==OB_CURVE) tbstr= " CURVE";
|
||||
else if(addmode==OB_SURF) tbstr= " SURF";
|
||||
else if(addmode==OB_MBALL) tbstr= " META";
|
||||
else tbstr= "ADD";
|
||||
break;
|
||||
case TBOX_MAIN_OBJECT1: tbstr= "OBJECT"; break;
|
||||
@ -240,8 +241,9 @@ void tbox_setinfo(int x, int y)
|
||||
case 0: tbstr= "Mesh"; tbstr1= ">>"; keystr= ">>"; tbval=OB_MESH; break;
|
||||
case 1: tbstr= "Curve"; tbstr1= ">>"; keystr= ">>"; tbval=OB_CURVE; ; break;
|
||||
case 2: tbstr= "Surface"; tbstr1= ">>"; keystr= ">>"; tbval=OB_SURF; break;
|
||||
case 3: tbstr= "Text"; tbstr1= ""; keystr= ""; tbval=OB_FONT; tbfunc= add_primitiveFont; break;
|
||||
case 4: tbstr= "MetaBall"; tbstr1= ""; keystr= ""; tbval=OB_MBALL; tbfunc= add_primitiveMball; break;
|
||||
case 3: tbstr= "Meta"; tbstr1= ">>"; keystr= ">>"; tbval=OB_MBALL;
|
||||
break;
|
||||
case 4: tbstr= "Text"; tbstr1= ""; keystr= ""; tbval=OB_FONT; tbfunc= add_primitiveFont; break;
|
||||
case 5: tbstr= "Empty"; tbstr1= "A"; keystr= ""; tbval=OB_EMPTY; break;
|
||||
case 6: tbstr= ""; tbstr1= ""; keystr= ""; tbval=0; break;
|
||||
case 7: tbstr= "Camera"; tbstr1= "A"; keystr= ""; tbval=OB_CAMERA; break;
|
||||
@ -302,13 +304,13 @@ void tbox_setinfo(int x, int y)
|
||||
}
|
||||
if(tbstr1 && tbstr1[0]=='A') tbfunc= add_primitiveCurve;
|
||||
}
|
||||
/* else if(addmode==OB_MBALL) {
|
||||
else if(addmode==OB_MBALL) {
|
||||
switch(y) {
|
||||
case 0: tbstr= "Ball"; tbstr1= "A"; tbval=1; break;
|
||||
case 1: tbstr= ""; tbstr1= ""; break;
|
||||
case 2: tbstr= ""; tbstr1= ""; break;
|
||||
case 3: tbstr= ""; tbstr1= ""; break;
|
||||
case 4: tbstr= ""; tbstr1= ""; break;
|
||||
case 0: tbstr= "Ball"; tbstr1= "A"; tbval=1; break;
|
||||
case 1: tbstr= "Tube"; tbstr1= "A"; tbval=2; break;
|
||||
case 2: tbstr= "Plane"; tbstr1= "A"; tbval=3; break;
|
||||
case 3: tbstr= "Elipsoid"; tbstr1= "A"; tbval=4; break;
|
||||
case 4: tbstr= "Cube"; tbstr1= "A"; tbval=5; break;
|
||||
case 5: tbstr= ""; tbstr1= ""; break;
|
||||
case 6: tbstr= ""; tbstr1= ""; break;
|
||||
case 7: tbstr= ""; tbstr1= ""; break;
|
||||
@ -318,7 +320,7 @@ void tbox_setinfo(int x, int y)
|
||||
case 11: tbstr= "Duplicate";tbstr1= "D"; break;
|
||||
}
|
||||
if(tbstr1 && tbstr1[0]=='A') tbfunc= add_primitiveMball;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
/* OB TOPICS 1 */
|
||||
|
Loading…
Reference in New Issue
Block a user