Skip to content

Commit 1cf2582

Browse files
authored
Allow any Texture type to be assigned as Indicator icon (dialogic-godot#2054)
Being restricted to specific filename formats prevented the use of things like AniamtedTexture Made the Texture conditional checking more clear and consistent too.
1 parent 17683f8 commit 1cf2582

2 files changed

Lines changed: 14 additions & 8 deletions

File tree

addons/dialogic/Modules/DefaultLayoutParts/Layer_VN_Textbox/vn_textbox_layer.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ enum AnimationsNewText {NONE, WIGGLE}
7373
@export var next_indicator_show_on_questions: bool = true
7474
@export var next_indicator_show_on_autoadvance: bool = false
7575
@export_enum('bounce', 'blink', 'none') var next_indicator_animation: int = 0
76-
@export_file("*.png","*.svg") var next_indicator_texture: String = ''
76+
@export_file("*.png","*.svg","*.tres") var next_indicator_texture: String = ''
7777
@export var next_indicator_size: Vector2 = Vector2(25,25)
7878

7979
@export_subgroup("Autoadvance")

addons/dialogic/Modules/Text/node_next_indicator.gd

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@ extends Control
1515

1616
## What animation should the indicator do.
1717
@export_enum('bounce', 'blink', 'none') var animation := 0
18+
19+
var texture_rect : TextureRect
20+
1821
## Set the image to use as the indicator.
19-
@export var texture := preload("res://addons/dialogic/Example Assets/next-indicator/next-indicator.png"):
22+
@export var texture : Texture2D = preload("res://addons/dialogic/Example Assets/next-indicator/next-indicator.png") as Texture2D:
2023
set(_texture):
2124
texture = _texture
22-
if has_node('Texture'):
23-
get_node('Texture').texture = texture
25+
if texture_rect:
26+
texture_rect.texture = texture
2427

2528
@export var texture_size := Vector2(32,32):
2629
set(_texture_size):
@@ -34,17 +37,20 @@ var tween: Tween
3437

3538
func _ready():
3639
add_to_group('dialogic_next_indicator')
37-
# Creating texture
38-
if texture:
40+
41+
# Creating TextureRect if missing
42+
if not texture_rect:
3943
var icon := TextureRect.new()
4044
icon.name = 'Texture'
4145
icon.ignore_texture_size = true
4246
icon.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
4347
icon.size = texture_size
4448
icon.position = -icon.size
4549
add_child(icon)
46-
icon.texture = texture
47-
50+
texture_rect = icon
51+
52+
texture_rect.texture = texture
53+
4854
hide()
4955
visibility_changed.connect(_on_visibility_changed)
5056

0 commit comments

Comments
 (0)