This is using instructions from Ton, so hopefully the implementation is ok.
This is really needed here where we are using all sorts of wacky scales, and
empties look too big or too small. Of course we don't want to scale the
empties because there are often things parented to them.
New options are in edit buttons for empties to control the display style
and the size. New styles are easy to add, too. Just needs useful ideas and
minor effort from anyone who wants to.
Support for copying these values has also been added to the Copy Attributes
->Drawtype menu command.
Mat4One(ob->obmat);
ob->dt= OB_SHADED;
if(U.flag & USER_MAT_ON_OB) ob->colbits= -1;
+ ob->empty_drawtype= OB_ARROWS;
+ ob->empty_drawsize= 1.0;
if(type==OB_CAMERA || type==OB_LAMP) {
ob->trackflag= OB_NEGZ;
}
}
+ if(main->versionfile <= 241) {
+ Object *ob;
+
+ /* for empty drawsize and drawtype */
+ for(ob=main->object.first; ob; ob= ob->id.next) {
+ ob->empty_drawtype = OB_ARROWS;
+ ob->empty_drawsize = 1.0;
+ }
+ }
+
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
/* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */
#define DRAW_PICKING 1
#define DRAW_CONSTCOLOR 2
void draw_object(struct Base *base, int flag);
-void drawaxes(float size, int flag);
+void drawaxes(float size, int flag, char drawtype);
void draw_object_ext(struct Base *base);
void drawsolidcube(float size);
char dt, dtx;
char totcol; /* copy of mesh or curve or meta */
char actcol;
+ char empty_drawtype, pad1[3];
+ float empty_drawsize;
ScriptLink scriptlink;
ListBase prop;
/* enable transparent draw */
#define OB_DRAWTRANSP 128
+/* empty_drawtype: no flags */
+#define OB_ARROWS 1
+#define OB_PLAINAXES 2
+#define OB_CIRCLE 3
+
/* boundtype */
#define OB_BOUND_BOX 0
#define OB_BOUND_SPHERE 1
/* to be sure */
- if ELEM5(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL);
+ if ELEM6(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL, OB_EMPTY);
else return;
+ if (ob->type==OB_EMPTY) {
+ uiDefBut(block, LABEL,0,"Empty Display:",
+ xco, 154, 130,20, 0, 0, 0, 0, 0, "");
+
+ uiBlockBeginAlign(block);
+ uiDefButC(block, MENU, REDRAWVIEW3D, "Empty Drawtype%t|Arrows%x1|Plain Axes%x2",
+ xco, 128, 140, 20, &ob->empty_drawtype, 0, 0, 0, 0, "Selects the Empty display type");
+ uiDefButF(block, NUM, REDRAWVIEW3D, "Size:",
+ xco, 108, 140, 21, &ob->empty_drawsize, 0.01, 10.0, 1, 0, "The size to display the Empty");
+ uiBlockEndAlign(block);
+ return;
+ }
if(ob->type==OB_MESH) poin= &( ((Mesh *)ob->data)->texflag );
else if(ob->type==OB_MBALL) poin= &( ((MetaBall *)ob->data)->texflag );
glPushMatrix();
glMultMatrixf(pchan->pose_mat);
glTranslatef(0.0f, pchan->bone->length, 0.0f);
- drawaxes(0.25f*pchan->bone->length, 0);
+ drawaxes(0.25f*pchan->bone->length, 0, OB_ARROWS);
glPopMatrix();
}
}
glPushMatrix();
set_matrix_editbone(eBone);
glTranslatef(0.0f, eBone->length, 0.0f);
- drawaxes(eBone->length*0.25f, 0);
+ drawaxes(eBone->length*0.25f, 0, OB_ARROWS);
glPopMatrix();
}
};
/* flag is same as for draw_object */
-void drawaxes(float size, int flag)
+void drawaxes(float size, int flag, char drawtype)
{
+ View3D *v3d= G.vd;
int axis;
+ float vec[3]= {0.0, 0.0, 0.0};
+
+ switch(drawtype) {
+
+ case OB_PLAINAXES:
+ for (axis=0; axis<3; axis++) {
+ float v1[3]= {0.0, 0.0, 0.0};
+ float v2[3]= {0.0, 0.0, 0.0};
+
+ glBegin(GL_LINES);
- for (axis=0; axis<3; axis++) {
- float v1[3]= {0.0, 0.0, 0.0};
- float v2[3]= {0.0, 0.0, 0.0};
- int arrow_axis= (axis==0)?1:0;
-
- glBegin(GL_LINES);
-
- v2[axis]= size;
- glVertex3fv(v1);
- glVertex3fv(v2);
+ v1[axis]= size;
+ v2[axis]= -size;
+ glVertex3fv(v1);
+ glVertex3fv(v2);
- v1[axis]= size*0.8;
- v1[arrow_axis]= -size*0.125;
- glVertex3fv(v1);
- glVertex3fv(v2);
+ glEnd();
+ }
+ break;
+ case OB_ARROWS:
+ default:
+ for (axis=0; axis<3; axis++) {
+ float v1[3]= {0.0, 0.0, 0.0};
+ float v2[3]= {0.0, 0.0, 0.0};
+ int arrow_axis= (axis==0)?1:0;
- v1[arrow_axis]= size*0.125;
- glVertex3fv(v1);
- glVertex3fv(v2);
+ glBegin(GL_LINES);
- glEnd();
+ v2[axis]= size;
+ glVertex3fv(v1);
+ glVertex3fv(v2);
+
+ v1[axis]= size*0.8;
+ v1[arrow_axis]= -size*0.125;
+ glVertex3fv(v1);
+ glVertex3fv(v2);
+
+ v1[arrow_axis]= size*0.125;
+ glVertex3fv(v1);
+ glVertex3fv(v2);
+
+ glEnd();
+
+ v2[axis]+= size*0.125;
+ glRasterPos3fv(v2);
- v2[axis]+= size*0.125;
- glRasterPos3fv(v2);
-
- // patch for 3d cards crashing on glSelect for text drawing (IBM)
- if((flag & DRAW_PICKING) == 0) {
- if (axis==0)
- BMF_DrawString(G.font, "x");
- else if (axis==1)
- BMF_DrawString(G.font, "y");
- else
- BMF_DrawString(G.font, "z");
+ // patch for 3d cards crashing on glSelect for text drawing (IBM)
+ if((flag & DRAW_PICKING) == 0) {
+ if (axis==0)
+ BMF_DrawString(G.font, "x");
+ else if (axis==1)
+ BMF_DrawString(G.font, "y");
+ else
+ BMF_DrawString(G.font, "z");
+ }
}
+ break;
}
}
empty_object= drawmball(base, dt);
break;
case OB_EMPTY:
- drawaxes(1.0, flag);
+ drawaxes(ob->empty_drawsize, flag, ob->empty_drawtype);
break;
case OB_LAMP:
drawlamp(ob);
empty_object= draw_armature(base, dt);
break;
default:
- drawaxes(1.0, flag);
+ drawaxes(1.0, flag, OB_ARROWS);
}
if(ob->pd && ob->pd->forcefield) draw_forcefield(ob);
if(dtx) {
if(G.f & G_SIMULATION);
else if(dtx & OB_AXIS) {
- drawaxes(1.0f, flag);
+ drawaxes(1.0f, flag, OB_ARROWS);
}
if(dtx & OB_BOUNDBOX) draw_bounding_volume(ob);
if(dtx & OB_TEXSPACE) drawtexspace(ob);
else if(event==4) { /* drawtype */
base->object->dt= ob->dt;
base->object->dtx= ob->dtx;
+ base->object->empty_drawtype= ob->empty_drawtype;
+ base->object->empty_drawsize= ob->empty_drawsize;
}
else if(event==5) { /* time offs */
base->object->sf= ob->sf;