pep8 compliance: E301 expected 1 blank line
This commit is contained in:
parent
44277200a0
commit
a81a6c3a8d
@ -39,6 +39,7 @@ class BrushMode(object):
|
|||||||
|
|
||||||
def performAtPoint(self, op, point, dirtyBox):
|
def performAtPoint(self, op, point, dirtyBox):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def createOptions(self, panel, tool):
|
def createOptions(self, panel, tool):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -46,6 +47,7 @@ class BrushMode(object):
|
|||||||
class Modes:
|
class Modes:
|
||||||
class Fill(BrushMode):
|
class Fill(BrushMode):
|
||||||
name = "Fill"
|
name = "Fill"
|
||||||
|
|
||||||
def createOptions(self, panel, tool):
|
def createOptions(self, panel, tool):
|
||||||
col = [
|
col = [
|
||||||
panel.modeStyleGrid,
|
panel.modeStyleGrid,
|
||||||
@ -72,6 +74,7 @@ class Modes:
|
|||||||
class FloodFill(BrushMode):
|
class FloodFill(BrushMode):
|
||||||
name = "Flood Fill"
|
name = "Flood Fill"
|
||||||
options = ['indiscriminate']
|
options = ['indiscriminate']
|
||||||
|
|
||||||
def createOptions(self, panel, tool):
|
def createOptions(self, panel, tool):
|
||||||
col = [
|
col = [
|
||||||
panel.brushModeRow,
|
panel.brushModeRow,
|
||||||
@ -87,6 +90,7 @@ class Modes:
|
|||||||
tmpfile = tempfile.mkdtemp("FloodFillUndo")
|
tmpfile = tempfile.mkdtemp("FloodFillUndo")
|
||||||
undoLevel = MCInfdevOldLevel(tmpfile,create=True)
|
undoLevel = MCInfdevOldLevel(tmpfile,create=True)
|
||||||
dirtyChunks = set()
|
dirtyChunks = set()
|
||||||
|
|
||||||
def saveUndoChunk(cx,cz):
|
def saveUndoChunk(cx,cz):
|
||||||
if (cx,cz) in dirtyChunks: return
|
if (cx,cz) in dirtyChunks: return
|
||||||
dirtyChunks.add( (cx,cz) )
|
dirtyChunks.add( (cx,cz) )
|
||||||
@ -150,6 +154,7 @@ class Modes:
|
|||||||
|
|
||||||
class Replace(Fill):
|
class Replace(Fill):
|
||||||
name = "Replace"
|
name = "Replace"
|
||||||
|
|
||||||
def createOptions(self, panel, tool):
|
def createOptions(self, panel, tool):
|
||||||
return Modes.Fill.createOptions(self, panel, tool) + [panel.replaceBlockButton]
|
return Modes.Fill.createOptions(self, panel, tool) + [panel.replaceBlockButton]
|
||||||
|
|
||||||
@ -245,6 +250,7 @@ class Modes:
|
|||||||
class Topsoil(Fill):
|
class Topsoil(Fill):
|
||||||
name = "Topsoil"
|
name = "Topsoil"
|
||||||
options = ['naturalEarth', 'topsoilDepth']
|
options = ['naturalEarth', 'topsoilDepth']
|
||||||
|
|
||||||
def createOptions(self, panel, tool):
|
def createOptions(self, panel, tool):
|
||||||
col = Modes.Fill.createOptions(self, panel, tool)
|
col = Modes.Fill.createOptions(self, panel, tool)
|
||||||
depthRow = IntInputRow("Depth: ", ref=AttrRef(tool, 'topsoilDepth'))
|
depthRow = IntInputRow("Depth: ", ref=AttrRef(tool, 'topsoilDepth'))
|
||||||
@ -382,8 +388,10 @@ class BrushOperation(Operation):
|
|||||||
Modes.Topsoil,
|
Modes.Topsoil,
|
||||||
Modes.Paste
|
Modes.Paste
|
||||||
]
|
]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def noise(self): return self.options.get('brushNoise', 100)
|
def noise(self): return self.options.get('brushNoise', 100)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def hollow(self): return self.options.get('brushHollow', False)
|
def hollow(self): return self.options.get('brushHollow', False)
|
||||||
|
|
||||||
@ -520,7 +528,6 @@ class BrushOperation(Operation):
|
|||||||
|
|
||||||
|
|
||||||
class BrushPanel(Panel):
|
class BrushPanel(Panel):
|
||||||
|
|
||||||
def __init__(self, tool):
|
def __init__(self, tool):
|
||||||
Panel.__init__(self)
|
Panel.__init__(self)
|
||||||
self.tool = tool
|
self.tool = tool
|
||||||
@ -638,6 +645,7 @@ class BrushTool(CloneTool):
|
|||||||
tooltipText = "Brush\nRight-click for options"
|
tooltipText = "Brush\nRight-click for options"
|
||||||
toolIconName = "brush"
|
toolIconName = "brush"
|
||||||
minimumSpacing = 1
|
minimumSpacing = 1
|
||||||
|
|
||||||
def __init__(self, *args):
|
def __init__(self, *args):
|
||||||
CloneTool.__init__(self, *args)
|
CloneTool.__init__(self, *args)
|
||||||
self.optionsPanel = BrushToolOptions(self)
|
self.optionsPanel = BrushToolOptions(self)
|
||||||
@ -923,6 +931,7 @@ class BrushTool(CloneTool):
|
|||||||
|
|
||||||
def flip(self):
|
def flip(self):
|
||||||
self.decreaseBrushSize()
|
self.decreaseBrushSize()
|
||||||
|
|
||||||
def roll(self):
|
def roll(self):
|
||||||
self.increaseBrushSize()
|
self.increaseBrushSize()
|
||||||
|
|
||||||
@ -945,9 +954,11 @@ class BrushTool(CloneTool):
|
|||||||
blockInfo = self.replaceBlockInfo
|
blockInfo = self.replaceBlockInfo
|
||||||
else:
|
else:
|
||||||
blockInfo = self.blockInfo
|
blockInfo = self.blockInfo
|
||||||
|
|
||||||
class FakeLevel(MCLevel):
|
class FakeLevel(MCLevel):
|
||||||
filename = "Fake Level"
|
filename = "Fake Level"
|
||||||
materials = self.editor.level.materials
|
materials = self.editor.level.materials
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.chunkCache = {}
|
self.chunkCache = {}
|
||||||
|
|
||||||
@ -955,9 +966,11 @@ class BrushTool(CloneTool):
|
|||||||
|
|
||||||
zerolight = zeros((16, 16, Height), dtype='uint8')
|
zerolight = zeros((16, 16, Height), dtype='uint8')
|
||||||
zerolight[:] = 15
|
zerolight[:] = 15
|
||||||
|
|
||||||
def getChunk(self, cx, cz):
|
def getChunk(self, cx, cz):
|
||||||
if (cx, cz) in self.chunkCache:
|
if (cx, cz) in self.chunkCache:
|
||||||
return self.chunkCache[cx, cz]
|
return self.chunkCache[cx, cz]
|
||||||
|
|
||||||
class FakeBrushChunk(pymclevel.level.FakeChunk):
|
class FakeBrushChunk(pymclevel.level.FakeChunk):
|
||||||
def compress(self):
|
def compress(self):
|
||||||
del self.world.chunkCache[self.chunkPosition]
|
del self.world.chunkCache[self.chunkPosition]
|
||||||
@ -1093,10 +1106,12 @@ class BrushTool(CloneTool):
|
|||||||
glVertex3f(*map(lambda a:a + 0.5, reticlePoint))
|
glVertex3f(*map(lambda a:a + 0.5, reticlePoint))
|
||||||
|
|
||||||
def updateOffsets(self): pass
|
def updateOffsets(self): pass
|
||||||
|
|
||||||
def selectionChanged(self): pass
|
def selectionChanged(self): pass
|
||||||
|
|
||||||
def option1(self):
|
def option1(self):
|
||||||
self.swapBrushStyles()
|
self.swapBrushStyles()
|
||||||
|
|
||||||
def option2(self):
|
def option2(self):
|
||||||
self.swapBrushModes()
|
self.swapBrushModes()
|
||||||
|
|
||||||
|
@ -99,6 +99,7 @@ class ChunkTool(EditorTool):
|
|||||||
|
|
||||||
_selectedChunks = None
|
_selectedChunks = None
|
||||||
_displayList = None
|
_displayList = None
|
||||||
|
|
||||||
def drawToolMarkers(self):
|
def drawToolMarkers(self):
|
||||||
if self._displayList is None:
|
if self._displayList is None:
|
||||||
self._displayList = DisplayList(self._drawToolMarkers)
|
self._displayList = DisplayList(self._drawToolMarkers)
|
||||||
@ -173,6 +174,7 @@ class ChunkTool(EditorTool):
|
|||||||
glDepthMask(False)
|
glDepthMask(False)
|
||||||
glDrawArrays(GL_QUADS, 0, len(positions) * 4)
|
glDrawArrays(GL_QUADS, 0, len(positions) * 4)
|
||||||
glDepthMask(True)
|
glDepthMask(True)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def worldTooltipText(self):
|
def worldTooltipText(self):
|
||||||
box = self.editor.selectionTool.selectionBoxInProgress()
|
box = self.editor.selectionTool.selectionBoxInProgress()
|
||||||
@ -216,6 +218,7 @@ class ChunkTool(EditorTool):
|
|||||||
if chunks is None:
|
if chunks is None:
|
||||||
chunks = self.selectedChunks()
|
chunks = self.selectedChunks()
|
||||||
chunks = list(chunks)
|
chunks = list(chunks)
|
||||||
|
|
||||||
def _destroyChunks():
|
def _destroyChunks():
|
||||||
i = 0
|
i = 0
|
||||||
chunkCount = len(chunks)
|
chunkCount = len(chunks)
|
||||||
@ -318,6 +321,7 @@ class ChunkTool(EditorTool):
|
|||||||
|
|
||||||
def mouseDown(self, *args):
|
def mouseDown(self, *args):
|
||||||
return self.editor.selectionTool.mouseDown(*args)
|
return self.editor.selectionTool.mouseDown(*args)
|
||||||
|
|
||||||
def mouseUp(self, evt, *args):
|
def mouseUp(self, evt, *args):
|
||||||
self.editor.selectionTool.mouseUp(evt, *args)
|
self.editor.selectionTool.mouseUp(evt, *args)
|
||||||
|
|
||||||
@ -357,6 +361,7 @@ def GeneratorPanel():
|
|||||||
yield
|
yield
|
||||||
jarStorage.downloadCurrentServer()
|
jarStorage.downloadCurrentServer()
|
||||||
yield
|
yield
|
||||||
|
|
||||||
showProgress("Checking for server updates...", _check())
|
showProgress("Checking for server updates...", _check())
|
||||||
versionChoice.choices = sorted(jarStorage.versions, reverse=True)
|
versionChoice.choices = sorted(jarStorage.versions, reverse=True)
|
||||||
versionChoice.choiceIndex = 0
|
versionChoice.choiceIndex = 0
|
||||||
@ -386,6 +391,7 @@ def GeneratorPanel():
|
|||||||
(revealStorage, revealCache, clearCache)[i]()
|
(revealStorage, revealCache, clearCache)[i]()
|
||||||
|
|
||||||
advancedButton = Button("Advanced...", presentMenu)
|
advancedButton = Button("Advanced...", presentMenu)
|
||||||
|
|
||||||
@alertException
|
@alertException
|
||||||
def revealStorage():
|
def revealStorage():
|
||||||
mcplatform.platform_open(jarStorage.cacheDir)
|
mcplatform.platform_open(jarStorage.cacheDir)
|
||||||
@ -399,6 +405,7 @@ def GeneratorPanel():
|
|||||||
@alertException
|
@alertException
|
||||||
def clearCache():
|
def clearCache():
|
||||||
MCServerChunkGenerator.clearWorldCache()
|
MCServerChunkGenerator.clearWorldCache()
|
||||||
|
|
||||||
simRow = CheckBoxLabel("Simulate world", ref=AttrRef(panel, "simulate"), tooltipText = "Simulate the world for a few seconds after generating it. Reduces the save file size by processing all of the TileTicks.")
|
simRow = CheckBoxLabel("Simulate world", ref=AttrRef(panel, "simulate"), tooltipText = "Simulate the world for a few seconds after generating it. Reduces the save file size by processing all of the TileTicks.")
|
||||||
|
|
||||||
simRow = Row((simRow, advancedButton), anchor="lrh")
|
simRow = Row((simRow, advancedButton), anchor="lrh")
|
||||||
|
@ -251,11 +251,13 @@ class CloneToolPanel(Panel):
|
|||||||
scaleField.max = 8
|
scaleField.max = 8
|
||||||
dv = scaleField.decrease_value
|
dv = scaleField.decrease_value
|
||||||
iv = scaleField.increase_value
|
iv = scaleField.increase_value
|
||||||
|
|
||||||
def scaleFieldDecrease():
|
def scaleFieldDecrease():
|
||||||
if scaleField.value > 1 / 8.0 and scaleField.value <= 1.0:
|
if scaleField.value > 1 / 8.0 and scaleField.value <= 1.0:
|
||||||
scaleField.value *= 0.5
|
scaleField.value *= 0.5
|
||||||
else:
|
else:
|
||||||
dv()
|
dv()
|
||||||
|
|
||||||
def scaleFieldIncrease():
|
def scaleFieldIncrease():
|
||||||
if scaleField.value < 1.0:
|
if scaleField.value < 1.0:
|
||||||
scaleField.value *= 2.0
|
scaleField.value *= 2.0
|
||||||
@ -331,6 +333,7 @@ class CloneTool(EditorTool):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def scaleFactor(self): return self._scaleFactor
|
def scaleFactor(self): return self._scaleFactor
|
||||||
|
|
||||||
@scaleFactor.setter
|
@scaleFactor.setter
|
||||||
def scaleFactor(self, val):
|
def scaleFactor(self, val):
|
||||||
self.rescaleLevel(val)
|
self.rescaleLevel(val)
|
||||||
@ -355,6 +358,7 @@ class CloneTool(EditorTool):
|
|||||||
panelClass = CloneToolPanel
|
panelClass = CloneToolPanel
|
||||||
#color = (0.89, 0.65, 0.35, 0.33)
|
#color = (0.89, 0.65, 0.35, 0.33)
|
||||||
color = (0.3 , 1.0, 0.3, 0.19)
|
color = (0.3 , 1.0, 0.3, 0.19)
|
||||||
|
|
||||||
def __init__(self, *args):
|
def __init__(self, *args):
|
||||||
self.rotation = 0
|
self.rotation = 0
|
||||||
|
|
||||||
@ -462,6 +466,7 @@ class CloneTool(EditorTool):
|
|||||||
self.showPanel()
|
self.showPanel()
|
||||||
|
|
||||||
cloneCameraDistance = 0
|
cloneCameraDistance = 0
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def cameraDistance(self):
|
def cameraDistance(self):
|
||||||
return self.cloneCameraDistance
|
return self.cloneCameraDistance
|
||||||
@ -527,6 +532,7 @@ class CloneTool(EditorTool):
|
|||||||
# srcshape = roundedShape[0]/srcfactor, srcfactor, roundedShape[1]/srcfactor, srcfactor, roundedShape[2]/srcfactor, srcfactor
|
# srcshape = roundedShape[0]/srcfactor, srcfactor, roundedShape[1]/srcfactor, srcfactor, roundedShape[2]/srcfactor, srcfactor
|
||||||
#
|
#
|
||||||
# newlevel = MCSchematic(xyzshape)
|
# newlevel = MCSchematic(xyzshape)
|
||||||
|
#
|
||||||
# def copyArray(dest, src):
|
# def copyArray(dest, src):
|
||||||
# dest.shape = intershape
|
# dest.shape = intershape
|
||||||
# src.shape = srcshape
|
# src.shape = srcshape
|
||||||
@ -760,6 +766,7 @@ class CloneTool(EditorTool):
|
|||||||
|
|
||||||
def option1(self):
|
def option1(self):
|
||||||
self.copyAir = not self.copyAir
|
self.copyAir = not self.copyAir
|
||||||
|
|
||||||
def option2(self):
|
def option2(self):
|
||||||
self.copyWater = not self.copyWater
|
self.copyWater = not self.copyWater
|
||||||
|
|
||||||
@ -950,6 +957,7 @@ class ConstructionTool(CloneTool):
|
|||||||
tooltipText = "Import"
|
tooltipText = "Import"
|
||||||
|
|
||||||
panelClass = ConstructionToolPanel
|
panelClass = ConstructionToolPanel
|
||||||
|
|
||||||
def toolEnabled(self):
|
def toolEnabled(self):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ def alertFilterException(func):
|
|||||||
|
|
||||||
class FilterModuleOptions(Widget):
|
class FilterModuleOptions(Widget):
|
||||||
is_gl_container = True
|
is_gl_container = True
|
||||||
|
|
||||||
def __init__(self, tool, module, *args, **kw):
|
def __init__(self, tool, module, *args, **kw):
|
||||||
Widget.__init__(self, *args, **kw)
|
Widget.__init__(self, *args, **kw)
|
||||||
rows = []
|
rows = []
|
||||||
@ -193,6 +194,7 @@ class FilterToolPanel(Panel):
|
|||||||
self.reload()
|
self.reload()
|
||||||
|
|
||||||
filterOptionsPanel = None
|
filterOptionsPanel = None
|
||||||
|
|
||||||
def saveOptions(self):
|
def saveOptions(self):
|
||||||
if self.filterOptionsPanel:
|
if self.filterOptionsPanel:
|
||||||
self.savedOptions[self.selectedFilterName] = self.filterOptionsPanel.options
|
self.savedOptions[self.selectedFilterName] = self.filterOptionsPanel.options
|
||||||
|
@ -19,6 +19,7 @@ from pymclevel.box import FloatBox
|
|||||||
|
|
||||||
class PlayerMoveOperation(Operation):
|
class PlayerMoveOperation(Operation):
|
||||||
undoPos = None
|
undoPos = None
|
||||||
|
|
||||||
def __init__(self, tool, pos, player="Player", yp = (None, None)):
|
def __init__(self, tool, pos, player="Player", yp = (None, None)):
|
||||||
self.tool, self.pos = tool, pos
|
self.tool, self.pos = tool, pos
|
||||||
self.yp = yp
|
self.yp = yp
|
||||||
@ -106,6 +107,7 @@ class PlayerPositionPanel(Panel):
|
|||||||
tableview.row_data = lambda i: (players[i],)
|
tableview.row_data = lambda i: (players[i],)
|
||||||
tableview.row_is_selected = lambda x: x==tableview.index
|
tableview.row_is_selected = lambda x: x==tableview.index
|
||||||
tableview.zebra_color = (0,0,0,48)
|
tableview.zebra_color = (0,0,0,48)
|
||||||
|
|
||||||
def selectTableRow(i, evt):
|
def selectTableRow(i, evt):
|
||||||
tableview.index = i
|
tableview.index = i
|
||||||
|
|
||||||
@ -237,6 +239,7 @@ class PlayerPositionTool(EditorTool):
|
|||||||
self.markerList = DisplayList()
|
self.markerList = DisplayList()
|
||||||
|
|
||||||
panel = None
|
panel = None
|
||||||
|
|
||||||
def showPanel(self):
|
def showPanel(self):
|
||||||
if not self.panel:
|
if not self.panel:
|
||||||
self.panel = PlayerPositionPanel(self)
|
self.panel = PlayerPositionPanel(self)
|
||||||
@ -391,6 +394,7 @@ class PlayerSpawnPositionTool(PlayerPositionTool):
|
|||||||
|
|
||||||
def toolEnabled(self):
|
def toolEnabled(self):
|
||||||
return self.editor.level.dimNo == 0
|
return self.editor.level.dimNo == 0
|
||||||
|
|
||||||
def showPanel(self):
|
def showPanel(self):
|
||||||
self.panel = Panel()
|
self.panel = Panel()
|
||||||
button = Button("Goto Spawn", action=self.gotoSpawn)
|
button = Button("Goto Spawn", action=self.gotoSpawn)
|
||||||
@ -502,6 +506,7 @@ class PlayerSpawnPositionTool(PlayerPositionTool):
|
|||||||
self.markerList.invalidate()
|
self.markerList.invalidate()
|
||||||
if len(status):
|
if len(status):
|
||||||
alert("Spawn point fixed. Changes: \n\n" + status)
|
alert("Spawn point fixed. Changes: \n\n" + status)
|
||||||
|
|
||||||
@alertException
|
@alertException
|
||||||
def toolReselected(self):
|
def toolReselected(self):
|
||||||
self.gotoSpawn()
|
self.gotoSpawn()
|
||||||
|
@ -73,7 +73,6 @@ def GetSelectionColor(colorWord = None):
|
|||||||
|
|
||||||
|
|
||||||
class SelectionToolOptions(ToolOptions):
|
class SelectionToolOptions(ToolOptions):
|
||||||
|
|
||||||
def updateColors(self):
|
def updateColors(self):
|
||||||
names = [name.lower() for (name, value) in config.config.items("Selection Colors")]
|
names = [name.lower() for (name, value) in config.config.items("Selection Colors")]
|
||||||
self.colorPopupButton.choices = [name.capitalize() for name in names]
|
self.colorPopupButton.choices = [name.capitalize() for name in names]
|
||||||
@ -95,6 +94,7 @@ class SelectionToolOptions(ToolOptions):
|
|||||||
|
|
||||||
def set_colorvalue(ch):
|
def set_colorvalue(ch):
|
||||||
i = "RGB".index(ch)
|
i = "RGB".index(ch)
|
||||||
|
|
||||||
def _set(val):
|
def _set(val):
|
||||||
choice = self.colorPopupButton.selectedChoice
|
choice = self.colorPopupButton.selectedChoice
|
||||||
values = GetSelectionColor(choice)
|
values = GetSelectionColor(choice)
|
||||||
@ -107,6 +107,7 @@ class SelectionToolOptions(ToolOptions):
|
|||||||
|
|
||||||
def get_colorvalue(ch):
|
def get_colorvalue(ch):
|
||||||
i = "RGB".index(ch)
|
i = "RGB".index(ch)
|
||||||
|
|
||||||
def _get():
|
def _get():
|
||||||
return int(GetSelectionColor()[i] * 255)
|
return int(GetSelectionColor()[i] * 255)
|
||||||
return _get
|
return _get
|
||||||
@ -686,6 +687,7 @@ class SelectionTool(EditorTool):
|
|||||||
self.selectOtherCorner()
|
self.selectOtherCorner()
|
||||||
|
|
||||||
_currentCorner = 0
|
_currentCorner = 0
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def currentCorner(self):
|
def currentCorner(self):
|
||||||
return self._currentCorner
|
return self._currentCorner
|
||||||
@ -985,6 +987,7 @@ class SelectionTool(EditorTool):
|
|||||||
self.editor.freezeStatus("Removing entities...")
|
self.editor.freezeStatus("Removing entities...")
|
||||||
level = self.editor.level
|
level = self.editor.level
|
||||||
editor = self.editor
|
editor = self.editor
|
||||||
|
|
||||||
class DeleteEntitiesOperation(Operation):
|
class DeleteEntitiesOperation(Operation):
|
||||||
def perform(self, recordUndo=True):
|
def perform(self, recordUndo=True):
|
||||||
self.undoEntities = level.getEntitiesInBox(box)
|
self.undoEntities = level.getEntitiesInBox(box)
|
||||||
@ -1066,6 +1069,7 @@ class SelectionTool(EditorTool):
|
|||||||
|
|
||||||
class SelectionOperation(Operation):
|
class SelectionOperation(Operation):
|
||||||
changedLevel = False
|
changedLevel = False
|
||||||
|
|
||||||
def __init__(self, selectionTool, points):
|
def __init__(self, selectionTool, points):
|
||||||
self.selectionTool = selectionTool
|
self.selectionTool = selectionTool
|
||||||
self.points = points;
|
self.points = points;
|
||||||
@ -1083,6 +1087,7 @@ class SelectionOperation(Operation):
|
|||||||
|
|
||||||
class NudgeSelectionOperation (Operation) :
|
class NudgeSelectionOperation (Operation) :
|
||||||
changedLevel = False
|
changedLevel = False
|
||||||
|
|
||||||
def __init__(self, selectionTool, direction):
|
def __init__(self, selectionTool, direction):
|
||||||
self.selectionTool = selectionTool;
|
self.selectionTool = selectionTool;
|
||||||
self.direction = direction;
|
self.direction = direction;
|
||||||
|
@ -109,6 +109,7 @@ class Operation(object):
|
|||||||
|
|
||||||
sch.compress()
|
sch.compress()
|
||||||
return sch
|
return sch
|
||||||
|
|
||||||
#represents a single undoable operation
|
#represents a single undoable operation
|
||||||
def perform(self, recordUndo=True):
|
def perform(self, recordUndo=True):
|
||||||
" Perform the operation. Record undo information if recordUndo"
|
" Perform the operation. Record undo information if recordUndo"
|
||||||
@ -186,6 +187,7 @@ class ThumbView(GLPerspective):
|
|||||||
GL.glDisableClientState(GL.GL_TEXTURE_COORD_ARRAY)
|
GL.glDisableClientState(GL.GL_TEXTURE_COORD_ARRAY)
|
||||||
|
|
||||||
drawBackground = True
|
drawBackground = True
|
||||||
|
|
||||||
def gl_draw_thumb(self):
|
def gl_draw_thumb(self):
|
||||||
GL.glPushAttrib(GL.GL_SCISSOR_BIT)
|
GL.glPushAttrib(GL.GL_SCISSOR_BIT)
|
||||||
r = self.rect
|
r = self.rect
|
||||||
@ -207,9 +209,11 @@ class BlockThumbView(Widget):
|
|||||||
|
|
||||||
thumb = None
|
thumb = None
|
||||||
_blockInfo = None
|
_blockInfo = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def blockInfo(self):
|
def blockInfo(self):
|
||||||
return self._blockInfo
|
return self._blockInfo
|
||||||
|
|
||||||
@blockInfo.setter
|
@blockInfo.setter
|
||||||
def blockInfo(self, b):
|
def blockInfo(self, b):
|
||||||
if self._blockInfo != b:
|
if self._blockInfo != b:
|
||||||
@ -271,6 +275,7 @@ class BlockView(GLOrtho):
|
|||||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY)
|
glDisableClientState(GL_TEXTURE_COORD_ARRAY)
|
||||||
glDisable(GL_ALPHA_TEST)
|
glDisable(GL_ALPHA_TEST)
|
||||||
glDisable(GL_TEXTURE_2D)
|
glDisable(GL_TEXTURE_2D)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def tooltipText(self):
|
def tooltipText(self):
|
||||||
return "{0}".format(self.blockInfo.name)
|
return "{0}".format(self.blockInfo.name)
|
||||||
@ -278,6 +283,7 @@ class BlockView(GLOrtho):
|
|||||||
|
|
||||||
class BlockButton(ButtonBase, Panel):
|
class BlockButton(ButtonBase, Panel):
|
||||||
_ref = None
|
_ref = None
|
||||||
|
|
||||||
def __init__(self, materials, blockInfo=None, ref=None, recentBlocks=None, *a, **kw):
|
def __init__(self, materials, blockInfo=None, ref=None, recentBlocks=None, *a, **kw):
|
||||||
self.allowWildcards = False
|
self.allowWildcards = False
|
||||||
Panel.__init__(self, *a, **kw)
|
Panel.__init__(self, *a, **kw)
|
||||||
@ -346,6 +352,7 @@ class BlockButton(ButtonBase, Panel):
|
|||||||
def makeBlockView(bi):
|
def makeBlockView(bi):
|
||||||
bv = BlockView(self.materials, bi)
|
bv = BlockView(self.materials, bi)
|
||||||
bv.size = (16, 16)
|
bv.size = (16, 16)
|
||||||
|
|
||||||
def action(evt):
|
def action(evt):
|
||||||
self.blockInfo = bi
|
self.blockInfo = bi
|
||||||
bv.mouse_up = action
|
bv.mouse_up = action
|
||||||
@ -452,12 +459,14 @@ class BlockPicker(Dialog):
|
|||||||
tableview.row_is_selected = lambda x: x == self.selectedBlockIndex
|
tableview.row_is_selected = lambda x: x == self.selectedBlockIndex
|
||||||
tableview.click_row = self.selectTableRow
|
tableview.click_row = self.selectTableRow
|
||||||
draw_table_cell = tableview.draw_table_cell
|
draw_table_cell = tableview.draw_table_cell
|
||||||
|
|
||||||
def draw_block_table_cell(surf, i, data, cell_rect, column):
|
def draw_block_table_cell(surf, i, data, cell_rect, column):
|
||||||
if isinstance(data, Block):
|
if isinstance(data, Block):
|
||||||
|
|
||||||
tableicons[i - tableview.rows.scroll].blockInfo = data
|
tableicons[i - tableview.rows.scroll].blockInfo = data
|
||||||
else:
|
else:
|
||||||
draw_table_cell(surf, i, data, cell_rect, column)
|
draw_table_cell(surf, i, data, cell_rect, column)
|
||||||
|
|
||||||
tableview.draw_table_cell = draw_block_table_cell
|
tableview.draw_table_cell = draw_block_table_cell
|
||||||
tableview.width = panelWidth
|
tableview.width = panelWidth
|
||||||
tableview.anchor = "lrbt"
|
tableview.anchor = "lrbt"
|
||||||
@ -466,9 +475,11 @@ class BlockPicker(Dialog):
|
|||||||
tableWidget = Widget()
|
tableWidget = Widget()
|
||||||
tableWidget.add(tableview)
|
tableWidget.add(tableview)
|
||||||
tableWidget.shrink_wrap()
|
tableWidget.shrink_wrap()
|
||||||
|
|
||||||
def wdraw(*args):
|
def wdraw(*args):
|
||||||
for t in tableicons:
|
for t in tableicons:
|
||||||
t.blockInfo = materials.Air
|
t.blockInfo = materials.Air
|
||||||
|
|
||||||
tableWidget.draw = wdraw
|
tableWidget.draw = wdraw
|
||||||
self.blockButton = blockView = BlockThumbView(materials, self.blockInfo)
|
self.blockButton = blockView = BlockThumbView(materials, self.blockInfo)
|
||||||
|
|
||||||
@ -591,6 +602,7 @@ class EditorTool(object):
|
|||||||
previewRenderer = None
|
previewRenderer = None
|
||||||
|
|
||||||
tooltipText = "???"
|
tooltipText = "???"
|
||||||
|
|
||||||
def levelChanged(self):
|
def levelChanged(self):
|
||||||
""" called after a level change """
|
""" called after a level change """
|
||||||
pass
|
pass
|
||||||
@ -598,6 +610,7 @@ class EditorTool(object):
|
|||||||
@property
|
@property
|
||||||
def statusText(self):
|
def statusText(self):
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def cameraDistance(self):
|
def cameraDistance(self):
|
||||||
return self.editor.cameraToolDistance
|
return self.editor.cameraToolDistance
|
||||||
@ -616,6 +629,7 @@ class EditorTool(object):
|
|||||||
|
|
||||||
def drawTerrainReticle(self):
|
def drawTerrainReticle(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def drawTerrainMarkers(self):
|
def drawTerrainMarkers(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -629,9 +643,13 @@ class EditorTool(object):
|
|||||||
glDisable(GL_POLYGON_OFFSET_FILL)
|
glDisable(GL_POLYGON_OFFSET_FILL)
|
||||||
|
|
||||||
def rotate(self, amount=1): pass
|
def rotate(self, amount=1): pass
|
||||||
|
|
||||||
def roll(self, amount=1): pass
|
def roll(self, amount=1): pass
|
||||||
|
|
||||||
def flip(self, amount=1): pass
|
def flip(self, amount=1): pass
|
||||||
|
|
||||||
def mirror(self, amount=1): pass
|
def mirror(self, amount=1): pass
|
||||||
|
|
||||||
def swap(self, amount=1): pass
|
def swap(self, amount=1): pass
|
||||||
|
|
||||||
def mouseDown(self, evt, pos, direction):
|
def mouseDown(self, evt, pos, direction):
|
||||||
@ -640,6 +658,7 @@ class EditorTool(object):
|
|||||||
its action on the specified block'''
|
its action on the specified block'''
|
||||||
|
|
||||||
pass;
|
pass;
|
||||||
|
|
||||||
def mouseUp(self, evt, pos, direction):
|
def mouseUp(self, evt, pos, direction):
|
||||||
pass;
|
pass;
|
||||||
|
|
||||||
@ -649,9 +668,11 @@ class EditorTool(object):
|
|||||||
def increaseToolReach(self):
|
def increaseToolReach(self):
|
||||||
"Return True if the tool handles its own reach"
|
"Return True if the tool handles its own reach"
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def decreaseToolReach(self):
|
def decreaseToolReach(self):
|
||||||
"Return True if the tool handles its own reach"
|
"Return True if the tool handles its own reach"
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def resetToolReach(self):
|
def resetToolReach(self):
|
||||||
"Return True if the tool handles its own reach"
|
"Return True if the tool handles its own reach"
|
||||||
return False
|
return False
|
||||||
@ -659,6 +680,7 @@ class EditorTool(object):
|
|||||||
def confirm(self):
|
def confirm(self):
|
||||||
''' called when user presses enter '''
|
''' called when user presses enter '''
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def cancel(self):
|
def cancel(self):
|
||||||
'''cancel the current operation. called when a different tool
|
'''cancel the current operation. called when a different tool
|
||||||
is picked, escape is pressed, or etc etc'''
|
is picked, escape is pressed, or etc etc'''
|
||||||
@ -714,6 +736,7 @@ class EditorTool(object):
|
|||||||
dim2 = dim + 2
|
dim2 = dim + 2
|
||||||
dim1 %= 3
|
dim1 %= 3
|
||||||
dim2 %= 3
|
dim2 %= 3
|
||||||
|
|
||||||
def pointInBounds(point, x):
|
def pointInBounds(point, x):
|
||||||
return box.origin[x] <= point[x] <= box.maximum[x]
|
return box.origin[x] <= point[x] <= box.maximum[x]
|
||||||
|
|
||||||
@ -844,6 +867,7 @@ class EditorTool(object):
|
|||||||
return Settings.blockBuffer.get() / 2 #assume block buffer in megabytes
|
return Settings.blockBuffer.get() / 2 #assume block buffer in megabytes
|
||||||
|
|
||||||
def showPanel(self): pass
|
def showPanel(self): pass
|
||||||
|
|
||||||
def hidePanel(self):
|
def hidePanel(self):
|
||||||
if self.panel and self.panel.parent:
|
if self.panel and self.panel.parent:
|
||||||
self.panel.parent.remove(self.panel)
|
self.panel.parent.remove(self.panel)
|
||||||
|
Reference in New Issue
Block a user