Skip to content

Commit a14eed5

Browse files
committed
BlockAST: Convert OptionData to selected value
With a block code script created using a previous version of the plugin, it is possible for a node's value to still be an OptionData object at the time BlockAST.format_code_template is called. https://phabricator.endlessm.com/T35564
1 parent 33133a6 commit a14eed5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

addons/block_code/code_generation/block_ast.gd

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,14 @@ static func format_code_template(code_template: String, arguments: Dictionary) -
104104
var code_string: String
105105
var raw_string: String
106106

107+
if argument_value is OptionData:
108+
# Temporary hack: previously, the value was stored as an OptionData
109+
# object with a list of items and a "selected" property. If we are
110+
# using an older block script where that is the case, convert the
111+
# value to the value of its selected item.
112+
# See also, ParameterInput._update_option_input.
113+
argument_value = argument_value.items[argument_value.selected]
114+
107115
if argument_value is ASTValueNode:
108116
code_string = argument_value.get_code()
109117
raw_string = code_string

0 commit comments

Comments
 (0)