Browse Source

Fix #205.

pull/207/head
Adam Johnson 4 years ago
parent
commit
a3e5af042f
Signed by: Hoikas
GPG Key ID: 0B6515D6FF6F271E
  1. 14
      korman/nodes/node_responder.py

14
korman/nodes/node_responder.py

@ -291,7 +291,7 @@ class PlasmaResponderStateNode(PlasmaNodeBase, bpy.types.Node):
# Convert the commands # Convert the commands
commands = CommandMgr(stateMgr.responder) commands = CommandMgr(stateMgr.responder)
for i in self.find_outputs("msgs"): for i in self._get_child_messages():
# slight optimization--commands attached to states can't wait on other commands # slight optimization--commands attached to states can't wait on other commands
# namely because it's impossible to wait on a command that doesn't exist... # namely because it's impossible to wait on a command that doesn't exist...
self._generate_command(exporter, so, stateMgr.responder, commands, i) self._generate_command(exporter, so, stateMgr.responder, commands, i)
@ -340,16 +340,24 @@ class PlasmaResponderStateNode(PlasmaNodeBase, bpy.types.Node):
if msgNode.has_callbacks: if msgNode.has_callbacks:
commandMgr.add_waitable_node(msgNode) commandMgr.add_waitable_node(msgNode)
if msgNode.find_output("msgs"): if msgNode.has_linked_callbacks:
childWaitOn = commandMgr.add_wait(idx) childWaitOn = commandMgr.add_wait(idx)
msgNode.convert_callback_message(exporter, so, msg, responder.key, childWaitOn) msgNode.convert_callback_message(exporter, so, msg, responder.key, childWaitOn)
else: else:
childWaitOn = waitOn childWaitOn = waitOn
# Export any linked callback messages # Export any linked callback messages
for i in msgNode.find_outputs("msgs"): for i in self._get_child_messages(msgNode):
self._generate_command(exporter, so, responder, commandMgr, i, childWaitOn) self._generate_command(exporter, so, responder, commandMgr, i, childWaitOn)
def _get_child_messages(self, node=None):
"""Returns a list of the message nodes sent by `node`. The list is sorted such that any
messages with callbacks are last in the list, allowing proper wait generation.
"""
if node is None:
node = self
return sorted(node.find_outputs("msgs"), key=lambda x: x.has_callbacks and x.has_linked_callbacks)
class PlasmaRespStateSocket(PlasmaNodeSocketBase, bpy.types.NodeSocket): class PlasmaRespStateSocket(PlasmaNodeSocketBase, bpy.types.NodeSocket):
bl_color = (0.388, 0.78, 0.388, 1.0) bl_color = (0.388, 0.78, 0.388, 1.0)

Loading…
Cancel
Save