* Added a new empty draw type - single arrow. This can be useful in situations

where you just need a direction, like a wind or vortex force field for example.
This commit is contained in:
2006-10-12 07:54:32 +00:00
parent 14a9460755
commit 1be92c8b19
3 changed files with 39 additions and 2 deletions

View File

@@ -323,6 +323,7 @@ extern Object workob;
#define OB_ARROWS 1
#define OB_PLAINAXES 2
#define OB_CIRCLE 3
#define OB_SINGLE_ARROW 4
/* boundtype */
#define OB_BOUND_BOX 0

View File

@@ -3826,8 +3826,8 @@ static void editing_panel_links(Object *ob)
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");
uiDefButC(block, MENU, REDRAWVIEW3D, "Empty Drawtype%t|Arrows%x1|Single Arrow%x4|Plain Axes%x2",
xco, 128, 140, 20, &ob->empty_drawtype, 0, 0, 0, 0, "The Empty 3D View display style");
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);

View File

@@ -256,6 +256,9 @@ static float cube[8][3] = {
void drawaxes(float size, int flag, char drawtype)
{
int axis;
float v1[3]= {0.0, 0.0, 0.0};
float v2[3]= {0.0, 0.0, 0.0};
float v3[3]= {0.0, 0.0, 0.0};
switch(drawtype) {
@@ -273,6 +276,39 @@ void drawaxes(float size, int flag, char drawtype)
glEnd();
}
break;
case OB_SINGLE_ARROW:
glBegin(GL_LINES);
/* in positive z direction only */
v1[2]= size;
glVertex3fv(v1);
glVertex3fv(v2);
glEnd();
/* square pyramid */
glBegin(GL_TRIANGLES);
v2[0]= size*0.035; v2[1] = size*0.035;
v3[0]= size*-0.035; v3[1] = size*0.035;
v2[2]= v3[2]= size*0.75;
for (axis=0; axis<4; axis++) {
if (axis % 2 == 1) {
v2[0] *= -1;
v3[1] *= -1;
} else {
v2[1] *= -1;
v3[0] *= -1;
}
glVertex3fv(v1);
glVertex3fv(v2);
glVertex3fv(v3);
}
glEnd();
break;
case OB_ARROWS:
default: