Fixed GL picking bug
This commit is contained in:
parent
f90565442c
commit
41fa2f64d3
@ -28,8 +28,13 @@ GLOptions = {
|
|||||||
|
|
||||||
|
|
||||||
class GLGraphicsItem(QtCore.QObject):
|
class GLGraphicsItem(QtCore.QObject):
|
||||||
|
_nextId = 0
|
||||||
|
|
||||||
def __init__(self, parentItem=None):
|
def __init__(self, parentItem=None):
|
||||||
QtCore.QObject.__init__(self)
|
QtCore.QObject.__init__(self)
|
||||||
|
self._id = GLGraphicsItem._nextId
|
||||||
|
GLGraphicsItem._nextId += 1
|
||||||
|
|
||||||
self.__parent = None
|
self.__parent = None
|
||||||
self.__view = None
|
self.__view = None
|
||||||
self.__children = set()
|
self.__children = set()
|
||||||
|
@ -159,7 +159,6 @@ class GLViewWidget(QtOpenGL.QGLWidget):
|
|||||||
|
|
||||||
items = [(h.near, h.names[0]) for h in hits]
|
items = [(h.near, h.names[0]) for h in hits]
|
||||||
items.sort(key=lambda i: i[0])
|
items.sort(key=lambda i: i[0])
|
||||||
|
|
||||||
return [self._itemNames[i[1]] for i in items]
|
return [self._itemNames[i[1]] for i in items]
|
||||||
|
|
||||||
def paintGL(self, region=None, viewport=None, useItemNames=False):
|
def paintGL(self, region=None, viewport=None, useItemNames=False):
|
||||||
@ -193,8 +192,8 @@ class GLViewWidget(QtOpenGL.QGLWidget):
|
|||||||
try:
|
try:
|
||||||
glPushAttrib(GL_ALL_ATTRIB_BITS)
|
glPushAttrib(GL_ALL_ATTRIB_BITS)
|
||||||
if useItemNames:
|
if useItemNames:
|
||||||
glLoadName(id(i))
|
glLoadName(i._id)
|
||||||
self._itemNames[id(i)] = i
|
self._itemNames[i._id] = i
|
||||||
i.paint()
|
i.paint()
|
||||||
except:
|
except:
|
||||||
from .. import debug
|
from .. import debug
|
||||||
|
Loading…
x
Reference in New Issue
Block a user