From 8ebb68a98b0e4b5cfac432b5d721df1c6def1cd9 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Wed, 29 Mar 2023 20:32:56 -0400 Subject: [PATCH] Fix Sound Message Nodes crashing the exporter. (#368) If a sound message was being sent to a random sound modifier, the responder tree might crash on export. This fixes that particular problem and adds a mitigation to the responder code itself. Remember kids that, in Python `None and True` is `None`... --- korman/nodes/node_messages.py | 1 + korman/nodes/node_responder.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/korman/nodes/node_messages.py b/korman/nodes/node_messages.py index 1c2fa4d..c36f39a 100644 --- a/korman/nodes/node_messages.py +++ b/korman/nodes/node_messages.py @@ -893,6 +893,7 @@ class PlasmaSoundMsgNode(idprops.IDPropObjectMixin, PlasmaMessageWithCallbacksNo def has_callbacks(self): if not self.is_random_sound: return self.event != "NONE" + return False @classmethod def _idprop_mapping(cls): diff --git a/korman/nodes/node_responder.py b/korman/nodes/node_responder.py index 10ccf69..9acaf3a 100644 --- a/korman/nodes/node_responder.py +++ b/korman/nodes/node_responder.py @@ -356,7 +356,7 @@ class PlasmaResponderStateNode(PlasmaNodeBase, bpy.types.Node): """ if node is None: node = self - return sorted(node.find_outputs("msgs"), key=lambda x: x.has_callbacks and x.has_linked_callbacks) + return sorted(node.find_outputs("msgs"), key=lambda x: bool(x.has_callbacks and x.has_linked_callbacks)) class PlasmaRespStateSocket(PlasmaNodeSocketBase, bpy.types.NodeSocket):