Skip to content

Commit

Permalink
Fixes rects in ImageLayers and replace, now they update properly each…
Browse files Browse the repository at this point in the history
… call.
  • Loading branch information
erodozer committed Jun 9, 2011
1 parent 8cd741c commit 80d5dbe
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/Rockmeter.py
Expand Up @@ -187,7 +187,6 @@ def __init__(self, stage, section, drawing):
#these are the images that are drawn when the layer is visible
self.drawing = self.engine.loadImgDrawing(self, None, drawing)
self.rectexpr = self.getexpr("rect", "(0.0,1.0,0.0,1.0)")
self.rect = [float(i) for i in eval(self.rectexpr)]
#how much of the image do you want rendered
# (left, right, top, bottom)

Expand All @@ -197,7 +196,7 @@ def updateLayer(self, playerNum):

super(ImageLayer, self).updateLayer(playerNum)

rect = self.rect = eval(self.rectexpr)
rect = self.rect = [float(i) for i in eval(self.rectexpr)]

#all of this has to be repeated instead of using the base method
#because now things can be calculated in relation to the image's properties
Expand Down Expand Up @@ -594,8 +593,8 @@ def __init__(self, layer, section):
if not self.get("rect") == None:
rects = self.getexprs("rect", separator="|")
for rect in rects:
self.rects.append(eval(rect))
self.rects.append(eval(layer.rect))
self.rects.append(rect)
self.rects.append(layer.rectexpr)
self.type = "image"
elif isinstance(layer, FontLayer):
self.font = self.engine.data.fontDict[self.get("font")]
Expand Down Expand Up @@ -637,7 +636,7 @@ def update(self):
if len(self.drawings) > 1:
self.layer.drawing = self.drawings[i]
if len(self.rects) > 1:
self.layer.rect = self.rects[i]
self.layer.rect = [float(i) for i in eval(self.rects[i])]
self.fixScale()
return
if self.type == "font":
Expand All @@ -646,7 +645,7 @@ def update(self):
if len(self.drawings) > 0:
self.layer.drawing = self.drawings[-1]
if len(self.rects) > 0:
self.layer.rect = self.rects[-1]
self.layer.rect = [float(i) for i in eval(self.rects[-1])]
self.fixScale()

#effect that allows one to set the number of frames and
Expand Down

0 comments on commit 80d5dbe

Please sign in to comment.