Fixed GL picking bug

This commit is contained in:
Luke Campagnola 2014-12-04 21:24:09 -05:00
parent f90565442c
commit 41fa2f64d3
2 changed files with 7 additions and 3 deletions

View File

@ -28,8 +28,13 @@ GLOptions = {
class GLGraphicsItem(QtCore.QObject):
_nextId = 0
def __init__(self, parentItem=None):
QtCore.QObject.__init__(self)
self._id = GLGraphicsItem._nextId
GLGraphicsItem._nextId += 1
self.__parent = None
self.__view = None
self.__children = set()

View File

@ -159,7 +159,6 @@ class GLViewWidget(QtOpenGL.QGLWidget):
items = [(h.near, h.names[0]) for h in hits]
items.sort(key=lambda i: i[0])
return [self._itemNames[i[1]] for i in items]
def paintGL(self, region=None, viewport=None, useItemNames=False):
@ -193,8 +192,8 @@ class GLViewWidget(QtOpenGL.QGLWidget):
try:
glPushAttrib(GL_ALL_ATTRIB_BITS)
if useItemNames:
glLoadName(id(i))
self._itemNames[id(i)] = i
glLoadName(i._id)
self._itemNames[i._id] = i
i.paint()
except:
from .. import debug