Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion addons/dialogic/Editor/Common/side_bar.tscn
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[gd_scene load_steps=7 format=3 uid="uid://cwe3r2tbh2og1"]
[gd_scene load_steps=8 format=3 uid="uid://cwe3r2tbh2og1"]

[ext_resource type="Script" uid="uid://myogqmakusx3" path="res://addons/dialogic/Editor/Common/sidebar.gd" id="1_jnq65"]
[ext_resource type="Texture2D" uid="uid://bff65e82555qr" path="res://addons/dialogic/Editor/Images/Pieces/close-icon.svg" id="2_54pks"]
[ext_resource type="Texture2D" uid="uid://dx3o2ild56i76" path="res://addons/dialogic/Editor/Images/Pieces/closed-icon.svg" id="2_ilyps"]
[ext_resource type="Script" uid="uid://4injjcial4s4" path="res://addons/dialogic/Editor/Common/sidebar_resource_tree.gd" id="4_4dik3"]

[sub_resource type="Theme" id="Theme_pn0f4"]
VBoxContainer/constants/separation = 4
Expand Down Expand Up @@ -104,6 +105,7 @@ layout_mode = 2
[node name="OptionsPopup" type="Popup" parent="VBoxPrimary/Margin/MainVSplit/VBox/HBoxSearchSort/Options"]
unique_name_in_owner = true
transparent_bg = true
oversampling_override = 1.0
position = Vector2i(890, 65)
size = Vector2i(165, 101)
visible = true
Expand Down Expand Up @@ -133,6 +135,7 @@ clip_text = true
selected = 0
item_count = 4
popup/item_0/text = "No Grouping"
popup/item_0/id = 0
popup/item_1/text = "Type Grouping"
popup/item_1/id = 1
popup/item_2/text = "Folder Grouping"
Expand All @@ -157,6 +160,7 @@ size_flags_vertical = 3
allow_rmb_select = true
hide_root = true
scroll_horizontal_enabled = false
script = ExtResource("4_4dik3")

[node name="HBoxContainer" type="HBoxContainer" parent="VBoxPrimary/Margin/MainVSplit/VBox"]
visible = false
Expand All @@ -173,6 +177,7 @@ layout_mode = 2
size_flags_horizontal = 3
item_count = 1
popup/item_0/text = "Alphabetical (All)"
popup/item_0/id = 0

[node name="ContentListSection" type="VBoxContainer" parent="VBoxPrimary/Margin/MainVSplit"]
unique_name_in_owner = true
Expand Down
4 changes: 4 additions & 0 deletions addons/dialogic/Editor/Common/sidebar.gd
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,10 @@ func _on_resources_tree_item_activated() -> void:
func _on_resources_tree_item_clicked(_pos: Vector2, mouse_button_index: int) -> void:
match mouse_button_index:
MOUSE_BUTTON_LEFT:
while Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT):
if get_viewport().gui_is_dragging():
return
await get_tree().physics_frame
var selected_item := resource_tree.get_selected()
if selected_item == null:
return
Expand Down
10 changes: 10 additions & 0 deletions addons/dialogic/Editor/Common/sidebar_resource_tree.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@tool
extends Tree

var previous_selected : TreeItem = null

func _get_drag_data(at_position: Vector2) -> Variant:
var item := get_item_at_position(at_position)
if item.get_metadata(0) and typeof(item.get_metadata(0)) == TYPE_STRING and item.get_metadata(0).begins_with("res://"):
return {"files":[item.get_metadata(0)]}
return null
1 change: 1 addition & 0 deletions addons/dialogic/Editor/Common/sidebar_resource_tree.gd.uid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uid://4injjcial4s4
14 changes: 11 additions & 3 deletions addons/dialogic/Editor/TimelineEditor/VisualEditor/TimelineArea.gd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ extends ScrollContainer
# Manages the drawing of the event lines and event dragging.


enum DragTypes {NOTHING, NEW_EVENT, EXISTING_EVENTS}
enum DragTypes {NOTHING, NEW_EVENT, EXISTING_EVENTS, GENERATED_EVENT}

var drag_type: DragTypes = DragTypes.NOTHING
var drag_data: Variant
Expand Down Expand Up @@ -48,7 +48,7 @@ func _input(event:InputEvent) -> void:
finish_dragging()


func _process(delta:float) -> void:
func _process(_delta:float) -> void:
if !dragging:
return

