Mess around with the appearance of selection boxes

This commit is contained in:
David Vierra 2016-02-14 05:17:32 -10:00
parent dfe9aa9ddc
commit 971fa25d84
3 changed files with 33 additions and 10 deletions

View File

@ -307,8 +307,8 @@ class SelectionCursorRenderNode(rendernode.RenderNode):
point = self.sceneNode.point point = self.sceneNode.point
if point is None: if point is None:
return return
selectionColor = map(lambda a: a * a * a * a, self.sceneNode.color) #selectionColor = map(lambda a: a * a * a * a, self.sceneNode.color)
r, g, b = selectionColor r, g, b = self.sceneNode.color
alpha = 0.3 alpha = 0.3
box = BoundingBox(point, (1, 1, 1)) box = BoundingBox(point, (1, 1, 1))
@ -317,15 +317,25 @@ class SelectionCursorRenderNode(rendernode.RenderNode):
GL.glEnable(GL.GL_BLEND) GL.glEnable(GL.GL_BLEND)
GL.glPolygonOffset(DepthOffsets.SelectionCursor, DepthOffsets.SelectionCursor) GL.glPolygonOffset(DepthOffsets.SelectionCursor, DepthOffsets.SelectionCursor)
# Highlighted face
GL.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_FILL)
GL.glColor(r, g, b, alpha)
cubes.drawFace(box, self.sceneNode.face)
# Wire box # Wire box
GL.glColor(1., 1., 1., alpha)
GL.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_LINE) GL.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_LINE)
GL.glLineWidth(3.0)
GL.glColor(1., 1., 1., alpha)
cubes.drawBox(box) cubes.drawBox(box)
# Highlighted face GL.glLineWidth(1.0)
GL.glColor(r, g, b, alpha) GL.glColor(0.2, 0.2, 0.2, alpha)
cubes.drawFace(box, self.sceneNode.face)
cubes.drawBox(box)
class SelectionCursor(scenenode.Node): class SelectionCursor(scenenode.Node):

View File

@ -279,8 +279,10 @@ class BoxHandle(scenenode.Node, QtCore.QObject):
self.faceDragNode.visible = False self.faceDragNode.visible = False
if self.moveModifierDown(event): if self.moveModifierDown(event):
self.faceDragNode.color = self._moveFaceColor self.faceDragNode.color = self._moveFaceColor
self.faceDragNode.wireColor = self._moveFaceColor
else: else:
self.faceDragNode.color = self._resizeFaceColor self.faceDragNode.color = self._resizeFaceColor
self.faceDragNode.wireColor = self._resizeFaceColor
_moveFaceColor = (0.3, 0.9, 0.3) _moveFaceColor = (0.3, 0.9, 0.3)
_resizeFaceColor = (0.3, 0.6, 0.9) _resizeFaceColor = (0.3, 0.6, 0.9)

View File

@ -326,7 +326,7 @@ class SelectionBoxNode(scenenode.Node):
self._color = value self._color = value
self.dirty = True self.dirty = True
_wireColor = (1, 1, 1, .6) _wireColor = (.8, .8, .8, .6)
@property @property
def wireColor(self): def wireColor(self):
return self._wireColor return self._wireColor
@ -344,16 +344,18 @@ class SelectionFaceRenderNode(rendernode.RenderNode):
return return
alpha = 0.16 alpha = 0.16
r, g, b = self.sceneNode.color
with gl.glPushAttrib(GL.GL_DEPTH_BUFFER_BIT | GL.GL_ENABLE_BIT | GL.GL_LINE_BIT): with gl.glPushAttrib(GL.GL_DEPTH_BUFFER_BIT | GL.GL_ENABLE_BIT | GL.GL_LINE_BIT):
GL.glDisable(GL.GL_DEPTH_TEST) GL.glDisable(GL.GL_DEPTH_TEST)
GL.glDepthMask(False) GL.glDepthMask(False)
GL.glEnable(GL.GL_BLEND) GL.glEnable(GL.GL_BLEND)
GL.glPolygonOffset(self.sceneNode.depth, self.sceneNode.depth) GL.glPolygonOffset(self.sceneNode.depth, self.sceneNode.depth)
GL.glColor(1.0, 1.0, 1.0, 1.0) r, g, b = self.sceneNode.wireColor
GL.glLineWidth(2.0) GL.glColor(r, g, b, .8)
GL.glLineWidth(3.0)
cubes.drawFace(box, self.sceneNode.face, GL.GL_LINE_STRIP) cubes.drawFace(box, self.sceneNode.face, GL.GL_LINE_STRIP)
r, g, b = self.sceneNode.color
GL.glColor(r, g, b, alpha) GL.glColor(r, g, b, alpha)
GL.glEnable(GL.GL_DEPTH_TEST) GL.glEnable(GL.GL_DEPTH_TEST)
cubes.drawFace(box, self.sceneNode.face) cubes.drawFace(box, self.sceneNode.face)
@ -394,6 +396,15 @@ class SelectionFaceNode(scenenode.Node):
self._color = value self._color = value
self.dirty = True self.dirty = True
_wireColor = (.8, .8, .8, .6)
@property
def wireColor(self):
return self._wireColor
@wireColor.setter
def wireColor(self, value):
self._wireColor = value
self.dirty = True
def boxFaceUnderCursor(box, mouseRay): def boxFaceUnderCursor(box, mouseRay):
""" """