[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12890] trunk/blender/source/blender: Patch #7916: New Empty Types - Sphere and Cone

Joshua Leung aligorith at gmail.com
Sat Dec 15 08:48:30 CET 2007


Revision: 12890
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12890
Author:   aligorith
Date:     2007-12-15 08:48:30 +0100 (Sat, 15 Dec 2007)

Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/blender/makesdna/DNA_object_types.h
    trunk/blender/source/blender/src/buttons_editing.c
    trunk/blender/source/blender/src/drawobject.c

Modified: trunk/blender/source/blender/makesdna/DNA_object_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_object_types.h	2007-12-15 07:35:16 UTC (rev 12889)
+++ trunk/blender/source/blender/makesdna/DNA_object_types.h	2007-12-15 07:48:30 UTC (rev 12890)
@@ -342,6 +342,8 @@
 #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 @@
 
 #endif
 
+

Modified: trunk/blender/source/blender/src/buttons_editing.c
===================================================================
--- trunk/blender/source/blender/src/buttons_editing.c	2007-12-15 07:35:16 UTC (rev 12889)
+++ trunk/blender/source/blender/src/buttons_editing.c	2007-12-15 07:48:30 UTC (rev 12890)
@@ -4941,7 +4941,7 @@
 				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");

Modified: trunk/blender/source/blender/src/drawobject.c
===================================================================
--- trunk/blender/source/blender/src/drawobject.c	2007-12-15 07:35:16 UTC (rev 12889)
+++ trunk/blender/source/blender/src/drawobject.c	2007-12-15 07:48:30 UTC (rev 12890)
@@ -143,6 +143,8 @@
 
 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 @@
 		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 @@
 	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 @@
 			break;
 	}
 }
-





More information about the Bf-blender-cvs mailing list