Skip to content

Commit

Permalink
Merge pull request #1639 from zaknafean/anima-fixes
Browse files Browse the repository at this point in the history
Anima Fixes
  • Loading branch information
zaknafean authored Jul 19, 2023
2 parents 863ba11 + cc13abd commit 382efe1
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 4 deletions.
Binary file modified addons/dialogic/Localization/dialogic.de.translation
Binary file not shown.
Binary file modified addons/dialogic/Localization/dialogic.en.translation
Binary file not shown.
Binary file modified addons/dialogic/Localization/dialogic.es.translation
Binary file not shown.
Binary file modified addons/dialogic/Localization/dialogic.fr.translation
Binary file not shown.
Binary file modified addons/dialogic/Localization/dialogic.zh_CN.translation
Binary file not shown.
6 changes: 5 additions & 1 deletion addons/dialogic/Nodes/Anima/DialogicAnimaPropertiesHelper.gd
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ static func get_rotation(node: Node):

static func set_2D_pivot(node: Node, pivot: int) -> void:
var size: Vector2 = get_size(node)


# If node does not contain offset, just pivot from origin.
if node.get('offset') == null:
return

match pivot:
PIVOT.TOP_CENTER:
if node is Control:
Expand Down
14 changes: 11 additions & 3 deletions addons/dialogic/Nodes/DialogNode.gd
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,10 @@ func event_handler(event: Dictionary):
## PLEASE UPDATE THIS! BUT HOW?
emit_signal("event_start", "action", event)
set_state(state.WAITING)

#Animations safe for custom portraits with no animation-wait
var safeAnimations = ['1-fade_in.gd', '[No Animation]']

if event['character'] == '':# No character found on the event. Skip.
_load_next_event()
else:
Expand Down Expand Up @@ -714,7 +718,7 @@ func event_handler(event: Dictionary):
$Portraits.move_child(p, get_portrait_z_index_point(event.get('z_index', 0)))
p.z_index = event.get('z_index', 0)

if event.get('animation_wait', false):
if (p.get('custom_instance') != null or event.get('animation_wait', false)) and !(event.get('animation', '[No Animation]') in safeAnimations):
yield(p, 'animation_finished')


Expand All @@ -731,7 +735,7 @@ func event_handler(event: Dictionary):
if is_instance_valid(p) and p.character_data['file'] == event['character']:
event = insert_animation_data(event, 'leave', 'fade_out_down.gd')
p.animate(event.get('animation', 'instant_out.gd'), event.get('animation_length', 1), 1, true)
if event.get('animation_wait', false):
if (p.get('custom_instance') != null or event.get('animation_wait', false)) and event.get('animation', 'instant_out.gd') != "instant_out.gd":
yield(p, 'animation_finished')

# UPDATE MODE -------------------------------------------
Expand Down Expand Up @@ -759,9 +763,13 @@ func event_handler(event: Dictionary):
$Portraits.move_child(portrait, get_portrait_z_index_point(event.get('z_index', 0)))
portrait.z_index = event.get('z_index', 0)

# Covers edge case of changing timeline with custom portraits causing infinite yields
if event.get('animation') == '[Default]':
event = insert_animation_data(event, 'join', 'fade_in_up.gd')

portrait.animate(event.get('animation', '[No Animation]'), event.get('animation_length', 1), event.get('animation_repeat', 1))

if event.get('animation_wait', false) and event.get('animation', '[No Animation]') != "[No Animation]":
if portrait.get('custom_instance') != null or (event.get('animation_wait', false) and event.get('animation', '[No Animation]') != "[No Animation]"):
yield(portrait, 'animation_finished')
set_state(state.READY)
_load_next_event()
Expand Down

0 comments on commit 382efe1

Please sign in to comment.