Skip to content

Commit

Permalink
Independent choices (dialogic-godot#2057)
Browse files Browse the repository at this point in the history
Moves choices logic into the choice event (the first choice of a question will handle it) instead of the text event.

Also updates the visual editor logic, lines and warning for choices to reflect that they can now exist wherever they want.
  • Loading branch information
Jowan-Spooner authored Jan 30, 2024
1 parent 5bca685 commit f1d4a70
Show file tree
Hide file tree
Showing 11 changed files with 209 additions and 129 deletions.
16 changes: 12 additions & 4 deletions addons/dialogic/Editor/Events/BranchEnd.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,42 @@
extends Control
## A scene shown at the end of events that contain other events

var resource : DialogicEndBranchEvent
var resource: DialogicEndBranchEvent

# References
var parent_node : Control = null
var end_control :Control = null
var parent_node: Control = null
var end_control: Control = null

# Indent
var indent_size := 22
var current_indent_level := 1

var selected := false

func _ready() -> void:
$Icon.icon = get_theme_icon("GuiSpinboxUpdown", "EditorIcons")
$Spacer.custom_minimum_size.x = 100*DialogicUtil.get_editor_scale()
$Spacer.custom_minimum_size.x = 90*DialogicUtil.get_editor_scale()
visual_deselect()
parent_node_changed()


## Called by the visual timeline editor
func visual_select() -> void:
modulate = get_theme_color("highlighted_font_color", "Editor")
selected = true


## Called by the visual timeline editor
func visual_deselect() -> void:
if !parent_node:return
selected = false
modulate = parent_node.resource.event_color.lerp(get_theme_color("font_color", "Editor"), 0.3)


func is_selected() -> bool:
return selected


## Called by the visual timeline editor
func highlight() -> void:
if !parent_node:return
Expand Down
15 changes: 7 additions & 8 deletions addons/dialogic/Editor/Events/BranchEnd.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,22 @@

[ext_resource type="Script" path="res://addons/dialogic/Editor/Events/BranchEnd.gd" id="1"]

[sub_resource type="Image" id="Image_8tlok"]
[sub_resource type="Image" id="Image_8jrl8"]
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),
"data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 93, 93, 41, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 44, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 44, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 94, 94, 234, 255, 95, 95, 43, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 94, 94, 234, 255, 95, 95, 43, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0),
"format": "RGBA8",
"height": 16,
"mipmaps": false,
"width": 16
}

[sub_resource type="ImageTexture" id="ImageTexture_vm1jl"]
image = SubResource("Image_8tlok")
[sub_resource type="ImageTexture" id="ImageTexture_44ap0"]
image = SubResource("Image_8jrl8")

[node name="EndBranch" type="HBoxContainer"]
custom_minimum_size = Vector2(0, 40)
anchors_preset = 10
anchor_right = 1.0
offset_bottom = 40.0
offset_bottom = 24.0
grow_horizontal = 2
mouse_filter = 0
script = ExtResource("1")
Expand All @@ -28,7 +27,7 @@ layout_mode = 2
size_flags_vertical = 0

[node name="Spacer" type="Control" parent="."]
custom_minimum_size = Vector2(75, 0)
custom_minimum_size = Vector2(90, 0)
layout_mode = 2
size_flags_vertical = 0

Expand All @@ -40,7 +39,7 @@ size_flags_vertical = 4
tooltip_text = "Click and drag"
focus_mode = 0
mouse_filter = 1
icon = SubResource("ImageTexture_vm1jl")
icon = SubResource("ImageTexture_44ap0")
flat = true

[node name="HiddenEventsLabel" type="Label" parent="."]
Expand Down
18 changes: 9 additions & 9 deletions addons/dialogic/Editor/Events/styles/selected_styleboxflat.tres
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[gd_resource type="StyleBoxFlat" format=3 uid="uid://obyrr26pqk2p"]

[resource]
content_margin_left = 7.0
content_margin_top = 0.0
content_margin_right = 0.0
content_margin_bottom = 0.0
content_margin_left = 3.0
content_margin_top = 1.0
content_margin_right = 4.0
content_margin_bottom = 1.0
bg_color = Color(0.776471, 0.776471, 0.776471, 0.207843)
border_width_left = 3
border_color = Color(1, 1, 1, 1)
corner_radius_top_left = 1
corner_radius_top_left = 5
corner_radius_top_right = 5
corner_radius_bottom_right = 5
corner_radius_bottom_left = 1
expand_margin_top = 3.0
expand_margin_bottom = 3.0
corner_radius_bottom_left = 5
expand_margin_left = 1.0
expand_margin_top = 1.0
expand_margin_bottom = 2.0
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
[gd_resource type="StyleBoxEmpty" format=3 uid="uid://cl75ikyq2is7c"]

[resource]
content_margin_left = 7.0
content_margin_left = 3.0
content_margin_top = 1.0
content_margin_right = 4.0
content_margin_bottom = 1.0
119 changes: 87 additions & 32 deletions addons/dialogic/Editor/TimelineEditor/VisualEditor/TimelineArea.gd
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func _ready() -> void:
%TimelineArea.get_theme_color("background_color", "CodeEdit")


################### EVENT DRAGGING #############################################
#region EVENT DRAGGING
################################################################################

func start_dragging(type:DragTypes, data:Variant) -> void:
Expand Down Expand Up @@ -67,74 +67,127 @@ func finish_dragging():
drag_canceled.emit()
queue_redraw()

#endregion


##################### LINE DRAWING #############################################
#region LINE DRAWING
################################################################################

func _draw() -> void:
var _scale := DialogicUtil.get_editor_scale()
var line_width := 5 * _scale
var horizontal_line_length := 100*_scale
var color_multiplier := Color(1,1,1,0.5)
var color_multiplier := Color(1,1,1,0.25)
var selected_color_multiplier := Color(1,1,1,1)


## Draw Event Lines
for idx in range($Timeline.get_child_count()):
var event : Control = $Timeline.get_child(idx)
var block : Control = $Timeline.get_child(idx)

if not "resource" in event:
if not "resource" in block:
continue

if not event.visible:
if not block.visible:
continue

if event.resource is DialogicEndBranchEvent:
if block.resource is DialogicEndBranchEvent:
continue

if not (event.has_any_enabled_body_content or event.resource.can_contain_events):
if not (block.has_any_enabled_body_content or block.resource.can_contain_events):
continue

var icon_panel_height := 32*_scale
var rect_position :Vector2= event.get_node('%IconPanel').global_position+Vector2(0,1)*event.get_node('%IconPanel').size+Vector2(0,-4)
var color :Color= event.resource.event_color
if event.is_selected():
var icon_panel_height: int = block.get_node('%IconPanel').size.y
var rect_position: Vector2 = block.get_node('%IconPanel').global_position+Vector2(0,1)*block.get_node('%IconPanel').size+Vector2(0,-4)
var color: Color = block.resource.event_color

if block.is_selected() or block.end_node and block.end_node.is_selected():
color *= selected_color_multiplier
else:
color *= color_multiplier

if idx < $Timeline.get_child_count()-1 and event.current_indent_level < $Timeline.get_child(idx+1).current_indent_level:
var end_node :Node= event.end_node
var sub_idx := idx
if block.expanded and not block.resource.can_contain_events:
draw_rect(Rect2(rect_position-global_position+Vector2(line_width, 0), Vector2(line_width, block.size.y-block.get_node('%IconPanel').size.y)), color)

if !end_node: # this doesn't have an end node (e.g. text event with choices in it)
## If the indentation has not changed, nothing else happens
if idx >= $Timeline.get_child_count()-1 or block.current_indent_level >= $Timeline.get_child(idx+1).current_indent_level:
continue

## Draw connection between opening and end branch events
if block.resource.can_contain_events:
var end_node: Node = block.end_node

if end_node != null:
var v_length: float = end_node.global_position.y+end_node.size.y/2-rect_position.y
#var rect_size := Vector2(line_width, )
var offset := Vector2(line_width, 0)

