def __init__(self, editorSession, *args, **kwargs): super(BrushTool, self).__init__(editorSession, *args, **kwargs) self.toolWidget = load_ui("editortools/brush.ui") self.cursorWorldScene = None self.cursorNode = scenegraph.TranslateNode() self.toolWidget.xSpinSlider.setMinimum(1) self.toolWidget.ySpinSlider.setMinimum(1) self.toolWidget.zSpinSlider.setMinimum(1) self.toolWidget.xSpinSlider.valueChanged.connect(self.setX) self.toolWidget.ySpinSlider.valueChanged.connect(self.setY) self.toolWidget.zSpinSlider.valueChanged.connect(self.setZ) self.toolWidget.blockTypeInput.editorSession = editorSession self.toolWidget.blockTypeInput.block = editorSession.worldEditor.blocktypes["minecraft:stone"] self.toolWidget.blockTypeInput.blocksChanged.connect(self.setBlocktypes) self.toolWidget.brushShapeInput.shapeChanged.connect(self.updateCursor) 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])
def createToolWidget(self): toolWidget = QtGui.QWidget() self.toolWidget = toolWidget column = [] self.generatorTypes = [TreeGen()] self.currentType = self.generatorTypes[0] self.generatorTypeInput = QtGui.QComboBox() for gt in self.generatorTypes: self.generatorTypeInput.addItem(gt.displayName, gt) self.generatorTypeInput.currentIndexChanged.connect( self.generatorTypeChanged) self.optionsHolder = QtGui.QStackedWidget() self.optionsHolder.setSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding) column.append(self.generatorTypeInput) column.append(self.optionsHolder) self.toolWidget.setLayout(Column(*column)) self.overlayNode = scenegraph.Node() self.sceneHolderNode = scenegraph.TranslateNode() self.overlayNode.addChild(self.sceneHolderNode) self.boxHandleNode = BoxHandle() self.boxHandleNode.boundsChanged.connect(self.boundsDidChange) self.boxHandleNode.boundsChangedDone.connect(self.boundsDidChangeDone) self.overlayNode.addChild(self.boxHandleNode) self.worldScene = None self.schematicBounds = None
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 = scenegraph.Node() self.sceneHolderNode = scenegraph.TranslateNode() 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 __init__(self): super(WorkplaneNode, self).__init__() self.translateNode = scenegraph.TranslateNode() self.addChild(self.translateNode) self.axis = 1