Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
6c41c6f
Baseline code for CallNode
Oct 7, 2024
b5bc5b3
Evolved CallNode to update its UI (not finished)
Oct 7, 2024
cab1640
Updated CallNode parameters UI section
Oct 8, 2024
d3c8b58
CallNode base UI code finished (still missing features)
Oct 9, 2024
7764d67
Removed editing "type check", wasn't working
Oct 9, 2024
8db7dec
ExampleCall backup
Oct 9, 2024
3a0bf8c
CallNode is operational! Missing some features though...
Oct 9, 2024
f7df213
Added Connection Shifting to CallNode
Oct 10, 2024
0eb30cb
Bugfixing + Expanding system to include Arrays and Dicts
Oct 10, 2024
38cd2da
QoL: Resize when TextEdits are changed
Oct 10, 2024
c59570d
Added type checker when Arguments and Returns are edited.
Oct 10, 2024
c6f081a
Merge remote-tracking branch 'refs/remotes/origin/main' into call_node
Oct 10, 2024
85c4344
Removed Bool auto-setup comment
Oct 10, 2024
0e2b110
Added TextEdit option to Arguments
Oct 11, 2024
6690f3b
Added "Line/Text" functionality to CallNodeReturn
Oct 11, 2024
7c006bf
Removed old print
Oct 11, 2024
9d82159
Included Undo/Redo for MethodSelection
Oct 12, 2024
94f343f
Resizable TextEdit for CallNode!
Oct 12, 2024
923e477
Tiny CallNode Argument tweak
Oct 12, 2024
faadbcb
Re-orged Return vars
Oct 12, 2024
3dad61e
Removed LineEdit from Argument/Return CallNode
Oct 12, 2024
54af88b
Removed LineEdit and TextEdit icons
Oct 12, 2024
a901c2e
Added TextEdit resizing to CallNode return
Oct 12, 2024
c6d2a47
Removed FlowContainer from Argument and Return (CallNode)
Oct 12, 2024
f7f80c1
added GraphFrame
nagidev Oct 12, 2024
ed1108e
Added UndoRedo for Arguments/Returns
Oct 12, 2024
bc9d0c3
Arg/Ret start as empty text by default
Oct 12, 2024
767994c
Added Undo/Redo for Method Changing
Oct 12, 2024
3cbe03a
Empty arguments are valid now. They will be translated to the default…
Oct 12, 2024
24086a8
CallNode Argument & Return do not update on focus lost if text has no…
Oct 12, 2024
717b223
Added Undo/Redo for CallNode Returns
Oct 12, 2024
53727ae
Fixed connection UndoRedo in CallNode
Oct 12, 2024
571ac74
Merged GraphFrame into CallNode branch
Oct 13, 2024
bf7ebac
Missing .project edit from last merge
Oct 13, 2024
884b588
Retrying merge from Main to CallNode
Oct 13, 2024
c30ffad
Still trying with the merge...
Oct 13, 2024
738f32d
Merge remote-tracking branch 'refs/remotes/origin/main' into call_node
Oct 13, 2024
704f563
Readded CallNode to graph.gd
Oct 13, 2024
19efee9
Fixed ExampleCall save file
Oct 13, 2024
5cc7bd2
CallNode Arguments and Returns update live
Oct 13, 2024
16a9e0b
Added variable checking to CallNode Parsing
Oct 13, 2024
6632364
Added Variable checking placeholder code on CallNode
Oct 13, 2024
9db7b0b
Fixed bug on DialogueParser where returns vars where not being parsed
Oct 13, 2024
03a8552
Created good ExampleCalls sample CallNode file
Oct 13, 2024
6db7efc
CallNode Return resizes on ready
Oct 14, 2024
f4e4e49
Added Variable Highlighting to CallNode
Oct 14, 2024
4949a94
Added RedColor background for invalid CallNode elements
Oct 14, 2024
f749503
Added FileSelection on CallNode
Oct 14, 2024
083fcd1
CallNode can now have its Library section hidden/shown for convenience
Oct 14, 2024
bd2eee2
Merge remote-tracking branch 'origin/main' into call_node
Oct 14, 2024
6ceebba
Fixed unwanted changes on graph.gd
Oct 14, 2024
dab7d99
Added option to call Autoloads.
Oct 15, 2024
c35f53f
Fixed a couple bugs related to DialogueParser regarding Autoload calls
Oct 15, 2024
bca7e59
Included Fork and Call Examples for Demo1
Oct 15, 2024
4fb76f6
Small fix from prev commit
Oct 15, 2024
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
47 changes: 47 additions & 0 deletions addons/dialogue_nodes/editor/calls.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
@tool
##
## Default Method Database for CallNodes
##
## Default method library for all function calls made from CallNodes.
## This script is expected to be expanded by the user and customized to their needs.
## Alternativelly, the user may create new [Script] files to call methods from.
## [br][br]
## [color=Yellow]Warning[/color]: [Array] and [Dictionary] arguments [b]cannot[/b] have default values.
## It is recommended that Static Typing is not used to specify their contents either,
## e.g. [code]Array[int][/code].