Expand All @@ -59,9 +59,17 @@ func _process(delta:float) -> void:
if get_global_mouse_position().y > child.global_position.y+(child.size.y/2.0):
drag_to_position = child.get_index()+1
queue_redraw()
return
else:
drag_to_position = child.get_index()
queue_redraw()
return
if get_global_rect().has_point(get_global_mouse_position()):
var last_child := %Timeline.get_child(-1)
if get_global_mouse_position().y > last_child.global_position.y + last_child.size.y:
drag_to_position = %Timeline.get_child_count()
queue_redraw()
return


func finish_dragging() -> void:
Expand Down Expand Up @@ -194,7 +202,7 @@ func _draw() -> void:
#region SPACE BELOW
################################################################################

func add_extra_scroll_area_to_timeline(fake_arg:Variant=null) -> void:
func add_extra_scroll_area_to_timeline(_fake_arg:Variant=null) -> void:
if %Timeline.get_children().size() > 4:
%Timeline.custom_minimum_size.y = 0
%Timeline.size.y = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,19 +343,65 @@ func _on_event_block_gui_input(event: InputEvent, item: Node) -> void:

if len(selected_items) > 0 and event is InputEventMouseMotion:
if Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT):
if !%TimelineArea.dragging and !get_viewport().gui_is_dragging() and drag_allowed:
if not %TimelineArea.dragging and not get_viewport().gui_is_dragging() and drag_allowed:
sort_selection()
%TimelineArea.start_dragging(%TimelineArea.DragTypes.EXISTING_EVENTS, selected_items)


func _can_drop_data(_at_position: Vector2, data: Variant) -> bool:
if %TimelineArea.dragging:
return %TimelineArea.drag_type == %TimelineArea.DragTypes.GENERATED_EVENT
if typeof(data) == TYPE_DICTIONARY and 'files' in data.keys() and len(data.files) == 1:
match data.files[0].get_extension().to_lower():
"dch":
var chr := load(data.files[0])
var resource : DialogicEvent
if (chr as DialogicCharacter).portraits.is_empty():
resource = DialogicTextEvent.new()
else:
resource = DialogicCharacterEvent.new()
resource._load_custom_defaults()
resource.character = chr
%TimelineArea.start_dragging(%TimelineArea.DragTypes.GENERATED_EVENT, resource)
return true
"dtl":
var resource := DialogicJumpEvent.new()
resource._load_custom_defaults()
resource.timeline = load(data.files[0])
%TimelineArea.start_dragging(%TimelineArea.DragTypes.GENERATED_EVENT, resource)
return true
"mp3", "wav", "ogg":
var resource := DialogicAudioEvent.new()
resource._load_custom_defaults()
resource.file_path = data.files[0]
%TimelineArea.start_dragging(%TimelineArea.DragTypes.GENERATED_EVENT, resource)
return true
"png", "jpg", "jpeg":
var resource := DialogicBackgroundEvent.new()
resource._load_custom_defaults()
resource.argument = data.files[0]
%TimelineArea.start_dragging(%TimelineArea.DragTypes.GENERATED_EVENT, resource)
return true
"tscn":
var resource := DialogicBackgroundEvent.new()
resource._load_custom_defaults()
resource.scene = data.files[0]
%TimelineArea.start_dragging(%TimelineArea.DragTypes.GENERATED_EVENT, resource)
return true
return false


## Activated by TimelineArea drag_completed
func _on_timeline_area_drag_completed(type:int, index:int, data:Variant) -> void:
if type == %TimelineArea.DragTypes.NEW_EVENT:
var resource: DialogicEvent = data.duplicate()
resource._load_custom_defaults()

add_event_undoable(resource, index)

elif type == %TimelineArea.DragTypes.GENERATED_EVENT:
add_event_undoable(data, index)
get_viewport().gui_cancel_drag()

elif type == %TimelineArea.DragTypes.EXISTING_EVENTS:
if not (len(data) == 1 and data[0].get_index()+1 == index):
move_blocks_to_index(data, index)
Expand Down
4 changes: 2 additions & 2 deletions addons/dialogic/Modules/Audio/event_audio.gd
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
@tool
class_name DialogicAudioEvent
extends DialogicEvent
## Event that can play audio on a channel. The channel can be prededinfed
## (with default settings defined in the settings) or created on the spot.
## If no channel is given will play as a One-Shot SFX.
class_name DialogicAudioEvent
extends DialogicEvent

### Settings

Expand Down