Commit 41fa2f64 authored by Luke Campagnola's avatar Luke Campagnola
Browse files

Fixed GL picking bug

parent f9056544
......@@ -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()
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment