Add addons

This commit is contained in:
Joey Yakimowich-Payne 2023-01-03 16:53:53 -07:00
commit 3367bad24f
No known key found for this signature in database
GPG key ID: 6BFE655FA5ABD1E1
527 changed files with 36197 additions and 0 deletions

View file

@ -0,0 +1,52 @@
@tool
extends Control
var resource
var parent_node
var end_control :Control
### the indent size
var indent_size = 15
var current_indent_level = 1
func _ready():
$Icon.icon = get_theme_icon("GuiSpinboxUpdown", "EditorIcons")
parent_node_changed()
$Spacer.custom_minimum_size.x = 100*DialogicUtil.get_editor_scale()
func visual_select():
modulate = get_theme_color("warning_color", "Editor")
func visual_deselect():
modulate = Color(1,1,1,1)
func highlight():
modulate = parent_node.resource.event_color.lightened(0.5)
func unhighlight():
modulate = Color(1,1,1,1)
func set_indent(indent: int):
var indent_node = $Indent
indent_node.custom_minimum_size = Vector2(indent_size * indent, 0)
indent_node.visible = indent != 0
current_indent_level = indent
queue_redraw()
func parent_node_changed():
if parent_node:
if end_control and end_control.has_method('refresh'):
end_control.refresh()
func add_end_control(control:Control):
add_child(control)
if "parent_resource" in control:
control.parent_resource = parent_node.resource
if control.has_method('refresh'):
control.refresh()
end_control = control

View file

@ -0,0 +1,42 @@
[gd_scene load_steps=4 format=3 uid="uid://de13fdeebrkcb"]
[ext_resource type="Script" path="res://addons/dialogic/Editor/Events/BranchEnd.gd" id="1"]
[sub_resource type="Image" id="Image_cje5s"]
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_sojvl"]
image = SubResource("Image_cje5s")
[node name="EndBranch" type="HBoxContainer"]
anchor_right = 1.0
offset_bottom = 48.0
mouse_filter = 0
script = ExtResource("1")
[node name="Indent" type="Control" parent="."]
offset_bottom = 48.0
[node name="Spacer" type="Control" parent="."]
custom_minimum_size = Vector2(300, 0)
offset_left = 4.0
offset_right = 304.0
offset_bottom = 48.0
[node name="Icon" type="Button" parent="."]
unique_name_in_owner = true
custom_minimum_size = Vector2(31, 0)
offset_left = 308.0
offset_top = 12.0
offset_right = 339.0
offset_bottom = 36.0
size_flags_vertical = 4
mouse_filter = 1
icon = SubResource("ImageTexture_sojvl")
flat = true

View file

@ -0,0 +1,408 @@
@tool
extends HBoxContainer
signal option_action(action_name)
signal content_changed()
# Resource
var resource : DialogicEvent
### internal node eferences
@onready var selected_style = %SelectedStyle
@onready var warning = %Warning
@onready var title_label = %TitleLabel
@onready var icon_texture = %IconTexture
@onready var header_content_container = %HeaderContent
@onready var body_container = %Body
@onready var body_content_container = %BodyContent
@onready var indent_node = %Indent
# is the body visible
var expanded = true
# does the body have elements?
var has_body_content = false
# for choice and condition
var end_node:Node = null:
get:
return end_node
set(node):
end_node = node
%CollapseButton.visible = true if end_node else false
var collapsed = false
### extarnal node references
var editor_reference
### the indent size
var indent_size = 15
var current_indent_level = 1
# Setting this to true will ignore the event while saving
# Useful for making placeholder events in drag and drop
var ignore_save = false
## *****************************************************************************
## PUBLIC METHODS
## *****************************************************************************
func visual_select():
selected_style.show()
func visual_deselect():
selected_style.hide()
func is_selected() -> bool:
return selected_style.visible
# called by the timeline before adding it to the tree
func load_data(data):
resource = data
func set_warning(text):
warning.show()
warning.tooltip_text = text
func remove_warning(text = ''):
if warning.tooltip_text == text or text == '':
warning.hide()
func set_indent(indent: int):
indent_node.custom_minimum_size = Vector2(indent_size * indent, 0)
indent_node.visible = indent != 0
current_indent_level = indent
queue_redraw()
## *****************************************************************************
## PRIVATE METHODS
## *****************************************************************************
func _set_event_icon(icon: Texture):
icon_texture.texture = icon
var _scale = DialogicUtil.get_editor_scale()
var cpanel = %IconPanelCenterC
var ip = %IconPanel
var ipc = icon_texture
# Resizing the icon acording to the scale
var icon_size = 32
cpanel.custom_minimum_size = Vector2(icon_size, icon_size) * _scale
ip.custom_minimum_size = cpanel.custom_minimum_size
ipc.custom_minimum_size = ip.custom_minimum_size
# Updating the theme properties to scale
var custom_style = ip.get_theme_stylebox('panel')
custom_style.corner_radius_top_left = 5 * _scale
custom_style.corner_radius_top_right = 5 * _scale
custom_style.corner_radius_bottom_left = 5 * _scale
custom_style.corner_radius_bottom_right = 5 * _scale
# Separation on the header
%Header.add_theme_constant_override("custom_constants/separation", 5 * _scale)
%BodySpacing.custom_minimum_size.x = title_label.position.x
func _on_OptionsControl_action(index):
if index == 0:
if not resource.help_page_path.is_empty():
OS.shell_open(resource.help_page_path)
elif index == 2:
emit_signal("option_action", "up")
elif index == 3:
emit_signal("option_action", "down")
elif index == 5:
emit_signal("option_action", "remove")
func _on_Indent_visibility_changed():
if not indent_node:
return
if resource:
if resource.needs_indentation:
if indent_node.visible:
remove_warning("This event needs a question event around it!")
else:
set_warning("This event needs a question event around it!")
func _request_selection():
# TODO doesn't work. I'm sure - JS
var timeline_editor = editor_reference.get_node_or_null('MainPanel/TimelineEditor')
if (timeline_editor != null):
# @todo select item and clear selection is marked as "private" in TimelineEditor.gd
# consider to make it "public" or add a public helper function
timeline_editor.select_item(self)
# called to inform event parts, that a focus is wanted
func focus():
pass
func toggle_collapse(toggled):
collapsed = toggled
$PanelContainer/MarginContainer/VBoxContainer/CollapsedBody.visible = toggled
var timeline_editor = find_parent('TimelineVisualEditor')
if (timeline_editor != null):
# @todo select item and clear selection is marked as "private" in TimelineEditor.gd
# consider to make it "public" or add a public helper function
timeline_editor.indent_events()
func build_editor():
var p_list = resource._get_property_list()
var edit_conditions_list = []
var current_body_container = HFlowContainer.new()
%BodyContent.add_child(current_body_container)
for p in p_list:
### --------------------------------------------------------------------
### 1. CREATE A NODE OF THE CORRECT TYPE FOR THE PROPERTY
var editor_node
### OTHER
if p.name == "linebreak":
current_body_container = HFlowContainer.new()
%BodyContent.add_child(current_body_container)
continue
### STRINGS
elif p.dialogic_type == resource.ValueType.MultilineText:
editor_node = load("res://addons/dialogic/Editor/Events/Fields/MultilineText.tscn").instantiate()
elif p.dialogic_type == resource.ValueType.SinglelineText:
editor_node = load("res://addons/dialogic/Editor/Events/Fields/SinglelineText.tscn").instantiate()
editor_node.placeholder = p.display_info.get('placeholder', '')
elif p.dialogic_type == resource.ValueType.Bool:
editor_node = load("res://addons/dialogic/Editor/Events/Fields/Bool.tscn").instantiate()
elif p.dialogic_type == resource.ValueType.File:
editor_node = load("res://addons/dialogic/Editor/Events/Fields/FilePicker.tscn").instantiate()
editor_node.file_filter = p.display_info.get('file_filter', '')
editor_node.placeholder = p.display_info.get('placeholder', '')
editor_node.resource_icon = p.display_info.get('icon', null)
if editor_node.resource_icon == null and p.display_info.has('editor_icon'):
editor_node.resource_icon = callv('get_theme_icon', p.display_info.editor_icon)
elif p.dialogic_type == resource.ValueType.Condition:
editor_node = load("res://addons/dialogic/Editor/Events/Fields/ConditionPicker.tscn").instantiate()
## Complex Picker
elif p.dialogic_type == resource.ValueType.ComplexPicker:
editor_node = load("res://addons/dialogic/Editor/Events/Fields/ComplexPicker.tscn").instantiate()
editor_node.file_extension = p.display_info.get('file_extension', '')
editor_node.get_suggestions_func = p.display_info.get('suggestions_func', editor_node.get_suggestions_func)
editor_node.empty_text = p.display_info.get('empty_text', '')
editor_node.placeholder_text = p.display_info.get('placeholder', 'Select Resource')
editor_node.resource_icon = p.display_info.get('icon', null)
editor_node.enable_pretty_name = p.display_info.get('enable_pretty_name', false)
if editor_node.resource_icon == null and p.display_info.has('editor_icon'):
editor_node.resource_icon = callv('get_theme_icon', p.display_info.editor_icon)
## INTEGERS
elif p.dialogic_type == resource.ValueType.Integer:
editor_node = load("res://addons/dialogic/Editor/Events/Fields/Number.tscn").instantiate()
editor_node.use_int_mode()
editor_node.max = p.display_info.get('max', 9999)
editor_node.min = p.display_info.get('min', -9999)
elif p.dialogic_type == resource.ValueType.Float:
editor_node = load("res://addons/dialogic/Editor/Events/Fields/Number.tscn").instantiate()
editor_node.use_float_mode()
editor_node.max = p.display_info.get('max', 9999)
editor_node.min = p.display_info.get('min', 0)
elif p.dialogic_type == resource.ValueType.Decibel:
editor_node = load("res://addons/dialogic/Editor/Events/Fields/Number.tscn").instantiate()
editor_node.use_decibel_mode()
elif p.dialogic_type == resource.ValueType.FixedOptionSelector:
editor_node = load("res://addons/dialogic/Editor/Events/Fields/OptionSelector.tscn").instantiate()
if p.display_info.has('selector_options'):
editor_node.options = p.display_info.selector_options
if p.display_info.has('disabled'):
editor_node.disabled = p.display_info.disabled
elif p.dialogic_type == resource.ValueType.Vector2:
editor_node = load("res://addons/dialogic/Editor/Events/Fields/Vector2.tscn").instantiate()
elif p.dialogic_type == resource.ValueType.StringArray:
editor_node = load("res://addons/dialogic/Editor/Events/Fields/Array.tscn").instantiate()
elif p.dialogic_type == resource.ValueType.Label:
editor_node = Label.new()
editor_node.text = p.display_info.text
editor_node.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
elif p.dialogic_type == resource.ValueType.Button:
editor_node = Button.new()
editor_node.text = p.display_info.text
if typeof(p.display_info.icon) == TYPE_ARRAY:
editor_node.icon = callv('get_theme_icon', p.display_info.icon)
else:
editor_node.icon = p.display_info.icon
editor_node.flat = true
editor_node.custom_minimum_size.x = 30*DialogicUtil.get_editor_scale()
editor_node.tooltip_text = p.display_info.tooltip
editor_node.pressed.connect(p.display_info.callable)
## CUSTOM
elif p.dialogic_type == resource.ValueType.Custom:
if p.display_info.has('path'):
editor_node = load(p.display_info.path).instantiate()
## ELSE
else:
editor_node = Label.new()
editor_node.text = p.name
### --------------------------------------------------------------------
### 2. ADD IT TO THE RIGHT PLACE (HEADER/BODY)
var location = %HeaderContent
if p.location == 1:
location = current_body_container
location.add_child(editor_node)
### --------------------------------------------------------------------
### 3. FILL THE NEW NODE WITH INFORMATION AND LISTEN TO CHANGES
if "event_resource" in editor_node:
editor_node.event_resource = resource
if 'property_name' in editor_node:
editor_node.property_name = p.name
if editor_node.has_method('set_value'):
if resource.get(p.name) != null: # Got an error here saying that "Cannot convert argument 1 from Nil to bool." so I'm adding this check
editor_node.set_value(resource.get(p.name))
if editor_node.has_signal('value_changed'):
editor_node.value_changed.connect(set_property)
if editor_node.has_method('set_left_text'):
editor_node.set_left_text(p.get('left_text', ''))
if editor_node.has_method('set_right_text'):
editor_node.set_right_text(p.get('right_text', ''))
if p.has('condition'):
edit_conditions_list.append([editor_node, p.condition])
has_body_content = true
if current_body_container.get_child_count() == 0:
has_body_content = false
expanded = false
body_container.visible = false
content_changed.connect(recalculate_edit_visibility.bind(edit_conditions_list))
recalculate_edit_visibility(edit_conditions_list)
func recalculate_edit_visibility(list):
for node_con in list:
if node_con[1].is_empty():
node_con[0].show()
else:
var expr = Expression.new()
expr.parse(node_con[1])
if expr.execute([], resource):
node_con[0].show()
else:
node_con[0].hide()
if expr.has_execute_failed():
var name = "unnamed" if "property_name" not in node_con[0] else node_con[0].property_name
printerr("(recalculate_edit_visibility) condition expression failed with error: " + expr.get_error_text())
%ExpandButton.visible = false
if body_content_container != null:
for node in body_content_container.get_children():
for sub_node in node.get_children():
if sub_node.visible:
%ExpandButton.visible = true
break
func set_property(property_name, value):
resource.set(property_name, value)
emit_signal('content_changed')
if end_node:
end_node.parent_node_changed()
func _update_color():
if resource.dialogic_color_name != '':
%IconPanel.self_modulate = DialogicUtil.get_color(resource.dialogic_color_name)
## *****************************************************************************
## OVERRIDES
## *****************************************************************************
func _ready():
## DO SOME STYLING
var _scale = DialogicUtil.get_editor_scale()
selected_style.modulate = get_theme_color("accent_color", "Editor")
warning.texture = get_theme_icon("NodeWarning", "EditorIcons")
warning.size = Vector2(16 * _scale, 16 * _scale)
title_label.add_theme_color_override("font_color", Color(1,1,1,1))
if not get_theme_constant("dark_theme", "Editor"):
title_label.add_theme_color_override("font_color", get_theme_color("font_color", "Editor"))
indent_size = indent_size * DialogicUtil.get_editor_scale()
%ExpandButton.icon = get_theme_icon("Tools", "EditorIcons")
if resource:
if resource.event_name:
#title_label.text = DTS.translate(resource.event_name)
title_label.text = resource.event_name
if resource._get_icon() != null:
_set_event_icon(resource._get_icon())
%IconPanel.self_modulate = resource.event_color
_on_ExpandButton_toggled(resource.expand_by_default)
# Only create this if it can collapse children events
if resource.can_contain_events:
var cb:HBoxContainer = HBoxContainer.new()
cb.name = 'CollapsedBody'
cb.visible = false
var cb_label:Label = Label.new()
cb_label.text = 'Contains Events (currently hidden)'
cb_label.size_flags_horizontal = 3
cb_label.horizontal_alignment = 1
cb.add_child(cb_label)
$PanelContainer/MarginContainer/VBoxContainer.add_child(cb)
set_focus_mode(1) # Allowing this node to grab focus
# signals
# TODO godot4 react to changes of the colors, the signal was removed
#ProjectSettings.project_settings_changed.connect(_update_color)
$PopupMenu.index_pressed.connect(_on_OptionsControl_action)
_on_Indent_visibility_changed()
%CollapseButton.toggled.connect(toggle_collapse)
%CollapseButton.icon = get_theme_icon("Collapse", "EditorIcons")
%CollapseButton.hide()
func _on_ExpandButton_toggled(button_pressed):
%ExpandButton.set_pressed_no_signal(button_pressed)
expanded = button_pressed
body_container.visible = button_pressed
get_parent().get_parent().queue_redraw()
func _on_EventNode_gui_input(event):
if event is InputEventMouseButton and event.is_pressed() and event.button_index == 1:
grab_focus() # Grab focus to avoid copy pasting text or events
if event.double_click:
if has_body_content:
_on_ExpandButton_toggled(!expanded)
# For opening the context menu
if event is InputEventMouseButton:
if event.button_index == MOUSE_BUTTON_RIGHT and event.pressed:
$PopupMenu.popup_on_parent(Rect2(get_global_mouse_position(),Vector2()))
if resource.help_page_path == "":
$PopupMenu.set_item_disabled(0, true)
else:
$PopupMenu.set_item_disabled(0, false)

View file

@ -0,0 +1,220 @@
[gd_scene load_steps=11 format=3 uid="uid://cx7w87y4t866f"]
[ext_resource type="Script" path="res://addons/dialogic/Editor/Events/EventNode/EventNode.gd" id="1"]
[ext_resource type="StyleBox" uid="uid://obyrr26pqk2p" path="res://addons/dialogic/Editor/Events/styles/selected_styleboxflat.tres" id="2_vj6hl"]
[ext_resource type="StyleBox" uid="uid://c8k6tbipodsg" path="res://addons/dialogic/Editor/Events/styles/ResourceMenuPanelBackground.tres" id="5_wntx6"]
[ext_resource type="Texture2D" uid="uid://b0jgbs777wfgw" path="res://addons/dialogic/Editor/Images/plugin-icon.svg" id="6"]
[ext_resource type="Script" path="res://addons/dialogic/Editor/Events/EventNode/PopupMenu.gd" id="8"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_otutu"]
bg_color = Color(1, 1, 1, 1)
corner_radius_top_left = 3
corner_radius_top_right = 3
corner_radius_bottom_right = 3
corner_radius_bottom_left = 3
[sub_resource type="Image" id="Image_jdnqf"]
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_4d04d"]
image = SubResource("Image_jdnqf")
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_lj5gu"]
[sub_resource type="Theme" id="Theme_g6f7f"]
PopupMenu/colors/font_color_hover = Color(0, 0, 0, 1)
PopupMenu/styles/hover = SubResource("StyleBoxEmpty_lj5gu")
PopupMenu/styles/panel = ExtResource("5_wntx6")
[node name="EventNode" type="HBoxContainer"]
anchors_preset = 10
anchor_right = 1.0
grow_horizontal = 2
size_flags_horizontal = 3
size_flags_vertical = 9
focus_mode = 1
script = ExtResource("1")
[node name="Indent" type="Control" parent="."]
unique_name_in_owner = true
visible = false
layout_mode = 2
anchors_preset = 0
[node name="PanelContainer" type="PanelContainer" parent="."]
layout_mode = 2
offset_right = 1152.0
offset_bottom = 28.0
size_flags_horizontal = 3
size_flags_vertical = 3
mouse_filter = 2
[node name="SelectedStyle" type="Panel" parent="PanelContainer"]
unique_name_in_owner = true
visible = false
modulate = Color(0, 0, 0, 1)
layout_mode = 2
offset_right = 1024.0
offset_bottom = 28.0
theme_override_styles/panel = ExtResource("2_vj6hl")
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer"]
layout_mode = 2
offset_right = 1152.0
offset_bottom = 28.0
size_flags_vertical = 3
theme_override_constants/margin_left = 7
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/MarginContainer"]
layout_mode = 2
offset_left = 7.0
offset_right = 1152.0
offset_bottom = 28.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="Header" type="HBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
offset_right = 1145.0
offset_bottom = 24.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="IconPanelCenterC" type="CenterContainer" parent="PanelContainer/MarginContainer/VBoxContainer/Header"]
unique_name_in_owner = true
layout_mode = 2
offset_bottom = 24.0
[node name="IconPanel" type="Panel" parent="PanelContainer/MarginContainer/VBoxContainer/Header/IconPanelCenterC"]
unique_name_in_owner = true
layout_mode = 2
offset_top = 12.0
offset_bottom = 12.0
mouse_filter = 1
mouse_default_cursor_shape = 6
theme_override_styles/panel = SubResource("StyleBoxFlat_otutu")
[node name="IconTexture" type="TextureRect" parent="PanelContainer/MarginContainer/VBoxContainer/Header/IconPanelCenterC/IconPanel"]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 0
grow_vertical = 2
size_flags_horizontal = 3
size_flags_vertical = 3
texture = ExtResource("6")
ignore_texture_size = true
stretch_mode = 5
[node name="Warning" type="TextureRect" parent="PanelContainer/MarginContainer/VBoxContainer/Header/IconPanelCenterC/IconPanel"]
unique_name_in_owner = true
visible = false
layout_mode = 0
offset_right = 16.0
offset_bottom = 16.0
texture = SubResource("ImageTexture_4d04d")
stretch_mode = 5
[node name="TitleLabel" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer/Header"]
unique_name_in_owner = true
layout_mode = 2
offset_left = 4.0
offset_right = 5.0
offset_bottom = 23.0
theme_override_colors/font_color = Color(0, 0, 0, 1)
vertical_alignment = 1
[node name="HeaderContent" type="HBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer/Header"]
unique_name_in_owner = true
layout_mode = 2
offset_left = 9.0
offset_right = 561.0
offset_bottom = 24.0
size_flags_horizontal = 3
[node name="Spacer" type="Control" parent="PanelContainer/MarginContainer/VBoxContainer/Header"]
layout_mode = 2
anchors_preset = 0
offset_left = 565.0
offset_right = 1117.0
offset_bottom = 24.0
size_flags_horizontal = 3
mouse_filter = 2
[node name="ExpandButton" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer/Header"]
unique_name_in_owner = true
layout_mode = 2
offset_left = 1121.0
offset_right = 1145.0
offset_bottom = 24.0
toggle_mode = true
icon = SubResource("ImageTexture_4d04d")
flat = true
[node name="CollapseButton" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer/Header"]
unique_name_in_owner = true
visible = false
layout_mode = 2
toggle_mode = true
icon = SubResource("ImageTexture_4d04d")
flat = true
[node name="Body" type="HBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
offset_top = 28.0
offset_right = 1145.0
offset_bottom = 28.0
size_flags_horizontal = 3
[node name="BodySpacing" type="Control" parent="PanelContainer/MarginContainer/VBoxContainer/Body"]
unique_name_in_owner = true
custom_minimum_size = Vector2(10, 0)
layout_mode = 2
anchors_preset = 0
offset_right = 10.0
[node name="BodyContent" type="VBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer/Body"]
unique_name_in_owner = true
layout_mode = 2
offset_left = 14.0
offset_right = 1145.0
size_flags_horizontal = 3
size_flags_vertical = 3
mouse_filter = 2
[node name="PopupMenu" type="PopupMenu" parent="."]
theme = SubResource("Theme_g6f7f")
item_count = 6
item_0/text = "Documentation"
item_0/icon = SubResource("ImageTexture_4d04d")
item_0/id = 0
item_1/text = ""
item_1/id = -1
item_1/separator = true
item_2/text = "Move up"
item_2/icon = SubResource("ImageTexture_4d04d")
item_2/id = 2
item_3/text = "Move down"
item_3/icon = SubResource("ImageTexture_4d04d")
item_3/id = 3
item_4/text = ""
item_4/id = -1
item_4/separator = true
item_5/text = "Delete"
item_5/icon = SubResource("ImageTexture_4d04d")
item_5/id = 5
script = ExtResource("8")
[connection signal="gui_input" from="." to="." method="_on_EventNode_gui_input"]
[connection signal="visibility_changed" from="Indent" to="." method="_on_Indent_visibility_changed"]
[connection signal="toggled" from="PanelContainer/MarginContainer/VBoxContainer/Header/ExpandButton" to="." method="_on_ExpandButton_toggled"]

View file

@ -0,0 +1,17 @@
@tool
extends PopupMenu
func _ready():
clear()
add_icon_item(get_theme_icon("Help", "EditorIcons"), "Documentation")
add_separator()
add_icon_item(get_theme_icon("ArrowUp", "EditorIcons"), "Move up")
add_icon_item(get_theme_icon("ArrowDown", "EditorIcons"), "Move down")
add_separator()
add_icon_item(get_theme_icon("Remove", "EditorIcons"), "Delete")
var menu_background = load("res://addons/dialogic/Editor/Events/styles/ResourceMenuPanelBackground.tres")
menu_background.bg_color = get_parent().get_theme_color("base_color", "Editor")
theme.set_stylebox('panel', 'PopupMenu', menu_background)
theme.set_stylebox('hover', 'PopupMenu', StyleBoxEmpty.new())
theme.set_color('font_color_hover', 'PopupMenu', get_parent().get_theme_color("accent_color", "Editor"))

View 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()

View 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"]

View 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

View 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"]

View 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)

View 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

View 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()

View 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"]

View 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

View 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"]

View 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])

View 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

View 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"))

View 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"

View 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())

View file

@ -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

View 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)

View 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"]

View file

@ -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))

View file

@ -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

View file

@ -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)

View file

@ -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

View 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)

View 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

View file

@ -0,0 +1,50 @@
[gd_resource type="Theme" load_steps=3 format=3 uid="uid://d3g4i4dshtdpu"]
[sub_resource type="StyleBoxFlat" id="1"]
content_margin_left = 30.0
content_margin_top = 5.0
content_margin_right = 20.0
content_margin_bottom = 5.0
bg_color = Color(0.12549, 0.141176, 0.192157, 1)
border_width_left = 1
border_width_top = 1
border_width_right = 1
border_width_bottom = 1
border_color = Color(0.0980392, 0.113725, 0.152941, 1)
corner_radius_top_left = 3
corner_radius_top_right = 3
corner_radius_bottom_right = 3
corner_radius_bottom_left = 3
[sub_resource type="StyleBoxFlat" id="2"]
content_margin_left = 11.0
content_margin_top = 5.0
content_margin_right = 20.0
content_margin_bottom = 5.0
bg_color = Color(0.12549, 0.141176, 0.192157, 1)
border_width_left = 1
border_width_top = 1
border_width_right = 1
border_width_bottom = 1
border_color = Color(0.0980392, 0.113725, 0.152941, 1)
corner_radius_top_left = 3
corner_radius_top_right = 3
corner_radius_bottom_right = 3
corner_radius_bottom_left = 3
[resource]
LineEdit/colors/clear_button_color = Color(0, 0, 0, 1)
LineEdit/colors/clear_button_color_pressed = Color(0, 0, 0, 1)
LineEdit/colors/cursor_color = Color(1, 1, 1, 1)
LineEdit/colors/font_color = Color(1, 1, 1, 1)
LineEdit/colors/font_color_selected = Color(1, 1, 1, 1)
LineEdit/colors/font_color_uneditable = Color(1, 1, 1, 1)
LineEdit/colors/selection_color = Color(1, 1, 1, 0.235294)
LineEdit/constants/minimum_spaces = 10
LineEdit/fonts/font = null
LineEdit/icons/clear = null
LineEdit/styles/focus = SubResource("1")
LineEdit/styles/normal = SubResource("2")
LineEdit/styles/read_only = SubResource("1")
LineEditWithIcon/base_type = &"LineEdit"
LineEditWithIcon/styles/normal = SubResource("1")

View file

@ -0,0 +1,11 @@
[gd_resource type="StyleBoxFlat" format=2]
[resource]
content_margin_left = 25.0
content_margin_right = 10.0
content_margin_top = 4.0
content_margin_bottom = 4.0
bg_color = Color( 0.466667, 0.466667, 0.466667, 0.141176 )
border_width_bottom = 2
corner_radius_top_left = 4
corner_radius_top_right = 4

View file

@ -0,0 +1,13 @@
[gd_resource type="StyleBoxFlat" format=2]
[resource]
content_margin_left = 25.0
content_margin_right = 10.0
content_margin_top = 4.0
content_margin_bottom = 4.0
bg_color = Color( 0.180392, 0.180392, 0.180392, 0.219608 )
draw_center = false
border_width_bottom = 2
border_color = Color( 0.8, 0.8, 0.8, 0.286275 )
corner_radius_top_left = 4
corner_radius_top_right = 4

View file

@ -0,0 +1,17 @@
[gd_resource type="StyleBoxFlat" format=3 uid="uid://c8k6tbipodsg"]
[resource]
content_margin_left = 10.0
content_margin_top = 10.0
content_margin_right = 10.0
content_margin_bottom = 10.0
bg_color = Color(0, 0, 0, 1)
border_width_left = 1
border_width_top = 1
border_width_right = 1
border_width_bottom = 1
border_color = Color(0.8, 0.8, 0.8, 0.109804)
corner_radius_top_left = 4
corner_radius_top_right = 4
corner_radius_bottom_right = 4
corner_radius_bottom_left = 4

View file

@ -0,0 +1,17 @@
[gd_resource type="StyleBoxFlat" format=2]
[resource]
content_margin_left = 6.0
content_margin_right = 6.0
content_margin_top = 5.0
content_margin_bottom = 4.0
bg_color = Color( 0.6, 0.6, 0.6, 0 )
border_width_left = 1
border_width_top = 1
border_width_right = 1
border_width_bottom = 1
border_color = Color( 0.2, 0.227451, 0.309804, 1 )
corner_radius_top_left = 3
corner_radius_top_right = 3
corner_radius_bottom_right = 3
corner_radius_bottom_left = 3

View file

@ -0,0 +1,18 @@
[gd_resource type="StyleBoxFlat" format=2]
[resource]
content_margin_left = 30.0
content_margin_right = 25.0
content_margin_top = 5.0
content_margin_bottom = 5.0
bg_color = Color( 0.12549, 0.141176, 0.192157, 1 )
border_width_left = 1
border_width_top = 1
border_width_right = 1
border_width_bottom = 1
border_color = Color( 0.0980392, 0.113725, 0.152941, 1 )
border_blend = true
corner_radius_top_left = 3
corner_radius_top_right = 3
corner_radius_bottom_right = 3
corner_radius_bottom_left = 3

View file

@ -0,0 +1,17 @@
[gd_resource type="StyleBoxFlat" format=2]
[resource]
content_margin_left = 3.0
content_margin_right = 3.0
content_margin_top = 3.0
content_margin_bottom = 3.0
bg_color = Color( 0.2, 0.231373, 0.309804, 0.317647 )
border_width_left = 1
border_width_top = 1
border_width_right = 1
border_width_bottom = 1
border_color = Color( 0.8, 0.8, 0.8, 0.109804 )
corner_radius_top_left = 4
corner_radius_top_right = 4
corner_radius_bottom_right = 4
corner_radius_bottom_left = 4

View file

@ -0,0 +1,17 @@
[gd_resource type="StyleBoxFlat" format=2]
[resource]
content_margin_left = 3.0
content_margin_right = 3.0
content_margin_top = 3.0
content_margin_bottom = 3.0
bg_color = Color( 0.2, 0.231373, 0.309804, 0.235294 )
border_width_left = 1
border_width_top = 1
border_width_right = 1
border_width_bottom = 1
border_color = Color( 0.8, 0.8, 0.8, 0.109804 )
corner_radius_top_left = 4
corner_radius_top_right = 4
corner_radius_bottom_right = 4
corner_radius_bottom_left = 4

View file

@ -0,0 +1,15 @@
[gd_resource type="StyleBoxFlat" format=2]
[resource]
content_margin_left = 16.0
content_margin_top = 14.0
bg_color = Color( 0.27451, 0.27451, 0.27451, 1 )
border_width_left = 1
border_width_top = 1
border_width_right = 1
border_width_bottom = 1
border_color = Color( 0.454902, 0.454902, 0.454902, 1 )
corner_radius_top_left = 8
corner_radius_top_right = 8
corner_radius_bottom_right = 8
corner_radius_bottom_left = 8

View file

@ -0,0 +1,14 @@
[gd_resource type="StyleBoxFlat" format=3 uid="uid://obyrr26pqk2p"]
[resource]
content_margin_left = 16.0
content_margin_top = 6.0
content_margin_right = 6.0
content_margin_bottom = 0.0
bg_color = Color(0.509804, 0.509804, 0.509804, 0.207843)
border_width_left = 5
border_color = Color(1, 1, 1, 1)
corner_radius_top_left = 5
corner_radius_bottom_left = 5
expand_margin_top = 2.0
expand_margin_bottom = 2.0