From 1be92c8b19cf63890bae3e409a4ede563bae7200 Mon Sep 17 00:00:00 2001 From: Matt Ebb Date: Thu, 12 Oct 2006 07:54:32 +0000 Subject: * 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. --- source/blender/makesdna/DNA_object_types.h | 1 + source/blender/src/buttons_editing.c | 4 ++-- source/blender/src/drawobject.c | 36 ++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h index 9cdb5054493..ef43ab72dfc 100644 --- a/source/blender/makesdna/DNA_object_types.h +++ b/source/blender/makesdna/DNA_object_types.h @@ -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 diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c index 3e03b3deaba..d3169168305 100644 --- a/source/blender/src/buttons_editing.c +++ b/source/blender/src/buttons_editing.c @@ -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); diff --git a/source/blender/src/drawobject.c b/source/blender/src/drawobject.c index dd82be68af4..2df2e771696 100644 --- a/source/blender/src/drawobject.c +++ b/source/blender/src/drawobject.c @@ -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: -- cgit v1.2.3