static func print_text(text: String) -> void:
print(text)


static func roll_a_die(die_name: String, ignore: Array, faces: int = 6) -> int:
var result: int = -1
for i: int in 100:
result = randi_range(1, faces)
if !ignore.has(result):
break
if result == -1:
push_error(
"Die %s rolled (<%d> faces). Set to ignore <%s>. Rolling a valid result was imposible!"
% [die_name, faces, ignore]
)
return -1

print("Die %s rolled (<%d> faces). Result is <%d>." % [die_name, faces, result])
return result


static func roll_dice(dice: Dictionary) -> Array:
var results: Array[int] = []
for die_name: String in dice:
var die: Dictionary = dice[die_name]
if !die.has("faces"):
push_error("Invalid dice <%s>. Cannot roll, it has no faces key!" % die_name)
continue

var result: int = roll_a_die(die_name, die.ignore if die.has("ignore") else [], die.faces)
if result != -1:
results.push_back(result)
print("Several dice where rolled, results are <%s>." % str(results))
return results
7 changes: 4 additions & 3 deletions addons/dialogue_nodes/editor/graph.gd
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ signal run_requested(start_node_idx: int)
preload('res://addons/dialogue_nodes/nodes/ConditionNode.tscn'),
preload('res://addons/dialogue_nodes/nodes/NestNode.tscn'),
preload('res://addons/dialogue_nodes/nodes/ForkNode.tscn'),
preload('res://addons/dialogue_nodes/nodes/GraphFrame.tscn')
preload('res://addons/dialogue_nodes/nodes/GraphFrame.tscn'),
preload('res://addons/dialogue_nodes/nodes/CallNode.tscn')
]
@export var detach_icon: Texture2D = preload('res://addons/dialogue_nodes/icons/ExternalLink.svg')

Expand Down Expand Up @@ -159,7 +160,7 @@ func connect_node_signals(node: GraphElement) -> void:
characters_updated.connect(node._on_characters_updated)
node.disconnection_from_request.connect(_on_disconnection_from_request)
node.connection_shift_request.connect(_on_connection_shift_request)
7: # fork node
7, 9: # fork node, call node
node.disconnection_from_request.connect(_on_disconnection_from_request)
node.connection_shift_request.connect(_on_connection_shift_request)

Expand All @@ -177,7 +178,7 @@ func disconnect_node_signals(node: GraphElement) -> void:
characters_updated.disconnect(node._on_characters_updated)
node.disconnection_from_request.disconnect(_on_disconnection_from_request)
node.connection_shift_request.disconnect(_on_connection_shift_request)
7: # fork node
7, 9: # fork node, call node
node.disconnection_from_request.disconnect(_on_disconnection_from_request)
node.connection_shift_request.disconnect(_on_connection_shift_request)

