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.
This commit is contained in:
Joshua Leung
2007-12-15 07:48:30 +00:00
parent faf638238d
commit 3301d046b6
3 changed files with 53 additions and 2 deletions

View File

@@ -342,6 +342,8 @@ extern Object workob;
#define OB_CIRCLE 3
#define OB_SINGLE_ARROW 4
#define OB_CUBE 5
#define OB_EMPTY_SPHERE 6
#define OB_EMPTY_CONE 7
/* boundtype */
#define OB_BOUND_BOX 0
@@ -453,3 +455,4 @@ extern Object workob;
#endif

View File

@@ -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");

View File

@@ -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;
}
}