本文整理汇总了Python中mcedit2.rendering.scenegraph.scenenode.Node.addChild方法的典型用法代码示例。如果您正苦于以下问题:Python Node.addChild方法的具体用法?Python Node.addChild怎么用?Python Node.addChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mcedit2.rendering.scenegraph.scenenode.Node
的用法示例。
在下文中一共展示了Node.addChild方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MonsterLocationRenderer
# 需要导入模块: from mcedit2.rendering.scenegraph.scenenode import Node [as 别名]
# 或者: from mcedit2.rendering.scenegraph.scenenode.Node import addChild [as 别名]
class MonsterLocationRenderer(EntityMeshBase):
layer = Layer.MonsterLocations
notMonsters = {"Item", "XPOrb", "Painting", "ItemFrame"}
def makeChunkVertices(self, chunk, limitBox):
monsterPositions = []
for i, entityRef in enumerate(chunk.Entities):
if i % 10 == 0:
yield
ID = entityRef.id
if ID in self.notMonsters:
continue
pos = entityRef.Position
if limitBox and pos not in limitBox:
continue
monsterPositions.append(pos)
monsters = self._computeVertices(monsterPositions,
(0xff, 0x22, 0x22, 0x44),
offset=True,
chunkPosition=chunk.chunkPosition)
yield
vertexNode = VertexNode(monsters)
vertexNode.addState(PolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_LINE))
vertexNode.addState(LineWidth(2.0))
vertexNode.addState(DepthFunc(GL.GL_ALWAYS))
self.sceneNode = Node()
self.sceneNode.addChild(vertexNode)
vertexNode = VertexNode(monsters)
self.sceneNode.addChild(vertexNode)
示例2: TileEntityLocationMesh
# 需要导入模块: from mcedit2.rendering.scenegraph.scenenode import Node [as 别名]
# 或者: from mcedit2.rendering.scenegraph.scenenode.Node import addChild [as 别名]
class TileEntityLocationMesh(EntityMeshBase):
layer = Layer.TileEntityLocations
def makeChunkVertices(self, chunk, limitBox):
tilePositions = []
defaultColor = (0xff, 0xff, 0x33, 0x44)
for i, ref in enumerate(chunk.TileEntities):
if i % 10 == 0:
yield
if limitBox and ref.Position not in limitBox:
continue
if ref.id == "Control":
continue
tilePositions.append(ref.Position)
tiles = self._computeVertices(tilePositions, defaultColor, chunkPosition=chunk.chunkPosition)
vertexNode = VertexNode([tiles])
polyNode = PolygonModeNode(GL.GL_FRONT_AND_BACK, GL.GL_LINE)
polyNode.addChild(vertexNode)
lineNode = LineWidthNode(2.0)
lineNode.addChild(polyNode)
depthNode = DepthFuncNode(GL.GL_ALWAYS)
depthNode.addChild(lineNode)
self.sceneNode = Node()
self.sceneNode.addChild(depthNode)
vertexNode = VertexNode([tiles])
self.sceneNode.addChild(vertexNode)
示例3: CommandBlockLocationMesh
# 需要导入模块: from mcedit2.rendering.scenegraph.scenenode import Node [as 别名]
# 或者: from mcedit2.rendering.scenegraph.scenenode.Node import addChild [as 别名]
class CommandBlockLocationMesh(EntityMeshBase):
layer = Layer.CommandBlockLocations
def makeChunkVertices(self, chunk, limitBox):
tilePositions = []
tileColors = []
defaultColor = (0xff, 0x33, 0x33, 0x44)
for i, ref in enumerate(chunk.TileEntities):
if i % 10 == 0:
yield
if limitBox and ref.Position not in limitBox:
continue
if ref.id == "Control":
tilePositions.append(ref.Position)
cmdText = ref.Command
if len(cmdText):
if cmdText[0] == "/":
cmdText = cmdText[1:]
command, _ = cmdText.split(None, 1)
color = commandColor(command)
tileColors.append(color + (0x44,))
else:
tileColors.append(defaultColor)
else:
continue
tiles = self._computeVertices(tilePositions, tileColors, chunkPosition=chunk.chunkPosition)
vertexNode = VertexNode([tiles])
polyNode = PolygonModeNode(GL.GL_FRONT_AND_BACK, GL.GL_LINE)
polyNode.addChild(vertexNode)
lineNode = LineWidthNode(2.0)
lineNode.addChild(polyNode)
depthNode = DepthFuncNode(GL.GL_ALWAYS)
depthNode.addChild(lineNode)
self.sceneNode = Node()
self.sceneNode.addChild(depthNode)
示例4: LineArcNode
# 需要导入模块: from mcedit2.rendering.scenegraph.scenenode import Node [as 别名]
# 或者: from mcedit2.rendering.scenegraph.scenenode.Node import addChild [as 别名]
def LineArcNode(p1, p2, color):
arcSegments = 20
rgba = [c * 255 for c in color]
points = [p1]
x, y, z = p1
dx = p2[0] - p1[0]
dz = p2[2] - p1[2]
dx /= arcSegments
dz /= arcSegments
heightDiff = p2[1] - p1[1]
# maxRise = 8
# initial y-velocity
dy = 0.3 if heightDiff >= 0 else -0.3
dy += 2 * heightDiff / arcSegments
# the height of p2 without gravity
overshot = y + dy * arcSegments - p2[1]
# needed gravity so the last point is p2
ddy = -overshot / (arcSegments * (arcSegments-1) / 2)
for i in range(arcSegments):
y += dy
dy += ddy
x += dx
z += dz
points.append((x, y, z))
arcNode = Node("lineArc")
lineNode = LineStripNode(points, rgba)
arcNode.addChild(lineNode)
arcNode.addState(LineWidth(3.0))
backLineNode = Node("lineArcBack")
backLineNode.addChild(lineNode)
arcNode.addChild(backLineNode)
backLineNode.addState(DepthFunc(GL.GL_GREATER))
backLineNode.addState(LineWidth(1.0))
return arcNode
示例5: WorldScene
# 需要导入模块: from mcedit2.rendering.scenegraph.scenenode import Node [as 别名]
# 或者: from mcedit2.rendering.scenegraph.scenenode.Node import addChild [as 别名]
class WorldScene(scenenode.Node):
def __init__(self, dimension, textureAtlas=None, geometryCache=None, bounds=None):
super(WorldScene, self).__init__()
self.dimension = dimension
self.textureAtlas = textureAtlas
self.depthOffset = DepthOffset(DepthOffsets.Renderer)
self.addState(self.depthOffset)
self.textureAtlasNode = Node()
self.textureAtlasState = TextureAtlasState(textureAtlas)
self.textureAtlasNode.addState(self.textureAtlasState)
self.addChild(self.textureAtlasNode)
self.renderstateNodes = {}
for rsClass in renderstates.allRenderstates:
rsNode = Node()
rsNode.addState(rsClass())
self.textureAtlasNode.addChild(rsNode)
self.renderstateNodes[rsClass] = rsNode
self.groupNodes = {} # by renderstate
self.chunkRenderInfo = {}
self.visibleLayers = set(Layer.DefaultVisibleLayers)
self.updateTask = SceneUpdateTask(self, textureAtlas)
if geometryCache is None:
geometryCache = GeometryCache()
self.geometryCache = geometryCache
self.showRedraw = False
self.minlod = 0
self.bounds = bounds
def setTextureAtlas(self, textureAtlas):
if textureAtlas is not self.textureAtlas:
self.textureAtlas = textureAtlas
self.textureAtlasState.textureAtlas = textureAtlas
self.updateTask.textureAtlas = textureAtlas
self.discardAllChunks()
def chunkPositions(self):
return self.chunkRenderInfo.iterkeys()
def getRenderstateGroup(self, rsClass):
groupNode = self.groupNodes.get(rsClass)
if groupNode is None:
groupNode = ChunkGroupNode()
self.groupNodes[rsClass] = groupNode
self.renderstateNodes[rsClass].addChild(groupNode)
return groupNode
def discardChunk(self, cx, cz):
"""
Discard the chunk at the given position from the scene
"""
for groupNode in self.groupNodes.itervalues():
groupNode.discardChunkNode(cx, cz)
self.chunkRenderInfo.pop((cx, cz), None)
def discardChunks(self, chunks):
for cx, cz in chunks:
self.discardChunk(cx, cz)
def discardAllChunks(self):
for groupNode in self.groupNodes.itervalues():
groupNode.clear()
self.chunkRenderInfo.clear()
def invalidateChunk(self, cx, cz, invalidLayers=None):
"""
Mark the chunk for regenerating vertex data
"""
if invalidLayers is None:
invalidLayers = Layer.AllLayers
node = self.chunkRenderInfo.get((cx, cz))
if node:
node.invalidLayers.update(invalidLayers)
_fastLeaves = False
@property
def fastLeaves(self):
return self._fastLeaves
@fastLeaves.setter
def fastLeaves(self, val):
if self._fastLeaves != bool(val):
self.discardAllChunks()
self._fastLeaves = bool(val)
_roughGraphics = False
@property
def roughGraphics(self):
#.........这里部分代码省略.........
示例6: PendingImportNode
# 需要导入模块: from mcedit2.rendering.scenegraph.scenenode import Node [as 别名]
# 或者: from mcedit2.rendering.scenegraph.scenenode.Node import addChild [as 别名]
class PendingImportNode(Node, QtCore.QObject):
__node_id_counter = 0
def __init__(self, pendingImport, textureAtlas, hasHandle=True):
"""
A scenegraph node displaying an object that will be imported later, including
live and deferred views of the object with transformed items, and a BoxHandle
for moving the item.
Parameters
----------
pendingImport: PendingImport
The object to be imported. The PendingImportNode responds to changes in this
object's position, rotation, and scale.
textureAtlas: TextureAtlas
The textures and block models used to render the preview of the object.
hasHandle: bool
True if this import node should have a user-interactive BoxHandle associated
with it. This is False for the extra copies displayed by a repeated clone.
Attributes
----------
basePosition: Vector
The pre-transform position of the pending import. This is equal to
`self.pendingImport.basePosition` except when the node is currently being
dragged.
transformedPosition: Vector
The post-transform position of the pending import. This is equal to
`self.pendingImport.importPos` except when the node is currently being
dragged, scaled, or rotated.
"""
super(PendingImportNode, self).__init__()
self.textureAtlas = textureAtlas
self.pendingImport = pendingImport
self.hasHandle = hasHandle
dim = pendingImport.sourceDim
self.transformedPosition = Vector(0, 0, 0)
# worldScene is contained by rotateNode, and
# translates the world scene back to 0, 0, 0 so the rotateNode can
# rotate it around the anchor, and the plainSceneNode can translate
# it to the current position.
self.worldScene = WorldScene(dim, textureAtlas, bounds=pendingImport.selection)
self.worldScene.depthOffset.depthOffset = DepthOffsets.PreviewRenderer
self.worldSceneTranslate = Translate(-self.pendingImport.selection.origin)
self.worldScene.addState(self.worldSceneTranslate)
# rotateNode is used to rotate the non-transformed preview during live rotation
self.rotateNode = Rotate3DNode()
self.rotateNode.setAnchor(self.pendingImport.selection.size * 0.5)
self.rotateNode.addChild(self.worldScene)
self.scaleNode = Scale3DNode()
self.scaleNode.setAnchor(self.pendingImport.selection.size * 0.5)
self.scaleNode.addChild(self.rotateNode)
# plainSceneNode contains the non-transformed preview of the imported
# object, including its world scene. This preview will be rotated model-wise
# while the user is dragging the rotate controls.
self.plainSceneNode = Node("plainScene")
self.positionTranslate = Translate()
self.plainSceneNode.addState(self.positionTranslate)
self.plainSceneNode.addChild(self.scaleNode)
self.addChild(self.plainSceneNode)
# transformedSceneNode contains the transformed preview of the imported
# object, including a world scene that displays the object wrapped by a
# DimensionTransform.
self.transformedSceneNode = Node("transformedScene")
self.transformedSceneTranslate = Translate()
self.transformedSceneNode.addState(self.transformedSceneTranslate)
self.transformedWorldScene = None
self.addChild(self.transformedSceneNode)
box = BoundingBox(pendingImport.importPos, pendingImport.importBounds.size)
if hasHandle:
# handleNode displays a bounding box that can be moved around, and responds
# to mouse events.
self.handleNode = BoxHandle()
self.handleNode.bounds = box
self.handleNode.resizable = False
self.boxNode = None
else:
# boxNode displays a plain, non-movable bounding box
self.boxNode = SelectionBoxNode()
self.boxNode.wireColor = (1, 1, 1, .2)
self.boxNode.filled = False
#.........这里部分代码省略.........
示例7: BrushTool
# 需要导入模块: from mcedit2.rendering.scenegraph.scenenode import Node [as 别名]
# 或者: from mcedit2.rendering.scenegraph.scenenode.Node import addChild [as 别名]
#.........这里部分代码省略.........
def setY(self, val):
x, y, z = self.brushSize
y = float(val)
self.brushSize = x, y, z
def setZ(self, val):
x, y, z = self.brushSize
z = float(val)
self.brushSize = x, y, z
def hoverPosition(self, event):
if event.blockPosition:
vector = (event.blockFace.vector * self.hoverDistance)
pos = event.blockPosition + vector
return pos
def mousePress(self, event):
self.dragPoints[:] = []
pos = self.hoverPosition(event)
if pos:
self.dragPoints.append(pos)
def mouseMove(self, event):
pos = self.hoverPosition(event)
if pos:
self.cursorTranslate.translateOffset = pos
def mouseDrag(self, event):
p2 = self.hoverPosition(event)
if p2:
if len(self.dragPoints):
p1 = self.dragPoints.pop(-1)
points = list(bresenham.bresenham(p1, p2))
self.dragPoints.extend(points)
else:
self.dragPoints.append(p2)
def mouseRelease(self, event):
if not len(self.dragPoints):
pos = self.hoverPosition(event)
if pos:
self.dragPoints.append(pos)
if len(self.dragPoints):
dragPoints = sorted(set(self.dragPoints))
self.dragPoints[:] = []
command = BrushCommand(self.editorSession, dragPoints, self.options)
self.editorSession.pushCommand(command)
@property
def options(self):
options = {'brushSize': self.brushSize,
'brushShape': self.brushShape,
'brushMode': self.brushMode,
'brushHollow': self.brushHollow}
options.update(self.brushMode.getOptions())
return options
def modeSettingChanged(self, value):
self.brushMode = self.brushModesByName[value]
stack = self.toolWidget.modeOptionsStack
while stack.count():
stack.removeWidget(stack.widget(0))
if self.brushMode.optionsWidget:
stack.addWidget(self.brushMode.optionsWidget)
@property
def brushShape(self):
return self.toolWidget.brushShapeInput.currentShape
@property
def brushHollow(self):
return self.toolWidget.hollowCheckBox.isChecked()
def updateCursor(self):
log.info("Updating brush cursor")
if self.cursorWorldScene:
self.brushLoader.timer.stop()
self.cursorNode.removeChild(self.cursorWorldScene)
self.cursorWorldScene = None
if self.cursorBoxNode:
self.cursorNode.removeChild(self.cursorBoxNode)
self.cursorBoxNode = None
cursorLevel = self.brushMode.createCursorLevel(self)
if cursorLevel is not None:
self.cursorWorldScene = worldscene.WorldScene(cursorLevel, self.editorSession.textureAtlas)
self.cursorWorldScene.depthOffset.depthOffset = DepthOffsets.PreviewRenderer
self.cursorNode.addChild(self.cursorWorldScene)
self.brushLoader = WorldLoader(self.cursorWorldScene)
self.brushLoader.startLoader()
cursorBox = self.brushMode.brushBoxForPoint((0, 0, 0), self.options)
if cursorBox is not None:
self.cursorBoxNode = SelectionBoxNode()
self.cursorBoxNode.selectionBox = cursorBox
self.cursorBoxNode.filled = False
self.cursorNode.addChild(self.cursorBoxNode)
示例8: GenerateTool
# 需要导入模块: from mcedit2.rendering.scenegraph.scenenode import Node [as 别名]
# 或者: from mcedit2.rendering.scenegraph.scenenode.Node import addChild [as 别名]
class GenerateTool(EditorTool):
name = "Generate"
iconName = "generate"
instantDisplayChunks = 32
def __init__(self, *args, **kwargs):
EditorTool.__init__(self, *args, **kwargs)
self.livePreview = False
self.blockPreview = False
self.glPreview = True
toolWidget = QtGui.QWidget()
self.toolWidget = toolWidget
column = []
self.generatorTypes = [pluginClass(self) for pluginClass in _pluginClasses]
self.currentGenerator = None
if len(self.generatorTypes):
self.currentGenerator = self.generatorTypes[0]
self.generatorTypeInput = QtGui.QComboBox()
self.generatorTypesChanged()
self.generatorTypeInput.currentIndexChanged.connect(self.currentTypeChanged)
self.livePreviewCheckbox = QtGui.QCheckBox("Live Preview")
self.livePreviewCheckbox.setChecked(self.livePreview)
self.livePreviewCheckbox.toggled.connect(self.livePreviewToggled)
self.blockPreviewCheckbox = QtGui.QCheckBox("Block Preview")
self.blockPreviewCheckbox.setChecked(self.blockPreview)
self.blockPreviewCheckbox.toggled.connect(self.blockPreviewToggled)
self.glPreviewCheckbox = QtGui.QCheckBox("GL Preview")
self.glPreviewCheckbox.setChecked(self.glPreview)
self.glPreviewCheckbox.toggled.connect(self.glPreviewToggled)
self.optionsHolder = QtGui.QStackedWidget()
self.optionsHolder.setSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding)
self.generateButton = QtGui.QPushButton(self.tr("Generate"))
self.generateButton.clicked.connect(self.generateClicked)
column.append(self.generatorTypeInput)
column.append(self.livePreviewCheckbox)
column.append(self.blockPreviewCheckbox)
column.append(self.glPreviewCheckbox)
column.append(self.optionsHolder)
column.append(self.generateButton)
self.toolWidget.setLayout(Column(*column))
self.overlayNode = scenenode.Node()
self.sceneHolderNode = Node()
self.sceneTranslate = Translate()
self.sceneHolderNode.addState(self.sceneTranslate)
self.overlayNode.addChild(self.sceneHolderNode)
self.previewNode = None
self.boxHandleNode = BoxHandle()
self.boxHandleNode.boundsChanged.connect(self.boundsDidChange)
self.boxHandleNode.boundsChangedDone.connect(self.boundsDidChangeDone)
self.overlayNode.addChild(self.boxHandleNode)
self.worldScene = None
self.loader = None
self.previewBounds = None
self.schematicBounds = None
self.currentSchematic = None
self.currentTypeChanged(0)
# Name of last selected generator plugin is saved after unloading
# so it can be reselected if it is immediately reloaded
self._lastTypeName = None
_GeneratePlugins.instance.pluginAdded.connect(self.addPlugin)
_GeneratePlugins.instance.pluginRemoved.connect(self.removePlugin)
def removePlugin(self, cls):
log.info("Removing plugin %s", cls.__name__)
self.generatorTypes[:] = [gt for gt in self.generatorTypes if not isinstance(gt, cls)]
self.generatorTypesChanged()
if self.currentGenerator not in self.generatorTypes:
lastTypeName = self.currentGenerator.__class__.__name__
self.currentTypeChanged(0) # resets self._lastTypeName
self._lastTypeName = lastTypeName
def addPlugin(self, cls):
log.info("Adding plugin %s", cls.__name__)
self.generatorTypes.append(cls(self))
self.generatorTypesChanged()
if self._lastTypeName is not None:
if cls.__name__ == self._lastTypeName:
#.........这里部分代码省略.........
示例9: WorldView
# 需要导入模块: from mcedit2.rendering.scenegraph.scenenode import Node [as 别名]
# 或者: from mcedit2.rendering.scenegraph.scenenode.Node import addChild [as 别名]
#.........这里部分代码省略.........
def setTextureAtlas(self, textureAtlas):
self.textureAtlas = textureAtlas
if self.worldScene:
self.worldScene.setTextureAtlas(textureAtlas)
if textureAtlas is not None:
self.waitForSwapThread()
self.makeCurrent()
textureAtlas.load()
self.resetLoadOrder()
# --- Graph construction ---
def createCompass(self):
return compass.CompassNode()
def createWorldScene(self):
return worldscene.WorldScene(self.dimension, self.textureAtlas, self.geometryCache)
def createSceneGraph(self):
sceneGraph = scenenode.Node("WorldView SceneGraph")
self.worldScene = self.createWorldScene()
self.worldScene.setVisibleLayers(self.layerToggleGroup.getVisibleLayers())
clearNode = ClearNode()
self.skyNode = sky.SkyNode()
self.loadableChunksNode = loadablechunks.LoadableChunksNode(self.dimension)
self.worldNode = Node("World Container")
self.matrixState = MatrixState()
self.worldNode.addState(self.matrixState)
self._updateMatrices()
self.worldNode.addChild(self.loadableChunksNode)
self.worldNode.addChild(self.worldScene)
self.worldNode.addChild(self.overlayNode)
sceneGraph.addChild(clearNode)
sceneGraph.addChild(self.skyNode)
sceneGraph.addChild(self.worldNode)
sceneGraph.addChild(self.compassNode)
if self.cursorNode:
self.worldNode.addChild(self.cursorNode)
return sceneGraph
# --- Tool support ---
def setToolCursor(self, cursorNode):
if self.cursorNode:
self.worldNode.removeChild(self.cursorNode)
self.cursorNode = cursorNode
if cursorNode:
self.worldNode.addChild(cursorNode)
def setToolOverlays(self, overlayNodes):
self.overlayNode.clear()
for node in overlayNodes:
self.overlayNode.addChild(node)
# --- View settings ---
def setLayerVisible(self, layerName, visible):
self.worldScene.setLayerVisible(layerName, visible)
self.resetLoadOrder()
示例10: BrushTool
# 需要导入模块: from mcedit2.rendering.scenegraph.scenenode import Node [as 别名]
# 或者: from mcedit2.rendering.scenegraph.scenenode.Node import addChild [as 别名]
#.........这里部分代码省略.........
self.fillBlock = editorSession.worldEditor.blocktypes["stone"]
self.brushSize = BrushSizeSetting.value(QtGui.QVector3D(5, 5, 5)).toTuple() # calls updateCursor
self.toolWidget.xSpinSlider.setValue(self.brushSize[0])
self.toolWidget.ySpinSlider.setValue(self.brushSize[1])
self.toolWidget.zSpinSlider.setValue(self.brushSize[2])
@property
def hoverDistance(self):
return self.toolWidget.hoverSpinSlider.value()
_brushSize = (0, 0, 0)
@property
def brushSize(self):
return self._brushSize
@brushSize.setter
def brushSize(self, value):
self._brushSize = value
BrushSizeSetting.setValue(QtGui.QVector3D(*self.brushSize))
self.updateCursor()
def setX(self, val):
x, y, z = self.brushSize
x = float(val)
self.brushSize = x, y, z
def setY(self, val):
x, y, z = self.brushSize
y = float(val)
self.brushSize = x, y, z
def setZ(self, val):
x, y, z = self.brushSize
z = float(val)
self.brushSize = x, y, z
def setBlocktypes(self, types):
if len(types) == 0:
return
self.fillBlock = types[0]
self.updateCursor()
def mousePress(self, event):
pos = event.blockPosition
vector = (event.blockFace.vector * self.hoverDistance)
command = BrushCommand(self.editorSession, [pos + vector], self.options)
self.editorSession.pushCommand(command)
def mouseMove(self, event):
if event.blockPosition:
vector = (event.blockFace.vector * self.hoverDistance)
assert isinstance(vector, Vector), "vector isa %s" % type(vector)
self.cursorTranslate.translateOffset = event.blockPosition + vector
@property
def options(self):
options = {'brushSize': self.brushSize,
'brushShape': self.brushShape,
'brushMode': self.brushMode}
options.update(self.brushMode.getOptions())
return options
def modeSettingChanged(self, value):
self.brushMode = self.brushModesByName[value]
stack = self.toolWidget.modeOptionsStack
while stack.count():
stack.removeWidget(stack.widget(0))
widget = self.brushMode.createOptionsWidget(self)
if widget:
stack.addWidget(widget)
@property
def brushShape(self):
return self.toolWidget.brushShapeInput.currentShape
def updateCursor(self):
log.info("Updating brush cursor")
if self.cursorWorldScene:
self.brushLoader.timer.stop()
self.cursorNode.removeChild(self.cursorWorldScene)
self.cursorNode.removeChild(self.cursorBoxNode)
cursorLevel = self.brushMode.createCursorLevel(self)
cursorBox = self.brushMode.brushBoxForPoint((0, 0, 0), self.options)
self.cursorBoxNode = SelectionBoxNode()
self.cursorBoxNode.selectionBox = cursorBox
self.cursorBoxNode.filled = False
self.cursorWorldScene = worldscene.WorldScene(cursorLevel, self.editorSession.textureAtlas)
self.cursorWorldScene.depthOffset.depthOffset = DepthOffsets.PreviewRenderer
self.cursorNode.addChild(self.cursorWorldScene)
self.cursorNode.addChild(self.cursorBoxNode)
self.brushLoader = WorldLoader(self.cursorWorldScene)
self.brushLoader.startLoader()