self.objColor[3] = profile.getPreferenceColour('model_colour3')\r
\r
def OnMouseMotion(self,e):\r
- size = (self.parent.objectsMaxV - self.parent.objectsMinV)\r
- sizeXY = math.sqrt((size[0] * size[0]) + (size[1] * size[1]))\r
- \r
- p0 = numpy.array(gluUnProject(e.GetX(), self.viewport[1] + self.viewport[3] - e.GetY(), 0, self.modelMatrix, self.projMatrix, self.viewport))\r
- p1 = numpy.array(gluUnProject(e.GetX(), self.viewport[1] + self.viewport[3] - e.GetY(), 1, self.modelMatrix, self.projMatrix, self.viewport))\r
- cursorZ0 = p0 - (p1 - p0) * (p0[2] / (p1[2] - p0[2]))\r
- cursorXY = math.sqrt((cursorZ0[0] * cursorZ0[0]) + (cursorZ0[1] * cursorZ0[1]))\r
- if cursorXY >= sizeXY * 0.7 and cursorXY <= sizeXY * 0.7 + 3:\r
- self.SetCursor(wx.StockCursor(wx.CURSOR_SIZING))\r
- else:\r
- self.SetCursor(wx.StockCursor(wx.CURSOR_DEFAULT))\r
+ if self.parent.objectsMaxV != None:\r
+ size = (self.parent.objectsMaxV - self.parent.objectsMinV)\r
+ sizeXY = math.sqrt((size[0] * size[0]) + (size[1] * size[1]))\r
+ \r
+ p0 = numpy.array(gluUnProject(e.GetX(), self.viewport[1] + self.viewport[3] - e.GetY(), 0, self.modelMatrix, self.projMatrix, self.viewport))\r
+ p1 = numpy.array(gluUnProject(e.GetX(), self.viewport[1] + self.viewport[3] - e.GetY(), 1, self.modelMatrix, self.projMatrix, self.viewport))\r
+ cursorZ0 = p0 - (p1 - p0) * (p0[2] / (p1[2] - p0[2]))\r
+ cursorXY = math.sqrt((cursorZ0[0] * cursorZ0[0]) + (cursorZ0[1] * cursorZ0[1]))\r
+ if cursorXY >= sizeXY * 0.7 and cursorXY <= sizeXY * 0.7 + 3:\r
+ self.SetCursor(wx.StockCursor(wx.CURSOR_SIZING))\r
+ else:\r
+ self.SetCursor(wx.StockCursor(wx.CURSOR_DEFAULT))\r
\r
if e.Dragging() and e.LeftIsDown():\r
if self.dragType == '':\r
glTranslate(self.parent.machineCenter.x, self.parent.machineCenter.y, 0)\r
\r
#Draw the rotate circle\r
- glDisable(GL_LIGHTING)\r
- glDisable(GL_CULL_FACE)\r
- glEnable(GL_BLEND)\r
- glBegin(GL_TRIANGLE_STRIP)\r
- size = (self.parent.objectsMaxV - self.parent.objectsMinV)\r
- sizeXY = math.sqrt((size[0] * size[0]) + (size[1] * size[1]))\r
- for i in xrange(0, 64+1):\r
- f = i if i < 64/2 else 64 - i\r
- glColor4ub(255,int(f*255/(64/2)),0,128)\r
- glVertex3f(sizeXY * 0.7 * math.cos(i/32.0*math.pi), sizeXY * 0.7 * math.sin(i/32.0*math.pi),0.1)\r
- glColor4ub( 0,128,0,128)\r
- glVertex3f((sizeXY * 0.7 + 3) * math.cos(i/32.0*math.pi), (sizeXY * 0.7 + 3) * math.sin(i/32.0*math.pi),0.1)\r
- glEnd()\r
- glEnable(GL_CULL_FACE)\r
+ if self.parent.objectsMaxV != None:\r
+ glDisable(GL_LIGHTING)\r
+ glDisable(GL_CULL_FACE)\r
+ glEnable(GL_BLEND)\r
+ glBegin(GL_TRIANGLE_STRIP)\r
+ size = (self.parent.objectsMaxV - self.parent.objectsMinV)\r
+ sizeXY = math.sqrt((size[0] * size[0]) + (size[1] * size[1]))\r
+ for i in xrange(0, 64+1):\r
+ f = i if i < 64/2 else 64 - i\r
+ glColor4ub(255,int(f*255/(64/2)),0,128)\r
+ glVertex3f(sizeXY * 0.7 * math.cos(i/32.0*math.pi), sizeXY * 0.7 * math.sin(i/32.0*math.pi),0.1)\r
+ glColor4ub( 0,128,0,128)\r
+ glVertex3f((sizeXY * 0.7 + 3) * math.cos(i/32.0*math.pi), (sizeXY * 0.7 + 3) * math.sin(i/32.0*math.pi),0.1)\r
+ glEnd()\r
+ glEnable(GL_CULL_FACE)\r
\r
glPopMatrix()\r
\r