@@ -158,13 +158,12 @@ func _save_data() -> void:
158158 children .sort_custom (func (a : Node , b : Node ): return a .name .naturalcasecmp_to (b .name ) < 0 )
159159 for child in children :
160160 if child is GaeaGraphNode :
161-
162161 resource_uids .append (ResourceUID .id_to_text (
163162 ResourceLoader .get_resource_uid (child .resource .get_script ().get_path ())
164163 ))
165164 resources .append (child .resource )
166- elif child is GraphFrame :
167- other .get_or_add (& "frames" , []).append (_get_frame_save_data ( child ))
165+ elif child is GaeaGraphFrame :
166+ other .get_or_add (& "frames" , []).append (child . get_save_data ( ))
168167
169168 for connection in connections :
170169 var from_node : GraphNode = _graph_edit .get_node (NodePath (connection.from_node))
@@ -187,19 +186,6 @@ func _save_data() -> void:
187186 EditorInterface .mark_scene_as_unsaved ()
188187
189188
190- func _get_frame_save_data (frame : GraphFrame ) -> Dictionary [String , Variant ]:
191- return {
192- & "title" : frame .title ,
193- & "tint_color" : frame .tint_color ,
194- & "tint_color_enabled" : frame .tint_color_enabled ,
195- & "position" : frame .position_offset ,
196- & "attached" : _graph_edit .get_attached_nodes_of_frame (frame .name ),
197- & "size" : frame .size ,
198- & "autoshrink" : frame .autoshrink_enabled ,
199- & "name" : frame .name
200- }
201-
202-
203189
204190func _load_data () -> void :
205191 is_loading = true
@@ -245,15 +231,9 @@ func _load_connections(connections: Array[Dictionary]) -> void:
245231
246232
247233func _load_frame (frame_data : Dictionary ) -> void :
248- var new_frame : GraphFrame = GraphFrame .new ()
249- new_frame .title = frame_data .get (& "title" , "Frame" )
250- new_frame .position_offset = frame_data .get (& "position" , Vector2 .ZERO )
251- new_frame .size = frame_data .get (& "size" , Vector2 (64 , 64 ))
252- new_frame .tint_color = frame_data .get (& "tint_color" , new_frame .tint_color )
253- new_frame .tint_color_enabled = frame_data .get (& "tint_color_enabled" , false )
254- new_frame .name = frame_data .get_or_add (& "name" , new_frame .name )
255- new_frame .autoshrink_enabled = frame_data .get (& "autoshrink" , true )
234+ var new_frame : GaeaGraphFrame = GaeaGraphFrame .new ()
256235 _graph_edit .add_child (new_frame )
236+ new_frame .load_save_data (frame_data )
257237
258238
259239func _load_node (resource : GaeaNodeResource , saved_data : Dictionary ) -> GraphNode :
@@ -347,12 +327,9 @@ func _on_tree_node_selected_for_creation(resource: GaeaNodeResource) -> void:
347327func _on_tree_special_node_selected_for_creation (id : StringName ) -> void :
348328 match id :
349329 & "frame" :
350- var new_frame : GraphFrame = GraphFrame .new ()
351- new_frame .size = Vector2 (512 , 256 )
330+ var new_frame : GaeaGraphFrame = GaeaGraphFrame .new ()
352331 new_frame .set_position_offset ((_graph_edit .get_local_mouse_position () + _graph_edit .scroll_offset ) / _graph_edit .zoom )
353- new_frame .title = "Frame"
354332 _graph_edit .add_child (new_frame )
355- new_frame .name = new_frame .name .replace ("@" , "_" )
356333 _save_data .call_deferred ()
357334 _create_node_popup .hide ()
358335
0 commit comments