def __init__(self, pos, commandObj): super(CloneVisuals, self).__init__() sourceBox = commandObj.resolveBoundingBox(pos) dest = commandObj.resolveDestination(pos) destBox = BoundingBox(dest, sourceBox.size) sourceColor = (0.3, 0.5, 0.9, 0.6) destColor = (0.0, 0.0, 0.9, 0.6) sourceBoxNode = SelectionBoxNode() sourceBoxNode.filled = False sourceBoxNode.wireColor = sourceColor sourceBoxNode.selectionBox = sourceBox destBoxNode = SelectionBoxNode() destBoxNode.filled = False destBoxNode.wireColor = destColor destBoxNode.selectionBox = destBox lineToSourceNode = LineArcNode( Vector(*pos) + (0.5, 0.5, 0.5), sourceBox.center, sourceColor) lineToDestNode = LineArcNode(sourceBox.center, destBox.center, destColor) self.addChild(sourceBoxNode) self.addChild(destBoxNode) self.addChild(lineToSourceNode) self.addChild(lineToDestNode)
def __init__(self, pos, commandObj): """ Parameters ---------- commandObj : ExecuteCommand Returns ------- """ super(ExecuteVisuals, self).__init__() selector = commandObj.targetSelector if selector.playerName is not None: return selectorPos = [selector.getArg(a) for a in 'xyz'] if None in (selectorPos): log.warn("No selector coordinates for command %s", commandObj) targetPos = commandObj.resolvePosition((0, 0, 0)) else: targetPos = commandObj.resolvePosition(selectorPos) # Draw box at selector pos and draw line from command block to selector pos # xxxx selector pos is a sphere of radius `selector.getArg('r')` boxNode = SelectionBoxNode() boxNode.filled = False boxNode.wireColor = (0.9, 0.2, 0.2, 0.6) boxNode.selectionBox = BoundingBox(selectorPos, (1, 1, 1)) lineNode = LineArcNode( Vector(*pos) + (0.5, 0.5, 0.5), Vector(*selectorPos) + (.5, .5, .5), (0.9, 0.2, 0.2, 0.6)) self.addChild(boxNode) self.addChild(lineNode) if selectorPos != targetPos: # Command block's own coordinates are different from the selected pos, # either relative or absolute. # Draw a box at the target coordinates and a line from # the selected pos to the target boxNode = SelectionBoxNode() boxNode.filled = False boxNode.wireColor = (0.9, 0.2, 0.2, 0.6) boxNode.selectionBox = BoundingBox(targetPos, (1, 1, 1)) lineNode = LineArcNode( Vector(*selectorPos) + (0.5, 0.5, 0.5), Vector(*targetPos) + (.5, .5, .5), (0.9, 0.2, 0.2, 0.6)) self.addChild(boxNode) self.addChild(lineNode) if not isinstance(commandObj.subcommand, UnknownCommand): subvisuals = CommandVisuals(targetPos, commandObj.subcommand) self.addChild(subvisuals)
def __init__(self, pos, commandObj): """ Parameters ---------- commandObj : ExecuteCommand Returns ------- """ super(ExecuteVisuals, self).__init__() selector = commandObj.targetSelector if selector.playerName is not None: return selectorPos = [selector.getArg(a) for a in 'xyz'] if None in (selectorPos): log.warn("No selector coordinates for command %s", commandObj) targetPos = commandObj.resolvePosition((0, 0, 0)) else: targetPos = commandObj.resolvePosition(selectorPos) # Draw box at selector pos and draw line from command block to selector pos # xxxx selector pos is a sphere of radius `selector.getArg('r')` boxNode = SelectionBoxNode() boxNode.filled = False boxNode.wireColor = (0.9, 0.2, 0.2, 0.6) boxNode.selectionBox = BoundingBox(selectorPos, (1, 1, 1)) lineNode = LineArcNode(Vector(*pos) + (0.5, 0.5, 0.5), Vector(*selectorPos) + (.5, .5, .5), (0.9, 0.2, 0.2, 0.6)) self.addChild(boxNode) self.addChild(lineNode) if selectorPos != targetPos: # Command block's own coordinates are different from the selected pos, # either relative or absolute. # Draw a box at the target coordinates and a line from # the selected pos to the target boxNode = SelectionBoxNode() boxNode.filled = False boxNode.wireColor = (0.9, 0.2, 0.2, 0.6) boxNode.selectionBox = BoundingBox(targetPos, (1, 1, 1)) lineNode = LineArcNode(Vector(*selectorPos) + (0.5, 0.5, 0.5), Vector(*targetPos) + (.5, .5, .5), (0.9, 0.2, 0.2, 0.6)) self.addChild(boxNode) self.addChild(lineNode) if not isinstance(commandObj.subcommand, UnknownCommand): subvisuals = CommandVisuals(targetPos, commandObj.subcommand) self.addChild(subvisuals)
def __init__(self, pos, commandObj): super(CloneVisuals, self).__init__() sourceBox = commandObj.resolveBoundingBox(pos) dest = commandObj.resolveDestination(pos) destBox = BoundingBox(dest, sourceBox.size) sourceColor = (0.3, 0.5, 0.9, 0.6) destColor = (0.0, 0.0, 0.9, 0.6) sourceBoxNode = SelectionBoxNode() sourceBoxNode.filled = False sourceBoxNode.wireColor = sourceColor sourceBoxNode.selectionBox = sourceBox destBoxNode = SelectionBoxNode() destBoxNode.filled = False destBoxNode.wireColor = destColor destBoxNode.selectionBox = destBox lineToSourceNode = LineArcNode(Vector(*pos) + (0.5, 0.5, 0.5), sourceBox.center, sourceColor) lineToDestNode = LineArcNode(sourceBox.center, destBox.center, destColor) self.addChild(sourceBoxNode) self.addChild(destBoxNode) self.addChild(lineToSourceNode) self.addChild(lineToDestNode)
def __init__(self, pos, commandObj): super(BoundingBoxVisuals, self).__init__() box = commandObj.resolveBoundingBox(pos) boxNode = SelectionBoxNode() boxNode.filled = False boxNode.wireColor = self.boxColor boxNode.selectionBox = box lineToBoxNode = LineArcNode( Vector(*pos) + (0.5, 0.5, 0.5), box.center, self.boxColor) self.addChild(boxNode) self.addChild(lineToBoxNode)
def __init__(self, pos, commandObj): super(BoundingBoxVisuals, self).__init__() box = commandObj.resolveBoundingBox(pos) boxNode = SelectionBoxNode() boxNode.filled = False boxNode.wireColor = self.boxColor boxNode.selectionBox = box lineToBoxNode = LineArcNode(Vector(*pos) + (0.5, 0.5, 0.5), box.center, self.boxColor) self.addChild(boxNode) self.addChild(lineToBoxNode)
def __init__(self, pos, commandObj): super(PositionalVisuals, self).__init__() x, y, z = commandObj.resolvePosition(pos) boxNode = SelectionBoxNode() boxNode.filled = False boxNode.wireColor = self.color boxNode.selectionBox = BoundingBox((x, y, z), (1, 1, 1)) lineNode = LineArcNode(Vector(*pos) + (0.5, 0.5, 0.5), (x+.5, y+.5, z+.5), self.color) self.addChild(boxNode) self.addChild(lineNode)
def __init__(self, pos, commandObj): super(PositionalVisuals, self).__init__() x, y, z = commandObj.resolvePosition(pos) boxNode = SelectionBoxNode() boxNode.filled = False boxNode.wireColor = self.color boxNode.selectionBox = BoundingBox((x, y, z), (1, 1, 1)) lineNode = LineArcNode( Vector(*pos) + (0.5, 0.5, 0.5), (x + .5, y + .5, z + .5), self.color) self.addChild(boxNode) self.addChild(lineNode)
def __init__(self, pos, commandObj): super(TargetedVisuals, self).__init__() selector = commandObj.targetSelector if selector.playerName is not None: return selectorPos = [selector.getArg(a) for a in 'xyz'] if None in selectorPos: return color = (0.2, 0.9, 0.7, 0.6) boxNode = SelectionBoxNode() boxNode.filled = False boxNode.wireColor = color boxNode.selectionBox = BoundingBox(selectorPos, (1, 1, 1)) lineNode = LineArcNode(Vector(*pos) + (0.5, 0.5, 0.5), Vector(*selectorPos) + (.5, .5, .5), color) self.addChild(boxNode) self.addChild(lineNode)
def __init__(self, pos, commandObj): super(TargetedVisuals, self).__init__() selector = commandObj.targetSelector if selector.playerName is not None: return selectorPos = [selector.getArg(a) for a in 'xyz'] if None in selectorPos: return color = (0.2, 0.9, 0.7, 0.6) boxNode = SelectionBoxNode() boxNode.filled = False boxNode.wireColor = color boxNode.selectionBox = BoundingBox(selectorPos, (1, 1, 1)) lineNode = LineArcNode( Vector(*pos) + (0.5, 0.5, 0.5), Vector(*selectorPos) + (.5, .5, .5), color) self.addChild(boxNode) self.addChild(lineNode)