@@ -24,6 +24,7 @@ def visitScriptBlock(blockcontext):
24
24
if not isinstance (blockcontext , BlockContext ):
25
25
return blockcontext
26
26
27
+ log .info ("[Scratch3] Converting Script: {}" .format (blockcontext .block .opcode ))
27
28
scriptblock_handler = blockcontext .getBlockHandler ()
28
29
scriptblock = scriptblock_handler (blockcontext )
29
30
blockcontext .nextBlock ()
@@ -67,6 +68,7 @@ def isShadowBlock(block, attributename):
67
68
def visitGeneric (blockcontext , attributename ):
68
69
block = blockcontext .block
69
70
if not attributename in block .inputs :
71
+ log .warn ("[Scratch3] Failed to convert attribute: {} of block {} (type {}). Input is: {}" .format (attributename , block .name , block .opcode , block .inputs .get (attributename )))
70
72
return [False ]
71
73
72
74
block_id = blockcontext .getInput (attributename )[1 ]
@@ -88,10 +90,13 @@ def visitDefault(blockcontext):
88
90
def visitCondition (blockcontext ):
89
91
block = blockcontext .block
90
92
if not "CONDITION" in block .inputs :
93
+ log .warn ("[Scratch3] Possibly empty condition in block {} ({})" .format (blockcontext .block .name , blockcontext .block .opcode ))
91
94
return False
95
+
92
96
block_id = blockcontext .getInput ("CONDITION" )[1 ]
93
97
conditionblock = blockcontext .get_block (block_id )
94
98
if not isinstance (conditionblock , Scratch3Block ):
99
+ log .warn ("[Scratch3] Possibly empty condition in block {} ({})" .format (blockcontext .block .name , blockcontext .block .opcode ))
95
100
return False
96
101
condition = visitGeneric (blockcontext , "CONDITION" )
97
102
return condition
@@ -111,6 +116,7 @@ def visitBlockList(blockcontext):
111
116
112
117
def visitSubstack (blockcontext , substackkey ):
113
118
if not substackkey in blockcontext .block .inputs :
119
+ log .warn ("[Scratch3] Possibly empty if or else clause in block {} ({})" .format (blockcontext .block .name , blockcontext .block .opcode ))
114
120
return None
115
121
block_id = blockcontext .getInput (substackkey )[1 ]
116
122
substackstartblock = blockcontext .get_block (block_id )
@@ -120,6 +126,7 @@ def visitSubstack(blockcontext, substackkey):
120
126
substack = visitBlockList (substack_context )
121
127
return substack
122
128
129
+
123
130
def visitMutation (blockcontext ):
124
131
return blockcontext .block .mutation ["proccode" ]
125
132
0 commit comments