Skip to content

Commit

Permalink
Multiple fixes (#2013)
Browse files Browse the repository at this point in the history
- fixes #2008
- fixes #2007
- fixes #2003
- partially adresses #1995

- also cleans up character and timeline resource scripts
  • Loading branch information
Jowan-Spooner authored Jan 10, 2024
1 parent f862fdc commit 812bf10
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 135 deletions.
4 changes: 2 additions & 2 deletions addons/dialogic/Editor/Events/BranchEnd.gd
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var parent_node : Control = null
var end_control :Control = null

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

func _ready() -> void:
Expand Down Expand Up @@ -51,7 +51,7 @@ func update_hidden_events_indicator(hidden_events_count:int = 0) -> void:

## Called by the visual timeline editor
func set_indent(indent: int) -> void:
$Indent.custom_minimum_size = Vector2(indent_size * indent, 0)
$Indent.custom_minimum_size = Vector2(indent_size * indent*DialogicUtil.get_editor_scale(), 0)
$Indent.visible = indent != 0
current_indent_level = indent
queue_redraw()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,11 @@ func _on_event_popup_menu_index_pressed(index:int) -> void:
offset_blocks_by_index(selected_items, +1)

elif index == 8:
var events_indexed := get_events_indexed([item])
var events_indexed : Dictionary
if item in selected_items:
events_indexed = get_events_indexed(selected_items)
else:
events_indexed = get_events_indexed([item])
TimelineUndoRedo.create_action("[D] Deleting 1 event.")
TimelineUndoRedo.add_do_method(delete_events_indexed.bind(events_indexed))
TimelineUndoRedo.add_undo_method(add_events_indexed.bind(events_indexed))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@ anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_left = 13.0
offset_top = -210.0
offset_right = 647.0
offset_top = -227.0
offset_right = 836.0
offset_bottom = -16.0
grow_vertical = 0
bbcode_enabled = true
text = "This is a fallback bubble, that is not actually connected to any character. In game use the following code to add speech bubbles to a character:
[color=darkgray]
var layout = Dialogic.start(@timeline_path)
layout.register_character(@character_resource, @node)
var layout = Dialogic.start(timeline_path)
layout.register_character(character_resource, node)
[/color]
[color=lightblue]@character_resource[/color] should be a loaded DialogicCharacter (a .dtl file)
[color=lightblue]@node[/color] should be the 2D node the bubble should point at."
[color=lightblue]@character_resource[/color] should be a loaded DialogicCharacter (a .dch file).
[color=lightblue]@node[/color] should be the 2D node the bubble should point at.
-> E.g. [color=darkgray]layout.register_character(load(\"res://path/to/my/character.dch\"), $BubbleMarker)"
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

[sub_resource type="AudioStream" id="AudioStream_pe27w"]

[node name="VN_Choice_Layer" type="Control"]
[node name="VN_ChoiceLayer" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("DialogicTextAnchor/DialogTextAnimationParent:position")
tracks/0/path = NodePath("Anchor/AnimationParent:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
Expand All @@ -28,7 +28,7 @@ tracks/0/keys = {
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("DialogicTextAnchor/DialogTextAnimationParent:rotation")
tracks/1/path = NodePath("Anchor/AnimationParent:rotation")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
Expand All @@ -40,7 +40,7 @@ tracks/1/keys = {
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("DialogicTextAnchor/DialogTextAnimationParent:scale")
tracks/2/path = NodePath("Anchor/AnimationParent:scale")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
Expand All @@ -52,7 +52,7 @@ tracks/2/keys = {
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("DialogicTextAnchor/DialogTextAnimationParent:modulate")
tracks/3/path = NodePath("Anchor/AnimationParent:modulate")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
Expand All @@ -64,7 +64,7 @@ tracks/3/keys = {
tracks/4/type = "bezier"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("DialogicTextAnchor/DialogTextAnimationParent/Sizer/DialogTextPanel:rotation")
tracks/4/path = NodePath("Anchor/AnimationParent/Sizer/DialogTextPanel:rotation")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
Expand All @@ -79,7 +79,7 @@ length = 0.4
tracks/0/type = "bezier"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("DialogicTextAnchor/DialogTextAnimationParent/Sizer/DialogTextPanel:rotation")
tracks/0/path = NodePath("Anchor/AnimationParent/Sizer/DialogTextPanel:rotation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
Expand All @@ -94,7 +94,7 @@ length = 0.7
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("DialogicTextAnchor/DialogTextAnimationParent:position")
tracks/0/path = NodePath("Anchor/AnimationParent:position")
tracks/0/interp = 2
tracks/0/loop_wrap = true
tracks/0/keys = {
Expand All @@ -106,7 +106,7 @@ tracks/0/keys = {
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("DialogicTextAnchor/DialogTextAnimationParent:modulate")
tracks/1/path = NodePath("Anchor/AnimationParent:modulate")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
Expand All @@ -118,7 +118,7 @@ tracks/1/keys = {
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("DialogicTextAnchor/DialogTextAnimationParent:rotation")
tracks/2/path = NodePath("Anchor/AnimationParent:rotation")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
Expand All @@ -130,7 +130,7 @@ tracks/2/keys = {
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("DialogicTextAnchor/DialogTextAnimationParent:scale")
tracks/3/path = NodePath("Anchor/AnimationParent:scale")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
Expand All @@ -146,7 +146,7 @@ length = 0.3
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("DialogicTextAnchor/DialogTextAnimationParent:position")
tracks/0/path = NodePath("Anchor/AnimationParent:position")
tracks/0/interp = 2
tracks/0/loop_wrap = true
tracks/0/keys = {
Expand All @@ -158,7 +158,7 @@ tracks/0/keys = {
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("DialogicTextAnchor/DialogTextAnimationParent:rotation")
tracks/1/path = NodePath("Anchor/AnimationParent:rotation")
tracks/1/interp = 2
tracks/1/loop_wrap = true
tracks/1/keys = {
Expand All @@ -170,7 +170,7 @@ tracks/1/keys = {
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("DialogicTextAnchor/DialogTextAnimationParent:scale")
tracks/2/path = NodePath("Anchor/AnimationParent:scale")
tracks/2/interp = 2
tracks/2/loop_wrap = true
tracks/2/keys = {
Expand All @@ -182,7 +182,7 @@ tracks/2/keys = {
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("DialogicTextAnchor/DialogTextAnimationParent:modulate")
tracks/3/path = NodePath("Anchor/AnimationParent:modulate")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
Expand All @@ -202,7 +202,7 @@ _data = {

[sub_resource type="FontVariation" id="FontVariation_v8y64"]

[node name="VN_Textbox_Layer" type="Control"]
[node name="VN_TextboxLayer" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
Expand All @@ -224,7 +224,7 @@ libraries = {
autoplay = "RESET"
script = ExtResource("2_xy7a2")

[node name="DialogicTextAnchor" type="Control" parent="."]
[node name="Anchor" type="Control" parent="."]
layout_mode = 1
anchors_preset = 7
anchor_left = 0.5
Expand All @@ -234,7 +234,7 @@ anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 0

[node name="DialogTextAnimationParent" type="Control" parent="DialogicTextAnchor"]
[node name="AnimationParent" type="Control" parent="Anchor"]
layout_mode = 1
anchors_preset = 7
anchor_left = 0.5
Expand All @@ -245,7 +245,7 @@ grow_horizontal = 2
grow_vertical = 0
mouse_filter = 2

[node name="Sizer" type="Control" parent="DialogicTextAnchor/DialogTextAnimationParent"]
[node name="Sizer" type="Control" parent="Anchor/AnimationParent"]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 7
Expand All @@ -259,7 +259,7 @@ offset_right = 150.0
grow_horizontal = 2
grow_vertical = 0

[node name="DialogTextPanel" type="PanelContainer" parent="DialogicTextAnchor/DialogTextAnimationParent/Sizer"]
[node name="DialogTextPanel" type="PanelContainer" parent="Anchor/AnimationParent/Sizer"]
unique_name_in_owner = true
self_modulate = Color(0.00784314, 0.00784314, 0.00784314, 0.843137)
custom_minimum_size = Vector2(300, 50)
Expand All @@ -273,7 +273,7 @@ mouse_filter = 2
theme_override_styles/panel = ExtResource("3_ssa84")
metadata/_edit_layout_mode = 1

[node name="DialogicNode_DialogText" type="RichTextLabel" parent="DialogicTextAnchor/DialogTextAnimationParent/Sizer/DialogTextPanel" node_paths=PackedStringArray("textbox_root")]
[node name="DialogicNode_DialogText" type="RichTextLabel" parent="Anchor/AnimationParent/Sizer/DialogTextPanel" node_paths=PackedStringArray("textbox_root")]
unique_name_in_owner = true
layout_mode = 2
mouse_filter = 1
Expand All @@ -288,12 +288,12 @@ visible_characters_behavior = 1
script = ExtResource("3_4634k")
textbox_root = NodePath("..")

[node name="DialogicNode_TypeSounds" type="AudioStreamPlayer" parent="DialogicTextAnchor/DialogTextAnimationParent/Sizer/DialogTextPanel/DialogicNode_DialogText"]
[node name="DialogicNode_TypeSounds" type="AudioStreamPlayer" parent="Anchor/AnimationParent/Sizer/DialogTextPanel/DialogicNode_DialogText"]
unique_name_in_owner = true
script = ExtResource("4_ma5mw")
play_every_character = 0

[node name="NextIndicator" type="Control" parent="DialogicTextAnchor/DialogTextAnimationParent/Sizer/DialogTextPanel"]
[node name="NextIndicator" type="Control" parent="Anchor/AnimationParent/Sizer/DialogTextPanel"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 8
Expand All @@ -303,7 +303,7 @@ show_on_questions = true
texture = ExtResource("6_uch03")
metadata/_edit_layout_mode = 1

[node name="AutoAdvanceProgressbar" type="ProgressBar" parent="DialogicTextAnchor/DialogTextAnimationParent/Sizer/DialogTextPanel"]
[node name="AutoAdvanceProgressbar" type="ProgressBar" parent="Anchor/AnimationParent/Sizer/DialogTextPanel"]
unique_name_in_owner = true
modulate = Color(1, 1, 1, 0.188235)
custom_minimum_size = Vector2(0, 10)
Expand All @@ -315,11 +315,11 @@ value = 0.5
show_percentage = false
script = ExtResource("6_07xym")

[node name="NameLabelHolder" type="Control" parent="DialogicTextAnchor/DialogTextAnimationParent/Sizer/DialogTextPanel"]
[node name="NameLabelHolder" type="Control" parent="Anchor/AnimationParent/Sizer/DialogTextPanel"]
layout_mode = 2
mouse_filter = 2

[node name="NameLabelPanel" type="PanelContainer" parent="DialogicTextAnchor/DialogTextAnimationParent/Sizer/DialogTextPanel/NameLabelHolder"]
[node name="NameLabelPanel" type="PanelContainer" parent="Anchor/AnimationParent/Sizer/DialogTextPanel/NameLabelHolder"]
unique_name_in_owner = true
self_modulate = Color(0.00784314, 0.00784314, 0.00784314, 0.843137)
layout_mode = 1
Expand All @@ -331,7 +331,7 @@ metadata/_edit_layout_mode = 1
metadata/_edit_use_custom_anchors = true
metadata/_edit_group_ = true

[node name="DialogicNode_NameLabel" type="Label" parent="DialogicTextAnchor/DialogTextAnimationParent/Sizer/DialogTextPanel/NameLabelHolder/NameLabelPanel" node_paths=PackedStringArray("name_label_root")]
[node name="DialogicNode_NameLabel" type="Label" parent="Anchor/AnimationParent/Sizer/DialogTextPanel/NameLabelHolder/NameLabelPanel" node_paths=PackedStringArray("name_label_root")]
unique_name_in_owner = true
layout_mode = 2
theme_override_colors/font_color = Color(1, 1, 1, 1)
Expand Down
32 changes: 16 additions & 16 deletions addons/dialogic/Resources/character.gd
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,36 @@ extends Resource
class_name DialogicCharacter


@export var display_name:String = ""
@export var nicknames:Array = []
## Resource that represents a character in dialog.
## Manages/contains portraits, custom info and translation of characters.

@export var color:Color = Color()
@export var description:String = ""
@export var display_name := ""
@export var nicknames := []

@export var scale:float = 1.0
@export var offset:Vector2 = Vector2()
@export var mirror:bool = false
@export var color := Color()
@export var description := ""

@export var default_portrait:String = ""
@export var portraits:Dictionary = {}
@export var scale := 1.0
@export var offset := Vector2()
@export var mirror := false

@export var custom_info:Dictionary = {}
@export var default_portrait := ""
@export var portraits := {}

@export var custom_info := {}

## All valid properties that can be accessed by their translation.
enum TranslatedProperties {
NAME,
NICKNAMES,
}

var _translation_id: String = ""

func __get_property_list() -> Array:
return []
var _translation_id := ""


func _to_string() -> String:
return "[{name}:{id}]".format({"name":get_character_name(), "id":get_instance_id()})

func _hide_script_from_inspector() -> bool:
return true

## This is automatically called, no need to use this.
func add_translation_id() -> String:
Expand All @@ -45,6 +43,7 @@ func add_translation_id() -> String:
func remove_translation_id() -> void:
_translation_id = ""


## Checks [param property] and matches it to a translation key.
##
## Undefined behaviour if an invalid integer is passed.
Expand Down Expand Up @@ -123,6 +122,7 @@ func get_character_name() -> String:
else:
return "UnnamedCharacter"


## Returns the info of the given portrait.
## Uses the default portrait if the given portrait doesn't exist.
func get_portrait_info(portrait_name:String) -> Dictionary:
Expand Down
Loading

0 comments on commit 812bf10

Please sign in to comment.