Add addons
This commit is contained in:
parent
2c862b2235
commit
3367bad24f
527 changed files with 36197 additions and 0 deletions
44
Sprout/addons/dialogic/Editor/Events/Fields/Array.gd
Normal file
44
Sprout/addons/dialogic/Editor/Events/Fields/Array.gd
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
@tool
|
||||
extends VBoxContainer
|
||||
|
||||
const ArrayValue = "res://addons/dialogic/Editor/Events/Fields/ArrayValue.tscn"
|
||||
|
||||
var property_name : String
|
||||
signal value_changed
|
||||
|
||||
|
||||
func set_value(value:Array):
|
||||
for child in %Values.get_children():
|
||||
child.queue_free()
|
||||
|
||||
for item in value:
|
||||
var x = load(ArrayValue).instantiate()
|
||||
%Values.add_child(x)
|
||||
x.set_value(item)
|
||||
x.value_changed.connect(recalculate_values)
|
||||
|
||||
func _on_value_changed(value):
|
||||
emit_signal("value_changed", property_name, value)
|
||||
|
||||
func recalculate_values():
|
||||
var arr = []
|
||||
for child in %Values.get_children():
|
||||
if !child.is_queued_for_deletion():
|
||||
arr.append(child.get_value())
|
||||
_on_value_changed(arr)
|
||||
|
||||
|
||||
func set_right_text(value):
|
||||
$RightText.text = str(value)
|
||||
$RightText.visible = value.is_empty()
|
||||
|
||||
func set_left_text(value):
|
||||
%LeftText.text = str(value)
|
||||
%LeftText.visible = value.is_empty()
|
||||
|
||||
func _on_AddButton_pressed():
|
||||
var x = load(ArrayValue).instantiate()
|
||||
%Values.add_child(x)
|
||||
x.set_value("")
|
||||
x.value_changed.connect(recalculate_values)
|
||||
recalculate_values()
|
||||
47
Sprout/addons/dialogic/Editor/Events/Fields/Array.tscn
Normal file
47
Sprout/addons/dialogic/Editor/Events/Fields/Array.tscn
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://btmy7ageqpyq1"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://ch4j2lesn1sis" path="res://addons/dialogic/Editor/Events/Fields/ArrayValue.tscn" id="1"]
|
||||
[ext_resource type="Script" path="res://addons/dialogic/Editor/Events/Fields/Array.gd" id="2"]
|
||||
|
||||
[node name="Array" type="VBoxContainer"]
|
||||
script = ExtResource("2")
|
||||
|
||||
[node name="Editing" type="HBoxContainer" parent="."]
|
||||
offset_right = 157.0
|
||||
offset_bottom = 31.0
|
||||
size_flags_horizontal = 3
|
||||
alignment = 2
|
||||
|
||||
[node name="LeftText" type="Label" parent="Editing"]
|
||||
unique_name_in_owner = true
|
||||
offset_top = 2.0
|
||||
offset_right = 67.0
|
||||
offset_bottom = 28.0
|
||||
size_flags_horizontal = 3
|
||||
text = "Top Text"
|
||||
|
||||
[node name="AddButton" type="Button" parent="Editing"]
|
||||
offset_left = 71.0
|
||||
offset_right = 157.0
|
||||
offset_bottom = 31.0
|
||||
text = "Add Value"
|
||||
|
||||
[node name="Values" type="VBoxContainer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
offset_top = 35.0
|
||||
offset_right = 157.0
|
||||
offset_bottom = 105.0
|
||||
|
||||
[node name="Value" parent="Values" instance=ExtResource("1")]
|
||||
offset_right = 157.0
|
||||
offset_bottom = 33.0
|
||||
|
||||
[node name="Value2" parent="Values" instance=ExtResource("1")]
|
||||
offset_top = 37.0
|
||||
offset_right = 157.0
|
||||
offset_bottom = 70.0
|
||||
|
||||
[node name="RightText" type="Label" parent="."]
|
||||
visible = false
|
||||
|
||||
[connection signal="pressed" from="Editing/AddButton" to="." method="_on_AddButton_pressed"]
|
||||
21
Sprout/addons/dialogic/Editor/Events/Fields/ArrayValue.gd
Normal file
21
Sprout/addons/dialogic/Editor/Events/Fields/ArrayValue.gd
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
@tool
|
||||
extends HBoxContainer
|
||||
|
||||
signal value_changed()
|
||||
|
||||
func _ready():
|
||||
$Delete.icon = get_theme_icon("Remove", "EditorIcons")
|
||||
|
||||
|
||||
func _on_Delete_pressed():
|
||||
queue_free()
|
||||
emit_signal("value_changed")
|
||||
|
||||
func _on_Value_text_changed(new_text):
|
||||
emit_signal('value_changed')
|
||||
|
||||
func set_value(value):
|
||||
$Value.text = str(value)
|
||||
|
||||
func get_value():
|
||||
return $Value.text
|
||||
35
Sprout/addons/dialogic/Editor/Events/Fields/ArrayValue.tscn
Normal file
35
Sprout/addons/dialogic/Editor/Events/Fields/ArrayValue.tscn
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://ch4j2lesn1sis"]
|
||||
|
||||
[ext_resource type="Script" path="res://addons/dialogic/Editor/Events/Fields/ArrayValue.gd" id="1"]
|
||||
[ext_resource type="Theme" uid="uid://d3g4i4dshtdpu" path="res://addons/dialogic/Editor/Events/styles/InputFieldsStyle.tres" id="2"]
|
||||
|
||||
[sub_resource type="Image" id="Image_u705h"]
|
||||
data = {
|
||||
"data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 0, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 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, 93, 93, 131, 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, 93, 93, 131, 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, 93, 93, 131, 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, 252, 255, 93, 93, 252, 255, 93, 93, 252, 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, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 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, 93, 93, 55, 255, 97, 97, 58, 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, 97, 97, 42, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 98, 98, 47, 255, 97, 97, 42, 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, 93, 93, 233, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 94, 94, 46, 255, 93, 93, 236, 255, 93, 93, 233, 255, 97, 97, 42, 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, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 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_f0jdc"]
|
||||
image = SubResource("Image_u705h")
|
||||
|
||||
[node name="Value" type="HBoxContainer"]
|
||||
theme = ExtResource("2")
|
||||
script = ExtResource("1")
|
||||
|
||||
[node name="Value" type="LineEdit" parent="."]
|
||||
offset_right = 90.0
|
||||
offset_bottom = 33.0
|
||||
size_flags_horizontal = 3
|
||||
expand_to_text_length = true
|
||||
|
||||
[node name="Delete" type="Button" parent="."]
|
||||
offset_left = 94.0
|
||||
offset_right = 118.0
|
||||
offset_bottom = 33.0
|
||||
icon = SubResource("ImageTexture_f0jdc")
|
||||
|
||||
[connection signal="text_changed" from="Value" to="." method="_on_Value_text_changed"]
|
||||
[connection signal="pressed" from="Delete" to="." method="_on_Delete_pressed"]
|
||||
23
Sprout/addons/dialogic/Editor/Events/Fields/Bool.gd
Normal file
23
Sprout/addons/dialogic/Editor/Events/Fields/Bool.gd
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
@tool
|
||||
extends HBoxContainer
|
||||
|
||||
var property_name : String
|
||||
signal value_changed
|
||||
|
||||
func _ready():
|
||||
$Toggle.toggled.connect(_on_value_changed)
|
||||
|
||||
|
||||
func set_value(value:bool):
|
||||
$Toggle.button_pressed = value
|
||||
|
||||
|
||||
func _on_value_changed(value):
|
||||
emit_signal("value_changed", property_name, value)
|
||||
|
||||
|
||||
func set_right_text(value):
|
||||
$RightText.text = str(value)
|
||||
|
||||
func set_left_text(value):
|
||||
$LeftText.text = str(value)
|
||||
23
Sprout/addons/dialogic/Editor/Events/Fields/Bool.tscn
Normal file
23
Sprout/addons/dialogic/Editor/Events/Fields/Bool.tscn
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/dialogic/Editor/Events/Fields/Bool.gd" type="Script" id=1]
|
||||
|
||||
[node name="Bool" type="HBoxContainer"]
|
||||
margin_right = 40.0
|
||||
margin_bottom = 40.0
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="LeftText" type="Label" parent="."]
|
||||
margin_top = 13.0
|
||||
margin_bottom = 27.0
|
||||
|
||||
[node name="Toggle" type="CheckButton" parent="."]
|
||||
margin_left = 4.0
|
||||
margin_right = 80.0
|
||||
margin_bottom = 40.0
|
||||
|
||||
[node name="RightText" type="Label" parent="."]
|
||||
margin_left = 84.0
|
||||
margin_top = 13.0
|
||||
margin_right = 84.0
|
||||
margin_bottom = 27.0
|
||||
259
Sprout/addons/dialogic/Editor/Events/Fields/ComplexPicker.gd
Normal file
259
Sprout/addons/dialogic/Editor/Events/Fields/ComplexPicker.gd
Normal file
|
|
@ -0,0 +1,259 @@
|
|||
@tool
|
||||
extends Control
|
||||
|
||||
@export var placeholder_text : String = "Select Resource"
|
||||
|
||||
### SETTINGS FOR THE RESOURCE PICKER
|
||||
var file_extension : String = ""
|
||||
var get_suggestions_func : Callable = get_default_suggestions
|
||||
var empty_text : String = ""
|
||||
@export var enable_pretty_name : bool = false
|
||||
|
||||
var resource_icon : Texture = null:
|
||||
get:
|
||||
return resource_icon
|
||||
set(new_icon):
|
||||
resource_icon = new_icon
|
||||
%Icon.texture = new_icon
|
||||
|
||||
## STORING VALUE AND REFERENCE TO RESOURCE
|
||||
var event_resource : DialogicEvent = null
|
||||
var property_name : String
|
||||
var current_value # Dynamic
|
||||
var editor_reference
|
||||
|
||||
var current_selected = 0
|
||||
|
||||
# this signal is on all event parts and informs the event that a change happened.
|
||||
signal value_changed(property_name, value)
|
||||
|
||||
################################################################################
|
||||
## BASIC EVENT PART FUNCTIONS
|
||||
################################################################################
|
||||
# These functions have to be implemented by all scenes that are used to display
|
||||
# values on the events.
|
||||
|
||||
func set_left_text(value:String) -> void:
|
||||
$LeftText.text = str(value)
|
||||
$LeftText.visible = !value.is_empty()
|
||||
|
||||
func set_right_text(value:String) -> void:
|
||||
$RightText.text = str(value)
|
||||
$RightText.visible = !value.is_empty()
|
||||
|
||||
func set_value(value, text : String = '') -> void:
|
||||
if value == null:
|
||||
%Search.text = empty_text
|
||||
elif file_extension != "" and file_extension != ".dch" and file_extension != ".dtl":
|
||||
%Search.text = value.resource_path
|
||||
%Search.tooltip_text = value.resource_path
|
||||
elif value:
|
||||
if enable_pretty_name:
|
||||
%Search.text = DialogicUtil.pretty_name(value)
|
||||
else:
|
||||
%Search.text = value
|
||||
else:
|
||||
%Search.text = empty_text
|
||||
if text:
|
||||
%Search.text = text
|
||||
|
||||
current_value = value
|
||||
|
||||
|
||||
func changed_to_empty() -> void:
|
||||
if file_extension != "" && file_extension != ".dch":
|
||||
emit_signal("value_changed", property_name, null)
|
||||
else:
|
||||
emit_signal("value_changed", property_name, "")
|
||||
|
||||
|
||||
################################################################################
|
||||
## BASIC
|
||||
################################################################################
|
||||
func _ready():
|
||||
%BG.add_theme_stylebox_override('panel', get_theme_stylebox('normal', 'LineEdit'))
|
||||
%Focus.add_theme_stylebox_override('panel', get_theme_stylebox('focus', 'LineEdit'))
|
||||
%Search.text_changed.connect(_on_Search_text_changed)
|
||||
%Search.focus_entered.connect(_on_Search_focus_entered)
|
||||
%Search.text_submitted.connect(_on_Search_text_entered)
|
||||
var scale: float = DialogicUtil.get_editor_scale()
|
||||
%SelectButton.icon = get_theme_icon("Collapse", "EditorIcons")
|
||||
%Search.placeholder_text = placeholder_text
|
||||
%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)
|
||||
if resource_icon == null:
|
||||
self.resource_icon = null
|
||||
|
||||
%Search.placeholder_text = 'Select Resource'
|
||||
if file_extension == '.dch':
|
||||
%Search.placeholder_text = 'Select Character'
|
||||
if file_extension == '.dtl':
|
||||
%Search.placeholder_text = 'Select Timeline'
|
||||
|
||||
set_left_text('')
|
||||
set_right_text('')
|
||||
editor_reference = find_parent('EditorView')
|
||||
|
||||
func _exit_tree():
|
||||
# Explicitly free any open cache resources on close, so we don't get leaked resource errors on shutdown
|
||||
event_resource = null
|
||||
|
||||
################################################################################
|
||||
## SEARCH & SUGGESTION POPUP
|
||||
################################################################################
|
||||
func _on_Search_text_entered(new_text:String) -> void:
|
||||
if %Suggestions.get_item_count() and not %Search.text.is_empty():
|
||||
if %Suggestions.is_anything_selected():
|
||||
suggestion_selected(%Suggestions.get_selected_items()[0])
|
||||
else:
|
||||
suggestion_selected(0)
|
||||
else:
|
||||
changed_to_empty()
|
||||
|
||||
|
||||
func _on_Search_text_changed(new_text:String, just_update:bool = false) -> void:
|
||||
%Suggestions.clear()
|
||||
|
||||
if new_text == "" and !just_update:
|
||||
changed_to_empty()
|
||||
|
||||
var suggestions :Dictionary = get_suggestions_func.call(new_text)
|
||||
|
||||
var line_length:int = 0
|
||||
var idx:int = 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():
|
||||
line_length = max(get_theme_font('font', 'Label').get_string_size(element, HORIZONTAL_ALIGNMENT_LEFT, -1, get_theme_font_size("font_size", 'Label')).x+80, line_length)
|
||||
%Suggestions.add_item(element)
|
||||
if suggestions[element].has('icon'):
|
||||
%Suggestions.set_item_icon(idx, suggestions[element].icon)
|
||||
elif suggestions[element].has('editor_icon'):
|
||||
%Suggestions.set_item_icon(idx, get_theme_icon(suggestions[element].editor_icon[0],suggestions[element].editor_icon[1]))
|
||||
|
||||
%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
|
||||
#%Suggestions.position = Vector2()
|
||||
%Suggestions.size.x = max(%Search.size.x, line_length)
|
||||
%Suggestions.size.y = min(%Suggestions.get_item_count()*35*DialogicUtil.get_editor_scale(), 200*DialogicUtil.get_editor_scale())
|
||||
if %Suggestions.get_item_count():
|
||||
%Suggestions.select(0)
|
||||
current_selected = 0
|
||||
else:
|
||||
current_selected = -1
|
||||
%Search.grab_focus()
|
||||
|
||||
func get_default_suggestions(input:String) -> Dictionary:
|
||||
if file_extension.is_empty(): return {'Nothing found!':{'value':''}}
|
||||
var suggestions: Dictionary = {}
|
||||
if file_extension == ".dch":
|
||||
suggestions['(No one)'] = {'value':'', 'editor_icon':["GuiRadioUnchecked", "EditorIcons"]}
|
||||
|
||||
for resource in editor_reference.character_directory.keys():
|
||||
suggestions[resource] = {'value': resource, 'tooltip': editor_reference.character_directory[resource]['full_path']}
|
||||
else:
|
||||
var resources: Array = DialogicUtil.list_resources_of_type(file_extension)
|
||||
|
||||
for resource in resources:
|
||||
suggestions[resource] = {'value':resource, 'tooltip':resource}
|
||||
|
||||
return suggestions
|
||||
|
||||
|
||||
func suggestion_selected(index : int, position:=Vector2(), button_index:=MOUSE_BUTTON_LEFT) -> void:
|
||||
if %Suggestions.is_item_disabled(index):
|
||||
return
|
||||
|
||||
%Search.text = %Suggestions.get_item_text(index)
|
||||
|
||||
if %Suggestions.get_item_metadata(index) == null:
|
||||
current_value = null
|
||||
|
||||
# if this is a resource, then load it instead of assigning the string:
|
||||
elif file_extension != "" and file_extension != ".dch" and file_extension != ".dtl":
|
||||
var file = load(%Suggestions.get_item_metadata(index))
|
||||
current_value = file
|
||||
else:
|
||||
current_value = %Suggestions.get_item_metadata(index)
|
||||
|
||||
hide_suggestions()
|
||||
|
||||
%Search.grab_focus()
|
||||
emit_signal("value_changed", property_name, current_value)
|
||||
|
||||
func _input(event:InputEvent):
|
||||
if event is InputEventMouseButton and event.pressed:
|
||||
if %Suggestions.visible:
|
||||
if !%Suggestions.get_global_rect().has_point(get_global_mouse_position()):
|
||||
hide_suggestions()
|
||||
|
||||
func hide_suggestions() -> void:
|
||||
%SelectButton.button_pressed = false
|
||||
%Suggestions.hide()
|
||||
|
||||
func _on_Search_focus_entered() -> void:
|
||||
if %Search.text == "" or current_value == null or (typeof(current_value) == TYPE_STRING and current_value.is_empty()):
|
||||
_on_Search_text_changed("")
|
||||
|
||||
func _on_SelectButton_toggled(button_pressed:bool) -> void:
|
||||
if button_pressed:
|
||||
_on_Search_text_changed('', true)
|
||||
|
||||
################################################################################
|
||||
## DRAG AND DROP
|
||||
################################################################################
|
||||
|
||||
func _can_drop_data(position, data) -> bool:
|
||||
if typeof(data) == TYPE_DICTIONARY and data.has('files') and len(data.files) == 1:
|
||||
if file_extension:
|
||||
if data.files[0].ends_with(file_extension):
|
||||
return true
|
||||
else:
|
||||
return false
|
||||
return false
|
||||
|
||||
func _drop_data(position, data) -> void:
|
||||
if data.files[0].ends_with('dch'):
|
||||
for character in editor_reference.character_directory.keys():
|
||||
if editor_reference.character_directory[character]["full_path"] == data.files[0]:
|
||||
set_value(character)
|
||||
break
|
||||
elif data.files[0].ends_with('dtl'):
|
||||
for timeline in editor_reference.timeline_directory.keys():
|
||||
if editor_reference.timeline_directory[timeline] == data.files[0]:
|
||||
set_value(timeline)
|
||||
break
|
||||
else:
|
||||
var file = load(data.files[0])
|
||||
set_value(file)
|
||||
emit_signal("value_changed", property_name, file)
|
||||
|
||||
|
||||
func _on_focus_entered():
|
||||
%Search.grab_focus()
|
||||
|
||||
func _on_search_gui_input(event):
|
||||
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()
|
||||
|
||||
func _on_search_focus_entered():
|
||||
%Focus.show()
|
||||
|
||||
func _on_search_focus_exited():
|
||||
%Focus.hide()
|
||||
if !%Suggestions.get_global_rect().has_point(get_global_mouse_position()):
|
||||
hide_suggestions()
|
||||
197
Sprout/addons/dialogic/Editor/Events/Fields/ComplexPicker.tscn
Normal file
197
Sprout/addons/dialogic/Editor/Events/Fields/ComplexPicker.tscn
Normal file
|
|
@ -0,0 +1,197 @@
|
|||
[gd_scene load_steps=7 format=3 uid="uid://dpwhshre1n4t6"]
|
||||
|
||||
[ext_resource type="Script" path="res://addons/dialogic/Editor/Events/Fields/ComplexPicker.gd" id="1"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_guyh1"]
|
||||
content_margin_left = 4.0
|
||||
content_margin_top = 4.0
|
||||
content_margin_right = 4.0
|
||||
content_margin_bottom = 4.0
|
||||
bg_color = Color(0.1, 0.1, 0.1, 0.6)
|
||||
border_width_bottom = 2
|
||||
border_color = Color(0, 0, 0, 0.6)
|
||||
corner_radius_top_left = 3
|
||||
corner_radius_top_right = 3
|
||||
corner_radius_bottom_right = 3
|
||||
corner_radius_bottom_left = 3
|
||||
corner_detail = 5
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_vennf"]
|
||||
|
||||
[sub_resource type="Image" id="Image_q6a87"]
|
||||
data = {
|
||||
"data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 0, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 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, 93, 93, 131, 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, 93, 93, 131, 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, 93, 93, 131, 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, 252, 255, 93, 93, 252, 255, 93, 93, 252, 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, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 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, 93, 93, 55, 255, 97, 97, 58, 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, 97, 97, 42, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 98, 98, 47, 255, 97, 97, 42, 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, 93, 93, 233, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 94, 94, 46, 255, 93, 93, 236, 255, 93, 93, 233, 255, 97, 97, 42, 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, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 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_xvxyn"]
|
||||
image = SubResource("Image_q6a87")
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ma30x"]
|
||||
content_margin_left = 4.0
|
||||
content_margin_top = 4.0
|
||||
content_margin_right = 4.0
|
||||
content_margin_bottom = 4.0
|
||||
bg_color = Color(1, 1, 1, 0.75)
|
||||
draw_center = false
|
||||
border_width_left = 2
|
||||
border_width_top = 2
|
||||
border_width_right = 2
|
||||
border_width_bottom = 2
|
||||
corner_radius_top_left = 3
|
||||
corner_radius_top_right = 3
|
||||
corner_radius_bottom_right = 3
|
||||
corner_radius_bottom_left = 3
|
||||
corner_detail = 5
|
||||
expand_margin_left = 2.0
|
||||
expand_margin_top = 2.0
|
||||
expand_margin_right = 2.0
|
||||
expand_margin_bottom = 2.0
|
||||
|
||||
[node name="ComplexPicker" type="HBoxContainer"]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -2.0
|
||||
offset_top = -2.0
|
||||
offset_right = -911.0
|
||||
offset_bottom = -615.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
focus_mode = 2
|
||||
script = ExtResource("1")
|
||||
|
||||
[node name="LeftText" type="Label" parent="."]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
offset_top = 230.0
|
||||
offset_right = 1.0
|
||||
offset_bottom = 253.0
|
||||
|
||||
[node name="PanelContainer" type="MarginContainer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
offset_right = 243.0
|
||||
offset_bottom = 35.0
|
||||
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
|
||||
offset_right = 243.0
|
||||
offset_bottom = 35.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_guyh1")
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer"]
|
||||
layout_mode = 2
|
||||
offset_right = 243.0
|
||||
offset_bottom = 35.0
|
||||
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
|
||||
offset_left = 2.0
|
||||
offset_top = 2.0
|
||||
offset_right = 241.0
|
||||
offset_bottom = 33.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="Icon" type="TextureRect" parent="PanelContainer/MarginContainer/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
offset_top = 15.0
|
||||
offset_bottom = 15.0
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 4
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="Search" type="LineEdit" parent="PanelContainer/MarginContainer/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
offset_left = 4.0
|
||||
offset_right = 211.0
|
||||
offset_bottom = 31.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 4
|
||||
focus_neighbor_bottom = NodePath("Suggestions")
|
||||
focus_mode = 1
|
||||
mouse_filter = 1
|
||||
theme_override_styles/focus = SubResource("StyleBoxEmpty_vennf")
|
||||
placeholder_text = "Select Resource"
|
||||
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
|
||||
item_0/text = "Hello"
|
||||
|
||||
[node name="SelectButton" type="Button" parent="PanelContainer/MarginContainer/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
offset_left = 215.0
|
||||
offset_right = 239.0
|
||||
offset_bottom = 31.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 2
|
||||
focus_mode = 0
|
||||
toggle_mode = true
|
||||
shortcut_in_tooltip = false
|
||||
icon = SubResource("ImageTexture_xvxyn")
|
||||
flat = true
|
||||
|
||||
[node name="Focus" type="Panel" parent="PanelContainer"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
offset_right = 243.0
|
||||
offset_bottom = 35.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_ma30x")
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="RightText" type="Label" parent="."]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
offset_left = 855.0
|
||||
offset_top = 230.0
|
||||
offset_right = 856.0
|
||||
offset_bottom = 253.0
|
||||
|
||||
[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"]
|
||||
129
Sprout/addons/dialogic/Editor/Events/Fields/ConditionPicker.gd
Normal file
129
Sprout/addons/dialogic/Editor/Events/Fields/ConditionPicker.gd
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
@tool
|
||||
extends Control
|
||||
|
||||
var property_name : String
|
||||
signal value_changed
|
||||
|
||||
func _ready():
|
||||
%ComplexEditor.add_theme_stylebox_override('normal', get_theme_stylebox('normal', 'LineEdit'))
|
||||
%ComplexEditor.add_theme_stylebox_override('focus', get_theme_stylebox('focus', 'LineEdit'))
|
||||
|
||||
%Operator.options = [
|
||||
{
|
||||
'label': '==',
|
||||
'value': '=='
|
||||
},
|
||||
{
|
||||
'label': '>',
|
||||
'value': '>'
|
||||
},
|
||||
{
|
||||
'label': '<',
|
||||
'value': '<'
|
||||
},
|
||||
{
|
||||
'label': '<=',
|
||||
'value': '<='
|
||||
},
|
||||
{
|
||||
'label': '>=',
|
||||
'value': '>='
|
||||
},
|
||||
{
|
||||
'label': '!=',
|
||||
'value': '!='
|
||||
}
|
||||
]
|
||||
%ToggleComplex.icon = get_theme_icon("Enum", "EditorIcons")
|
||||
|
||||
%Value1.resource_icon = get_theme_icon("ClassList", "EditorIcons")
|
||||
%Value1.get_suggestions_func = get_value1_suggestions
|
||||
%Value1.value_changed.connect(something_changed)
|
||||
%Operator.value_changed.connect(something_changed)
|
||||
|
||||
%Value2.resource_icon = get_theme_icon("Variant", "EditorIcons")
|
||||
%Value2.get_suggestions_func = get_value2_suggestions
|
||||
%Value2.value_changed.connect(something_changed)
|
||||
|
||||
func set_right_text(value:String):
|
||||
$RightText.text = str(value)
|
||||
$RightText.visible = !value.is_empty()
|
||||
|
||||
func set_left_text(value:String):
|
||||
$LeftText.text = str(value)
|
||||
$LeftText.visible = !value.is_empty()
|
||||
|
||||
func set_value(value:String):
|
||||
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:
|
||||
var data = complex2simple(value)
|
||||
%Value1.set_value(data[0], data[0].trim_prefix("{").trim_suffix('}'))
|
||||
%Operator.set_value(data[1].strip_edges())
|
||||
%Value2.set_value(data[2], data[2].trim_prefix("{").trim_suffix('}'))
|
||||
|
||||
func something_changed(fake_arg1=null, fake_arg2 = null):
|
||||
if %ComplexEditor.visible:
|
||||
value_changed.emit(property_name, %ComplexEditor.text)
|
||||
elif %SimpleEditor.visible:
|
||||
value_changed.emit(property_name, simple2complex(%Value1.current_value, %Operator.get_value(), %Value2.current_value))
|
||||
|
||||
func is_too_complex(condition:String) -> bool:
|
||||
return !condition.is_empty() and len(condition.split(' ', false)) != 3
|
||||
|
||||
func complex2simple(condition:String) -> Array:
|
||||
if is_too_complex(condition) or condition.strip_edges().is_empty():
|
||||
return ['', '==','']
|
||||
var cond_split = Array(condition.split(' ', false))
|
||||
if cond_split[2].begins_with('"'): cond_split[2] = cond_split[2].trim_prefix('"').trim_suffix('"')
|
||||
return cond_split
|
||||
|
||||
func simple2complex(value1, operator, value2) -> String:
|
||||
if value1 == null: value1 = ''
|
||||
if value1.is_empty():
|
||||
return ''
|
||||
if value2 == null: value2 = ''
|
||||
if !value2.is_valid_float() and !value2.begins_with('{'):
|
||||
value2 = '"'+value2+'"'
|
||||
return value1 +" "+ operator +" "+ value2
|
||||
|
||||
func _on_toggle_complex_toggled(button_pressed) -> void:
|
||||
if button_pressed:
|
||||
%ComplexEditor.show()
|
||||
%SimpleEditor.hide()
|
||||
%ComplexEditor.text = simple2complex(%Value1.current_value, %Operator.get_value(), %Value2.current_value)
|
||||
else:
|
||||
if !is_too_complex(%ComplexEditor.text):
|
||||
%ComplexEditor.hide()
|
||||
%SimpleEditor.show()
|
||||
var data = complex2simple(%ComplexEditor.text)
|
||||
%Value1.set_value(data[0], data[0].trim_prefix("{").trim_suffix('}'))
|
||||
%Operator.set_value(data[1].strip_edges())
|
||||
%Value2.set_value(data[2], data[2].trim_prefix("{").trim_suffix('}'))
|
||||
|
||||
func _on_complex_editor_text_changed(new_text):
|
||||
%ToggleComplex.disabled = is_too_complex(%ComplexEditor.text)
|
||||
something_changed()
|
||||
|
||||
func get_value1_suggestions(filter:String) -> Dictionary:
|
||||
var suggestions = {}
|
||||
if filter:
|
||||
suggestions[filter] = {'value':filter, 'editor_icon':["GuiScrollArrowRight", "EditorIcons"]}
|
||||
var vars = DialogicUtil.get_project_setting('dialogic/variables', {})
|
||||
for var_path in DialogicUtil.list_variables(vars):
|
||||
suggestions[var_path] = {'value':'{'+var_path+"}", 'editor_icon':["ClassList", "EditorIcons"]}
|
||||
return suggestions
|
||||
|
||||
|
||||
func get_value2_suggestions(filter:String) -> Dictionary:
|
||||
var suggestions = {}
|
||||
if filter:
|
||||
suggestions[filter] = {'value':filter, 'editor_icon':["GuiScrollArrowRight", "EditorIcons"]}
|
||||
var vars = DialogicUtil.get_project_setting('dialogic/variables', {})
|
||||
for var_path in DialogicUtil.list_variables(vars):
|
||||
suggestions[var_path] = {'value':'{'+var_path+"}", 'editor_icon':["ClassList", "EditorIcons"]}
|
||||
return suggestions
|
||||
152
Sprout/addons/dialogic/Editor/Events/Fields/ConditionPicker.tscn
Normal file
152
Sprout/addons/dialogic/Editor/Events/Fields/ConditionPicker.tscn
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
[gd_scene load_steps=9 format=3 uid="uid://ir6334lqtuwt"]
|
||||
|
||||
[ext_resource type="Script" path="res://addons/dialogic/Editor/Events/Fields/ConditionPicker.gd" id="1_q5p62"]
|
||||
[ext_resource type="PackedScene" uid="uid://dpwhshre1n4t6" path="res://addons/dialogic/Editor/Events/Fields/ComplexPicker.tscn" id="1_rr7mq"]
|
||||
[ext_resource type="PackedScene" uid="uid://d3bhehatwoio" path="res://addons/dialogic/Editor/Events/Fields/OptionSelector.tscn" id="4_27ir8"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_6mta0"]
|
||||
content_margin_left = 4.0
|
||||
content_margin_top = 4.0
|
||||
content_margin_right = 4.0
|
||||
content_margin_bottom = 4.0
|
||||
bg_color = Color(0.1, 0.1, 0.1, 0.6)
|
||||
border_width_bottom = 2
|
||||
border_color = Color(0, 0, 0, 0.6)
|
||||
corner_radius_top_left = 3
|
||||
corner_radius_top_right = 3
|
||||
corner_radius_bottom_right = 3
|
||||
corner_radius_bottom_left = 3
|
||||
corner_detail = 5
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_66k5i"]
|
||||
content_margin_left = 4.0
|
||||
content_margin_top = 4.0
|
||||
content_margin_right = 4.0
|
||||
content_margin_bottom = 4.0
|
||||
bg_color = Color(1, 1, 1, 0.75)
|
||||
draw_center = false
|
||||
border_width_left = 2
|
||||
border_width_top = 2
|
||||
border_width_right = 2
|
||||
border_width_bottom = 2
|
||||
corner_radius_top_left = 3
|
||||
corner_radius_top_right = 3
|
||||
corner_radius_bottom_right = 3
|
||||
corner_radius_bottom_left = 3
|
||||
corner_detail = 5
|
||||
expand_margin_left = 2.0
|
||||
expand_margin_top = 2.0
|
||||
expand_margin_right = 2.0
|
||||
expand_margin_bottom = 2.0
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_q81pd"]
|
||||
content_margin_left = 3.75
|
||||
content_margin_top = 3.75
|
||||
content_margin_right = 3.75
|
||||
content_margin_bottom = 3.75
|
||||
bg_color = Color(0.113725, 0.121569, 0.145098, 1)
|
||||
border_color = Color(0.0784314, 0.0862745, 0.101961, 1)
|
||||
corner_radius_top_left = 2
|
||||
corner_radius_top_right = 2
|
||||
corner_radius_bottom_right = 2
|
||||
corner_radius_bottom_left = 2
|
||||
|
||||
[sub_resource type="Image" id="Image_vivn8"]
|
||||
data = {
|
||||
"data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 0, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 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, 93, 93, 131, 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, 93, 93, 131, 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, 93, 93, 131, 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, 252, 255, 93, 93, 252, 255, 93, 93, 252, 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, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 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, 93, 93, 55, 255, 97, 97, 58, 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, 97, 97, 42, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 98, 98, 47, 255, 97, 97, 42, 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, 93, 93, 233, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 94, 94, 46, 255, 93, 93, 236, 255, 93, 93, 233, 255, 97, 97, 42, 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, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 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_vtsk1"]
|
||||
image = SubResource("Image_vivn8")
|
||||
|
||||
[node name="ConditionPicker" type="HBoxContainer"]
|
||||
offset_right = 77.0
|
||||
offset_bottom = 31.0
|
||||
script = ExtResource("1_q5p62")
|
||||
|
||||
[node name="LeftText" type="Label" parent="."]
|
||||
layout_mode = 2
|
||||
offset_top = 5.0
|
||||
offset_right = 1.0
|
||||
offset_bottom = 28.0
|
||||
|
||||
[node name="SimpleEditor" type="HBoxContainer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
offset_left = 5.0
|
||||
offset_right = 542.0
|
||||
offset_bottom = 34.0
|
||||
|
||||
[node name="Value1" parent="SimpleEditor" instance=ExtResource("1_rr7mq")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
anchors_preset = 0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
offset_right = 196.0
|
||||
offset_bottom = 34.0
|
||||
grow_horizontal = 1
|
||||
grow_vertical = 1
|
||||
placeholder_text = "Variable"
|
||||
disable_pretty_name = true
|
||||
|
||||
[node name="Operator" parent="SimpleEditor" instance=ExtResource("4_27ir8")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
offset_left = 200.0
|
||||
offset_right = 337.0
|
||||
offset_bottom = 34.0
|
||||
|
||||
[node name="Value2" parent="SimpleEditor" instance=ExtResource("1_rr7mq")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
anchors_preset = 0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
offset_left = 341.0
|
||||
offset_right = 537.0
|
||||
offset_bottom = 34.0
|
||||
grow_horizontal = 1
|
||||
grow_vertical = 1
|
||||
placeholder_text = "Value"
|
||||
disable_pretty_name = true
|
||||
|
||||
[node name="ComplexEditor" type="LineEdit" parent="."]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
custom_minimum_size = Vector2i(150, 0)
|
||||
layout_mode = 2
|
||||
offset_left = 569.0
|
||||
offset_right = 1076.0
|
||||
offset_bottom = 34.0
|
||||
mouse_filter = 1
|
||||
theme_override_styles/normal = SubResource("StyleBoxFlat_6mta0")
|
||||
theme_override_styles/focus = SubResource("StyleBoxFlat_66k5i")
|
||||
theme_override_styles/read_only = SubResource("StyleBoxFlat_q81pd")
|
||||
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
|
||||
offset_left = 546.0
|
||||
offset_right = 570.0
|
||||
offset_bottom = 34.0
|
||||
tooltip_text = "Use complex expression"
|
||||
toggle_mode = true
|
||||
icon = SubResource("ImageTexture_vtsk1")
|
||||
|
||||
[node name="RightText" type="Label" parent="."]
|
||||
layout_mode = 2
|
||||
offset_left = 574.0
|
||||
offset_top = 5.0
|
||||
offset_right = 575.0
|
||||
offset_bottom = 28.0
|
||||
|
||||
[connection signal="text_changed" from="ComplexEditor" to="." method="_on_complex_editor_text_changed"]
|
||||
[connection signal="toggled" from="ToggleComplex" to="." method="_on_toggle_complex_toggled"]
|
||||
74
Sprout/addons/dialogic/Editor/Events/Fields/FilePicker.gd
Normal file
74
Sprout/addons/dialogic/Editor/Events/Fields/FilePicker.gd
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
@tool
|
||||
extends Control
|
||||
|
||||
@export var file_filter := ""
|
||||
@export var placeholder := ""
|
||||
@export var file_mode : EditorFileDialog.FileMode = EditorFileDialog.FILE_MODE_OPEN_FILE
|
||||
@export var resource_icon:Texture = null:
|
||||
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 current_value : String
|
||||
var property_name : String
|
||||
signal value_changed
|
||||
|
||||
func _ready():
|
||||
DCSS.style(%Field, {
|
||||
'border-radius': 3,
|
||||
'border-color': get_theme_color("dark_color_3", "Editor"),
|
||||
'border': 1,
|
||||
'background': get_theme_color("dark_color_1", "Editor"),
|
||||
'padding': [5, 5],
|
||||
})
|
||||
$PanelContainer.add_theme_stylebox_override('panel', get_theme_stylebox("normal", "LineEdit"))
|
||||
%OpenButton.icon = get_theme_icon("Folder", "EditorIcons")
|
||||
%ClearButton.icon = get_theme_icon("Reload", "EditorIcons")
|
||||
%OpenButton.button_down.connect(_on_OpenButton_pressed)
|
||||
%ClearButton.button_up.connect(clear_path)
|
||||
%Field.set_drag_forwarding(self)
|
||||
%Field.placeholder_text = placeholder
|
||||
|
||||
func set_right_text(value:String):
|
||||
$RightText.text = str(value)
|
||||
$RightText.visible = !value.is_empty()
|
||||
|
||||
func set_left_text(value:String):
|
||||
$LeftText.text = str(value)
|
||||
$LeftText.visible = !value.is_empty()
|
||||
|
||||
func set_value(value):
|
||||
current_value = value
|
||||
if file_mode != EditorFileDialog.FILE_MODE_OPEN_DIR:
|
||||
%Field.text = value.get_file()
|
||||
tooltip_text = value
|
||||
%ClearButton.visible = !value.is_empty()
|
||||
else:
|
||||
%Field.text = value
|
||||
|
||||
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:
|
||||
emit_signal("value_changed", property_name, path)
|
||||
set_value(path)
|
||||
|
||||
func clear_path():
|
||||
emit_signal("value_changed", property_name, "")
|
||||
set_value("")
|
||||
|
||||
func _can_drop_data_fw(position, data, from_control):
|
||||
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(position, data, from_control):
|
||||
_on_file_dialog_selected(data.files[0])
|
||||
118
Sprout/addons/dialogic/Editor/Events/Fields/FilePicker.tscn
Normal file
118
Sprout/addons/dialogic/Editor/Events/Fields/FilePicker.tscn
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
[gd_scene load_steps=7 format=3 uid="uid://7mvxuaulctcq"]
|
||||
|
||||
[ext_resource type="Script" path="res://addons/dialogic/Editor/Events/Fields/FilePicker.gd" id="1_838yp"]
|
||||
[ext_resource type="Theme" uid="uid://d3g4i4dshtdpu" path="res://addons/dialogic/Editor/Events/styles/InputFieldsStyle.tres" id="2_514jv"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_oahfl"]
|
||||
content_margin_left = 4.0
|
||||
content_margin_top = 4.0
|
||||
content_margin_right = 4.0
|
||||
content_margin_bottom = 4.0
|
||||
bg_color = Color(0.1, 0.1, 0.1, 0.6)
|
||||
border_width_bottom = 2
|
||||
border_color = Color(0, 0, 0, 0.6)
|
||||
corner_radius_top_left = 3
|
||||
corner_radius_top_right = 3
|
||||
corner_radius_bottom_right = 3
|
||||
corner_radius_bottom_left = 3
|
||||
corner_detail = 5
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_qm060"]
|
||||
content_margin_left = 3.75
|
||||
content_margin_top = 3.75
|
||||
content_margin_right = 3.75
|
||||
content_margin_bottom = 3.75
|
||||
bg_color = Color(0, 0, 0, 1)
|
||||
border_color = Color(0, 0, 0, 1)
|
||||
corner_radius_top_left = 2
|
||||
corner_radius_top_right = 2
|
||||
corner_radius_bottom_right = 2
|
||||
corner_radius_bottom_left = 2
|
||||
|
||||
[sub_resource type="Image" id="Image_b3vou"]
|
||||
data = {
|
||||
"data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 0, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 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, 93, 93, 131, 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, 93, 93, 131, 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, 93, 93, 131, 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, 252, 255, 93, 93, 252, 255, 93, 93, 252, 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, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 255, 128, 128, 4, 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, 93, 93, 55, 255, 97, 97, 58, 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, 97, 97, 42, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 98, 98, 47, 255, 97, 97, 42, 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, 93, 93, 233, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 94, 94, 46, 255, 93, 93, 236, 255, 93, 93, 233, 255, 97, 97, 42, 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, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 255, 93, 93, 252, 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_bx3tb"]
|
||||
image = SubResource("Image_b3vou")
|
||||
|
||||
[node name="FilePicker" type="HBoxContainer"]
|
||||
offset_right = 340.0
|
||||
offset_bottom = 40.0
|
||||
script = ExtResource("1_838yp")
|
||||
|
||||
[node name="LeftText" type="Label" parent="."]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
offset_top = 8.0
|
||||
offset_right = 1.0
|
||||
offset_bottom = 31.0
|
||||
|
||||
[node name="PanelContainer" type="PanelContainer" parent="."]
|
||||
layout_mode = 2
|
||||
offset_right = 340.0
|
||||
offset_bottom = 40.0
|
||||
size_flags_horizontal = 3
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_oahfl")
|
||||
|
||||
[node name="HBox" type="HBoxContainer" parent="PanelContainer"]
|
||||
layout_mode = 2
|
||||
offset_left = 4.0
|
||||
offset_top = 4.0
|
||||
offset_right = 336.0
|
||||
offset_bottom = 36.0
|
||||
alignment = 2
|
||||
|
||||
[node name="Icon" type="TextureRect" parent="PanelContainer/HBox"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
offset_top = 16.0
|
||||
offset_bottom = 16.0
|
||||
size_flags_vertical = 4
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="Field" type="LineEdit" parent="PanelContainer/HBox"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
offset_left = 4.0
|
||||
offset_right = 276.0
|
||||
offset_bottom = 32.0
|
||||
size_flags_horizontal = 3
|
||||
mouse_filter = 1
|
||||
theme = ExtResource("2_514jv")
|
||||
theme_type_variation = &"LineEditWithIcon"
|
||||
theme_override_styles/normal = SubResource("StyleBoxFlat_qm060")
|
||||
theme_override_styles/focus = SubResource("StyleBoxFlat_qm060")
|
||||
theme_override_styles/read_only = SubResource("StyleBoxFlat_qm060")
|
||||
expand_to_text_length = true
|
||||
|
||||
[node name="OpenButton" type="Button" parent="PanelContainer/HBox"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
offset_left = 280.0
|
||||
offset_right = 304.0
|
||||
offset_bottom = 32.0
|
||||
icon = SubResource("ImageTexture_bx3tb")
|
||||
flat = true
|
||||
|
||||
[node name="ClearButton" type="Button" parent="PanelContainer/HBox"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
offset_left = 308.0
|
||||
offset_right = 332.0
|
||||
offset_bottom = 32.0
|
||||
icon = SubResource("ImageTexture_bx3tb")
|
||||
flat = true
|
||||
|
||||
[node name="RightText" type="Label" parent="."]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
offset_left = 339.0
|
||||
offset_top = 8.0
|
||||
offset_right = 340.0
|
||||
offset_bottom = 31.0
|
||||
13
Sprout/addons/dialogic/Editor/Events/Fields/Label.gd
Normal file
13
Sprout/addons/dialogic/Editor/Events/Fields/Label.gd
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
@tool
|
||||
extends Control
|
||||
|
||||
|
||||
@export var text: String = "Hello World"
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
$Label.text = text
|
||||
#$Label.text = DTS.translate(text)
|
||||
$Label.set('custom_colors/font_color', Color("#7b7b7b"))
|
||||
|
||||
18
Sprout/addons/dialogic/Editor/Events/Fields/Label.tscn
Normal file
18
Sprout/addons/dialogic/Editor/Events/Fields/Label.tscn
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/dialogic/Editor/Events/Fields/Label.gd" type="Script" id=1]
|
||||
|
||||
[node name="Control" type="CenterContainer"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
mouse_filter = 1
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
margin_left = 474.0
|
||||
margin_top = 293.0
|
||||
margin_right = 550.0
|
||||
margin_bottom = 307.0
|
||||
size_flags_horizontal = 3
|
||||
custom_colors/font_color = Color( 0.482353, 0.482353, 0.482353, 1 )
|
||||
text = "Hello World"
|
||||
48
Sprout/addons/dialogic/Editor/Events/Fields/MultilineText.gd
Normal file
48
Sprout/addons/dialogic/Editor/Events/Fields/MultilineText.gd
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
@tool
|
||||
extends Control
|
||||
|
||||
var property_name : String
|
||||
signal value_changed
|
||||
|
||||
func _ready():
|
||||
find_parent('TimelineArea').resized.connect(change_size)
|
||||
$TextEdit.text_changed.connect(text_changed)
|
||||
change_size()
|
||||
|
||||
func text_changed(value = ""):
|
||||
change_size()
|
||||
emit_signal("value_changed", property_name, $TextEdit.text)
|
||||
|
||||
func set_left_text(value):
|
||||
$LeftText.text = str(value)
|
||||
|
||||
func set_right_text(value):
|
||||
$RightText.text = str(value)
|
||||
|
||||
func set_value(value):
|
||||
$TextEdit.text = str(value)
|
||||
|
||||
|
||||
|
||||
func change_size():
|
||||
# the distance between the sidebar of the timeline editor and the TextEdit box.
|
||||
var max_width = find_parent('View').get_node('ScrollContainer').global_position.x- $TextEdit.global_position.x
|
||||
# adding a margin
|
||||
max_width -= 50 * DialogicUtil.get_editor_scale()
|
||||
|
||||
var font = get_theme_font("normal_font")
|
||||
var line_height = font.get_height()+4
|
||||
|
||||
var longest_line_len = 0
|
||||
var lines = 0
|
||||
for line in $TextEdit.text.split("\n"):
|
||||
longest_line_len = font.get_string_size(line).x if font.get_string_size(line).x > longest_line_len else longest_line_len
|
||||
if font.get_string_size(line).x+50 > max_width:
|
||||
lines += ceil(get_theme_font("normal_font").get_string_size(line).x/(max_width))
|
||||
lines += 1
|
||||
|
||||
# because there is a margin and a number inside the stylebox (especially to the left) this needs to be added
|
||||
longest_line_len += 50 * DialogicUtil.get_editor_scale()
|
||||
$TextEdit.custom_minimum_size.x = min(max_width, longest_line_len)
|
||||
# a margin has to be added vertically as well because of the stylebox
|
||||
$TextEdit.custom_minimum_size.y = line_height*lines + (20 * DialogicUtil.get_editor_scale())
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://dyp7m2nvab1aj"]
|
||||
|
||||
[ext_resource type="Script" path="res://addons/dialogic/Editor/Events/Fields/MultilineText.gd" id="1"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_bofjx"]
|
||||
content_margin_left = 16.0
|
||||
content_margin_top = 14.0
|
||||
bg_color = Color(0.09, 0.09, 0.09, 0.588235)
|
||||
corner_radius_top_right = 8
|
||||
corner_radius_bottom_right = 8
|
||||
|
||||
[node name="MultilineText" type="HBoxContainer"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
size_flags_horizontal = 3
|
||||
theme_override_constants/separation = 0
|
||||
script = ExtResource("1")
|
||||
|
||||
[node name="LeftText" type="Label" parent="."]
|
||||
visible = false
|
||||
offset_top = 288.0
|
||||
offset_right = 1.0
|
||||
offset_bottom = 311.0
|
||||
|
||||
[node name="TextEdit" type="TextEdit" parent="."]
|
||||
offset_right = 1024.0
|
||||
offset_bottom = 600.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
theme_override_styles/normal = SubResource("StyleBoxFlat_bofjx")
|
||||
|
||||
[node name="RightText" type="Label" parent="."]
|
||||
visible = false
|
||||
offset_left = 1023.0
|
||||
offset_top = 288.0
|
||||
offset_right = 1024.0
|
||||
offset_bottom = 311.0
|
||||
84
Sprout/addons/dialogic/Editor/Events/Fields/Number.gd
Normal file
84
Sprout/addons/dialogic/Editor/Events/Fields/Number.gd
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
@tool
|
||||
extends Control
|
||||
|
||||
var property_name : String
|
||||
@export var allow_string :bool = false
|
||||
@export var step:float = 0.1
|
||||
@export var enforce_step:bool = true
|
||||
@export var min:float = 0
|
||||
@export var max:float= 999
|
||||
@export var value = 0
|
||||
@export var suffix := ""
|
||||
signal value_changed
|
||||
|
||||
func _ready():
|
||||
if $Value.text.is_empty():
|
||||
set_value(value)
|
||||
$Spin.icon = get_theme_icon("updown", "SpinBox")
|
||||
$Value.add_theme_stylebox_override('normal', get_theme_stylebox('normal', 'LineEdit'))
|
||||
$Value.add_theme_stylebox_override('focus', get_theme_stylebox('focus', 'LineEdit'))
|
||||
|
||||
func set_right_text(value):
|
||||
$RightText.text = str(value)
|
||||
$RightText.visible = !value.is_empty()
|
||||
|
||||
func set_left_text(value):
|
||||
$LeftText.text = str(value)
|
||||
$LeftText.visible = !value.is_empty()
|
||||
|
||||
func set_value(new_value) -> void:
|
||||
if new_value:
|
||||
_on_value_text_submitted(str(new_value))
|
||||
else:
|
||||
_on_value_text_submitted(str(value))
|
||||
|
||||
func get_value():
|
||||
return value
|
||||
|
||||
func use_timestamp_mode():
|
||||
step = 0.1
|
||||
suffix = ' sec'
|
||||
max = 9999 #2.7 hours. Enough, or is more needed?
|
||||
|
||||
func use_float_mode():
|
||||
step = 0.1
|
||||
suffix = ""
|
||||
enforce_step = false
|
||||
|
||||
func use_int_mode():
|
||||
step = 1
|
||||
suffix = ""
|
||||
|
||||
func use_decibel_mode():
|
||||
max = 6
|
||||
suffix = "dB"
|
||||
min = -80
|
||||
|
||||
func set_max_value(value):
|
||||
max = value
|
||||
|
||||
func set_min_value(value):
|
||||
min = value
|
||||
|
||||
func _on_spin_gui_input(event):
|
||||
if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
|
||||
if event.position.y < size.y/2.0:
|
||||
_on_value_text_submitted(str(value+step))
|
||||
else:
|
||||
_on_value_text_submitted(str(value-step))
|
||||
|
||||
|
||||
func _on_value_text_submitted(new_text):
|
||||
new_text = new_text.trim_suffix(suffix)
|
||||
if new_text.is_valid_float():
|
||||
var temp:float = min(max(new_text.to_float(), min), max)
|
||||
if !enforce_step or temp/step == round(temp/step):
|
||||
value = temp
|
||||
elif allow_string:
|
||||
value = new_text
|
||||
$Value.text = str(value)+suffix
|
||||
value_changed.emit(property_name, value)
|
||||
|
||||
|
||||
func _on_value_focus_exited():
|
||||
_on_value_text_submitted($Value.text)
|
||||
66
Sprout/addons/dialogic/Editor/Events/Fields/Number.tscn
Normal file
66
Sprout/addons/dialogic/Editor/Events/Fields/Number.tscn
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://kdpp3mibml33"]
|
||||
|
||||
[ext_resource type="Script" path="res://addons/dialogic/Editor/Events/Fields/Number.gd" id="1"]
|
||||
[ext_resource type="Theme" uid="uid://d3g4i4dshtdpu" path="res://addons/dialogic/Editor/Events/styles/InputFieldsStyle.tres" id="2_u2kma"]
|
||||
|
||||
[sub_resource type="Image" id="Image_q6bmg"]
|
||||
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, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 76, 255, 255, 255, 75, 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, 99, 255, 255, 255, 191, 255, 255, 255, 191, 255, 255, 255, 99, 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, 4, 255, 255, 255, 122, 255, 255, 255, 191, 255, 255, 255, 188, 255, 255, 255, 188, 255, 255, 255, 191, 255, 255, 255, 121, 255, 255, 255, 4, 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, 12, 255, 255, 255, 142, 255, 255, 255, 191, 255, 255, 255, 181, 255, 255, 255, 53, 255, 255, 255, 54, 255, 255, 255, 181, 255, 255, 255, 191, 255, 255, 255, 142, 255, 255, 255, 12, 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, 71, 255, 255, 255, 191, 255, 255, 255, 171, 255, 255, 255, 36, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 36, 255, 255, 255, 171, 255, 255, 255, 191, 255, 255, 255, 71, 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, 86, 255, 255, 255, 22, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 22, 255, 255, 255, 86, 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, 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, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 86, 255, 255, 255, 22, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 22, 255, 255, 255, 86, 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, 71, 255, 255, 255, 191, 255, 255, 255, 171, 255, 255, 255, 36, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 36, 255, 255, 255, 171, 255, 255, 255, 191, 255, 255, 255, 71, 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, 12, 255, 255, 255, 142, 255, 255, 255, 191, 255, 255, 255, 181, 255, 255, 255, 54, 255, 255, 255, 54, 255, 255, 255, 182, 255, 255, 255, 191, 255, 255, 255, 142, 255, 255, 255, 12, 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, 4, 255, 255, 255, 121, 255, 255, 255, 191, 255, 255, 255, 188, 255, 255, 255, 188, 255, 255, 255, 191, 255, 255, 255, 121, 255, 255, 255, 4, 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, 98, 255, 255, 255, 191, 255, 255, 255, 191, 255, 255, 255, 98, 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, 75, 255, 255, 255, 75, 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, 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_cbs3g"]
|
||||
image = SubResource("Image_q6bmg")
|
||||
|
||||
[node name="NumberValue" type="HBoxContainer"]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_right = -1036.0
|
||||
offset_bottom = -615.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_constants/separation = 0
|
||||
script = ExtResource("1")
|
||||
min = 0.0
|
||||
max = 999.0
|
||||
|
||||
[node name="LeftText" type="Label" parent="."]
|
||||
layout_mode = 2
|
||||
offset_top = 5.0
|
||||
offset_right = 1.0
|
||||
offset_bottom = 28.0
|
||||
|
||||
[node name="Value" type="LineEdit" parent="."]
|
||||
layout_mode = 2
|
||||
offset_left = 1.0
|
||||
offset_right = 46.0
|
||||
offset_bottom = 33.0
|
||||
theme = ExtResource("2_u2kma")
|
||||
theme_override_constants/minimum_character_width = 0
|
||||
expand_to_text_length = true
|
||||
|
||||
[node name="Spin" type="Button" parent="."]
|
||||
layout_mode = 2
|
||||
offset_left = 46.0
|
||||
offset_top = 4.0
|
||||
offset_right = 70.0
|
||||
offset_bottom = 28.0
|
||||
size_flags_vertical = 4
|
||||
focus_mode = 0
|
||||
icon = SubResource("ImageTexture_cbs3g")
|
||||
flat = true
|
||||
|
||||
[node name="RightText" type="Label" parent="."]
|
||||
layout_mode = 2
|
||||
offset_left = 70.0
|
||||
offset_top = 5.0
|
||||
offset_right = 71.0
|
||||
offset_bottom = 28.0
|
||||
|
||||
[connection signal="focus_exited" from="Value" to="." method="_on_value_focus_exited"]
|
||||
[connection signal="text_submitted" from="Value" to="." method="_on_value_text_submitted"]
|
||||
[connection signal="gui_input" from="Spin" to="." method="_on_spin_gui_input"]
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
@tool
|
||||
extends Control
|
||||
|
||||
var property_name : String
|
||||
signal value_changed
|
||||
|
||||
var options : Array = []
|
||||
var disabled = false:
|
||||
get:
|
||||
return disabled
|
||||
set(_disabled):
|
||||
disabled = _disabled
|
||||
$MenuButton.disabled = disabled
|
||||
$MenuButton.focus_mode = FOCUS_NONE
|
||||
|
||||
func _ready():
|
||||
$MenuButton.add_theme_stylebox_override("normal", get_theme_stylebox("normal", "LineEdit"))
|
||||
$MenuButton.add_theme_stylebox_override("hover", get_theme_stylebox("normal", "LineEdit"))
|
||||
|
||||
$MenuButton.add_theme_stylebox_override("focus", get_theme_stylebox("focus", "LineEdit"))
|
||||
$MenuButton.add_theme_stylebox_override("disabled", get_theme_stylebox("normal", "LineEdit"))
|
||||
$MenuButton.add_theme_color_override("font_disabled_color", get_theme_color("font_color", "MenuButton"))
|
||||
$MenuButton.about_to_popup.connect(insert_options)
|
||||
$MenuButton.get_popup().index_pressed.connect(index_pressed)
|
||||
set_left_text('')
|
||||
set_right_text('')
|
||||
|
||||
func set_right_text(value:String):
|
||||
$RightText.text = str(value)
|
||||
$RightText.visible = !value.is_empty()
|
||||
|
||||
func set_left_text(value:String):
|
||||
$LeftText.text = str(value)
|
||||
$LeftText.visible = !value.is_empty()
|
||||
|
||||
func set_value(value):
|
||||
for option in options:
|
||||
if option['value'] == value:
|
||||
$MenuButton.text = option['label']
|
||||
$MenuButton.icon = option.get('icon', load("res://addons/dialogic/Editor/Images/Dropdown/default.svg"))
|
||||
|
||||
func get_value():
|
||||
return $MenuButton.text
|
||||
|
||||
func insert_options():
|
||||
$MenuButton.get_popup().clear()
|
||||
|
||||
var idx = 0
|
||||
for option in options:
|
||||
$MenuButton.get_popup().add_icon_item(option.get('icon',load("res://addons/dialogic/Editor/Images/Dropdown/default.svg")), option['label'])
|
||||
$MenuButton.get_popup().set_item_metadata(idx, option['value'])
|
||||
idx += 1
|
||||
|
||||
func index_pressed(idx):
|
||||
$MenuButton.text = $MenuButton.get_popup().get_item_text(idx)
|
||||
$MenuButton.icon = $MenuButton.get_popup().get_item_icon(idx)
|
||||
|
||||
emit_signal("value_changed", property_name, $MenuButton.get_popup().get_item_metadata(idx))
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://d3bhehatwoio"]
|
||||
|
||||
[ext_resource type="Script" path="res://addons/dialogic/Editor/Events/Fields/OptionSelector.gd" id="1"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_6mta0"]
|
||||
content_margin_left = 4.0
|
||||
content_margin_top = 4.0
|
||||
content_margin_right = 4.0
|
||||
content_margin_bottom = 4.0
|
||||
bg_color = Color(0.1, 0.1, 0.1, 0.6)
|
||||
border_width_bottom = 2
|
||||
border_color = Color(0, 0, 0, 0.6)
|
||||
corner_radius_top_left = 3
|
||||
corner_radius_top_right = 3
|
||||
corner_radius_bottom_right = 3
|
||||
corner_radius_bottom_left = 3
|
||||
corner_detail = 5
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_66k5i"]
|
||||
content_margin_left = 4.0
|
||||
content_margin_top = 4.0
|
||||
content_margin_right = 4.0
|
||||
content_margin_bottom = 4.0
|
||||
bg_color = Color(1, 1, 1, 0.75)
|
||||
draw_center = false
|
||||
border_width_left = 2
|
||||
border_width_top = 2
|
||||
border_width_right = 2
|
||||
border_width_bottom = 2
|
||||
corner_radius_top_left = 3
|
||||
corner_radius_top_right = 3
|
||||
corner_radius_bottom_right = 3
|
||||
corner_radius_bottom_left = 3
|
||||
corner_detail = 5
|
||||
expand_margin_left = 2.0
|
||||
expand_margin_top = 2.0
|
||||
expand_margin_right = 2.0
|
||||
expand_margin_bottom = 2.0
|
||||
|
||||
[node name="OptionSelector" type="HBoxContainer"]
|
||||
offset_right = 137.0
|
||||
offset_bottom = 43.0
|
||||
script = ExtResource("1")
|
||||
|
||||
[node name="LeftText" type="Label" parent="."]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
offset_top = 288.0
|
||||
offset_right = 1.0
|
||||
offset_bottom = 311.0
|
||||
|
||||
[node name="MenuButton" type="MenuButton" parent="."]
|
||||
layout_mode = 2
|
||||
offset_right = 137.0
|
||||
offset_bottom = 43.0
|
||||
focus_mode = 2
|
||||
theme_override_styles/normal = SubResource("StyleBoxFlat_6mta0")
|
||||
theme_override_styles/hover = SubResource("StyleBoxFlat_6mta0")
|
||||
theme_override_styles/disabled = SubResource("StyleBoxFlat_66k5i")
|
||||
theme_override_styles/focus = SubResource("StyleBoxFlat_66k5i")
|
||||
text = "Placeholder Text"
|
||||
flat = false
|
||||
|
||||
[node name="RightText" type="Label" parent="."]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
offset_left = 62.0
|
||||
offset_top = 288.0
|
||||
offset_right = 63.0
|
||||
offset_bottom = 311.0
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
@tool
|
||||
extends Control
|
||||
|
||||
var property_name : String
|
||||
var placeholder :String= "":
|
||||
set(value):
|
||||
placeholder = value
|
||||
$TextEdit.placeholder_text = placeholder
|
||||
|
||||
signal value_changed
|
||||
|
||||
func _ready():
|
||||
$TextEdit.text_changed.connect(text_changed)
|
||||
$TextEdit.add_theme_stylebox_override('normal', get_theme_stylebox('normal', 'LineEdit'))
|
||||
$TextEdit.add_theme_stylebox_override('focus', get_theme_stylebox('focus', 'LineEdit'))
|
||||
|
||||
func text_changed(value = ""):
|
||||
emit_signal("value_changed", property_name, $TextEdit.text)
|
||||
|
||||
func set_left_text(value):
|
||||
$LeftText.text = str(value)
|
||||
$LeftText.visible = !value.is_empty()
|
||||
|
||||
func set_right_text(value):
|
||||
$RightText.text = str(value)
|
||||
$RightText.visible = !value.is_empty()
|
||||
|
||||
func set_value(value):
|
||||
$TextEdit.text = str(value)
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://c0vkcehgjsjy"]
|
||||
|
||||
[ext_resource type="Script" path="res://addons/dialogic/Editor/Events/Fields/SinglelineText.gd" id="1"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_6mta0"]
|
||||
content_margin_left = 4.0
|
||||
content_margin_top = 4.0
|
||||
content_margin_right = 4.0
|
||||
content_margin_bottom = 4.0
|
||||
bg_color = Color(0.1, 0.1, 0.1, 0.6)
|
||||
border_width_bottom = 2
|
||||
border_color = Color(0, 0, 0, 0.6)
|
||||
corner_radius_top_left = 3
|
||||
corner_radius_top_right = 3
|
||||
corner_radius_bottom_right = 3
|
||||
corner_radius_bottom_left = 3
|
||||
corner_detail = 5
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_66k5i"]
|
||||
content_margin_left = 4.0
|
||||
content_margin_top = 4.0
|
||||
content_margin_right = 4.0
|
||||
content_margin_bottom = 4.0
|
||||
bg_color = Color(1, 1, 1, 0.75)
|
||||
draw_center = false
|
||||
border_width_left = 2
|
||||
border_width_top = 2
|
||||
border_width_right = 2
|
||||
border_width_bottom = 2
|
||||
corner_radius_top_left = 3
|
||||
corner_radius_top_right = 3
|
||||
corner_radius_bottom_right = 3
|
||||
corner_radius_bottom_left = 3
|
||||
corner_detail = 5
|
||||
expand_margin_left = 2.0
|
||||
expand_margin_top = 2.0
|
||||
expand_margin_right = 2.0
|
||||
expand_margin_bottom = 2.0
|
||||
|
||||
[node name="SinglelineText" type="HBoxContainer"]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_bottom = -567.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 0
|
||||
script = ExtResource("1")
|
||||
|
||||
[node name="LeftText" type="Label" parent="."]
|
||||
layout_mode = 2
|
||||
offset_top = 29.0
|
||||
offset_right = 1.0
|
||||
offset_bottom = 52.0
|
||||
|
||||
[node name="TextEdit" type="LineEdit" parent="."]
|
||||
layout_mode = 2
|
||||
offset_left = 5.0
|
||||
offset_right = 1147.0
|
||||
offset_bottom = 81.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
theme_override_styles/normal = SubResource("StyleBoxFlat_6mta0")
|
||||
theme_override_styles/focus = SubResource("StyleBoxFlat_66k5i")
|
||||
expand_to_text_length = true
|
||||
|
||||
[node name="RightText" type="Label" parent="."]
|
||||
layout_mode = 2
|
||||
offset_left = 1151.0
|
||||
offset_top = 29.0
|
||||
offset_right = 1152.0
|
||||
offset_bottom = 52.0
|
||||
24
Sprout/addons/dialogic/Editor/Events/Fields/Vector2.gd
Normal file
24
Sprout/addons/dialogic/Editor/Events/Fields/Vector2.gd
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
@tool
|
||||
extends Control
|
||||
|
||||
var property_name : String
|
||||
signal value_changed
|
||||
|
||||
func _ready():
|
||||
$X.value_changed.connect(_on_value_changed)
|
||||
$Y.value_changed.connect(_on_value_changed)
|
||||
|
||||
func _on_value_changed(property, value):
|
||||
emit_signal("value_changed", property_name, Vector2($X.value, $Y.value))
|
||||
|
||||
func set_right_text(value):
|
||||
$RightText.text = str(value)
|
||||
$RightText.visible = !value.is_empty()
|
||||
|
||||
func set_left_text(value):
|
||||
$LeftText.text = str(value)
|
||||
$LeftText.visible = !value.is_empty()
|
||||
|
||||
func set_value(value:Vector2):
|
||||
$X.set_value(value.x)
|
||||
$Y.set_value(value.y)
|
||||
53
Sprout/addons/dialogic/Editor/Events/Fields/Vector2.tscn
Normal file
53
Sprout/addons/dialogic/Editor/Events/Fields/Vector2.tscn
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://dtimnsj014cu"]
|
||||
|
||||
[ext_resource type="Script" path="res://addons/dialogic/Editor/Events/Fields/Vector2.gd" id="1_288li"]
|
||||
[ext_resource type="PackedScene" uid="uid://kdpp3mibml33" path="res://addons/dialogic/Editor/Events/Fields/Number.tscn" id="3_l3bum"]
|
||||
|
||||
[node name="Vector2" type="HBoxContainer"]
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
theme_override_constants/separation = -7
|
||||
script = ExtResource("1_288li")
|
||||
|
||||
[node name="LeftText" type="Label" parent="."]
|
||||
layout_mode = 2
|
||||
offset_top = 8.0
|
||||
offset_right = 1.0
|
||||
offset_bottom = 31.0
|
||||
|
||||
[node name="X" parent="." instance=ExtResource("3_l3bum")]
|
||||
layout_mode = 2
|
||||
anchors_preset = 0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
offset_left = -6.0
|
||||
offset_right = 42.0
|
||||
offset_bottom = 40.0
|
||||
grow_horizontal = 1
|
||||
grow_vertical = 1
|
||||
step = 1.0
|
||||
min = -9999.0
|
||||
max = 9999.0
|
||||
suffix = "x"
|
||||
|
||||
[node name="Y" parent="." instance=ExtResource("3_l3bum")]
|
||||
layout_mode = 2
|
||||
anchors_preset = 0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
offset_left = 35.0
|
||||
offset_right = 83.0
|
||||
offset_bottom = 40.0
|
||||
grow_horizontal = 1
|
||||
grow_vertical = 1
|
||||
step = 1.0
|
||||
min = -9999.0
|
||||
max = 9999.0
|
||||
suffix = "y"
|
||||
|
||||
[node name="RightText" type="Label" parent="."]
|
||||
layout_mode = 2
|
||||
offset_left = 76.0
|
||||
offset_top = 8.0
|
||||
offset_right = 77.0
|
||||
offset_bottom = 31.0
|
||||
Loading…
Add table
Add a link
Reference in a new issue