SelectionCursorNode and SelectionFaceNode now use 4-tuple colors
This commit is contained in:
parent
ab0f1934ec
commit
52a137df59
@ -168,6 +168,7 @@ class SelectCommand(QtGui.QUndoCommand):
|
|||||||
self.previousBox = self.editorSession.currentSelection
|
self.previousBox = self.editorSession.currentSelection
|
||||||
self.editorSession.currentSelection = self.box
|
self.editorSession.currentSelection = self.box
|
||||||
|
|
||||||
|
|
||||||
class SelectionTool(EditorTool):
|
class SelectionTool(EditorTool):
|
||||||
name = "Select"
|
name = "Select"
|
||||||
iconName = "select_blocks"
|
iconName = "select_blocks"
|
||||||
@ -337,9 +338,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)
|
|
||||||
r, g, b = self.sceneNode.color
|
r, g, b, a = self.sceneNode.color
|
||||||
alpha = 0.3
|
|
||||||
box = BoundingBox(point, (1, 1, 1))
|
box = BoundingBox(point, (1, 1, 1))
|
||||||
|
|
||||||
with gl.glPushAttrib(GL.GL_DEPTH_BUFFER_BIT | GL.GL_ENABLE_BIT | GL.GL_POLYGON_BIT):
|
with gl.glPushAttrib(GL.GL_DEPTH_BUFFER_BIT | GL.GL_ENABLE_BIT | GL.GL_POLYGON_BIT):
|
||||||
@ -351,19 +351,19 @@ class SelectionCursorRenderNode(rendernode.RenderNode):
|
|||||||
|
|
||||||
GL.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_FILL)
|
GL.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_FILL)
|
||||||
|
|
||||||
GL.glColor(r, g, b, alpha)
|
GL.glColor(r, g, b, a)
|
||||||
cubes.drawFace(box, self.sceneNode.face)
|
cubes.drawFace(box, self.sceneNode.face)
|
||||||
|
|
||||||
# Wire box
|
# Wire box
|
||||||
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.glLineWidth(3.0)
|
||||||
GL.glColor(1., 1., 1., alpha)
|
GL.glColor(1., 1., 1., a)
|
||||||
|
|
||||||
cubes.drawBox(box)
|
cubes.drawBox(box)
|
||||||
|
|
||||||
GL.glLineWidth(1.0)
|
GL.glLineWidth(1.0)
|
||||||
GL.glColor(0.2, 0.2, 0.2, alpha)
|
GL.glColor(0.2, 0.2, 0.2, a)
|
||||||
|
|
||||||
cubes.drawBox(box)
|
cubes.drawBox(box)
|
||||||
|
|
||||||
@ -371,7 +371,7 @@ class SelectionCursorRenderNode(rendernode.RenderNode):
|
|||||||
class SelectionCursor(scenenode.Node):
|
class SelectionCursor(scenenode.Node):
|
||||||
RenderNodeClass = SelectionCursorRenderNode
|
RenderNodeClass = SelectionCursorRenderNode
|
||||||
|
|
||||||
def __init__(self, point=Vector(0, 0, 0), face=faces.FaceXDecreasing, color=(.3, .3, 1)):
|
def __init__(self, point=Vector(0, 0, 0), face=faces.FaceXDecreasing, color=(.3, .3, 1, .8)):
|
||||||
super(SelectionCursor, self).__init__()
|
super(SelectionCursor, self).__init__()
|
||||||
self._point = point
|
self._point = point
|
||||||
self._face = face
|
self._face = face
|
||||||
|
@ -300,13 +300,15 @@ 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
|
self.faceDragNode.wireColor = self._moveFaceWireColor
|
||||||
else:
|
else:
|
||||||
self.faceDragNode.color = self._resizeFaceColor
|
self.faceDragNode.color = self._resizeFaceColor
|
||||||
self.faceDragNode.wireColor = self._resizeFaceColor
|
self.faceDragNode.wireColor = self._resizeFaceWireColor
|
||||||
|
|
||||||
_moveFaceColor = (0.3, 0.9, 0.3)
|
_moveFaceColor = (0.3, 0.9, 0.3, 0.3)
|
||||||
_resizeFaceColor = (0.3, 0.6, 0.9)
|
_moveFaceWireColor = (0.3, 0.9, 0.3, 0.8)
|
||||||
|
_resizeFaceColor = (0.3, 0.6, 0.9, 0.3)
|
||||||
|
_resizeFaceWireColor = (0.3, 0.6, 0.9, 0.8)
|
||||||
|
|
||||||
# --- Mouse events ---
|
# --- Mouse events ---
|
||||||
|
|
||||||
|
@ -343,20 +343,19 @@ class SelectionFaceRenderNode(rendernode.RenderNode):
|
|||||||
if box is None:
|
if box is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
alpha = 0.16
|
|
||||||
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)
|
||||||
|
|
||||||
r, g, b = self.sceneNode.wireColor
|
r, g, b, a = self.sceneNode.wireColor
|
||||||
GL.glColor(r, g, b, .8)
|
GL.glColor(r, g, b, a)
|
||||||
GL.glLineWidth(3.0)
|
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
|
r, g, b, a = self.sceneNode.color
|
||||||
GL.glColor(r, g, b, alpha)
|
GL.glColor(r, g, b, a)
|
||||||
GL.glEnable(GL.GL_DEPTH_TEST)
|
GL.glEnable(GL.GL_DEPTH_TEST)
|
||||||
cubes.drawFace(box, self.sceneNode.face)
|
cubes.drawFace(box, self.sceneNode.face)
|
||||||
|
|
||||||
@ -386,13 +385,14 @@ class SelectionFaceNode(scenenode.Node):
|
|||||||
self._face = value
|
self._face = value
|
||||||
self.dirty = True
|
self.dirty = True
|
||||||
|
|
||||||
_color = (.3, .3, 1)
|
_color = (.3, .3, 1, .15)
|
||||||
@property
|
@property
|
||||||
def color(self):
|
def color(self):
|
||||||
return self._color
|
return self._color
|
||||||
|
|
||||||
@color.setter
|
@color.setter
|
||||||
def color(self, value):
|
def color(self, value):
|
||||||
|
assert len(value) == 4
|
||||||
self._color = value
|
self._color = value
|
||||||
self.dirty = True
|
self.dirty = True
|
||||||
|
|
||||||
@ -403,6 +403,7 @@ class SelectionFaceNode(scenenode.Node):
|
|||||||
|
|
||||||
@wireColor.setter
|
@wireColor.setter
|
||||||
def wireColor(self, value):
|
def wireColor(self, value):
|
||||||
|
assert len(value) == 4
|
||||||
self._wireColor = value
|
self._wireColor = value
|
||||||
self.dirty = True
|
self.dirty = True
|
||||||
|
|
||||||
|
@ -79,6 +79,18 @@ class MCESettingsNamespace(object):
|
|||||||
self.prefix = prefix
|
self.prefix = prefix
|
||||||
|
|
||||||
def getOption(self, key, type=None, default=None):
|
def getOption(self, key, type=None, default=None):
|
||||||
|
"""
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
key: str
|
||||||
|
type: bool | int | float | str
|
||||||
|
default: Any
|
||||||
|
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
|
||||||
|
option: MCESettingsOption
|
||||||
|
"""
|
||||||
return self.rootSettings.getOption(self.prefix + key, type, default)
|
return self.rootSettings.getOption(self.prefix + key, type, default)
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user