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

View File

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

View File

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