Expand Down
1 change: 1 addition & 0 deletions addons/dialogue_nodes/icons/GuiVisibilityHidden.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions addons/dialogue_nodes/icons/GuiVisibilityHidden.svg.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://2mg38tjwdqxy"
path="res://.godot/imported/GuiVisibilityHidden.svg-738b8ca69e63c5fe2502627e2587ba16.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://addons/dialogue_nodes/icons/GuiVisibilityHidden.svg"
dest_files=["res://.godot/imported/GuiVisibilityHidden.svg-738b8ca69e63c5fe2502627e2587ba16.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false
1 change: 1 addition & 0 deletions addons/dialogue_nodes/icons/GuiVisibilityVisible.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions addons/dialogue_nodes/icons/GuiVisibilityVisible.svg.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://bu86pp64kp8x1"
path="res://.godot/imported/GuiVisibilityVisible.svg-b483b14bb2090f8a0fc45209c4b12a10.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://addons/dialogue_nodes/icons/GuiVisibilityVisible.svg"
dest_files=["res://.godot/imported/GuiVisibilityVisible.svg-b483b14bb2090f8a0fc45209c4b12a10.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false
164 changes: 164 additions & 0 deletions addons/dialogue_nodes/nodes/CallNode.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
[gd_scene load_steps=6 format=3 uid="uid://cu71fiowdkvmr"]

[ext_resource type="Script" path="res://addons/dialogue_nodes/nodes/callNode.gd" id="1_hul2k"]
[ext_resource type="Texture2D" uid="uid://cf5ef41yo6jl6" path="res://addons/dialogue_nodes/icons/Reload.svg" id="2_u8etb"]
[ext_resource type="Texture2D" uid="uid://buayifvickq2l" path="res://addons/dialogue_nodes/icons/Folder.svg" id="2_w7ejb"]
[ext_resource type="Texture2D" uid="uid://2mg38tjwdqxy" path="res://addons/dialogue_nodes/icons/GuiVisibilityHidden.svg" id="4_golf1"]
[ext_resource type="Texture2D" uid="uid://cj0m8q8hgm0ed" path="res://addons/dialogue_nodes/icons/Add.svg" id="4_hca56"]

[node name="CallNode" type="GraphNode"]
custom_minimum_size = Vector2(200, 180)
offset_right = 192.0
offset_bottom = 183.0
title = "CallNode"
slot/0/left_enabled = true
slot/0/left_type = 0
slot/0/left_color = Color(1, 1, 1, 1)
slot/0/left_icon = null
slot/0/right_enabled = false
slot/0/right_type = 0
slot/0/right_color = Color(1, 1, 1, 1)
slot/0/right_icon = null
slot/0/draw_stylebox = true
slot/1/left_enabled = false
slot/1/left_type = 0
slot/1/left_color = Color(1, 1, 1, 1)
slot/1/left_icon = null
slot/1/right_enabled = false
slot/1/right_type = 0
slot/1/right_color = Color(1, 1, 1, 1)
slot/1/right_icon = null
slot/1/draw_stylebox = true
slot/2/left_enabled = false
slot/2/left_type = 0
slot/2/left_color = Color(1, 1, 1, 1)
slot/2/left_icon = null
slot/2/right_enabled = false
slot/2/right_type = 0
slot/2/right_color = Color(1, 1, 1, 1)
slot/2/right_icon = null
slot/2/draw_stylebox = true
slot/3/left_enabled = false
slot/3/left_type = 0
slot/3/left_color = Color(1, 1, 1, 1)
slot/3/left_icon = null
slot/3/right_enabled = false
slot/3/right_type = 0
slot/3/right_color = Color(1, 1, 1, 1)
slot/3/right_icon = null
slot/3/draw_stylebox = true
slot/4/left_enabled = false
slot/4/left_type = 0
slot/4/left_color = Color(1, 1, 1, 1)
slot/4/left_icon = null
slot/4/right_enabled = true
slot/4/right_type = 0
slot/4/right_color = Color(1, 1, 1, 1)
slot/4/right_icon = null
slot/4/draw_stylebox = true
script = ExtResource("1_hul2k")

[node name="MethodSetup" type="VBoxContainer" parent="."]
layout_mode = 2

[node name="MethodLibraryContainer" type="VBoxContainer" parent="MethodSetup"]
unique_name_in_owner = true
visible = false
layout_mode = 2

[node name="FileSelection" type="BoxContainer" parent="MethodSetup/MethodLibraryContainer"]
layout_mode = 2

[node name="FilePath" type="LineEdit" parent="MethodSetup/MethodLibraryContainer/FileSelection"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 12
text = "res://addons/dialogue_nodes/editor/calls.gd"
placeholder_text = "GDScript Resource"

[node name="BrowseButton" type="Button" parent="MethodSetup/MethodLibraryContainer/FileSelection"]
layout_mode = 2
size_flags_horizontal = 8
icon = ExtResource("2_w7ejb")

[node name="ReimportButton" type="Button" parent="MethodSetup/MethodLibraryContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
theme_override_font_sizes/font_size = 12
text = "Reimport"
icon = ExtResource("2_u8etb")

[node name="HSeparator" type="HSeparator" parent="MethodSetup/MethodLibraryContainer"]
layout_mode = 2

[node name="BoxContainer" type="BoxContainer" parent="MethodSetup"]
layout_mode = 2

[node name="MethodLibraryButton" type="Button" parent="MethodSetup/BoxContainer"]
unique_name_in_owner = true
layout_mode = 2
toggle_mode = true
icon = ExtResource("4_golf1")
icon_alignment = 1

[node name="MethodSelector" type="OptionButton" parent="MethodSetup/BoxContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
allow_reselect = true

[node name="ArgumentsSectionContainer" type="HBoxContainer" parent="MethodSetup"]
unique_name_in_owner = true
visible = false
layout_mode = 2
size_flags_vertical = 4

[node name="VSeparator" type="VSeparator" parent="MethodSetup/ArgumentsSectionContainer"]
layout_mode = 2
size_flags_horizontal = 0

[node name="ArgumentsContainer" type="VBoxContainer" parent="MethodSetup/ArgumentsSectionContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3

[node name="HSeparator" type="HSeparator" parent="."]
layout_mode = 2

[node name="ReturnsLabel" type="Label" parent="."]
layout_mode = 2
text = "Returns"

[node name="AddReturnButton" type="Button" parent="."]
unique_name_in_owner = true
layout_mode = 2
icon = ExtResource("4_hca56")
icon_alignment = 1

[node name="DefaultLabel" type="Label" parent="."]
unique_name_in_owner = true
layout_mode = 2
text = "Default Exit"
horizontal_alignment = 2

[node name="FileDialog" type="FileDialog" parent="."]
unique_name_in_owner = true
auto_translate_mode = 1
title = "Open a DialogueData Resource"
size = Vector2i(600, 400)
ok_button_text = "Open"
mode_overrides_title = false
file_mode = 0
filters = PackedStringArray("*.gd; GDScript Files")

[connection signal="focus_exited" from="MethodSetup/MethodLibraryContainer/FileSelection/FilePath" to="." method="_on_file_path_focus_exited"]
[connection signal="text_submitted" from="MethodSetup/MethodLibraryContainer/FileSelection/FilePath" to="." method="_on_file_path_text_submitted"]
[connection signal="pressed" from="MethodSetup/MethodLibraryContainer/FileSelection/BrowseButton" to="." method="_on_browse_button_pressed"]
[connection signal="pressed" from="MethodSetup/MethodLibraryContainer/ReimportButton" to="." method="_on_reimport_button_pressed"]
[connection signal="toggled" from="MethodSetup/BoxContainer/MethodLibraryButton" to="." method="_on_method_library_button_toggled"]
[connection signal="item_selected" from="MethodSetup/BoxContainer/MethodSelector" to="." method="_on_method_selector_item_selected"]
[connection signal="pressed" from="AddReturnButton" to="." method="_on_add_return_button_pressed"]
[connection signal="file_selected" from="FileDialog" to="." method="_on_file_dialog_file_selected"]
Loading