# Draw vertical line
draw_rect(Rect2(rect_position-global_position+offset, Vector2(line_width, v_length)), color)
# Draw horizonal line (on END BRANCH event)
draw_rect(Rect2(
rect_position.x+line_width-global_position.x+offset.x,
rect_position.y+v_length-line_width-global_position.y,
horizontal_line_length-offset.x,
line_width),
color)

if block.resource.wants_to_group:
var group_color: Color = block.resource.event_color*color_multiplier
var group_starter := true
if idx != 0:
var block_above := $Timeline.get_child(idx-1)
if block_above.resource.event_name == block.resource.event_name:
group_starter = false
if block_above.resource is DialogicEndBranchEvent and block_above.parent_node.resource.event_name == block.resource.event_name:
group_starter = false

## Draw small horizontal line on any event in group
draw_rect(Rect2(
rect_position.x-global_position.x-line_width,
rect_position.y-global_position.y-icon_panel_height/2,
line_width,
line_width),
group_color)

if group_starter:
## Find the last event in the group (or that events END BRANCH)
var sub_idx := idx
var group_end_idx := idx
while sub_idx < $Timeline.get_child_count()-1:
sub_idx += 1
if $Timeline.get_child(sub_idx).current_indent_level == event.current_indent_level:
end_node = $Timeline.get_child(sub_idx-1)
if $Timeline.get_child(sub_idx).current_indent_level == block.current_indent_level-1:
group_end_idx = sub_idx-1
break
var rect_size := Vector2()
if end_node != null:
rect_size = Vector2(line_width, end_node.global_position.y+end_node.size.y-rect_position.y)
if end_node.resource is DialogicEndBranchEvent and event.resource.can_contain_events:
rect_size = Vector2(line_width, end_node.global_position.y+end_node.size.y/2-rect_position.y)
else:
rect_size = Vector2(line_width, $Timeline.get_child(-1).global_position.y+$Timeline.get_child(-1).size.y-rect_position.y)

draw_rect(Rect2(rect_position-global_position, rect_size), color)
draw_rect(Rect2(Vector2(event.get_node('%IconPanel').global_position.x+line_width, rect_position.y+rect_size.y-line_width)-global_position, Vector2(horizontal_line_length, line_width)), color)
var end_node := $Timeline.get_child(group_end_idx)

var offset := Vector2(-2*line_width, -icon_panel_height/2)
var v_length: float = end_node.global_position.y - rect_position.y + icon_panel_height

## Draw vertical line
draw_rect(Rect2(
rect_position.x - global_position.x + offset.x,
rect_position.y - global_position.y + offset.y,
line_width,
v_length),
group_color)

elif event.expanded:
draw_rect(Rect2(rect_position-global_position, Vector2(line_width, event.size.y-event.get_node('%IconPanel').size.y+10*_scale)), color.darkened(0.5))

## Draw line that indicates the dragging position
if dragging and get_global_rect().has_point(get_global_mouse_position()):
var height :int = 0
var height: int = 0
if drag_to_position == %Timeline.get_child_count():
height = %Timeline.get_child(-1).global_position.y+%Timeline.get_child(-1).size.y-global_position.y-(line_width/2.0)
else:
height = %Timeline.get_child(drag_to_position).global_position.y-global_position.y-(line_width/2.0)

draw_line(Vector2(0, height), Vector2(size.x*0.9, height), get_theme_color("accent_color", "Editor"), line_width*0.2)
draw_line(Vector2(0, height), Vector2(size.x*0.9, height), get_theme_color("accent_color", "Editor"), line_width*.3)

##################### SPACE BELOW ##############################################
#endregion


#region SPACE BELOW
################################################################################

func add_extra_scroll_area_to_timeline(fake_arg:Variant=null) -> void:
Expand All @@ -143,3 +196,5 @@ func add_extra_scroll_area_to_timeline(fake_arg:Variant=null) -> void:
%Timeline.size.y = 0
if %Timeline.size.y + 200 > %TimelineArea.size.y:
%Timeline.custom_minimum_size = Vector2(0, %Timeline.size.y + 200)

#endregion
Loading

0 comments on commit f1d4a70

Please sign in to comment.