pep8 compliance: E301 expected 1 blank line, found 0

This commit is contained in:
David Sowder 2012-02-19 17:54:52 -06:00
parent 1525942506
commit 42c9f6616b

View File

@ -345,6 +345,7 @@ class ChunkCalculator (object):
@classmethod @classmethod
def bind(self): def bind(self):
pass pass
@classmethod @classmethod
def release(self): def release(self):
pass pass
@ -364,6 +365,7 @@ class ChunkCalculator (object):
@classmethod @classmethod
def bind(self): def bind(self):
glEnable(GL_ALPHA_TEST) glEnable(GL_ALPHA_TEST)
@classmethod @classmethod
def release(self): def release(self):
glDisable(GL_ALPHA_TEST) glDisable(GL_ALPHA_TEST)
@ -372,12 +374,14 @@ class ChunkCalculator (object):
@classmethod @classmethod
def bind(self): def bind(self):
glEnable(GL_BLEND) glEnable(GL_BLEND)
@classmethod @classmethod
def release(self): def release(self):
glDisable(GL_BLEND) glDisable(GL_BLEND)
class renderstateWater(_renderstateAlphaBlend): class renderstateWater(_renderstateAlphaBlend):
pass pass
class renderstateIce(_renderstateAlphaBlend): class renderstateIce(_renderstateAlphaBlend):
pass pass
@ -742,6 +746,7 @@ class BlockRenderer(object):
FaceZIncreasing:s_[1:-1, 2:, 1:-1], FaceZIncreasing:s_[1:-1, 2:, 1:-1],
} }
renderstate = ChunkCalculator.renderstateAlphaTest renderstate = ChunkCalculator.renderstateAlphaTest
def __init__(self, cc): def __init__(self, cc):
self.makeTemplate = cc.makeTemplate self.makeTemplate = cc.makeTemplate
self.chunkCalculator = cc self.chunkCalculator = cc
@ -885,6 +890,7 @@ class BaseEntityRenderer(EntityRendererGeneric):
class MonsterRenderer(BaseEntityRenderer): class MonsterRenderer(BaseEntityRenderer):
layer = Layer.Entities # xxx Monsters layer = Layer.Entities # xxx Monsters
notMonsters = set(["Item", "XPOrb", "Painting"]) notMonsters = set(["Item", "XPOrb", "Painting"])
def makeChunkVertices(self, chunk): def makeChunkVertices(self, chunk):
monsterPositions = [] monsterPositions = []
for i, ent in enumerate(chunk.Entities): for i, ent in enumerate(chunk.Entities):
@ -920,6 +926,7 @@ class EntityRenderer(BaseEntityRenderer):
class ItemRenderer(BaseEntityRenderer): class ItemRenderer(BaseEntityRenderer):
layer = Layer.Items layer = Layer.Items
def makeChunkVertices(self, chunk): def makeChunkVertices(self, chunk):
entityPositions = [] entityPositions = []
entityColors = [] entityColors = []
@ -945,6 +952,7 @@ class ItemRenderer(BaseEntityRenderer):
class TileTicksRenderer(EntityRendererGeneric): class TileTicksRenderer(EntityRendererGeneric):
layer = Layer.TileTicks layer = Layer.TileTicks
def makeChunkVertices(self, chunk): def makeChunkVertices(self, chunk):
chunk.decompress() chunk.decompress()
if chunk.root_tag and "Level" in chunk.root_tag and "TileTicks" in chunk.root_tag["Level"]: if chunk.root_tag and "Level" in chunk.root_tag and "TileTicks" in chunk.root_tag["Level"]:
@ -1004,6 +1012,7 @@ class TerrainPopulatedRenderer(EntityRendererGeneric):
def makeChunkVertices(self, chunk): def makeChunkVertices(self, chunk):
chunk.decompress() chunk.decompress()
neighbors = self.chunkCalculator.getNeighboringChunks(chunk) neighbors = self.chunkCalculator.getNeighboringChunks(chunk)
def getpop(ch): def getpop(ch):
return getattr(ch, "TerrainPopulated", True) return getattr(ch, "TerrainPopulated", True)
@ -1030,6 +1039,7 @@ class TerrainPopulatedRenderer(EntityRendererGeneric):
class LowDetailBlockRenderer(BlockRenderer): class LowDetailBlockRenderer(BlockRenderer):
renderstate = ChunkCalculator.renderstateLowDetail renderstate = ChunkCalculator.renderstateLowDetail
detailLevels = (1,) detailLevels = (1,)
def drawFaceVertices(self, buf): def drawFaceVertices(self, buf):
if not len(buf): if not len(buf):
return return
@ -1149,6 +1159,7 @@ class GenericBlockRenderer(BlockRenderer):
renderstate = ChunkCalculator.renderstateAlphaTest renderstate = ChunkCalculator.renderstateAlphaTest
materialIndex = 1 materialIndex = 1
def makeGenericVertices(self, facingBlockIndices, blocks, blockMaterials, blockData, areaBlockLights, texMap): def makeGenericVertices(self, facingBlockIndices, blocks, blockMaterials, blockData, areaBlockLights, texMap):
vertexArrays = [] vertexArrays = []
materialIndices = self.getMaterialIndices(blockMaterials) materialIndices = self.getMaterialIndices(blockMaterials)
@ -1172,8 +1183,10 @@ class GenericBlockRenderer(BlockRenderer):
def setGrassColors(): def setGrassColors():
grass = theseBlocks == alphaMaterials.Grass.ID grass = theseBlocks == alphaMaterials.Grass.ID
vertexArray.view('uint8')[_RGB][grass] *= self.grassColor vertexArray.view('uint8')[_RGB][grass] *= self.grassColor
def getBlockLight(): def getBlockLight():
return facingBlockLight[blockIndices] return facingBlockLight[blockIndices]
def setColors(): def setColors():
vertexArray.view('uint8')[_RGB] *= getBlockLight()[..., newaxis, newaxis] vertexArray.view('uint8')[_RGB] *= getBlockLight()[..., newaxis, newaxis]
if self.materials.name in ("Alpha", "Pocket"): if self.materials.name in ("Alpha", "Pocket"):
@ -1203,6 +1216,7 @@ class GenericBlockRenderer(BlockRenderer):
class LeafBlockRenderer(BlockRenderer): class LeafBlockRenderer(BlockRenderer):
blocktypes = [18] blocktypes = [18]
@property @property
def renderstate(self): def renderstate(self):
if self.chunkCalculator.fastLeaves: if self.chunkCalculator.fastLeaves:
@ -1614,6 +1628,7 @@ class SnowBlockRenderer(BlockRenderer):
snowID = 78 snowID = 78
blocktypes = [snowID] blocktypes = [snowID]
def makeSnowVertices(self, facingBlockIndices, blocks, blockMaterials, blockData, areaBlockLights, texMap): def makeSnowVertices(self, facingBlockIndices, blocks, blockMaterials, blockData, areaBlockLights, texMap):
snowIndices = self.getMaterialIndices(blockMaterials) snowIndices = self.getMaterialIndices(blockMaterials)
arrays = [] arrays = []
@ -1653,6 +1668,7 @@ class SnowBlockRenderer(BlockRenderer):
class RedstoneBlockRenderer(BlockRenderer): class RedstoneBlockRenderer(BlockRenderer):
blocktypes = [55] blocktypes = [55]
def redstoneVertices(self, facingBlockIndices, blocks, blockMaterials, blockData, areaBlockLights, texMap): def redstoneVertices(self, facingBlockIndices, blocks, blockMaterials, blockData, areaBlockLights, texMap):
blockIndices = self.getMaterialIndices(blockMaterials) blockIndices = self.getMaterialIndices(blockMaterials)
yield yield
@ -1728,6 +1744,7 @@ class FeatureBlockRenderer(BlockRenderer):
buttonOffsets[buttonOffsets < 0] += 1.0 buttonOffsets[buttonOffsets < 0] += 1.0
dirIndexes = ((3, 2), (-3, 2), (1, 3), (1, 3), (-1, 2), (1, 2)) dirIndexes = ((3, 2), (-3, 2), (1, 3), (1, 3), (-1, 2), (1, 2))
def buttonVertices(self, facingBlockIndices, blocks, blockMaterials, blockData, areaBlockLights, texMap): def buttonVertices(self, facingBlockIndices, blocks, blockMaterials, blockData, areaBlockLights, texMap):
blockIndices = blocks == alphaMaterials.Button.ID blockIndices = blocks == alphaMaterials.Button.ID
axes = blockIndices.nonzero() axes = blockIndices.nonzero()
@ -1912,6 +1929,7 @@ from glutils import DisplayList
class MCRenderer(object): class MCRenderer(object):
isPreviewer = False isPreviewer = False
def __init__(self, level = None, alpha=1.0): def __init__(self, level = None, alpha=1.0):
self.render = True self.render = True
self.origin = (0, 0, 0) self.origin = (0, 0, 0)
@ -1983,8 +2001,10 @@ class MCRenderer(object):
def layerProperty(layer, default = True): # @NoSelf def layerProperty(layer, default = True): # @NoSelf
attr = intern("_draw" + layer) attr = intern("_draw" + layer)
def _get(self): def _get(self):
return getattr(self, attr, default) return getattr(self, attr, default)
def _set(self, val): def _set(self, val):
if val != _get(self): if val != _get(self):
setattr(self, attr, val) setattr(self, attr, val)
@ -2202,9 +2222,11 @@ class MCRenderer(object):
self.level.compressChunk(cx, cz) self.level.compressChunk(cx, cz)
_fastLeaves = False _fastLeaves = False
@property @property
def fastLeaves(self): def fastLeaves(self):
return self._fastLeaves return self._fastLeaves
@fastLeaves.setter @fastLeaves.setter
def fastLeaves(self, val): def fastLeaves(self, val):
if self._fastLeaves != bool(val): if self._fastLeaves != bool(val):
@ -2213,9 +2235,11 @@ class MCRenderer(object):
self._fastLeaves = bool(val) self._fastLeaves = bool(val)
_roughGraphics = False _roughGraphics = False
@property @property
def roughGraphics(self): def roughGraphics(self):
return self._roughGraphics return self._roughGraphics
@roughGraphics.setter @roughGraphics.setter
def roughGraphics(self, val): def roughGraphics(self, val):
if self._roughGraphics != bool(val): if self._roughGraphics != bool(val):
@ -2224,9 +2248,11 @@ class MCRenderer(object):
self._roughGraphics = bool(val) self._roughGraphics = bool(val)
_showHiddenOres = False _showHiddenOres = False
@property @property
def showHiddenOres(self): def showHiddenOres(self):
return self._showHiddenOres return self._showHiddenOres
@showHiddenOres.setter @showHiddenOres.setter
def showHiddenOres(self, val): def showHiddenOres(self, val):
if self._showHiddenOres != bool(val): if self._showHiddenOres != bool(val):
@ -2286,6 +2312,7 @@ class MCRenderer(object):
self.discardMasterList() self.discardMasterList()
shouldRecreateMasterList = True shouldRecreateMasterList = True
def discardMasterList(self): def discardMasterList(self):
self.shouldRecreateMasterList = True self.shouldRecreateMasterList = True
@ -2341,6 +2368,7 @@ class MCRenderer(object):
self.loadChunksStartingFrom(box.origin[0] + box.width / 2, box.origin[2] + box.length / 2, max(box.width, box.length)) self.loadChunksStartingFrom(box.origin[0] + box.width / 2, box.origin[2] + box.length / 2, max(box.width, box.length))
_floorTexture = None _floorTexture = None
@property @property
def floorTexture(self): def floorTexture(self):
if self._floorTexture is None: if self._floorTexture is None: