First work on dialogic, resized guild, and started implementing portraits.

This commit is contained in:
2025-08-14 10:26:24 -04:00
parent 95a7db036b
commit 3aeb3d44e6
959 changed files with 47688 additions and 46 deletions

View File

@@ -0,0 +1,28 @@
@tool
extends PanelContainer
## Event block field part for the Array field.
signal value_changed()
var value_field: Node
var value_type: int = -1
var current_value: Variant
func _ready() -> void:
%FlexValue.value_changed.connect(emit_signal.bind("value_changed"))
%Delete.icon = get_theme_icon("Remove", "EditorIcons")
func set_value(value:Variant):
%FlexValue.set_value(value)
func get_value() -> Variant:
return %FlexValue.current_value
func _on_delete_pressed() -> void:
queue_free()
value_changed.emit()

View File

@@ -0,0 +1 @@
uid://l73oqhxu5y82

View File

@@ -0,0 +1,39 @@
[gd_scene load_steps=5 format=3 uid="uid://ch4j2lesn1sis"]
[ext_resource type="Script" path="res://addons/dialogic/Editor/Events/Fields/array_part.gd" id="1"]
[ext_resource type="PackedScene" uid="uid://dl08ubinx6ugu" path="res://addons/dialogic/Editor/Events/Fields/field_flex_value.tscn" id="3_s4j7i"]
[sub_resource type="Image" id="Image_dcsrk"]
data = {
"data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 93, 93, 41, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 44, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 44, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 94, 94, 234, 255, 95, 95, 43, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 94, 94, 234, 255, 95, 95, 43, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0),
"format": "RGBA8",
"height": 16,
"mipmaps": false,
"width": 16
}
[sub_resource type="ImageTexture" id="ImageTexture_cpbga"]
image = SubResource("Image_dcsrk")
[node name="ArrayValue" type="PanelContainer"]
offset_left = 2.0
offset_right = 76.0
offset_bottom = 24.0
theme_type_variation = &"DialogicEventEditGroup"
script = ExtResource("1")
[node name="Value" type="HBoxContainer" parent="."]
layout_mode = 2
[node name="FlexValue" parent="Value" instance=ExtResource("3_s4j7i")]
unique_name_in_owner = true
layout_mode = 2
[node name="Delete" type="Button" parent="Value"]
unique_name_in_owner = true
layout_mode = 2
tooltip_text = "Remove"
icon = SubResource("ImageTexture_cpbga")
flat = true
[connection signal="pressed" from="Value/Delete" to="." method="_on_delete_pressed"]

View File

@@ -0,0 +1,44 @@
@tool
extends PanelContainer
## Event block field part for the Dictionary field.
signal value_changed()
func set_key(value:String) -> void:
%Key.text = str(value)
func get_key() -> String:
return %Key.text
func set_value(value:Variant) -> void:
%FlexValue.set_value(value)
func get_value() -> Variant:
return %FlexValue.current_value
func _ready() -> void:
%Delete.icon = get_theme_icon("Remove", "EditorIcons")
func focus_key() -> void:
%Key.grab_focus()
func _on_key_text_changed(new_text: String) -> void:
value_changed.emit()
func _on_flex_value_value_changed() -> void:
value_changed.emit()
func _on_delete_pressed() -> void:
queue_free()
value_changed.emit()

View File

@@ -0,0 +1 @@
uid://k46spe7qsnrs

View File

@@ -0,0 +1,54 @@
[gd_scene load_steps=5 format=3 uid="uid://b27yweami3mxi"]
[ext_resource type="Script" path="res://addons/dialogic/Editor/Events/Fields/dictionary_part.gd" id="2_q88pg"]
[ext_resource type="PackedScene" uid="uid://dl08ubinx6ugu" path="res://addons/dialogic/Editor/Events/Fields/field_flex_value.tscn" id="3_p082d"]
[sub_resource type="Image" id="Image_dcsrk"]
data = {
"data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 93, 93, 41, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 44, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 44, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 94, 94, 234, 255, 95, 95, 43, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 94, 94, 234, 255, 95, 95, 43, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0),
"format": "RGBA8",
"height": 16,
"mipmaps": false,
"width": 16
}
[sub_resource type="ImageTexture" id="ImageTexture_cpbga"]
image = SubResource("Image_dcsrk")
[node name="DictionaryPart" type="PanelContainer"]
offset_left = 1.0
offset_top = -1.0
offset_right = 131.0
offset_bottom = 32.0
theme_type_variation = &"DialogicEventEditGroup"
script = ExtResource("2_q88pg")
[node name="HBox" type="HBoxContainer" parent="."]
layout_mode = 2
[node name="Key" type="LineEdit" parent="HBox"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
theme_type_variation = &"DialogicEventEdit"
expand_to_text_length = true
select_all_on_focus = true
[node name="Label" type="Label" parent="HBox"]
layout_mode = 2
text = ":"
[node name="FlexValue" parent="HBox" instance=ExtResource("3_p082d")]
unique_name_in_owner = true
layout_mode = 2
[node name="Delete" type="Button" parent="HBox"]
unique_name_in_owner = true
layout_mode = 2
tooltip_text = "Remove"
icon = SubResource("ImageTexture_cpbga")
flat = true
[connection signal="text_changed" from="HBox/Key" to="." method="_on_key_text_changed"]
[connection signal="value_changed" from="HBox/FlexValue" to="." method="_on_flex_value_value_changed"]
[connection signal="pressed" from="HBox/Delete" to="." method="_on_delete_pressed"]

View File

@@ -0,0 +1,48 @@
@tool
extends DialogicVisualEditorField
## Event block field for editing arrays.
const ArrayValue := "res://addons/dialogic/Editor/Events/Fields/array_part.tscn"
func _ready() -> void:
%Add.icon = get_theme_icon("Add", "EditorIcons")
%Add.pressed.connect(_on_AddButton_pressed)
func _set_value(value:Variant) -> void:
value = value as Array
for child in get_children():
if child != %Add:
child.queue_free()
for item in value:
var x: Node = load(ArrayValue).instantiate()
add_child(x)
x.set_value(item)
x.value_changed.connect(recalculate_values)
move_child(%Add, -1)
func _on_value_changed(value:Variant) -> void:
value_changed.emit(property_name, value)
func recalculate_values() -> void:
var arr := []
for child in get_children():
if child != %Add and !child.is_queued_for_deletion():
arr.append(child.get_value())
_on_value_changed(arr)
func _on_AddButton_pressed() -> void:
var x: Control = load(ArrayValue).instantiate()
add_child(x)
x.set_value("")
x.value_changed.connect(recalculate_values)
recalculate_values()
move_child(%Add, -1)

View File

@@ -0,0 +1 @@
uid://dktoxkoi5v3lm

View File

@@ -0,0 +1,28 @@
[gd_scene load_steps=4 format=3 uid="uid://btmy7ageqpyq1"]
[ext_resource type="Script" path="res://addons/dialogic/Editor/Events/Fields/field_array.gd" id="2"]
[sub_resource type="Image" id="Image_dcsrk"]
data = {
"data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 93, 93, 41, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 44, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 44, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 94, 94, 234, 255, 95, 95, 43, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 94, 94, 234, 255, 95, 95, 43, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0),
"format": "RGBA8",
"height": 16,
"mipmaps": false,
"width": 16
}
[sub_resource type="ImageTexture" id="ImageTexture_cpbga"]
image = SubResource("Image_dcsrk")
[node name="Field_Array" type="HFlowContainer"]
offset_right = 329.0
offset_bottom = 256.0
size_flags_horizontal = 3
script = ExtResource("2")
[node name="Add" type="Button" parent="."]
unique_name_in_owner = true
layout_mode = 2
tooltip_text = "Add value"
icon = SubResource("ImageTexture_cpbga")
flat = true

View File

@@ -0,0 +1,52 @@
@tool
extends DialogicVisualEditorField
var file_path: String
func _ready() -> void:
self.pressed.connect(_on_pressed)
%AudioStreamPlayer.finished.connect(_on_finished)
#region OVERWRITES
################################################################################
## To be overwritten
func _set_value(value:Variant) -> void:
file_path = value
self.disabled = file_path.is_empty()
_stop()
#endregion
#region SIGNAL METHODS
################################################################################
func _on_pressed() -> void:
if %AudioStreamPlayer.playing:
_stop()
elif not file_path.is_empty():
_play()
func _on_finished() -> void:
_stop()
#endregion
func _stop() -> void:
%AudioStreamPlayer.stop()
%AudioStreamPlayer.stream = null
self.icon = get_theme_icon("Play", "EditorIcons")
func _play() -> void:
if ResourceLoader.exists(file_path):
%AudioStreamPlayer.stream = load(file_path)
%AudioStreamPlayer.play()
self.icon = get_theme_icon("Stop", "EditorIcons")

View File

@@ -0,0 +1 @@
uid://cj4e7ls38qk1x

View File

@@ -0,0 +1,12 @@
[gd_scene load_steps=2 format=3 uid="uid://dotvrsumm5y5c"]
[ext_resource type="Script" path="res://addons/dialogic/Editor/Events/Fields/field_audio_preview.gd" id="1_7wm54"]
[node name="Field_Audio_Preview" type="Button"]
offset_right = 8.0
offset_bottom = 8.0
flat = true
script = ExtResource("1_7wm54")
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
unique_name_in_owner = true

View File

@@ -0,0 +1,38 @@
@tool
extends DialogicVisualEditorField
## Event block field for boolean values.
#region MAIN METHODS
################################################################################
func _ready() -> void:
add_theme_color_override("icon_normal_color", get_theme_color("disabled_font_color", "Editor"))
add_theme_color_override("icon_hover_color", get_theme_color("warning_color", "Editor"))
add_theme_color_override("icon_pressed_color", get_theme_color("icon_saturation", "Editor"))
add_theme_color_override("icon_hover_pressed_color", get_theme_color("warning_color", "Editor"))
add_theme_color_override("icon_focus_color", get_theme_color("disabled_font_color", "Editor"))
self.toggled.connect(_on_value_changed)
func _load_display_info(info:Dictionary) -> void:
if info.has('editor_icon'):
if not is_inside_tree():
await ready
self.icon = callv('get_theme_icon', info.editor_icon)
else:
self.icon = info.get('icon', null)
func _set_value(value:Variant) -> void:
self.button_pressed = true if value else false
#endregion
#region SIGNAL METHODS
################################################################################
func _on_value_changed(value:bool) -> void:
value_changed.emit(property_name, value)
#endregion

View File

@@ -0,0 +1 @@
uid://dm8od5udqkx0b

View File

@@ -0,0 +1,13 @@
[gd_scene load_steps=2 format=3 uid="uid://iypxcctv080u"]
[ext_resource type="Script" path="res://addons/dialogic/Editor/Events/Fields/field_bool_button.gd" id="1_t1n1f"]
[node name="Field_BoolButton" type="Button"]
theme_override_colors/icon_normal_color = Color(0, 0, 0, 1)
theme_override_colors/icon_pressed_color = Color(0, 0, 0, 1)
theme_override_colors/icon_hover_color = Color(0, 0, 0, 1)
theme_override_colors/icon_hover_pressed_color = Color(0, 0, 0, 1)
theme_override_colors/icon_focus_color = Color(0, 0, 0, 1)
toggle_mode = true
flat = true
script = ExtResource("1_t1n1f")

View File

@@ -0,0 +1,30 @@
@tool
extends DialogicVisualEditorField
## Event block field for boolean values.
#region MAIN METHODS
################################################################################
func _ready() -> void:
self.toggled.connect(_on_value_changed)
func _load_display_info(info:Dictionary) -> void:
pass
func _set_value(value:Variant) -> void:
match DialogicUtil.get_variable_value_type(value):
DialogicUtil.VarTypes.STRING:
self.button_pressed = value and not value.strip_edges() == "false"
_:
self.button_pressed = value and true
#endregion
#region SIGNAL METHODS
################################################################################
func _on_value_changed(value:bool) -> void:
value_changed.emit(property_name, value)
#endregion

View File

@@ -0,0 +1 @@
uid://dnpuarsjejd37

View File

@@ -0,0 +1,8 @@
[gd_scene load_steps=2 format=3 uid="uid://dm5hxmhyyxgq"]
[ext_resource type="Script" path="res://addons/dialogic/Editor/Events/Fields/field_bool_check.gd" id="1_ckmtx"]
[node name="Field_BoolCheck" type="CheckButton"]
offset_right = 44.0
offset_bottom = 24.0
script = ExtResource("1_ckmtx")

View File

@@ -0,0 +1,30 @@
@tool
extends DialogicVisualEditorField
## Event block field for color values.
#region MAIN METHODS
################################################################################
func _ready() -> void:
self.color_changed.connect(_on_value_changed)
func _load_display_info(info:Dictionary) -> void:
self.edit_alpha = info.get("edit_alpha", true)
func _set_value(value:Variant) -> void:
if value is Color:
self.color = Color(value)
#endregion
#region SIGNAL METHODS
################################################################################
func _on_value_changed(value: Color) -> void:
value_changed.emit(property_name, value)
#endregion

View File

@@ -0,0 +1 @@
uid://cy43rgu20isih

View File

@@ -0,0 +1,12 @@
[gd_scene load_steps=2 format=3 uid="uid://4e0kjekan5e7"]
[ext_resource type="Script" path="res://addons/dialogic/Editor/Events/Fields/field_color.gd" id="1_l666a"]
[node name="Field_Color" type="ColorPickerButton"]
custom_minimum_size = Vector2(48, 0)
offset_right = 64.0
offset_bottom = 31.0
theme_type_variation = &"DialogicEventEdit"
text = " "
color = Color(1, 1, 1, 1)
script = ExtResource("1_l666a")

View File

@@ -0,0 +1,267 @@
@tool
extends DialogicVisualEditorField
## Event block field for displaying conditions in either a simple or complex way.
var _current_value1: Variant = ""
var _current_value2: Variant = ""
#region MAIN METHODS
################################################################################
func _set_value(value:Variant) -> void:
var too_complex := is_too_complex(value)
%ToggleComplex.disabled = too_complex
%ToggleComplex.button_pressed = too_complex
%ComplexEditor.visible = too_complex
%SimpleEditor.visible = !too_complex
%ComplexEditor.text = value
if not too_complex:
load_simple_editor(value)
func _autofocus() -> void:
%Value1Variable.grab_focus()
#endregion
func _ready() -> void:
for i in [%Value1Type, %Value2Type]:
i.options = [{
'label': 'String',
'icon': ["String", "EditorIcons"],
'value': 0
},{
'label': 'Number',
'icon': ["float", "EditorIcons"],
'value': 1
},{
'label': 'Variable',
'icon': load("res://addons/dialogic/Editor/Images/Pieces/variable.svg"),
'value': 2
},{
'label': 'Bool',
'icon': ["bool", "EditorIcons"],
'value': 3
},{
'label': 'Expression',
'icon': ["Variant", "EditorIcons"],
'value': 4
}]
i.symbol_only = true
i.value_changed.connect(value_type_changed.bind(i.name))
i.value_changed.connect(something_changed)
i.tooltip_text = "Change type"
for i in [%Value1Variable, %Value2Variable]:
i.get_suggestions_func = get_variable_suggestions
i.value_changed.connect(something_changed)
%Value1Number.value_changed.connect(something_changed)
%Value2Number.value_changed.connect(something_changed)
%Value1Text.value_changed.connect(something_changed)
%Value2Text.value_changed.connect(something_changed)
%Value1Bool.value_changed.connect(something_changed)
%Value2Bool.value_changed.connect(something_changed)
%ToggleComplex.icon = get_theme_icon("Enum", "EditorIcons")
%Operator.value_changed.connect(something_changed)
%Operator.options = [
{'label': '==', 'value': '=='},
{'label': '>', 'value': '>'},
{'label': '<', 'value': '<'},
{'label': '<=', 'value': '<='},
{'label': '>=', 'value': '>='},
{'label': '!=', 'value': '!='}
]
func load_simple_editor(condition_string:String) -> void:
var data := complex2simple(condition_string)
%Value1Type.set_value(get_value_type(data[0], 2))
_current_value1 = data[0]
value_type_changed('', get_value_type(data[0], 2), 'Value1')
%Operator.set_value(data[1].strip_edges())
%Value2Type.set_value(get_value_type(data[2], 0))
_current_value2 = data[2]
value_type_changed('', get_value_type(data[2], 0), 'Value2')
func value_type_changed(property:String, value_type:int, value_name:String) -> void:
value_name = value_name.trim_suffix('Type')
get_node('%'+value_name+'Variable').hide()
get_node('%'+value_name+'Text').hide()
get_node('%'+value_name+'Number').hide()
get_node('%'+value_name+'Bool').hide()
var current_val: Variant = ""
if '1' in value_name:
current_val = _current_value1
else:
current_val = _current_value2
match value_type:
0:
get_node('%'+value_name+'Text').show()
get_node('%'+value_name+'Text').set_value(trim_value(current_val, value_type))
1:
get_node('%'+value_name+'Number').show()
get_node('%'+value_name+'Number').set_value(float(current_val.strip_edges()))
2:
get_node('%'+value_name+'Variable').show()
get_node('%'+value_name+'Variable').set_value(trim_value(current_val, value_type))
3:
get_node('%'+value_name+'Bool').show()
get_node('%'+value_name+'Bool').set_value(trim_value(current_val, value_type))
4:
get_node('%'+value_name+'Text').show()
get_node('%'+value_name+'Text').set_value(str(current_val))
func get_value_type(value:String, default:int) -> int:
value = value.strip_edges()
if value.begins_with('"') and value.ends_with('"') and value.count('"')-value.count('\\"') == 2:
return 0
elif value.begins_with('{') and value.ends_with('}') and value.count('{') == 1:
return 2
elif value == "true" or value == "false":
return 3
else:
if value.is_empty():
return default
if value.is_valid_float():
return 1
else:
return 4
func prep_value(value:Variant, value_type:int) -> String:
if value != null: value = str(value)
else: value = ""
value = value.strip_edges()
match value_type:
0: return '"'+value.replace('"', '\\"')+'"'
2: return '{'+value+'}'
_: return value
func trim_value(value:Variant, value_type:int) -> String:
value = value.strip_edges()
match value_type:
0: return value.trim_prefix('"').trim_suffix('"').replace('\\"', '"')
2: return value.trim_prefix('{').trim_suffix('}')
3:
if value == "true" or (value and (typeof(value) != TYPE_STRING or value != "false")):
return "true"
else:
return "false"
_: return value
func something_changed(fake_arg1=null, fake_arg2 = null):
if %ComplexEditor.visible:
value_changed.emit(property_name, %ComplexEditor.text)
return
match %Value1Type.current_value:
0: _current_value1 = prep_value(%Value1Text.text, %Value1Type.current_value)
1: _current_value1 = str(%Value1Number.get_value())
2: _current_value1 = prep_value(%Value1Variable.current_value, %Value1Type.current_value)
3: _current_value1 = prep_value(%Value1Bool.button_pressed, %Value1Type.current_value)
_: _current_value1 = prep_value(%Value1Text.text, %Value1Type.current_value)
match %Value2Type.current_value:
0: _current_value2 = prep_value(%Value2Text.text, %Value2Type.current_value)
1: _current_value2 = str(%Value2Number.get_value())
2: _current_value2 = prep_value(%Value2Variable.current_value, %Value2Type.current_value)
3: _current_value2 = prep_value(%Value2Bool.button_pressed, %Value2Type.current_value)
_: _current_value2 = prep_value(%Value2Text.text, %Value2Type.current_value)
if event_resource:
if not %Operator.text in ['==', '!='] and get_value_type(_current_value2, 0) in [0, 3]:
event_resource.ui_update_warning.emit("This operator doesn't work with strings and booleans.")
else:
event_resource.ui_update_warning.emit("")
value_changed.emit(property_name, get_simple_condition())
func is_too_complex(condition:String) -> bool:
if condition.strip_edges().is_empty():
return false
var comparison_count: int = 0
for i in ['==', '!=', '<=', '<', '>', '>=']:
comparison_count += condition.count(i)
if comparison_count == 1:
return false
return true
## Combines the info from the simple editor fields into a string condition
func get_simple_condition() -> String:
return _current_value1 +" "+ %Operator.text +" "+ _current_value2
func complex2simple(condition:String) -> Array:
if is_too_complex(condition) or condition.strip_edges().is_empty():
return ['', '==','']
for i in ['==', '!=', '<=', '<', '>', '>=']:
if i in condition:
var cond_split := Array(condition.split(i, false))
return [cond_split[0], i, cond_split[1]]
return ['', '==','']
func _on_toggle_complex_toggled(button_pressed:bool) -> void:
if button_pressed:
%ComplexEditor.show()
%SimpleEditor.hide()
%ComplexEditor.text = get_simple_condition()
else:
if !is_too_complex(%ComplexEditor.text):
%ComplexEditor.hide()
%SimpleEditor.show()
load_simple_editor(%ComplexEditor.text)
func _on_complex_editor_text_changed(new_text:String) -> void:
%ToggleComplex.disabled = is_too_complex(%ComplexEditor.text)
something_changed()
func get_variable_suggestions(filter:String) -> Dictionary:
var suggestions := {}
var vars: Dictionary = ProjectSettings.get_setting('dialogic/variables', {})
for var_path in DialogicUtil.list_variables(vars):
suggestions[var_path] = {'value':var_path, 'editor_icon':["ClassList", "EditorIcons"]}
return suggestions
func _on_value_1_variable_value_changed(property_name: Variant, value: Variant) -> void:
var type := DialogicUtil.get_variable_type(value)
match type:
DialogicUtil.VarTypes.BOOL:
if not %Operator.text in ["==", "!="]:
%Operator.text = "=="
if get_value_type(_current_value2, 3) in [0, 1]:
%Value2Type.insert_options()
%Value2Type.index_pressed(3)
DialogicUtil.VarTypes.STRING:
if not %Operator.text in ["==", "!="]:
%Operator.text = "=="
if get_value_type(_current_value2, 0) in [1, 3]:
%Value2Type.insert_options()
%Value2Type.index_pressed(0)
DialogicUtil.VarTypes.FLOAT, DialogicUtil.VarTypes.INT:
if get_value_type(_current_value2, 1) in [0,3]:
%Value2Type.insert_options()
%Value2Type.index_pressed(1)
something_changed()

View File

@@ -0,0 +1 @@
uid://cbu4n0aj1g5tv

View File

@@ -0,0 +1,101 @@
[gd_scene load_steps=9 format=3 uid="uid://ir6334lqtuwt"]
[ext_resource type="Script" path="res://addons/dialogic/Editor/Events/Fields/field_condition.gd" id="1_owjj0"]
[ext_resource type="PackedScene" uid="uid://d3bhehatwoio" path="res://addons/dialogic/Editor/Events/Fields/field_options_fixed.tscn" id="2_f6v80"]
[ext_resource type="PackedScene" uid="uid://c0vkcehgjsjy" path="res://addons/dialogic/Editor/Events/Fields/field_text_singleline.tscn" id="3_3kfwc"]
[ext_resource type="PackedScene" uid="uid://kdpp3mibml33" path="res://addons/dialogic/Editor/Events/Fields/field_number.tscn" id="4_6q3a6"]
[ext_resource type="PackedScene" uid="uid://dm5hxmhyyxgq" path="res://addons/dialogic/Editor/Events/Fields/field_bool_check.tscn" id="5_1x02a"]
[ext_resource type="PackedScene" uid="uid://dpwhshre1n4t6" path="res://addons/dialogic/Editor/Events/Fields/field_options_dynamic.tscn" id="6_5a2xd"]
[sub_resource type="Image" id="Image_je1w7"]
data = {
"data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 93, 93, 41, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 44, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 44, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 94, 94, 234, 255, 95, 95, 43, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 94, 94, 234, 255, 95, 95, 43, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0),
"format": "RGBA8",
"height": 16,
"mipmaps": false,
"width": 16
}
[sub_resource type="ImageTexture" id="ImageTexture_81s3d"]
image = SubResource("Image_je1w7")
[node name="Field_Condition" type="HBoxContainer"]
offset_right = 77.0
offset_bottom = 31.0
script = ExtResource("1_owjj0")
[node name="SimpleEditor" type="HBoxContainer" parent="."]
unique_name_in_owner = true
layout_mode = 2
[node name="Value1Type" parent="SimpleEditor" instance=ExtResource("2_f6v80")]
unique_name_in_owner = true
layout_mode = 2
tooltip_text = "Change type"
text = ""
[node name="Value1Text" parent="SimpleEditor" instance=ExtResource("3_3kfwc")]
unique_name_in_owner = true
layout_mode = 2
[node name="Value1Number" parent="SimpleEditor" instance=ExtResource("4_6q3a6")]
unique_name_in_owner = true
layout_mode = 2
[node name="Value1Bool" parent="SimpleEditor" instance=ExtResource("5_1x02a")]
unique_name_in_owner = true
layout_mode = 2
[node name="Value1Variable" parent="SimpleEditor" instance=ExtResource("6_5a2xd")]
unique_name_in_owner = true
layout_mode = 2
placeholder_text = "Variable"
[node name="Operator" parent="SimpleEditor" instance=ExtResource("2_f6v80")]
unique_name_in_owner = true
layout_mode = 2
[node name="Value2Type" parent="SimpleEditor" instance=ExtResource("2_f6v80")]
unique_name_in_owner = true
layout_mode = 2
tooltip_text = "Change type"
text = ""
[node name="Value2Text" parent="SimpleEditor" instance=ExtResource("3_3kfwc")]
unique_name_in_owner = true
layout_mode = 2
[node name="Value2Number" parent="SimpleEditor" instance=ExtResource("4_6q3a6")]
unique_name_in_owner = true
layout_mode = 2
[node name="Value2Variable" parent="SimpleEditor" instance=ExtResource("6_5a2xd")]
unique_name_in_owner = true
layout_mode = 2
placeholder_text = "Variable"
[node name="Value2Bool" parent="SimpleEditor" instance=ExtResource("5_1x02a")]
unique_name_in_owner = true
layout_mode = 2
[node name="ComplexEditor" type="LineEdit" parent="."]
unique_name_in_owner = true
visible = false
custom_minimum_size = Vector2(150, 0)
layout_mode = 2
mouse_filter = 1
theme_type_variation = &"DialogicEventEdit"
text = "VAR.Player.Health > 20 and VAR.Counter < 3 and randi()%3 == 2"
placeholder_text = "Enter condition"
expand_to_text_length = true
[node name="ToggleComplex" type="Button" parent="."]
unique_name_in_owner = true
layout_mode = 2
tooltip_text = "Use complex expression"
toggle_mode = true
icon = SubResource("ImageTexture_81s3d")
[connection signal="value_changed" from="SimpleEditor/Value1Variable" to="." method="_on_value_1_variable_value_changed"]
[connection signal="text_changed" from="ComplexEditor" to="." method="_on_complex_editor_text_changed"]
[connection signal="toggled" from="ToggleComplex" to="." method="_on_toggle_complex_toggled"]

View File

@@ -0,0 +1,60 @@
@tool
extends DialogicVisualEditorField
## Event block field for editing dictionaries.
const DictionaryValue = "res://addons/dialogic/Editor/Events/Fields/dictionary_part.tscn"
func _ready() -> void:
%Add.icon = get_theme_icon("Add", "EditorIcons")
func _set_value(value:Variant) -> void:
for child in get_children():
if child != %Add:
child.queue_free()
var dict: Dictionary
# attempt to take dictionary values, create a fresh one if not possible
if typeof(value) == TYPE_DICTIONARY:
dict = value
elif typeof(value) == TYPE_STRING:
if value.begins_with('{'):
var result: Variant = JSON.parse_string(value)
if result != null:
dict = result as Dictionary
var keys := dict.keys()
var values := dict.values()
for index in dict.size():
var x: Node = load(DictionaryValue).instantiate()
add_child(x)
x.set_value(values[index])
x.set_key(keys[index])
x.value_changed.connect(recalculate_values)
move_child(%Add, -1)
func _on_value_changed(value:Variant) -> void:
value_changed.emit(property_name, value)
func recalculate_values() -> void:
var dict := {}
for child in get_children():
if child != %Add and !child.is_queued_for_deletion():
dict[child.get_key()] = child.get_value()
_on_value_changed(dict)
func _on_AddButton_pressed() -> void:
var x: Control = load(DictionaryValue).instantiate()
add_child(x)
x.set_key("")
x.set_value("")
x.value_changed.connect(recalculate_values)
x.focus_key()
recalculate_values()
move_child(%Add, -1)

View File

@@ -0,0 +1 @@
uid://ce5jr72owg24n

View File

@@ -0,0 +1,28 @@
[gd_scene load_steps=4 format=3 uid="uid://c74bnmhefu72w"]
[ext_resource type="Script" path="res://addons/dialogic/Editor/Events/Fields/field_dictionary.gd" id="1_p4kmu"]
[sub_resource type="Image" id="Image_dcsrk"]
data = {
"data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 93, 93, 41, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 44, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 44, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 94, 94, 234, 255, 95, 95, 43, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 94, 94, 234, 255, 95, 95, 43, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0),
"format": "RGBA8",
"height": 16,
"mipmaps": false,
"width": 16
}
[sub_resource type="ImageTexture" id="ImageTexture_cpbga"]
image = SubResource("Image_dcsrk")
[node name="Field_Dictionary" type="HFlowContainer"]
size_flags_horizontal = 3
script = ExtResource("1_p4kmu")
[node name="Add" type="Button" parent="."]
unique_name_in_owner = true
layout_mode = 2
tooltip_text = "Add key-value pair"
icon = SubResource("ImageTexture_cpbga")
flat = true
[connection signal="pressed" from="Add" to="." method="_on_AddButton_pressed"]

View File

@@ -0,0 +1,139 @@
@tool
extends DialogicVisualEditorField
## Event block field for selecting a file or directory.
#region VARIABLES
################################################################################
@export var file_filter := ""
@export var placeholder := ""
@export var file_mode: EditorFileDialog.FileMode = EditorFileDialog.FILE_MODE_OPEN_FILE
var resource_icon: Texture:
get:
return resource_icon
set(new_icon):
resource_icon = new_icon
%Icon.texture = new_icon
if new_icon == null:
%Field.theme_type_variation = ""
else:
%Field.theme_type_variation = "LineEditWithIcon"
var max_width := 200
var current_value: String
var hide_reset := false
#endregion
#region MAIN METHODS
################################################################################
func _ready() -> void:
$FocusStyle.add_theme_stylebox_override('panel', get_theme_stylebox('focus', 'DialogicEventEdit'))
%OpenButton.icon = get_theme_icon("Folder", "EditorIcons")
%OpenButton.button_down.connect(_on_OpenButton_pressed)
%ClearButton.icon = get_theme_icon("Reload", "EditorIcons")
%ClearButton.button_up.connect(clear_path)
%ClearButton.visible = !hide_reset
%Field.set_drag_forwarding(Callable(), self._can_drop_data_fw, self._drop_data_fw)
%Field.placeholder_text = placeholder
func _load_display_info(info:Dictionary) -> void:
file_filter = info.get('file_filter', '')
placeholder = info.get('placeholder', '')
resource_icon = info.get('icon', null)
await ready
if resource_icon == null and info.has('editor_icon'):
resource_icon = callv('get_theme_icon', info.editor_icon)
func _set_value(value: Variant) -> void:
current_value = value
var text: String = value
if file_mode != EditorFileDialog.FILE_MODE_OPEN_DIR:
text = value.get_file()
%Field.tooltip_text = value
if %Field.get_theme_font('font').get_string_size(
text, 0, -1,
%Field.get_theme_font_size('font_size')).x > max_width:
%Field.expand_to_text_length = false
%Field.custom_minimum_size.x = max_width
%Field.size.x = 0
else:
%Field.custom_minimum_size.x = 0
%Field.expand_to_text_length = true
if not %Field.text == text:
value_changed.emit(property_name, current_value)
%Field.text = text
%ClearButton.visible = not value.is_empty() and not hide_reset
#endregion
#region BUTTONS
################################################################################
func _on_OpenButton_pressed() -> void:
find_parent('EditorView').godot_file_dialog(_on_file_dialog_selected, file_filter, file_mode, "Open "+ property_name)
func _on_file_dialog_selected(path:String) -> void:
_set_value(path)
value_changed.emit(property_name, path)
func clear_path() -> void:
_set_value("")
value_changed.emit(property_name, "")
#endregion
#region DRAG AND DROP
################################################################################
func _can_drop_data_fw(_at_position: Vector2, data: Variant) -> bool:
if typeof(data) == TYPE_DICTIONARY and data.has('files') and len(data.files) == 1:
if file_filter:
if '*.'+data.files[0].get_extension() in file_filter:
return true
else: return true
return false
func _drop_data_fw(_at_position: Vector2, data: Variant) -> void:
var file: String = data.files[0]
_on_file_dialog_selected(file)
#endregion
#region VISUALS FOR FOCUS
################################################################################
func _on_field_focus_entered() -> void:
$FocusStyle.show()
func _on_field_focus_exited() -> void:
$FocusStyle.hide()
var field_text: String = %Field.text
_on_file_dialog_selected(field_text)
#endregion

View File

@@ -0,0 +1 @@
uid://smurqrx4p1t4

View File

@@ -0,0 +1,87 @@
[gd_scene load_steps=8 format=3 uid="uid://7mvxuaulctcq"]
[ext_resource type="Script" path="res://addons/dialogic/Editor/Events/Fields/field_file.gd" id="1_0grcf"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_tr837"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_wq6bt"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_6b7on"]
[sub_resource type="Image" id="Image_bpoe1"]
data = {
"data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 93, 93, 41, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 44, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 44, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 94, 94, 234, 255, 95, 95, 43, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 94, 94, 234, 255, 95, 95, 43, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0),
"format": "RGBA8",
"height": 16,
"mipmaps": false,
"width": 16
}
[sub_resource type="ImageTexture" id="ImageTexture_dkuon"]
image = SubResource("Image_bpoe1")
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_yv1pn"]
content_margin_left = 4.0
content_margin_top = 4.0
content_margin_right = 4.0
content_margin_bottom = 4.0
bg_color = Color(1, 0.365, 0.365, 1)
draw_center = false
border_width_left = 2
border_width_top = 2
border_width_right = 2
border_width_bottom = 2
corner_detail = 1
[node name="Field_File" type="MarginContainer"]
offset_right = 314.0
offset_bottom = 40.0
theme_type_variation = &"DialogicEventEdit"
script = ExtResource("1_0grcf")
[node name="BG" type="PanelContainer" parent="."]
layout_mode = 2
theme_type_variation = &"DialogicEventEdit"
[node name="HBox" type="HBoxContainer" parent="BG"]
layout_mode = 2
alignment = 2
[node name="Icon" type="TextureRect" parent="BG/HBox"]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 4
mouse_filter = 2
[node name="Field" type="LineEdit" parent="BG/HBox"]
unique_name_in_owner = true
custom_minimum_size = Vector2(100, 0)
layout_mode = 2
size_flags_horizontal = 3
mouse_filter = 1
theme_override_styles/normal = SubResource("StyleBoxEmpty_tr837")
theme_override_styles/focus = SubResource("StyleBoxEmpty_wq6bt")
theme_override_styles/read_only = SubResource("StyleBoxEmpty_6b7on")
expand_to_text_length = true
[node name="OpenButton" type="Button" parent="BG/HBox"]
unique_name_in_owner = true
layout_mode = 2
icon = SubResource("ImageTexture_dkuon")
flat = true
[node name="ClearButton" type="Button" parent="BG/HBox"]
unique_name_in_owner = true
layout_mode = 2
icon = SubResource("ImageTexture_dkuon")
flat = true
[node name="FocusStyle" type="Panel" parent="."]
visible = false
layout_mode = 2
mouse_filter = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_yv1pn")
[connection signal="focus_entered" from="BG/HBox/Field" to="." method="_on_field_focus_entered"]
[connection signal="focus_exited" from="BG/HBox/Field" to="." method="_on_field_focus_exited"]
[connection signal="text_submitted" from="BG/HBox/Field" to="." method="_on_file_dialog_selected"]

View File

@@ -0,0 +1,154 @@
@tool
extends HBoxContainer
## Event block field part for a value that can change type.
signal value_changed
var value_field: Node
var value_type: int = -1
var current_value: Variant
func _ready() -> void:
%ValueType.options = [{
'label': 'String',
'icon': ["String", "EditorIcons"],
'value': TYPE_STRING
},{
'label': 'Number (int)',
'icon': ["int", "EditorIcons"],
'value': TYPE_INT
},{
'label': 'Number (float)',
'icon': ["float", "EditorIcons"],
'value': TYPE_FLOAT
},{
'label': 'Boolean',
'icon': ["bool", "EditorIcons"],
'value': TYPE_BOOL
},{
'label': 'Expression',
'icon': ["Variant", "EditorIcons"],
'value': TYPE_MAX
}
]
%ValueType.symbol_only = true
%ValueType.value_changed.connect(_on_type_changed.bind())
%ValueType.tooltip_text = "Change type"
func set_value(value:Variant):
change_field_type(deduce_type(value))
%ValueType.set_value(deduce_type(value))
current_value = value
match value_type:
TYPE_BOOL:
value_field.button_pressed = value
TYPE_STRING:
value_field.text = value
TYPE_FLOAT, TYPE_INT:
value_field.set_value(value)
TYPE_MAX, _:
value_field.text = value.trim_prefix('@')
func deduce_type(value:Variant) -> int:
if value is String and value.begins_with('@'):
return TYPE_MAX
else:
return typeof(value)
func _on_type_changed(prop:String, type:Variant) -> void:
if type == value_type:
return
match type:
TYPE_BOOL:
if typeof(current_value) == TYPE_STRING:
current_value = DialogicUtil.str_to_bool(current_value)
elif value_type == TYPE_FLOAT or value_type == TYPE_INT:
current_value = bool(current_value)
else:
current_value = true if current_value else false
set_value(current_value)
TYPE_STRING:
current_value = str(current_value).trim_prefix('@')
set_value(current_value)
TYPE_FLOAT:
current_value = float(current_value)
set_value(current_value)
TYPE_INT:
current_value = int(current_value)
set_value(current_value)
TYPE_MAX,_:
current_value = var_to_str(current_value)
set_value('@'+current_value)
emit_signal.call_deferred('value_changed')
func get_value() -> Variant:
return current_value
func _on_delete_pressed() -> void:
queue_free()
value_changed.emit()
func change_field_type(type:int) -> void:
if type == value_type:
return
value_type = type
if value_field:
value_field.queue_free()
match type:
TYPE_BOOL:
value_field = CheckBox.new()
value_field.toggled.connect(_on_bool_toggled)
TYPE_STRING:
value_field = LineEdit.new()
value_field.theme_type_variation = "DialogicEventEdit"
value_field.text_changed.connect(_on_str_text_changed)
value_field.expand_to_text_length = true
TYPE_FLOAT, TYPE_INT:
value_field = load("res://addons/dialogic/Editor/Events/Fields/field_number.tscn").instantiate()
if type == TYPE_FLOAT:
value_field.use_float_mode()
else:
value_field.use_int_mode()
value_field.value_changed.connect(_on_number_value_changed.bind(type == TYPE_INT))
TYPE_MAX, _:
value_field = LineEdit.new()
value_field.expand_to_text_length = true
value_field.text_changed.connect(_on_expression_changed)
add_child(value_field)
move_child(value_field, 1)
func _on_bool_toggled(value:bool) -> void:
current_value = value
value_changed.emit()
func _on_str_text_changed(value:String) -> void:
current_value = value
value_changed.emit()
func _on_expression_changed(value:String) -> void:
current_value = '@'+value
value_changed.emit()
func _on_number_value_changed(prop:String, value:float, int := false) -> void:
if int:
current_value = int(value)
else:
current_value = value
value_changed.emit()

View File

@@ -0,0 +1 @@
uid://bo3recbebij1p

View File

@@ -0,0 +1,15 @@
[gd_scene load_steps=3 format=3 uid="uid://dl08ubinx6ugu"]
[ext_resource type="Script" path="res://addons/dialogic/Editor/Events/Fields/field_flex_value.gd" id="1_m5nnp"]
[ext_resource type="PackedScene" uid="uid://d3bhehatwoio" path="res://addons/dialogic/Editor/Events/Fields/field_options_fixed.tscn" id="3_h10fc"]
[node name="FlexValue" type="HBoxContainer"]
offset_right = 65.0
offset_bottom = 22.0
script = ExtResource("1_m5nnp")
[node name="ValueType" parent="." instance=ExtResource("3_h10fc")]
unique_name_in_owner = true
layout_mode = 2
tooltip_text = "Change type"
text = ""

View File

@@ -0,0 +1,199 @@
@tool
class_name DialogicVisualEditorFieldNumber
extends DialogicVisualEditorField
## Event block field for integers and floats. Improved version of the native spinbox.
@export var allow_string: bool = false
@export var step: float = 0.1
@export var enforce_step: bool = true
@export var min: float = -INF
@export var max: float = INF
@export var value = 0.0
@export var prefix: String = ""
@export var suffix: String = ""
var _is_holding_button: bool = false #For handling incrementing while holding key or click
#region MAIN METHODS
################################################################################
func _ready() -> void:
if %Value.text.is_empty():
set_value(value)
update_prefix(prefix)
update_suffix(suffix)
func _load_display_info(info: Dictionary) -> void:
match info.get('mode', 0):
0: #FLOAT
use_float_mode(info.get('step', 0.1))
1: #INT
use_int_mode(info.get('step', 1))
2: #DECIBLE:
use_decibel_mode(info.get('step', step))
for option in info.keys():
match option:
'min': min = info[option]
'max': max = info[option]
'prefix': update_prefix(info[option])
'suffix': update_suffix(info[option])
'step':
enforce_step = true
step = info[option]
'hide_step_button': %Spin.hide()
func _set_value(new_value: Variant) -> void:
_on_value_text_submitted(str(new_value), true)
%Value.tooltip_text = tooltip_text
func _autofocus() -> void:
%Value.grab_focus()
func get_value() -> float:
return value
func use_float_mode(value_step: float = 0.1) -> void:
step = value_step
update_suffix("")
enforce_step = false
func use_int_mode(value_step: float = 1) -> void:
step = value_step
update_suffix("")
enforce_step = true
func use_decibel_mode(value_step: float = step) -> void:
max = 6
update_suffix("dB")
min = -80
#endregion
#region UI FUNCTIONALITY
################################################################################
var _stop_button_holding: Callable = func(button: BaseButton) -> void:
_is_holding_button = false
if button.button_up.get_connections().find(_stop_button_holding):
button.button_up.disconnect(_stop_button_holding)
if button.focus_exited.get_connections().find(_stop_button_holding):
button.focus_exited.disconnect(_stop_button_holding)
if button.mouse_exited.get_connections().find(_stop_button_holding):
button.mouse_exited.disconnect(_stop_button_holding)
func _holding_button(value_direction: int, button: BaseButton) -> void:
if _is_holding_button:
return
if _stop_button_holding.get_bound_arguments_count() > 0:
_stop_button_holding.unbind(0)
_is_holding_button = true
#Ensure removal of our value changing routine when it shouldn't run anymore
button.button_up.connect(_stop_button_holding.bind(button))
button.focus_exited.connect(_stop_button_holding.bind(button))
button.mouse_exited.connect(_stop_button_holding.bind(button))
var scene_tree: SceneTree = get_tree()
var delay_timer_ms: int = 600
#Instead of awaiting for the duration, await per-frame so we can catch any changes in _is_holding_button and exit completely
while(delay_timer_ms > 0):
if _is_holding_button == false:
return
var pre_time: int = Time.get_ticks_msec()
await scene_tree.process_frame
delay_timer_ms -= Time.get_ticks_msec() - pre_time
var change_speed: float = 0.25
while(_is_holding_button == true):
await scene_tree.create_timer(change_speed).timeout
change_speed = maxf(0.05, change_speed - 0.01)
_on_value_text_submitted(str(value+(step * value_direction)))
func update_prefix(to_prefix: String) -> void:
prefix = to_prefix
%Prefix.visible = to_prefix != null and to_prefix != ""
%Prefix.text = prefix
func update_suffix(to_suffix: String) -> void:
suffix = to_suffix
%Suffix.visible = to_suffix != null and to_suffix != ""
%Suffix.text = suffix
#endregion
#region SIGNAL METHODS
################################################################################
func _on_gui_input(event: InputEvent) -> void:
if event.is_action('ui_up') and event.get_action_strength('ui_up') > 0.5:
_on_value_text_submitted(str(value+step))
elif event.is_action('ui_down') and event.get_action_strength('ui_down') > 0.5:
_on_value_text_submitted(str(value-step))
func _on_increment_button_down(button: NodePath) -> void:
_on_value_text_submitted(str(value+step))
_holding_button(1.0, get_node(button) as BaseButton)
func _on_decrement_button_down(button: NodePath) -> void:
_on_value_text_submitted(str(value-step))
_holding_button(-1.0, get_node(button) as BaseButton)
func _on_value_text_submitted(new_text: String, no_signal:= false) -> void:
if new_text.is_empty() and not allow_string:
new_text = "0.0"
if new_text.is_valid_float():
var temp: float = min(max(new_text.to_float(), min), max)
if !enforce_step:
value = temp
else:
value = snapped(temp, step)
elif allow_string:
value = new_text
%Value.text = str(value).pad_decimals(len(str(float(step)-floorf(step)))-2)
if not no_signal:
value_changed.emit(property_name, value)
# Visually disable Up or Down arrow when limit is reached to better indicate a limit has been hit
%Spin/Decrement.disabled = value <= min
%Spin/Increment.disabled = value >= max
# If prefix or suffix was clicked, select the actual value box instead and move the caret to the closest side.
func _on_sublabel_clicked(event: InputEvent) -> void:
if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
var mousePos: Vector2 = get_global_mouse_position()
mousePos.x -= get_minimum_size().x / 2
if mousePos.x > global_position.x:
(%Value as LineEdit).caret_column = (%Value as LineEdit).text.length()
else:
(%Value as LineEdit).caret_column = 0
(%Value as LineEdit).grab_focus()
func _on_value_focus_exited() -> void:
_on_value_text_submitted(%Value.text)
$Value_Panel.add_theme_stylebox_override('panel', get_theme_stylebox('panel', 'DialogicEventEdit'))
func _on_value_focus_entered() -> void:
$Value_Panel.add_theme_stylebox_override('panel', get_theme_stylebox('focus', 'DialogicEventEdit'))
%Value.select_all.call_deferred()
#endregion

View File

@@ -0,0 +1 @@
uid://deg8fblljuxmf

View File

@@ -0,0 +1,160 @@
[gd_scene load_steps=9 format=3 uid="uid://kdpp3mibml33"]
[ext_resource type="Script" path="res://addons/dialogic/Editor/Events/Fields/field_number.gd" id="1_0jdnn"]
[ext_resource type="Texture2D" uid="uid://dh1ycbmw8anqh" path="res://addons/dialogic/Editor/Images/Interactable/increment_icon.svg" id="3_v5cne"]
[ext_resource type="Texture2D" uid="uid://brjikovneb63n" path="res://addons/dialogic/Editor/Images/Interactable/decrement_icon.svg" id="4_ph52o"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_sj3oj"]
content_margin_left = 3.0
content_margin_right = 1.0
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_8yqsu"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_smq50"]
content_margin_left = 2.0
content_margin_right = 1.0
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_increment"]
content_margin_left = 2.0
content_margin_top = 6.0
content_margin_right = 2.0
content_margin_bottom = 2.0
bg_color = Color(0.94, 0.94, 0.94, 0)
border_color = Color(0, 0, 0, 0)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_decrement"]
content_margin_left = 2.0
content_margin_top = 2.0
content_margin_right = 2.0
content_margin_bottom = 6.0
bg_color = Color(0.94, 0.94, 0.94, 0)
border_color = Color(0, 0, 0, 0)
[node name="Field_Number" type="HBoxContainer"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_right = -1102.0
offset_bottom = -617.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/separation = 0
script = ExtResource("1_0jdnn")
[node name="Value_Panel" type="PanelContainer" parent="."]
layout_mode = 2
theme_type_variation = &"DialogicEventEdit"
[node name="Layout" type="HBoxContainer" parent="Value_Panel"]
layout_mode = 2
theme_override_constants/separation = 0
[node name="Prefix" type="RichTextLabel" parent="Value_Panel/Layout"]
unique_name_in_owner = true
visible = false
clip_contents = false
layout_direction = 2
layout_mode = 2
size_flags_horizontal = 0
size_flags_vertical = 4
mouse_filter = 1
mouse_default_cursor_shape = 1
theme_override_colors/default_color = Color(0.54099, 0.540991, 0.54099, 1)
theme_override_styles/focus = SubResource("StyleBoxEmpty_sj3oj")
theme_override_styles/normal = SubResource("StyleBoxEmpty_sj3oj")
bbcode_enabled = true
fit_content = true
scroll_active = false
autowrap_mode = 0
tab_size = 2
shortcut_keys_enabled = false
drag_and_drop_selection_enabled = false
text_direction = 1
[node name="Value" type="LineEdit" parent="Value_Panel/Layout"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
focus_mode = 1
theme_override_constants/minimum_character_width = 0
theme_override_styles/normal = SubResource("StyleBoxEmpty_8yqsu")
theme_override_styles/focus = SubResource("StyleBoxEmpty_8yqsu")
theme_override_styles/read_only = SubResource("StyleBoxEmpty_8yqsu")
text = "0"
alignment = 1
expand_to_text_length = true
virtual_keyboard_type = 3
[node name="Suffix" type="RichTextLabel" parent="Value_Panel/Layout"]
unique_name_in_owner = true
visible = false
clip_contents = false
layout_direction = 2
layout_mode = 2
size_flags_horizontal = 8
size_flags_vertical = 4
mouse_default_cursor_shape = 1
theme_override_colors/default_color = Color(0.435192, 0.435192, 0.435192, 1)
theme_override_styles/focus = SubResource("StyleBoxEmpty_smq50")
theme_override_styles/normal = SubResource("StyleBoxEmpty_smq50")
bbcode_enabled = true
fit_content = true
scroll_active = false
autowrap_mode = 0
tab_size = 2
shortcut_keys_enabled = false
drag_and_drop_selection_enabled = false
text_direction = 1
[node name="Spin" type="VBoxContainer" parent="Value_Panel/Layout"]
unique_name_in_owner = true
layout_mode = 2
theme_override_constants/separation = 0
alignment = 1
[node name="Increment" type="Button" parent="Value_Panel/Layout/Spin"]
layout_mode = 2
size_flags_vertical = 3
auto_translate = false
focus_neighbor_left = NodePath("../../Value")
focus_neighbor_top = NodePath(".")
focus_neighbor_bottom = NodePath("../Decrement")
theme_override_colors/icon_hover_color = Color(0.412738, 0.550094, 0.760917, 1)
theme_override_colors/icon_focus_color = Color(0.412738, 0.550094, 0.760917, 1)
theme_override_styles/normal = SubResource("StyleBoxFlat_increment")
theme_override_styles/hover = SubResource("StyleBoxFlat_increment")
theme_override_styles/pressed = SubResource("StyleBoxFlat_increment")
theme_override_styles/disabled = SubResource("StyleBoxFlat_increment")
theme_override_styles/focus = SubResource("StyleBoxFlat_increment")
icon = ExtResource("3_v5cne")
flat = true
vertical_icon_alignment = 2
[node name="Decrement" type="Button" parent="Value_Panel/Layout/Spin"]
layout_mode = 2
size_flags_vertical = 3
auto_translate = false
focus_neighbor_left = NodePath("../../Value")
focus_neighbor_top = NodePath("../Increment")
focus_neighbor_bottom = NodePath(".")
theme_override_colors/icon_hover_color = Color(0.412738, 0.550094, 0.760917, 1)
theme_override_colors/icon_focus_color = Color(0.412738, 0.550094, 0.760917, 1)
theme_override_styles/normal = SubResource("StyleBoxFlat_decrement")
theme_override_styles/hover = SubResource("StyleBoxFlat_decrement")
theme_override_styles/pressed = SubResource("StyleBoxFlat_decrement")
theme_override_styles/disabled = SubResource("StyleBoxFlat_decrement")
theme_override_styles/focus = SubResource("StyleBoxFlat_decrement")
icon = ExtResource("4_ph52o")
flat = true
vertical_icon_alignment = 2
[connection signal="gui_input" from="Value_Panel/Layout/Prefix" to="." method="_on_sublabel_clicked"]
[connection signal="focus_entered" from="Value_Panel/Layout/Value" to="." method="_on_value_focus_entered"]
[connection signal="focus_exited" from="Value_Panel/Layout/Value" to="." method="_on_value_focus_exited"]
[connection signal="gui_input" from="Value_Panel/Layout/Value" to="." method="_on_gui_input"]
[connection signal="text_submitted" from="Value_Panel/Layout/Value" to="." method="_on_value_text_submitted"]
[connection signal="gui_input" from="Value_Panel/Layout/Suffix" to="." method="_on_sublabel_clicked"]
[connection signal="button_down" from="Value_Panel/Layout/Spin/Increment" to="." method="_on_increment_button_down" binds= [NodePath("%Spin/Increment")]]
[connection signal="gui_input" from="Value_Panel/Layout/Spin/Increment" to="." method="_on_gui_input"]
[connection signal="button_down" from="Value_Panel/Layout/Spin/Decrement" to="." method="_on_decrement_button_down" binds= [NodePath("%Spin/Decrement")]]
[connection signal="gui_input" from="Value_Panel/Layout/Spin/Decrement" to="." method="_on_gui_input"]

View File

@@ -0,0 +1,289 @@
@tool
extends DialogicVisualEditorField
## Event block field for strings. Options are determined by a function.
## SETTINGS
@export var placeholder_text := "Select Resource"
@export var empty_text := ""
enum Modes {PURE_STRING, PRETTY_PATH, IDENTIFIER}
@export var mode := Modes.PURE_STRING
@export var fit_text_length := true
var collapse_when_empty := false
var valid_file_drop_extension := ""
var get_suggestions_func: Callable
var resource_icon: Texture = null:
get:
return resource_icon
set(new_icon):
resource_icon = new_icon
%Icon.texture = new_icon
## STATE
var current_value: String
var current_selected := 0
## SUGGESTIONS ITEM LIST
var _v_separation := 0
var _h_separation := 0
var _icon_margin := 0
var _line_height := 24
var _max_height := 200 * DialogicUtil.get_editor_scale()
#region FIELD METHODS
################################################################################
func _set_value(value:Variant) -> void:
if value == null or value.is_empty():
%Search.text = empty_text
else:
match mode:
Modes.PRETTY_PATH:
%Search.text = DialogicUtil.pretty_name(value)
Modes.IDENTIFIER when value.begins_with("res://"):
%Search.text = DialogicResourceUtil.get_unique_identifier(value)
_:
%Search.text = str(value)
%Search.visible = not collapse_when_empty or value
current_value = str(value)
func _load_display_info(info:Dictionary) -> void:
valid_file_drop_extension = info.get('file_extension', '')
collapse_when_empty = info.get('collapse_when_empty', false)
get_suggestions_func = info.get('suggestions_func', get_suggestions_func)
empty_text = info.get('empty_text', '')
placeholder_text = info.get('placeholder', 'Select Resource')
mode = info.get("mode", 0)
resource_icon = info.get('icon', null)
%Search.tooltip_text = info.get('tooltip_text', '')
await ready
if resource_icon == null and info.has('editor_icon'):
resource_icon = callv('get_theme_icon', info.editor_icon)
func _autofocus() -> void:
%Search.grab_focus()
#endregion
#region BASIC
################################################################################
func _ready() -> void:
var focus := get_theme_stylebox("focus", "LineEdit")
if has_theme_stylebox("focus", "DialogicEventEdit"):
focus = get_theme_stylebox('focus', 'DialogicEventEdit')
%Focus.add_theme_stylebox_override('panel', focus)
%Search.text_changed.connect(_on_Search_text_changed)
%Search.text_submitted.connect(_on_Search_text_entered)
%Search.placeholder_text = placeholder_text
%Search.expand_to_text_length = fit_text_length
%SelectButton.icon = get_theme_icon("Collapse", "EditorIcons")
%Suggestions.add_theme_stylebox_override('bg', load("res://addons/dialogic/Editor/Events/styles/ResourceMenuPanelBackground.tres"))
%Suggestions.hide()
%Suggestions.item_selected.connect(suggestion_selected)
%Suggestions.item_clicked.connect(suggestion_selected)
%Suggestions.fixed_icon_size = Vector2i(16, 16) * DialogicUtil.get_editor_scale()
_v_separation = %Suggestions.get_theme_constant("v_separation")
_h_separation = %Suggestions.get_theme_constant("h_separation")
_icon_margin = %Suggestions.get_theme_constant("icon_margin")
if resource_icon == null:
self.resource_icon = null
func change_to_empty() -> void:
value_changed.emit(property_name, "")
#endregion
#region SEARCH & SUGGESTION POPUP
################################################################################
func _on_Search_text_entered(new_text:String) -> void:
if %Suggestions.get_item_count():
if %Suggestions.is_anything_selected():
suggestion_selected(%Suggestions.get_selected_items()[0])
else:
suggestion_selected(0)
else:
change_to_empty()
func _on_Search_text_changed(new_text:String, just_update:bool = false) -> void:
%Suggestions.clear()
if new_text == "" and !just_update:
change_to_empty()
else:
%Search.show()
var suggestions: Dictionary = get_suggestions_func.call(new_text)
var line_length := 0
var idx := 0
for element in suggestions:
if new_text.is_empty() or new_text.to_lower() in element.to_lower() or new_text.to_lower() in str(suggestions[element].value).to_lower() or new_text.to_lower() in suggestions[element].get('tooltip', '').to_lower():
var curr_line_length: int = 0
curr_line_length = get_theme_font('font', 'Label').get_string_size(
element, HORIZONTAL_ALIGNMENT_LEFT, -1, get_theme_font_size("font_size", 'Label')
).x
%Suggestions.add_item(element)
if suggestions[element].has('icon'):
%Suggestions.set_item_icon(idx, suggestions[element].icon)
curr_line_length += %Suggestions.fixed_icon_size.x * %Suggestions.get_icon_scale() + _icon_margin * 2 + _h_separation
elif suggestions[element].has('editor_icon'):
%Suggestions.set_item_icon(idx, get_theme_icon(suggestions[element].editor_icon[0],suggestions[element].editor_icon[1]))
curr_line_length += %Suggestions.fixed_icon_size.x * %Suggestions.get_icon_scale() + _icon_margin * 2 + _h_separation
line_length = max(line_length, curr_line_length)
%Suggestions.set_item_tooltip(idx, suggestions[element].get('tooltip', ''))
%Suggestions.set_item_metadata(idx, suggestions[element].value)
idx += 1
if not %Suggestions.visible:
%Suggestions.show()
%Suggestions.global_position = $PanelContainer.global_position+Vector2(0,1)*$PanelContainer.size.y
if %Suggestions.item_count:
%Suggestions.select(0)
current_selected = 0
else:
current_selected = -1
%Search.grab_focus()
var total_height: int = 0
for item in %Suggestions.item_count:
total_height += _line_height * DialogicUtil.get_editor_scale() + _v_separation
total_height += _v_separation * 2
if total_height > _max_height:
line_length += %Suggestions.get_v_scroll_bar().get_minimum_size().x
%Suggestions.size.x = max(%PanelContainer.size.x, line_length)
%Suggestions.size.y = min(total_height, _max_height)
# Defer setting width to give PanelContainer
# time to update it's size
await get_tree().process_frame
await get_tree().process_frame
%Suggestions.size.x = max(%PanelContainer.size.x, line_length)
func suggestion_selected(index: int, position := Vector2(), button_index := MOUSE_BUTTON_LEFT) -> void:
if button_index != MOUSE_BUTTON_LEFT:
return
if %Suggestions.is_item_disabled(index):
return
%Search.text = %Suggestions.get_item_text(index)
if %Suggestions.get_item_metadata(index) == null:
current_value = ""
else:
current_value = %Suggestions.get_item_metadata(index)
hide_suggestions()
grab_focus()
value_changed.emit(property_name, current_value)
func _input(event:InputEvent) -> void:
if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
if %Suggestions.visible:
if !%Suggestions.get_global_rect().has_point(get_global_mouse_position()) and \
!%SelectButton.get_global_rect().has_point(get_global_mouse_position()):
hide_suggestions()
func hide_suggestions() -> void:
%SelectButton.set_pressed_no_signal(false)
%Suggestions.hide()
if !current_value and collapse_when_empty:
%Search.hide()
func _on_SelectButton_toggled(button_pressed:bool) -> void:
if button_pressed:
_on_Search_text_changed('', true)
else:
hide_suggestions()
func _on_focus_entered() -> void:
%Search.grab_focus()
func _on_search_gui_input(event: InputEvent) -> void:
if event is InputEventKey and (event.keycode == KEY_DOWN or event.keycode == KEY_UP) and event.pressed:
if !%Suggestions.visible:
_on_Search_text_changed('', true)
current_selected = -1
if event.keycode == KEY_DOWN:
current_selected = wrapi(current_selected+1, 0, %Suggestions.item_count)
if event.keycode == KEY_UP:
current_selected = wrapi(current_selected-1, 0, %Suggestions.item_count)
%Suggestions.select(current_selected)
%Suggestions.ensure_current_is_visible()
if Input.is_key_pressed(KEY_CTRL):
if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
if valid_file_drop_extension in [".dch", ".dtl"] and not current_value.is_empty():
EditorInterface.edit_resource(DialogicResourceUtil.get_resource_from_identifier(current_value, valid_file_drop_extension))
if valid_file_drop_extension in [".dch", ".dtl"] and not current_value.is_empty():
%Search.mouse_default_cursor_shape = CURSOR_POINTING_HAND
else:
%Search.mouse_default_cursor_shape = CURSOR_IBEAM
func _on_search_focus_entered() -> void:
if %Search.text == "":
_on_Search_text_changed("")
%Search.call_deferred('select_all')
%Focus.show()
func _on_search_focus_exited() -> void:
%Focus.hide()
if !%Suggestions.get_global_rect().has_point(get_global_mouse_position()):
hide_suggestions()
#endregion
#region DRAG AND DROP
################################################################################
func _can_drop_data(position:Vector2, data:Variant) -> bool:
if typeof(data) == TYPE_DICTIONARY and data.has('files') and len(data.files) == 1:
if valid_file_drop_extension:
if data.files[0].ends_with(valid_file_drop_extension):
return true
else:
return false
return false
func _drop_data(position:Vector2, data:Variant) -> void:
var path := str(data.files[0])
if mode == Modes.IDENTIFIER:
path = DialogicResourceUtil.get_unique_identifier(path)
_set_value(path)
value_changed.emit(property_name, path)
#endregion

View File

@@ -0,0 +1 @@
uid://cf2a73icxlm1i

View File

@@ -0,0 +1,135 @@
[gd_scene load_steps=7 format=3 uid="uid://dpwhshre1n4t6"]
[ext_resource type="Script" path="res://addons/dialogic/Editor/Events/Fields/field_options_dynamic.gd" id="1_b07gq"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_tmt5n"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_vennf"]
[sub_resource type="Image" id="Image_5e7lo"]
data = {
"data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 93, 93, 41, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 44, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 44, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 94, 94, 234, 255, 95, 95, 43, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 94, 94, 234, 255, 95, 95, 43, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0),
"format": "RGBA8",
"height": 16,
"mipmaps": false,
"width": 16
}
[sub_resource type="ImageTexture" id="ImageTexture_g63da"]
image = SubResource("Image_5e7lo")
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_g74jb"]
content_margin_left = 4.0
content_margin_top = 4.0
content_margin_right = 4.0
content_margin_bottom = 4.0
bg_color = Color(1, 0.365, 0.365, 1)
draw_center = false
border_width_left = 2
border_width_top = 2
border_width_right = 2
border_width_bottom = 2
corner_detail = 1
[node name="Field_DynamicStringOptions" type="HBoxContainer"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -2.0
offset_top = -2.0
offset_right = -1005.0
offset_bottom = -622.0
grow_horizontal = 2
grow_vertical = 2
focus_mode = 2
script = ExtResource("1_b07gq")
placeholder_text = ""
[node name="PanelContainer" type="MarginContainer" parent="."]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
theme_override_constants/margin_left = 0
theme_override_constants/margin_top = 0
theme_override_constants/margin_right = 0
theme_override_constants/margin_bottom = 0
[node name="BG" type="Panel" parent="PanelContainer"]
unique_name_in_owner = true
layout_mode = 2
mouse_filter = 2
theme_type_variation = &"DialogicEventEdit"
metadata/_edit_use_anchors_ = true
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer"]
layout_mode = 2
theme_override_constants/margin_left = 2
theme_override_constants/margin_top = 2
theme_override_constants/margin_right = 2
theme_override_constants/margin_bottom = 2
[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer/MarginContainer"]
layout_mode = 2
[node name="Icon" type="TextureRect" parent="PanelContainer/MarginContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 4
mouse_filter = 2
stretch_mode = 5
[node name="Search" type="LineEdit" parent="PanelContainer/MarginContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
focus_neighbor_bottom = NodePath("Suggestions")
focus_mode = 1
mouse_filter = 1
theme_override_styles/normal = SubResource("StyleBoxEmpty_tmt5n")
theme_override_styles/focus = SubResource("StyleBoxEmpty_vennf")
expand_to_text_length = true
flat = true
caret_blink = true
[node name="Suggestions" type="ItemList" parent="PanelContainer/MarginContainer/HBoxContainer/Search"]
unique_name_in_owner = true
visible = false
top_level = true
custom_minimum_size = Vector2(-1086, 0)
layout_mode = 0
offset_left = -5.0
offset_top = 36.0
offset_right = 195.0
offset_bottom = 71.0
size_flags_vertical = 0
auto_translate = false
focus_neighbor_top = NodePath("..")
max_text_lines = 3
item_count = 1
fixed_icon_size = Vector2i(16, 16)
item_0/text = "Hello"
[node name="SelectButton" type="Button" parent="PanelContainer/MarginContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
focus_mode = 0
toggle_mode = true
shortcut_in_tooltip = false
icon = SubResource("ImageTexture_g63da")
flat = true
[node name="Focus" type="Panel" parent="PanelContainer"]
unique_name_in_owner = true
visible = false
layout_mode = 2
mouse_filter = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_g74jb")
metadata/_edit_use_anchors_ = true
[connection signal="focus_entered" from="." to="." method="_on_focus_entered"]
[connection signal="focus_entered" from="PanelContainer/MarginContainer/HBoxContainer/Search" to="." method="_on_search_focus_entered"]
[connection signal="focus_exited" from="PanelContainer/MarginContainer/HBoxContainer/Search" to="." method="_on_search_focus_exited"]
[connection signal="gui_input" from="PanelContainer/MarginContainer/HBoxContainer/Search" to="." method="_on_search_gui_input"]
[connection signal="gui_input" from="PanelContainer/MarginContainer/HBoxContainer/Search/Suggestions" to="." method="_on_suggestions_gui_input"]
[connection signal="toggled" from="PanelContainer/MarginContainer/HBoxContainer/SelectButton" to="." method="_on_SelectButton_toggled"]

View File

@@ -0,0 +1,62 @@
@tool
extends DialogicVisualEditorField
## Event block field for constant options. For varying options use ComplexPicker.
var options: Array = []
## if true, only the symbol will be displayed. In the dropdown text will be visible.
## Useful for making UI simpler
var symbol_only := false:
set(value):
symbol_only = value
if value: self.text = ""
var current_value: Variant = -1
func _ready() -> void:
add_theme_color_override("font_disabled_color", get_theme_color("font_color", "MenuButton"))
self.about_to_popup.connect(insert_options)
call("get_popup").index_pressed.connect(index_pressed)
func _load_display_info(info:Dictionary) -> void:
options = info.get('options', [])
self.disabled = info.get('disabled', false)
symbol_only = info.get('symbol_only', false)
func _set_value(value:Variant) -> void:
for option in options:
if option['value'] == value:
if typeof(option.get('icon')) == TYPE_ARRAY:
option.icon = callv('get_theme_icon', option.get('icon'))
if !symbol_only:
self.text = option['label']
self.icon = option.get('icon', null)
current_value = value
func get_value() -> Variant:
return current_value
func insert_options() -> void:
call("get_popup").clear()
var idx := 0
for option in options:
if typeof(option.get('icon')) == TYPE_ARRAY:
option.icon = callv('get_theme_icon', option.get('icon'))
call("get_popup").add_icon_item(option.get('icon', null), option['label'])
call("get_popup").set_item_metadata(idx, option['value'])
idx += 1
func index_pressed(idx:int) -> void:
current_value = idx
if !symbol_only:
self.text = call("get_popup").get_item_text(idx)
self.icon =call("get_popup").get_item_icon(idx)
value_changed.emit(property_name, call("get_popup").get_item_metadata(idx))

View File

@@ -0,0 +1 @@
uid://cd33s8frjwah

View File

@@ -0,0 +1,13 @@
[gd_scene load_steps=2 format=3 uid="uid://d3bhehatwoio"]
[ext_resource type="Script" path="res://addons/dialogic/Editor/Events/Fields/field_options_fixed.gd" id="1"]
[node name="Field_FixedOptions" type="MenuButton"]
offset_right = 137.0
offset_bottom = 43.0
focus_mode = 2
theme_type_variation = &"DialogicEventEdit"
theme_override_colors/font_disabled_color = Color(0.875, 0.875, 0.875, 1)
text = "Placeholder Text"
flat = false
script = ExtResource("1")

View File

@@ -0,0 +1,74 @@
@tool
extends DialogicVisualEditorField
## Event block field that allows entering multiline text (mainly text event).
@onready var code_completion_helper: Node = find_parent('EditorsManager').get_node('CodeCompletionHelper')
#region MAIN METHODS
################################################################################
func _ready() -> void:
self.text_changed.connect(_on_text_changed)
self.syntax_highlighter = code_completion_helper.text_syntax_highlighter
func _load_display_info(info:Dictionary) -> void:
pass
func _set_value(value:Variant) -> void:
self.text = str(value)
func _autofocus() -> void:
grab_focus()
#endregion
#region SIGNAL METHODS
################################################################################
func _on_text_changed(value := "") -> void:
value_changed.emit(property_name, self.text)
#endregion
#region AUTO COMPLETION
################################################################################
## Called if something was typed
func _request_code_completion(force:bool):
code_completion_helper.request_code_completion(force, self, 0)
## Filters the list of all possible options, depending on what was typed
## Purpose of the different Kinds is explained in [_request_code_completion]
func _filter_code_completion_candidates(candidates:Array) -> Array:
return code_completion_helper.filter_code_completion_candidates(candidates, self)
## Called when code completion was activated
## Inserts the selected item
func _confirm_code_completion(replace:bool) -> void:
code_completion_helper.confirm_code_completion(replace, self)
#endregion
#region SYMBOL CLICKING
################################################################################
## Performs an action (like opening a link) when a valid symbol was clicked
func _on_symbol_lookup(symbol, line, column):
code_completion_helper.symbol_lookup(symbol, line, column)
## Called to test if a symbol can be clicked
func _on_symbol_validate(symbol:String) -> void:
code_completion_helper.symbol_validate(symbol, self)
#endregion

View File

@@ -0,0 +1 @@
uid://unnp6fxk7knn

View File

@@ -0,0 +1,28 @@
[gd_scene load_steps=4 format=3 uid="uid://dyp7m2nvab1aj"]
[ext_resource type="Script" path="res://addons/dialogic/Editor/TimelineEditor/TextEditor/syntax_highlighter.gd" id="2_ww6ga"]
[ext_resource type="Script" path="res://addons/dialogic/Editor/Events/Fields/field_text_multiline.gd" id="3_q7600"]
[sub_resource type="SyntaxHighlighter" id="SyntaxHighlighter_2q5dk"]
script = ExtResource("2_ww6ga")
[node name="Field_Text_Multiline" type="CodeEdit"]
offset_right = 413.0
offset_bottom = 15.0
size_flags_horizontal = 3
size_flags_vertical = 3
theme_type_variation = &"DialogicTextEventTextEdit"
wrap_mode = 1
scroll_fit_content_height = true
syntax_highlighter = SubResource("SyntaxHighlighter_2q5dk")
symbol_lookup_on_click = true
delimiter_strings = Array[String]([])
code_completion_enabled = true
code_completion_prefixes = Array[String](["[", "{"])
indent_automatic_prefixes = Array[String]([":", "{", "[", ")"])
auto_brace_completion_enabled = true
auto_brace_completion_pairs = {
"[": "]",
"{": "}"
}
script = ExtResource("3_q7600")

View File

@@ -0,0 +1,40 @@
@tool
extends DialogicVisualEditorField
## Event block field for a single line of text.
var placeholder := "":
set(value):
placeholder = value
self.placeholder_text = placeholder
#region MAIN METHODS
################################################################################
func _ready() -> void:
self.text_changed.connect(_on_text_changed)
func _load_display_info(info:Dictionary) -> void:
self.placeholder = info.get('placeholder', '')
func _set_value(value:Variant) -> void:
self.text = str(value)
func _autofocus() -> void:
grab_focus()
#endregion
#region SIGNAL METHODS
################################################################################
func _on_text_changed(value := "") -> void:
value_changed.emit(property_name, self.text)
#endregion

View File

@@ -0,0 +1 @@
uid://cpfnibxxkfwoo

View File

@@ -0,0 +1,10 @@
[gd_scene load_steps=2 format=3 uid="uid://c0vkcehgjsjy"]
[ext_resource type="Script" path="res://addons/dialogic/Editor/Events/Fields/field_text_singleline.gd" id="1_4vnxv"]
[node name="Field_Text_Singleline" type="LineEdit"]
offset_right = 1152.0
offset_bottom = 81.0
theme_type_variation = &"DialogicEventEdit"
expand_to_text_length = true
script = ExtResource("1_4vnxv")

View File

@@ -0,0 +1,26 @@
@tool
extends DialogicVisualEditorFieldVector
## Event block field for a Vector2.
var current_value := Vector2()
func _set_value(value: Variant) -> void:
current_value = value
super(value)
func get_value() -> Vector2:
return current_value
func _on_sub_value_changed(sub_component: String, value: float) -> void:
match sub_component:
'X': current_value.x = value
'Y': current_value.y = value
_on_value_changed(current_value)
func _update_sub_component_text(value: Variant) -> void:
$X._on_value_text_submitted(str(value.x), true)
$Y._on_value_text_submitted(str(value.y), true)

View File

@@ -0,0 +1 @@
uid://bh0vcsgjq1ytc

View File

@@ -0,0 +1,29 @@
[gd_scene load_steps=3 format=3 uid="uid://dtimnsj014cu"]
[ext_resource type="Script" path="res://addons/dialogic/Editor/Events/Fields/field_vector2.gd" id="1_v6lp0"]
[ext_resource type="PackedScene" uid="uid://kdpp3mibml33" path="res://addons/dialogic/Editor/Events/Fields/field_number.tscn" id="2_a0b6y"]
[node name="Field_Vector2" type="HBoxContainer"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_right = -1033.0
offset_bottom = -617.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/separation = 2
script = ExtResource("1_v6lp0")
[node name="X" parent="." instance=ExtResource("2_a0b6y")]
layout_mode = 2
step = 0.001
min = -9999.0
max = 9999.0
prefix = ""
[node name="Y" parent="." instance=ExtResource("2_a0b6y")]
layout_mode = 2
step = 0.001
min = -9999.0
max = 9999.0
prefix = ""

View File

@@ -0,0 +1,28 @@
@tool
extends DialogicVisualEditorFieldVector
## Event block field for a Vector3.
var current_value := Vector3()
func _set_value(value: Variant) -> void:
current_value = value
super(value)
func get_value() -> Vector3:
return current_value
func _on_sub_value_changed(sub_component: String, value: float) -> void:
match sub_component:
'X': current_value.x = value
'Y': current_value.y = value
'Z': current_value.z = value
_on_value_changed(current_value)
func _update_sub_component_text(value: Variant) -> void:
$X._on_value_text_submitted(str(value.x), true)
$Y._on_value_text_submitted(str(value.y), true)
$Z._on_value_text_submitted(str(value.z), true)

View File

@@ -0,0 +1 @@
uid://dajktw4lcdmtq

View File

@@ -0,0 +1,16 @@
[gd_scene load_steps=4 format=3 uid="uid://cklkpfrcvopgw"]
[ext_resource type="PackedScene" uid="uid://dtimnsj014cu" path="res://addons/dialogic/Editor/Events/Fields/field_vector2.tscn" id="1_l3y0o"]
[ext_resource type="Script" path="res://addons/dialogic/Editor/Events/Fields/field_vector3.gd" id="2_gktf1"]
[ext_resource type="PackedScene" uid="uid://kdpp3mibml33" path="res://addons/dialogic/Editor/Events/Fields/field_number.tscn" id="3_k0u0p"]
[node name="Field_Vector3" instance=ExtResource("1_l3y0o")]
offset_right = -973.0
script = ExtResource("2_gktf1")
[node name="Z" parent="." index="2" instance=ExtResource("3_k0u0p")]
layout_mode = 2
step = 0.001
min = -9999.0
max = 9999.0
affix = "z:"

View File

@@ -0,0 +1,30 @@
@tool
extends DialogicVisualEditorFieldVector
## Event block field for a Vector4.
var current_value := Vector4()
func _set_value(value: Variant) -> void:
current_value = value
super(value)
func get_value() -> Vector4:
return current_value
func _on_sub_value_changed(sub_component: String, value: float) -> void:
match sub_component:
'X': current_value.x = value
'Y': current_value.y = value
'Z': current_value.z = value
'W': current_value.w = value
_on_value_changed(current_value)
func _update_sub_component_text(value: Variant) -> void:
$X._on_value_text_submitted(str(value.x), true)
$Y._on_value_text_submitted(str(value.y), true)
$Z._on_value_text_submitted(str(value.z), true)
$W._on_value_text_submitted(str(value.w), true)

View File

@@ -0,0 +1 @@
uid://bpsm6ltuiqfha

View File

@@ -0,0 +1,16 @@
[gd_scene load_steps=4 format=3 uid="uid://dykss037r2rsc"]
[ext_resource type="PackedScene" uid="uid://cklkpfrcvopgw" path="res://addons/dialogic/Editor/Events/Fields/field_vector3.tscn" id="1_20tvl"]
[ext_resource type="Script" path="res://addons/dialogic/Editor/Events/Fields/field_vector4.gd" id="2_yksrc"]
[ext_resource type="PackedScene" uid="uid://kdpp3mibml33" path="res://addons/dialogic/Editor/Events/Fields/field_number.tscn" id="3_1jogk"]
[node name="Field_Vector4" instance=ExtResource("1_20tvl")]
offset_right = -908.0
script = ExtResource("2_yksrc")
[node name="W" parent="." index="3" instance=ExtResource("3_1jogk")]
layout_mode = 2
step = 0.001
min = -9999.0
max = 9999.0
affix = "w:"

View File

@@ -0,0 +1,38 @@
class_name DialogicVisualEditorFieldVector
extends DialogicVisualEditorField
## Base type for Vector event blocks
func _ready() -> void:
for child in get_children():
child.tooltip_text = tooltip_text
child.property_name = child.name #to identify the name of the changed sub-component
child.value_changed.connect(_on_sub_value_changed)
func _load_display_info(info: Dictionary) -> void:
for child in get_children():
if child is DialogicVisualEditorFieldNumber:
if info.get('no_prefix', false):
child._load_display_info(info)
else:
var prefixed_info := info.duplicate()
prefixed_info.merge({'prefix':child.name.to_lower()})
child._load_display_info(prefixed_info)
func _set_value(value: Variant) -> void:
_update_sub_component_text(value)
_on_value_changed(value)
func _on_value_changed(value: Variant) -> void:
value_changed.emit(property_name, value)
func _on_sub_value_changed(sub_component: String, value: float) -> void:
pass
func _update_sub_component_text(value: Variant) -> void:
pass

View File

@@ -0,0 +1 @@
uid://cs36l122re1jw