Skip to content

Commit ca3cf12

Browse files
committed
Fix merge conflicts
2 parents 59a9f8a + 9146ea4 commit ca3cf12

File tree

67 files changed

+1364
-398
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+1364
-398
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
<p align="center">
1212
<a href="https://discord.gg/DjcDgDaTMe" target="_blank" style="text-decoration:none"><img alt="Discord" src="https://img.shields.io/discord/628713677239091231?logo=discord&labelColor=CFC9C8&color=646FA9"></a>
13-
<a href="https://godotengine.org/download/" target="_blank" style="text-decoration:none"><img alt="Godot v4.2+" src="https://img.shields.io/badge/Godot-v4.2+-%23478cbf?labelColor=CFC9C8&color=49A9B4" /></a>
13+
<a href="https://godotengine.org/download/" target="_blank" style="text-decoration:none"><img alt="Godot v4.3+" src="https://img.shields.io/badge/Godot-v4.3+-%23478cbf?labelColor=CFC9C8&color=49A9B4" /></a>
1414
<a href="https://docs.dialogic.pro/introduction.html" target="_blank" style="text-decoration:none"><img alt="Dialogic 2 Documentation" src="https://img.shields.io/badge/documention-online-green?labelColor=CFC9C8&color=6BCD69"></a>
1515
<a href="https://github.com/dialogic-godot/dialogic/actions/workflows/unit_test.yml" target="_blank style="text-decoration:none"><img alt="GitHub Actions Workflow Status" src="https://img.shields.io/github/actions/workflow/status/dialogic-godot/dialogic/unit_test.yml?labelColor=CFC9C8&color=DBDCB8"></a>
1616
<a href="https://github.com/dialogic-godot/dialogic/releases" target="_blank" style="text-decoration:none"><img alt="Latest Dialogic Release" src="https://img.shields.io/github/v/release/dialogic-godot/dialogic?include_prereleases&labelColor=CFC9C8&color=CBA18C"></a>
@@ -26,7 +26,7 @@
2626

2727
## Version
2828

29-
Dialogic 2 **requires at least Godot 4.2.2**.
29+
Dialogic 2 **requires at least Godot 4.3**.
3030

