Skip to content

Commit

Permalink
Try to fix animation node
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo committed Jan 24, 2022
1 parent b7d0977 commit 9d8c7cb
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def read_file(name):
return f.read()


version = 'v1.4.6.1'
version = 'v1.4.6.2'
shortdesc = "Uplogic utility for UPBGE."
longdesc = '\n\n'.join([read_file(name) for name in [
'README.md',
Expand All @@ -30,7 +30,7 @@ def read_file(name):
author='Leopold Auersperg-Castell',
author_email='[email protected]',
url='https://github.com/UPBGE/uplogic',
download_url='https://github.com/UPBGE/uplogic/archive/refs/tags/v1.4.6.1.tar.gz',
download_url='https://github.com/UPBGE/uplogic/archive/refs/tags/v1.4.6.2.tar.gz',
license='GPLv2',
packages=[
'uplogic',
Expand Down
2 changes: 2 additions & 0 deletions uplogic/animation/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def __init__(
self._locked = False
self._speed = speed
self._frozen_speed = 0
self.finished = False
self.keep = keep
self._layer_weight = layer_weight
act_system = 'default'
Expand Down Expand Up @@ -224,6 +225,7 @@ def unpause(self):
self.speed = self._frozen_speed

def stop(self):
self.finished = True
self.on_finish()
self.game_object.stopAction(self.layer)

Expand Down
16 changes: 13 additions & 3 deletions uplogic/nodes/actions/playaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from uplogic.events import receive
from uplogic.nodes import ULActionNode
from uplogic.nodes import ULOutSocket
from uplogic.utils import STATUS_WAITING
from uplogic.utils import STATUS_INVALID, STATUS_WAITING
from uplogic.utils import is_invalid
from uplogic.utils import is_waiting
from uplogic.utils import not_met
Expand All @@ -31,10 +31,12 @@ def __init__(self):
self.old_speed = None
self.blendin = None
self.blend_mode = None
self.in_use = False
self._started = False
self._running = False
self._finished = False
self._action = None
self.action_evt = None
self.act_system = self.get_act_system()
self.STARTED = ULOutSocket(self, self._get_started)
self.FINISHED = ULOutSocket(self, self._get_finished)
Expand Down Expand Up @@ -77,29 +79,35 @@ def evaluate(self):
layer = self.get_input(self.layer)
game_object = self.get_input(self.game_object)
play_mode = self.get_input(self.play_mode)
self.action_evt = receive(self._action)
if not_met(condition):
self._set_ready()
if has_action:
action.speed = speed
action.layer_weight = layer_weight
if self._action.finished:
self._action = None
self.in_use = False
if play_mode > 2:
self._action.remove()
self._action = None
self.in_use = False
return
if self.in_use:
return
layer_action = self.act_system.get_layer(game_object, layer)
if layer_action is not self._action:
self._action = layer_action
action_name = self.get_input(self.action_name)
if has_action and action.name == action_name:
return
if has_action and not action.is_playing:
if has_action and action.finished:
self._action = None
start_frame = self.get_input(self.start_frame)
end_frame = self.get_input(self.end_frame)
priority = self.get_input(self.priority)
blendin = self.get_input(self.blendin)
blend_mode = self.get_input(self.blend_mode)
self.action_evt = receive(self._action)
self._set_ready()
if is_invalid(game_object):
return
Expand All @@ -126,6 +134,7 @@ def evaluate(self):
speed = 0.01
if is_invalid(game_object): # can't play
self._action = None
self.in_use = False

self._action = ULAction(
game_object,
Expand All @@ -140,3 +149,4 @@ def evaluate(self):
layer_weight,
blend_mode
)
self.in_use = True

0 comments on commit 9d8c7cb

Please sign in to comment.