@@ -60,6 +60,8 @@ var connections: Array[Dictionary]
6060## The related [GaeaGraphNode] for editing in the Gaea graph editor.
6161## This is null during runtime.
6262var node : GaeaGraphNode
63+ ## The related [GaeaGraph] that holds this node.
64+ var graph : GaeaGraph
6365## A Dictionary holding the values of the arguments
6466## where the keys are their names.
6567var arguments : Dictionary
@@ -107,22 +109,22 @@ static func is_valid_node_resource(uid_path: String) -> String:
107109
108110
109111## Public version of [method _on_added_to_graph].
110- func on_added_to_graph (graph : GaeaGraph ) -> void :
111- _on_added_to_graph (graph )
112+ func on_added_to_graph () -> void :
113+ _on_added_to_graph ()
112114
113115
114- ## Called when the node is added to [param graph], by [method GaeaGraph.add_node].
115- func _on_added_to_graph (_graph : GaeaGraph ) -> void :
116+ ## Called when the node is added to [member graph], by [method GaeaGraph.add_node].
117+ func _on_added_to_graph () -> void :
116118 pass
117119
118120
119121## Public version of [method _on_removed_from_graph].
120- func on_removed_from_graph (graph : GaeaGraph ) -> void :
121- _on_removed_from_graph (graph )
122+ func on_removed_from_graph () -> void :
123+ _on_removed_from_graph ()
122124
123125
124- ## Called when the node is removed from [param graph], by [method GaeaGraph.remove_node].
125- func _on_removed_from_graph (_graph : GaeaGraph ) -> void :
126+ ## Called when the node is removed from [member graph], by [method GaeaGraph.remove_node].
127+ func _on_removed_from_graph () -> void :
126128 pass
127129
128130
@@ -501,15 +503,15 @@ func _on_argument_value_changed(_arg_name: StringName, _new_value: Variant) -> v
501503#region Args
502504## Returns the value of the argument of [param name]. Pass in [param graph] to allow overriding with input slots.[br]
503505## [param settings] is used for values of the type Data or Map. (See [enum GaeaValue.Type]).
504- func _get_arg (arg_name : StringName , graph : GaeaGraph , pouch : GaeaGenerationPouch ) -> Variant :
505- _log_arg (arg_name , graph )
506+ func _get_arg (arg_name : StringName , pouch : GaeaGenerationPouch ) -> Variant :
507+ _log_arg (arg_name )
506508
507509 var connection := _get_argument_connection (arg_name )
508510 if not connection.is_empty ():
509511 var connected_id = connection .from_node
510512 var connected_node = graph .get_node (connected_id )
511513 var connected_output = connected_node .connection_idx_to_output (connection .from_port )
512- var connected_data = connected_node .traverse (connected_output , graph , pouch )
514+ var connected_data = connected_node .traverse (connected_output , pouch )
513515 if connected_data.has ("value" ):
514516 var connected_value = connected_data .get ("value" )
515517 var connected_type : GaeaValue .Type = connected_node .get_output_port_type (
@@ -527,7 +529,6 @@ func _get_arg(arg_name: StringName, graph: GaeaGraph, pouch: GaeaGenerationPouch
527529
528530 _log_error (
529531 "Could not get data from previous node, using default value instead." ,
530- graph ,
531532 connected_id
532533 )
533534 return get_argument_default_value (arg_name )
@@ -538,26 +539,26 @@ func _get_arg(arg_name: StringName, graph: GaeaGraph, pouch: GaeaGenerationPouch
538539
539540#region Execution
540541## Traverses the graph using this node's connections, and returns the result for [param output_port].
541- func traverse (output_port : StringName , graph : GaeaGraph , pouch : GaeaGenerationPouch ) -> Variant :
542- _log_traverse (graph )
542+ func traverse (output_port : StringName , pouch : GaeaGenerationPouch ) -> Variant :
543+ _log_traverse ()
543544
544545 # Cancellation
545546 if pouch .cancelled :
546547 return {}
547548
548549 # Validation
549- if not _has_inputs_connected (_get_required_arguments (), graph ):
550+ if not _has_inputs_connected (_get_required_arguments ()):
550551 return {}
551552
552553 # Get Data with caching
553554 var data : Variant
554- var use_caching = _use_caching (output_port , graph )
555+ var use_caching = _use_caching (output_port )
555556 if use_caching and pouch .has_cache (self , output_port ):
556557 data = pouch .get_cache (self , output_port )
557558 else :
558559 _define_rng (pouch )
559- _log_data (output_port , graph )
560- data = _get_data (output_port , graph , pouch )
560+ _log_data (output_port )
561+ data = _get_data (output_port , pouch )
561562 if use_caching :
562563 pouch .set_cache (self , output_port , data )
563564
@@ -571,13 +572,13 @@ func traverse(output_port: StringName, graph: GaeaGraph, pouch: GaeaGenerationPo
571572## Returns the data corresponding to [param output_port]. Should be overridden to create custom
572573## behavior for each node.
573574@abstract
574- func _get_data (output_port : StringName , graph : GaeaGraph , pouch : GaeaGenerationPouch ) -> Variant
575+ func _get_data (output_port : StringName , pouch : GaeaGenerationPouch ) -> Variant
575576#endregion
576577
577578
578579#region Caching
579580## Checks if this node should use caching or not. Can be overridden to disable it.
580- func _use_caching (_output_port : StringName , _graph : GaeaGraph ) -> bool :
581+ func _use_caching (_output_port : StringName ) -> bool :
581582 return true
582583#endregion
583584
@@ -590,15 +591,15 @@ func _get_required_arguments() -> Array[StringName]:
590591
591592
592593# Returns [code]true[/code] if all [param required] inputs are connected.
593- func _has_inputs_connected (required : Array [StringName ], graph : GaeaGraph ) -> bool :
594+ func _has_inputs_connected (required : Array [StringName ]) -> bool :
594595 for idx in required :
595- if _get_input_resource (idx , graph ) == null :
596+ if _get_input_resource (idx ) == null :
596597 return false
597598 return true
598599
599600
600601# Gets the [GaeaNodeResource] connected to the input of name [param arg_name].
601- func _get_input_resource (arg_name : StringName , graph : GaeaGraph ) -> GaeaNodeResource :
602+ func _get_input_resource (arg_name : StringName ) -> GaeaNodeResource :
602603 var connection = _get_argument_connection (arg_name )
603604 if connection .is_empty () or connection .from_node == - 1 :
604605 return null
@@ -659,45 +660,45 @@ func connection_idx_to_output(output_idx: int) -> StringName:
659660
660661#region Logging
661662# If enabled in [member GaeaGraph.logging], log the execution information. (See [enum GaeaGraph.Log]).
662- func _log_execute (message : String , area : AABB , graph : GaeaGraph ) -> void :
663+ func _log_execute (message : String , area : AABB ) -> void :
663664 message = message .strip_edges ()
664665 message = message if message == "" else message + " "
665666 graph .log (GaeaGraph .Log .EXECUTE , "%s Area %s on %s " % [message , area , _get_title ()])
666667
667668# If enabled in [member GaeaGraph.logging], log the time it took to generate. (See [enum GaeaGraph.Log]).
668- func _log_time (message : String , time : int , graph : GaeaGraph ) -> void :
669+ func _log_time (message : String , time : int ) -> void :
669670 message = message .strip_edges ()
670671 message = message if message == "" else message + " "
671672 graph .log (GaeaGraph .Log .EXECUTE , "%s took %s ms. on %s " % [message , time , _get_title ()])
672673
673674
674675# If enabled in [member GaeaGraph.logging], log the layer information. (See [enum GaeaGraph.Log]).
675- func _log_layer (message : String , layer : int , graph : GaeaGraph ) -> void :
676+ func _log_layer (message : String , layer : int ) -> void :
676677 message = message .strip_edges ()
677678 message = message if message == "" else message + " "
678679 graph .log (GaeaGraph .Log .EXECUTE , "%s Layer %d on %s " % [message , layer , _get_title ()])
679680
680681
681682# If enabled in [member GaeaGraph.logging], log the traverse information. (See [enum GaeaGraph.Log]).
682- func _log_traverse (graph : GaeaGraph ) -> void :
683+ func _log_traverse () -> void :
683684 graph .log (GaeaGraph .Log .TRAVERSE , _get_title ())
684685
685686
686687## If enabled in [member GaeaGraph.logging], log the data information. (See [enum GaeaGraph.Log]).
687- func _log_data (output_port : StringName , graph : GaeaGraph ) -> void :
688+ func _log_data (output_port : StringName ) -> void :
688689 graph .log (GaeaGraph .Log .DATA , "%s from port %s " % [_get_title (), output_port ])
689690
690691
691692# If enabled in [member GaeaGraph.logging], log the argument information. (See [enum GaeaGraph.Log]).
692- func _log_arg (arg : String , graph : GaeaGraph ) -> void :
693+ func _log_arg (arg : String ) -> void :
693694 graph .log (GaeaGraph .Log .ARGUMENTS , "%s on %s " % [arg , _get_title ()])
694695
695696
696697## Display a error message in the Output log panel.
697698## If a [param node_idx] is provided, it will display the path and position of the node.
698699## Otherwise, it will display the path of the resource.
699700## The [param node_idx] is the index of the node in the graph.resources array.
700- func _log_error (message : String , graph : GaeaGraph , node_idx : int = - 1 ) -> void :
701+ func _log_error (message : String , node_idx : int = - 1 ) -> void :
701702 if node_idx >= 0 :
702703 printerr ("%s :%s in node '%s ' - %s " % [
703704 graph .get_node (node_idx ).resource_path ,
0 commit comments