def toolSelected(self): """ Applies options of BrushToolOptions. It then imports all brush modes from their files, sets up the panel, and sets up the brush preview. Called on pressing "2" or pressing the brush button in the hotbar when brush is not selected. """ self.setupBrushModes() self.selectedBrushMode = [m for m in self.brushModes][0] self.brushMode = self.brushModes[self.selectedBrushMode] if self.settings['chooseBlockImmediately']: key = getattr(self.brushMode, 'mainBlock', 'Block') wcb = getattr(self.brushMode, 'wildcardBlocks', []) aw = False if key in wcb: aw = True blockPicker = BlockPicker(self.options[key], self.editor.level.materials, allowWildcards=aw) if blockPicker.present(): self.options[key] = blockPicker.blockInfo if self.settings['updateBrushOffset']: self.reticleOffset = self.offsetMax() self.resetToolDistance() if os.path.isfile(os.path.join(directories.brushesDir, '__temp__.preset')): self.loadBrushPreset('__temp__') else: print 'No __temp__ file found.' self.showPanel() self.setupPreview() if getattr(self.brushMode, 'addPasteButton', False): stack = self.editor.copyStack if len(stack) == 0: self.importPaste() else: self.loadLevel(stack[0])
def toolSelected(self): box = self.selectionBox() if None is box: return self.replacing = False self.showPanel() if self.chooseBlockImmediately: blockPicker = BlockPicker(self.blockInfo, self.editor.level.materials, allowWildcards=True) if blockPicker.present(): self.blockInfo = blockPicker.blockInfo self.showPanel()
def toolReselected(self): """ Called on reselecting the brush. Makes a blockpicker show up for the Main Block of the brush mode. """ if not self.panel: self.toolSelected() key = getattr(self.brushMode, 'mainBlock', 'Block') wcb = getattr(self.brushMode, 'wildcardBlocks', []) aw = (key in wcb) #if key in wcb: # aw = True blockPicker = BlockPicker(self.options[key], self.editor.level.materials, allowWildcards=aw) if blockPicker.present(): self.options[key] = blockPicker.blockInfo self.setupPreview()
def pickFillBlock(self): blockPicker = BlockPicker(self.tool.blockInfo, self.tool.editor.level.materials, allowWildcards=True) if blockPicker.present(): self.tool.blockInfo = blockPicker.blockInfo
def pickReplaceBlock(self): blockPicker = BlockPicker(self.tool.replaceBlockInfo, self.tool.editor.level.materials) if blockPicker.present(): self.replaceBlockButton.blockInfo = self.tool.replaceBlockInfo = blockPicker.blockInfo