@@ -15,6 +15,8 @@ extends Control
15
15
@onready var _icon_collapse := EditorInterface .get_editor_theme ().get_icon ("Back" , "EditorIcons" )
16
16
@onready var _icon_expand := EditorInterface .get_editor_theme ().get_icon ("Forward" , "EditorIcons" )
17
17
18
+ const Constants = preload ("res://addons/block_code/ui/constants.gd" )
19
+
18
20
var _current_block_code_node : BlockCode
19
21
var _block_code_nodes : Array
20
22
var _collapsed : bool = false
@@ -86,6 +88,14 @@ func _on_delete_dialog_confirmed(block_code_node: BlockCode):
86
88
undo_redo .commit_action ()
87
89
88
90
91
+ func _try_migration ():
92
+ var version : int = _current_block_code_node .block_script .version
93
+ if version == Constants .CURRENT_DATA_VERSION :
94
+ # No migration needed.
95
+ return
96
+ push_warning ("Migration not implemented from %d to %d " % [version , Constants .CURRENT_DATA_VERSION ])
97
+
98
+
89
99
func switch_scene (scene_root : Node ):
90
100
_title_bar .scene_selected (scene_root )
91
101
@@ -94,6 +104,8 @@ func switch_block_code_node(block_code_node: BlockCode):
94
104
var block_script : BlockScriptData = block_code_node .block_script if block_code_node else null
95
105
_current_block_code_node = block_code_node
96
106
_delete_node_button .disabled = _current_block_code_node == null
107
+ if _current_block_code_node != null :
108
+ _try_migration ()
97
109
_picker .bsd_selected (block_script )
98
110
_title_bar .bsd_selected (block_script )
99
111
_block_canvas .bsd_selected (block_script )
@@ -133,6 +145,7 @@ func save_script():
133
145
var generated_script = _block_canvas .generate_script_from_current_window (block_script .script_inherits )
134
146
block_script .block_trees = block_trees
135
147
block_script .generated_script = generated_script
148
+ block_script .version = Constants .CURRENT_DATA_VERSION
136
149
137
150
undo_redo .add_do_property (_current_block_code_node .block_script , "block_trees" , block_trees )
138
151
undo_redo .add_do_property (_current_block_code_node .block_script , "generated_script" , generated_script )
0 commit comments