3131
[If you are looking for the Godot 3.x version (Dialogic 1.x) you can find it here.](https://github.com/dialogic-godot/dialogic-1)
3232

@@ -72,7 +72,7 @@ Contributors: [CakeVR](https://github.com/CakeVR), [Exelia](https://github.com/e
7272

7373
Special thanks: [Arnaud](https://github.com/arnaudvergnet), [AnidemDex](https://github.com/AnidemDex), [ellogwen](https://github.com/ellogwen), [Tim Krief](https://github.com/timkrief), [Toen](https://twitter.com/ToenAndreMC), Òscar, [Francisco Presencia](https://francisco.io/), [M7mdKady14](https://github.com/M7mdKady14).
7474

75-
### Thank you to all my [Patreons](https://www.patreon.com/coppolaemilio) and Github sponsors for making this possible!
75+
### Thank you to all my [Patreons](https://www.patreon.com/jowanspooner) and Github sponsors for making this possible!
7676

7777
## License
7878
This project is licensed under the terms of the [MIT license](https://github.com/dialogic-godot/dialogic/blob/main/LICENSE).

addons/dialogic/Core/DialogicGameHandler.gd

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,10 @@ func start(timeline:Variant, label_or_idx:Variant="") -> Node:
194194
scene.show()
195195

196196
if not scene.is_node_ready():
197-
scene.ready.connect(clear.bind(ClearFlags.KEEP_VARIABLES))
198-
scene.ready.connect(start_timeline.bind(timeline, label_or_idx))
197+
if not scene.ready.is_connected(clear.bind(ClearFlags.KEEP_VARIABLES)):
198+
scene.ready.connect(clear.bind(ClearFlags.KEEP_VARIABLES))
199+
if not scene.ready.is_connected(start_timeline.bind(timeline, label_or_idx)):
200+
scene.ready.connect(start_timeline.bind(timeline, label_or_idx))
199201
else:
200202
start_timeline(timeline, label_or_idx)
201203

@@ -207,7 +209,7 @@ func start(timeline:Variant, label_or_idx:Variant="") -> Node:
207209
## @label_or_idx can be a label (string) or index (int) to skip to immediatly.
208210
func start_timeline(timeline:Variant, label_or_idx:Variant = "") -> void:
209211
# load the resource if only the path is given
210-
if typeof(timeline) == TYPE_STRING:
212+
if typeof(timeline) in [TYPE_STRING, TYPE_STRING_NAME]:
211213
#check the lookup table if it's not a full file name
212214
if "://" in timeline:
213215
timeline = load(timeline)
@@ -226,7 +228,7 @@ func start_timeline(timeline:Variant, label_or_idx:Variant = "") -> void:
226228
event.dialogic = self
227229
current_event_idx = -1
228230

229-
if typeof(label_or_idx) == TYPE_STRING:
231+
if typeof(label_or_idx) in [TYPE_STRING, TYPE_STRING_NAME]:
230232
if label_or_idx:
231233
if has_subsystem('Jump'):
232234
Jump.jump_to_label((label_or_idx as String))
@@ -244,7 +246,7 @@ func start_timeline(timeline:Variant, label_or_idx:Variant = "") -> void:
244246
## [param timeline_resource] can be either a path (string) or a loaded timeline (resource)
245247
func preload_timeline(timeline_resource:Variant) -> Variant:
246248
# I think ideally this should be on a new thread, will test
247-
if typeof(timeline_resource) == TYPE_STRING:
249+
if typeof(timeline_resource) in [TYPE_STRING, TYPE_STRING_NAME]:
248250
if "://" in timeline_resource:
249251
timeline_resource = load(timeline_resource)
250252
else:
@@ -279,6 +281,18 @@ func end_timeline(skip_ending := false) -> void:
279281
timeline_ended.emit()
280282

281283

284+
## Method to check if timeline exists.
285+
## @timeline can be either a loaded timeline resource or a path to a timeline file.
286+
func timeline_exists(timeline:Variant) -> bool:
287+
if typeof(timeline) in [TYPE_STRING, TYPE_STRING_NAME]:
288+
if "://" in timeline and ResourceLoader.exists(timeline):
289+
return load(timeline) is DialogicTimeline
290+
else:
291+
return DialogicResourceUtil.timeline_resource_exists(timeline)
292+
293+
return timeline is DialogicTimeline
294+
295+
282296
## Handles the next event.
283297
func handle_next_event(_ignore_argument: Variant = "") -> void:
284298
handle_event(current_event_idx+1)

addons/dialogic/Core/DialogicResourceUtil.gd

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ static func update() -> void:
1313
update_directory('.dtl')
1414
update_label_cache()
1515
update_audio_channel_cache()
16-
DialogicStylesUtil.update_style_directory()
16+
DialogicStylesUtil.build_style_directory()
1717

1818

1919
#region RESOURCE DIRECTORIES
@@ -82,6 +82,13 @@ static func get_unique_identifier_by_path(file_path:String) -> String:
8282
return ""
8383

8484

85+
static func get_resource_path_from_identifier(identifier:String, extension:String) -> String:
86+
var value: Variant = get_directory(extension).get(identifier, '')
87+
if value is String:
88+
return value
89+
return ""
90+
91+
8592
## Returns the resource associated with the given unique identifier.
8693
## The expected extension is needed to use the right directory.
8794
static func get_resource_from_identifier(identifier:String, extension:String) -> Resource:
@@ -93,6 +100,15 @@ static func get_resource_from_identifier(identifier:String, extension:String) ->
93100
return null
94101

95102

103+
## Returns a boolean that expresses whether the resource exists.
104+
## The expected extension is needed to use the right directory.
105+
static func resource_exists_from_identifier(identifier:String, extension:String) -> bool:
106+
var value: Variant = get_directory(extension).get(identifier, '')
107+
if typeof(value) == TYPE_STRING:
108+
return ResourceLoader.exists(value)
109+
return value is Resource
110+
111+
96112
## Editor Only
97113
static func change_unique_identifier(file_path:String, new_identifier:String) -> void:
98114
var directory := get_directory(file_path.get_extension())
@@ -331,6 +347,10 @@ static func get_timeline_directory() -> Dictionary:
331347
return get_directory('dtl')
332348

333349

350+
static func timeline_resource_exists(timeline_identifier:String) -> bool:
351+
return resource_exists_from_identifier(timeline_identifier, 'dtl')
352+
353+
334354
static func get_timeline_resource(timeline_identifier:String) -> DialogicTimeline:
335355
return get_resource_from_identifier(timeline_identifier, 'dtl')
336356

addons/dialogic/Core/DialogicUtil.gd

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -445,39 +445,53 @@ static func setup_script_property_edit_node(property_info: Dictionary, value:Var
445445
input.select(value)
446446
input.item_selected.connect(DialogicUtil._on_export_int_enum_submitted.bind(property_info.name, property_changed))
447447
else:
448-
input = SpinBox.new()
449-
input.value_changed.connect(DialogicUtil._on_export_number_submitted.bind(property_info.name, property_changed))
450-
if property_info.hint_string == 'int':
451-
input.step = 1
452-
input.allow_greater = true
453-
input.allow_lesser = true
454-
elif ',' in property_info.hint_string:
448+
input = load("res://addons/dialogic/Editor/Events/Fields/field_number.tscn").instantiate()
449+
input.property_name = property_info['name']
450+
input.use_int_mode()
451+
452+
if ',' in property_info.hint_string:
455453
input.min_value = int(property_info.hint_string.get_slice(',', 0))
456454
input.max_value = int(property_info.hint_string.get_slice(',', 1))
457455
if property_info.hint_string.count(',') > 1:
458456
input.step = int(property_info.hint_string.get_slice(',', 2))
457+
else:
458+
input.step = 1
459+
input.max_value = INF
460+
input.min_value = -INF
461+
459462
if value != null:
460-
input.value = value
463+
input.set_value(value)
464+
input.value_changed.connect(DialogicUtil._on_export_number_submitted.bind(property_changed))
461465
TYPE_FLOAT:
462-
input = SpinBox.new()
466+
input = load("res://addons/dialogic/Editor/Events/Fields/field_number.tscn").instantiate()
467+
input.property_name = property_info['name']
468+
input.use_float_mode()
463469
input.step = 0.01
464470
if ',' in property_info.hint_string:
465471
input.min_value = float(property_info.hint_string.get_slice(',', 0))
466472
input.max_value = float(property_info.hint_string.get_slice(',', 1))
467473
if property_info.hint_string.count(',') > 1:
468474
input.step = float(property_info.hint_string.get_slice(',', 2))
469-
input.value_changed.connect(DialogicUtil._on_export_number_submitted.bind(property_info.name, property_changed))
470475
if value != null:
471-
input.value = value
476+
input.set_value(value)
477+
input.value_changed.connect(DialogicUtil._on_export_number_submitted.bind(property_changed))
472478
TYPE_VECTOR2, TYPE_VECTOR3, TYPE_VECTOR4:
473479
var vectorSize: String = type_string(typeof(value))[-1]
474480
input = load("res://addons/dialogic/Editor/Events/Fields/field_vector" + vectorSize + ".tscn").instantiate()
475481
input.property_name = property_info['name']
476482
input.set_value(value)
477483
input.value_changed.connect(DialogicUtil._on_export_vector_submitted.bind(property_changed))
484+
TYPE_VECTOR2I, TYPE_VECTOR3I, TYPE_VECTOR4I:
485+
var vectorSize: String = type_string(typeof(value))[-2]
486+
input = load("res://addons/dialogic/Editor/Events/Fields/field_vector" + vectorSize + ".tscn").instantiate()
487+
input.step = 1
488+
input.property_name = property_info['name']
489+
input.set_value(value)
490+
input.value_changed.connect(DialogicUtil._on_export_vectori_submitted.bind(property_changed))
478491
TYPE_STRING:
479492
if property_info['hint'] & PROPERTY_HINT_FILE or property_info['hint'] & PROPERTY_HINT_DIR:
480493
input = load("res://addons/dialogic/Editor/Events/Fields/field_file.tscn").instantiate()
494+
input.show_editing_button = true
481495
input.file_filter = property_info['hint_string']
482496
input.file_mode = FileDialog.FILE_MODE_OPEN_FILE
483497
if property_info['hint'] == PROPERTY_HINT_DIR:
@@ -531,7 +545,7 @@ static func _on_export_color_submitted(color:Color, property_name:String, callab
531545
static func _on_export_int_enum_submitted(item:int, property_name:String, callable: Callable) -> void:
532546
callable.call(property_name, var_to_str(item))
533547

534-
static func _on_export_number_submitted(value:float, property_name:String, callable: Callable) -> void:
548+
static func _on_export_number_submitted(property_name:String, value:float, callable: Callable) -> void:
535549
callable.call(property_name, var_to_str(value))
536550

537551
static func _on_export_file_submitted(property_name:String, value:String, callable: Callable) -> void:
@@ -543,6 +557,13 @@ static func _on_export_string_enum_submitted(value:int, property_name:String, li
543557
static func _on_export_vector_submitted(property_name:String, value:Variant, callable: Callable) -> void:
544558
callable.call(property_name, var_to_str(value))
545559

560+
static func _on_export_vectori_submitted(property_name:String, value:Variant, callable: Callable) -> void:
561+
match typeof(value):
562+
TYPE_VECTOR2: value = Vector2i(value)
563+
TYPE_VECTOR3: value = Vector3i(value)
564+
TYPE_VECTOR4: value = Vector4i(value)
565+
callable.call(property_name, var_to_str(value))
566+
546567
static func _on_export_dict_submitted(property_name:String, value:Variant, callable: Callable) -> void:
547568
callable.call(property_name, var_to_str(value))
548569

addons/dialogic/Editor/Common/broken_reference_manager.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ func display_search_results(finds:Array[Dictionary]) -> void:
205205
## Inspired by how godot highlights stuff in its search results
206206
func _custom_draw(item:TreeItem, rect:Rect2) -> void:
207207
var text := item.get_text(2)
208-
var find := item.get_metadata(0)
208+
var find: Dictionary = item.get_metadata(0)
209209

210210
var font: Font = %ReferenceTree.get_theme_font("font")
211211
var font_size: int = %ReferenceTree.get_theme_font_size("font_size")

addons/dialogic/Editor/Common/reference_manager_window.gd

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ func open() -> void:
164164
DialogicResourceUtil.update_directory('dch')
165165
DialogicResourceUtil.update_directory('dtl')
166166
popup_centered_ratio(0.5)
167-
move_to_foreground()
168167
grab_focus()
169168

170169

@@ -173,6 +172,10 @@ func _on_close_requested() -> void:
173172
broken_manager.close()
174173

175174

175+
func get_change_count() -> int:
176+
return len(broken_manager.reference_changes)
177+
178+
176179
func update_indicator() -> void:
177180
icon_button.get_child(0).visible = !broken_manager.reference_changes.is_empty()
178181

addons/dialogic/Editor/Common/sidebar.gd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ func update_resource_list(resources_list: PackedStringArray = []) -> void:
168168
resource_tree.clear()
169169

170170
var character_items: Array = get_directory_items.call(character_directory, filter, load("res://addons/dialogic/Editor/Images/Resources/character.svg"), resources_list)
171-
var timeline_items: Array = get_directory_items.call(timeline_directory, filter, get_theme_icon("TripleBar", "EditorIcons"), resources_list)
171+
var timeline_items: Array = get_directory_items.call(timeline_directory, filter, load("res://addons/dialogic/Editor/Images/Resources/timeline.svg"), resources_list)
172172
var all_items := character_items + timeline_items
173173

174174
# BUILD TREE
@@ -391,7 +391,7 @@ func _on_resources_tree_item_clicked(_pos: Vector2, mouse_button_index: int) ->
391391

392392

393393
func _on_resources_tree_item_collapsed(item:TreeItem) -> void:
394-
var collapsed_info := DialogicUtil.get_editor_setting("resource_list_collapsed_info", [])
394+
var collapsed_info: Array = DialogicUtil.get_editor_setting("resource_list_collapsed_info", [])
395395
if item.get_text(0) in collapsed_info:
396396
if not item.collapsed:
397397
collapsed_info.erase(item.get_text(0))

addons/dialogic/Editor/Common/update_install_window.gd

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ func _ready() -> void:
2020
func open() -> void:
2121
get_parent().popup_centered_ratio(0.5)
2222
get_parent().mode = Window.MODE_WINDOWED
23-
get_parent().move_to_foreground()
2423
get_parent().grab_focus()
2524

2625

@@ -109,7 +108,7 @@ func _on_update_manager_downdload_completed(result:int):
109108
func _on_resources_reimported(resources:Array) -> void:
110109
if is_inside_tree():
111110
await get_tree().process_frame
112-
get_parent().move_to_foreground()
111+
get_parent().grab_focus()
113112

114113

115114
func markdown_to_bbcode(text:String) -> String:

addons/dialogic/Editor/Events/EventBlock/event_block.gd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,6 @@ func _on_EventNode_gui_input(event:InputEvent) -> void:
450450
popup.current_event = self
451451
popup.popup_on_parent(Rect2(get_global_mouse_position(), Vector2()))
452452
if resource.help_page_path == "":
453-
popup.set_item_disabled(2, true)
453+
popup.set_item_disabled(4, true)
454454
else:
455-
popup.set_item_disabled(2, false)
455+
popup.set_item_disabled(4, false)

addons/dialogic/Editor/Events/Fields/field_file.gd

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ var resource_icon: Texture:
2323
var max_width := 200
2424
var current_value: String
2525
var hide_reset := false
26+
var show_editing_button := false
2627

2728
#endregion
2829

@@ -36,6 +37,9 @@ func _ready() -> void:
3637
%OpenButton.icon = get_theme_icon("Folder", "EditorIcons")
3738
%OpenButton.button_down.connect(_on_OpenButton_pressed)
3839

40+
%EditButton.icon = get_theme_icon("Edit", "EditorIcons")
41+
%EditButton.button_down.connect(_on_EditButton_pressed)
42+
3943
%ClearButton.icon = get_theme_icon("Reload", "EditorIcons")
4044
%ClearButton.button_up.connect(clear_path)
4145
%ClearButton.visible = !hide_reset
@@ -72,6 +76,8 @@ func _set_value(value: Variant) -> void:
7276
%Field.custom_minimum_size.x = 0
7377
%Field.expand_to_text_length = true
7478

79+
%EditButton.visible = show_editing_button and value
80+
7581
if not %Field.text == text:
7682
value_changed.emit(property_name, current_value)
7783
%Field.text = text
@@ -94,6 +100,11 @@ func _on_file_dialog_selected(path:String) -> void:
94100
value_changed.emit(property_name, path)
95101

96102

103+
func _on_EditButton_pressed() -> void:
104+
if ResourceLoader.exists(current_value):
105+
EditorInterface.inspect_object(load(current_value), "", true)
106+
107+
97108
func clear_path() -> void:
98109
_set_value("")
99110
value_changed.emit(property_name, "")

0 commit comments

Comments
 (0)