diff options
author | Joshua Leung <aligorith@gmail.com> | 2007-12-15 10:48:30 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2007-12-15 10:48:30 +0300 |
commit | 3301d046b67098b72eed93f6384ea2a9477d77e4 (patch) | |
tree | 4f35471ddba75b1d6239ca46ca2dd4b34d134dcb /source/blender/src | |
parent | faf638238dc5147fa3b9c5cc4999bda907acd6f7 (diff) |
Patch #7916: New Empty Types - Sphere and Cone
Submitted by: David Bryant (digikiller)
This patch adds two new drawtypes for empties in Blender:
* Sphere
* Cone
These draw with wireframes which are slightly more complicated than for other empties. However, this shouldn't really be an issue.
Diffstat (limited to 'source/blender/src')
-rw-r--r-- | source/blender/src/buttons_editing.c | 2 | ||||
-rw-r--r-- | source/blender/src/drawobject.c | 50 |
2 files changed, 50 insertions, 2 deletions
diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c index 2a14609dc40..218ae7f3161 100644 --- a/source/blender/src/buttons_editing.c +++ b/source/blender/src/buttons_editing.c @@ -4941,7 +4941,7 @@ 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|Single Arrow%x4|Plain Axes%x2|Circle%x3|Cube%x5", + uiDefButC(block, MENU, REDRAWVIEW3D, "Empty Drawtype%t|Arrows%x1|Single Arrow%x4|Plain Axes%x2|Circle%x3|Cube%x5|Sphere%x6|Cone%x7", 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"); diff --git a/source/blender/src/drawobject.c b/source/blender/src/drawobject.c index 26858f657a6..397d411e4b0 100644 --- a/source/blender/src/drawobject.c +++ b/source/blender/src/drawobject.c @@ -143,6 +143,8 @@ static void draw_bounding_volume(Object *ob); static void drawcube_size(float size); static void drawcircle_size(float size); +static void draw_empty_sphere(float size); +static void draw_empty_cone(float size); /* ************* Setting OpenGL Material ************ */ @@ -412,6 +414,14 @@ void drawaxes(float size, int flag, char drawtype) drawcircle_size(size); break; + case OB_EMPTY_SPHERE: + draw_empty_sphere(size); + break; + + case OB_EMPTY_CONE: + draw_empty_cone(size); + break; + case OB_ARROWS: default: for (axis=0; axis<3; axis++) { @@ -3984,6 +3994,45 @@ static void drawnurb(Base *base, Nurb *nurb, int dt) if(G.vd->zbuf) glEnable(GL_DEPTH_TEST); } +/* draw a sphere for use as an empty drawtype */ +static void draw_empty_sphere (float size) +{ + float cent=0; + GLUquadricObj *qobj = gluNewQuadric(); + gluQuadricDrawStyle(qobj, GLU_SILHOUETTE); + + glPushMatrix(); + glTranslatef(cent, cent, cent); + glScalef(size, size, size); + gluSphere(qobj, 1.0, 8, 5); + + glPopMatrix(); + + gluDeleteQuadric(qobj); +} + +/* draw a cone for use as an empty drawtype */ +static void draw_empty_cone (float size) +{ + float cent=0; + float radius; + GLUquadricObj *qobj = gluNewQuadric(); + gluQuadricDrawStyle(qobj, GLU_SILHOUETTE); + + + glPushMatrix(); + + radius = size; + glTranslatef(cent,cent, cent); + glScalef(radius, 2.0*size, radius); + glRotatef(-90., 1.0, 0.0, 0.0); + gluCylinder(qobj, 1.0, 0.0, 1.0, 8, 1); + + glPopMatrix(); + + gluDeleteQuadric(qobj); +} + /* draw points on curve speed handles */ static void curve_draw_speed(Object *ob) { @@ -5504,4 +5553,3 @@ void draw_object_instance(Object *ob, int dt, int outline) break; } } - |