Skip to content
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
6eb1f47
Added a custom _duplicate method for to GaeaGraph
cullumi Aug 6, 2025
20ebc44
Added a duplicate button to the Gaea editor panel; used GaeaGraph.dup…
cullumi Sep 4, 2025
f98bee9
Light tweaks to GaeaGraph (added _get_unique_resources method), added…
cullumi Sep 8, 2025
8a2ba4a
Gave the Duplicate button an icon
cullumi Oct 11, 2025
60a6803
GaeaGraph now properly initializes (by calling _setup_local_to_scene)…
cullumi Oct 11, 2025
a8048fa
Removed (incomplete) duplicate test
cullumi Oct 11, 2025
72241ca
Simplified GaeaGraph's _duplicate method to only what actually gets s…
cullumi Oct 11, 2025
a300a8c
Added a class name to walker_demo
cullumi Oct 11, 2025
df1698e
Added a series of graph tests (assign_to_generator, duplicate, assign…
cullumi Oct 11, 2025
4a3399a
Added github workflow for new Graph testing
cullumi Oct 11, 2025
0002505
Added the contents of testing\graph\graph_test.gd into testing\other\…
cullumi Oct 14, 2025
d3f9618
generator.gd is no longer calling GaeaGraph's private _refresh method…
cullumi Oct 14, 2025
dcc571f
Using duplicate_deep for duplication of GaeaGraph.
cullumi Oct 14, 2025
182c2b2
Added tooltip for the Duplicate button, and elaborated the Load button.
cullumi Oct 14, 2025
8b6c4bb
Added compare_dictionaries helper method to gaea_graph testing class
cullumi Oct 28, 2025
7d3bff3
Added proper assertions to duplicate and assign_to_generator methods.…
cullumi Oct 28, 2025
eb9c47d
Merge branch '2.0' into GaeaData-Duplication-Fix
cullumi Oct 28, 2025
c43d7fe
Renamed "duplicate" stuff to "duplicate_graph" for clarity, in case o…
cullumi Oct 31, 2025
389b6f5
Naming, typos and formatting tweaks.
cullumi Oct 31, 2025
d62f32b
Merge branch '2.0' into GaeaData-Duplication-Fix
BenjaTK Nov 2, 2025
9ada16d
Added get_raw_connections and get_all_node_data as getters for _conne…
cullumi Nov 3, 2025
bf0f9fc
Merge branch 'GaeaData-Duplication-Fix' of https://github.com/cullumi…
cullumi Nov 3, 2025
2829d4d
Merge branch '2.0' into GaeaData-Duplication-Fix
cullumi Nov 3, 2025
5e4602f
Fixed trailing whitespace
cullumi Nov 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions addons/gaea/editor/panel.gd
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ var _dragged_from_left: bool = false
@onready var _search_bar: LineEdit = %SearchBar
@onready var _save_button: Button = %SaveButton
@onready var _load_button: Button = %LoadButton
@onready var _duplicate_button: Button = %DuplicateButton
@onready var _reload_node_tree_button: Button = %ReloadNodeTreeButton
@onready var _reload_parameters_list_button: Button = %ReloadParametersListButton
@onready var _file_dialog: FileDialog = $FileDialog
@onready var _file_open_dialog: FileDialog = $OpenFileDialog
@onready var _file_save_dialog: FileDialog = $SaveFileDialog
@onready var _online_docs_button: Button = %OnlineDocsButton
@onready var _window_popout_separator: VSeparator = %WindowPopoutSeparator
@onready var _window_popout_button: Button = %WindowPopoutButton
Expand All @@ -51,6 +53,9 @@ func _ready() -> void:
_reload_parameters_list_button.icon = preload("uid://cwg7oy4i2cbwq")
_save_button.icon = EditorInterface.get_base_control().get_theme_icon(&"Save", &"EditorIcons")
_load_button.icon = EditorInterface.get_base_control().get_theme_icon(&"Load", &"EditorIcons")
_duplicate_button.icon = EditorInterface.get_base_control().get_theme_icon(
&"Duplicate", &"EditorIcons"
)
_window_popout_button.icon = EditorInterface.get_base_control().get_theme_icon(
&"MakeFloating", &"EditorIcons"
)
Expand Down Expand Up @@ -534,6 +539,10 @@ func _on_graph_edit_connection_from_empty(


#region Buttons
func _on_duplicate_button_pressed() -> void:
_file_save_dialog.popup_centered()


func _on_generate_button_pressed() -> void:
_selected_generator.generate()

Expand All @@ -542,13 +551,18 @@ func _on_reload_node_tree_button_pressed() -> void:
_create_node_tree.populate()

func _on_load_button_pressed() -> void:
_file_dialog.popup_centered()
_file_open_dialog.popup_centered()


func _on_file_dialog_file_selected(path: String) -> void:
func _on_open_file_dialog_selected(path: String) -> void:
_selected_generator.data = load(path)


func _on_save_file_dialog_selected(path: String) -> void:
var copy: GaeaGraph = _selected_generator.data.duplicate_deep(Resource.DEEP_DUPLICATE_INTERNAL)
ResourceSaver.save(copy, path)


func _on_reload_parameters_list_button_pressed() -> void:
if (
not is_instance_valid(_selected_generator)
Expand Down
22 changes: 17 additions & 5 deletions addons/gaea/editor/panel.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,19 @@ flat = true

[node name="LoadButton" type="Button" parent="Editor/VBoxContainer/HBoxContainer"]
unique_name_in_owner = true
visible = false
layout_mode = 2
tooltip_text = "Load data."
tooltip_text = "Assign a graph to this generator."
icon = SubResource("ImageTexture_ve3i7")
flat = true

[node name="DuplicateButton" type="Button" parent="Editor/VBoxContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 8
tooltip_text = "Duplicate this graph."
flat = true

[node name="VSeparator" type="VSeparator" parent="Editor/VBoxContainer/HBoxContainer"]
visible = false
layout_mode = 2

[node name="ReloadNodeTreeButton" type="Button" parent="Editor/VBoxContainer/HBoxContainer"]
Expand Down Expand Up @@ -373,19 +378,25 @@ item_0/id = 0
script = ExtResource("7_dhpru")
graph_edit = NodePath("../VBoxContainer/GraphEdit")

[node name="FileDialog" type="FileDialog" parent="."]
[node name="OpenFileDialog" type="FileDialog" parent="."]
title = "Open a File"
ok_button_text = "Open"
file_mode = 0
filters = PackedStringArray("*.tres,*.res;Resources")

[node name="SaveFileDialog" type="FileDialog" parent="."]
auto_translate_mode = 1
title = "Save a Copy"
filters = PackedStringArray("*.tres,*.res;Resources")

[node name="AboutWindow" parent="." instance=ExtResource("9_affj1")]
visible = false
exclusive = true

[connection signal="pressed" from="NoData/NewDataButton" to="." method="_on_new_data_button_pressed"]
[connection signal="pressed" from="Editor/VBoxContainer/HBoxContainer/SaveButton" to="." method="_on_save_button_pressed"]
[connection signal="pressed" from="Editor/VBoxContainer/HBoxContainer/LoadButton" to="." method="_on_load_button_pressed"]
[connection signal="pressed" from="Editor/VBoxContainer/HBoxContainer/DuplicateButton" to="." method="_on_duplicate_button_pressed"]
[connection signal="pressed" from="Editor/VBoxContainer/HBoxContainer/ReloadNodeTreeButton" to="." method="_on_reload_node_tree_button_pressed"]
[connection signal="pressed" from="Editor/VBoxContainer/HBoxContainer/ReloadParametersListButton" to="." method="_on_reload_parameters_list_button_pressed"]
[connection signal="pressed" from="Editor/VBoxContainer/HBoxContainer/GenerateButton" to="." method="_on_generate_button_pressed"]
Expand Down Expand Up @@ -413,4 +424,5 @@ exclusive = true
[connection signal="pressed" from="Editor/CreateNodePopup/MainContentContainer/VBox/HBoxContainer/CreateButton" to="Editor/CreateNodePopup/MainContentContainer/VBox/CreateNodeTree" method="_on_create_button_pressed"]
[connection signal="create_node_popup_requested" from="Editor/NodePopup" to="." method="_popup_create_node_menu_at_mouse"]
[connection signal="new_reroute_requested" from="Editor/LinkPopup" to="." method="_on_new_reroute_requested"]
[connection signal="file_selected" from="FileDialog" to="." method="_on_file_dialog_file_selected"]
[connection signal="file_selected" from="OpenFileDialog" to="." method="_on_open_file_dialog_selected"]
[connection signal="file_selected" from="SaveFileDialog" to="." method="_on_save_file_dialog_selected"]
32 changes: 29 additions & 3 deletions addons/gaea/resources/gaea_graph.gd
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ var scroll_offset: Vector2 = Vector2(NAN, NAN)
## in the current session.
var zoom: float = 1.0
## The currently related generator.
var generator: GaeaGenerator
var generator: GaeaGenerator :
set(value):
generator = value
_refresh()
## Cache used during generation to avoid recalculating data unnecessarily.
## The inner dictionary keys are the slot output port names, and the values are the cached data.
var cache: Dictionary[GaeaNodeResource, Dictionary] = {}
Expand All @@ -83,7 +86,12 @@ var _resources: Dictionary[int, GaeaNodeResource]


func _init() -> void:
_refresh()


func _refresh() -> void:
resource_local_to_scene = true
_setup_local_to_scene()
notify_property_list_changed()


Expand Down Expand Up @@ -217,6 +225,11 @@ func get_ids() -> Array[int]:
return _node_data.keys()


## Returns all node data.
func get_all_node_data() -> Dictionary[int, Dictionary]:
return _node_data


## Returns an available id.
func get_next_available_id() -> int:
var ids := get_ids()
Expand Down Expand Up @@ -280,6 +293,11 @@ func get_all_connections() -> Array[Dictionary]:
return all_connections


## Returns all connections in the graph in the form "from_node-from_port-to_node-to_port" (ex.: 1-0-2-1)
func get_raw_connections() -> Array[StringName]:
return _connections


## Returns all connections to and from the specified node as dictionaries.
func get_node_connections(id: int) -> Array[Dictionary]:
return get_connections_to(id) + get_connections_from(id)
Expand Down Expand Up @@ -411,6 +429,13 @@ func _setup_local_to_scene() -> void:
GaeaGraphMigration.migrate(self)

_resources.clear()
var uniques = _get_unique_resources()
for id in uniques.keys():
_resources.set(id, uniques[id])


func _get_unique_resources() -> Dictionary[Variant, GaeaNodeResource]:
var uniques: Dictionary[Variant, GaeaNodeResource] = {}
for id in _node_data.keys():
var base_uid: String = get_node_data(id).get(&"uid", "")
if base_uid.is_empty():
Expand All @@ -419,6 +444,7 @@ func _setup_local_to_scene() -> void:
var resource: GaeaNodeResource = load(base_uid).new()
if not resource is GaeaNodeResource:
push_error("Something went wrong, the resource at %s is not a GaeaNodeResource" % base_uid)
return
return uniques
resource._load_save_data(data)
_resources.set(id, resource)
uniques.set(id, resource)
return uniques
4 changes: 1 addition & 3 deletions scenes/walker_demo/walker_demo.gd
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
extends Node2D

class_name WalkerDemo

@onready var gaea_generator: GaeaGenerator = $GaeaGenerator

var last_grid: GaeaGrid




## Used for integration testing.
func test_generation(fixed_seed: int = 0) -> void:
gaea_generator.world_size = Vector3i(45, 45, 1)
Expand Down
Loading
Loading