Skip to content

Commit

Permalink
Improved pen fill detection
Browse files Browse the repository at this point in the history
  • Loading branch information
RexScratch committed Mar 18, 2019
1 parent 4b78119 commit 66abc9c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions sb3tosb2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1808,7 +1808,7 @@ def convertTarget(self, target, index, maxLen):
penUp = ['putPenUp']

def scriptAddFill(script, down, up):
if type(script) != list:
if type(script) != list or len(script) < 1:
return
if type(script[0]) == str:
if script[0] in ['penSize:', 'changePenSizeBy:']:
Expand All @@ -1820,6 +1820,8 @@ def scriptAddFill(script, down, up):
except:
return
else:
for block in script[1:]: # Convert subscripts in repeats, ifs, etc.
scriptAddFill(block, down, up)
return script
else:
top = None
Expand All @@ -1837,11 +1839,11 @@ def scriptAddFill(script, down, up):
elif value[0:len(up)+1] == up and top != None and self.bigSize:
script[top:i+1] = [
['penSize:', 200],
['gotoX:y:', -250, -100],
['gotoX:y:', -350, -100],
down,
['xpos:', 250],
up,
['gotoX:y:', -250, 100],
['gotoX:y:', -350, 100],
down,
['xpos:', 250],
up,
Expand Down

0 comments on commit 66abc9c

Please sign in to comment.