diff --git a/korman/nodes/node_conditions.py b/korman/nodes/node_conditions.py index 1b1abba..b903313 100644 --- a/korman/nodes/node_conditions.py +++ b/korman/nodes/node_conditions.py @@ -97,6 +97,11 @@ class PlasmaClickableNode(PlasmaNodeBase, bpy.types.Node): face_target = self.find_input_socket("facing") face_target.convert_subcondition(exporter, tree, clickable_bo, clickable_so, logicmod) + @property + def requires_actor(self): + face_target = self.find_input_socket("facing") + return face_target.enable_condition + class PlasmaClickableRegionNode(PlasmaNodeBase, bpy.types.Node): bl_category = "CONDITIONS" @@ -178,6 +183,10 @@ class PlasmaFacingTargetNode(PlasmaNodeBase, bpy.types.Node): layout.prop(self, "directional") layout.prop(self, "tolerance") + @property + def requires_actor(self): + return True + class PlasmaFacingTargetSocket(PlasmaNodeSocketBase, bpy.types.NodeSocket): bl_color = (0.0, 0.267, 0.247, 1.0) @@ -210,10 +219,6 @@ class PlasmaFacingTargetSocket(PlasmaNodeSocketBase, bpy.types.NodeSocket): # This is a programmer failure, so we need a traceback. raise RuntimeError("Tried to export an unused PlasmaFacingTargetSocket") - # Plasma internally depends on a CoordinateInterface. Since we're a node, we don't actually - # flag that in the exporter. Ensure it is generated now. - exporter.export_coordinate_interface(so, bo) - facing_key = exporter.mgr.find_create_key(plFacingConditionalObject, name=name, so=so) facing = facing_key.object facing.directional = directional diff --git a/korman/nodes/node_core.py b/korman/nodes/node_core.py index 625b2f8..3bcca4c 100644 --- a/korman/nodes/node_core.py +++ b/korman/nodes/node_core.py @@ -111,6 +111,10 @@ class PlasmaNodeBase: def poll(cls, context): return (context.bl_idname == "PlasmaNodeTree") + @property + def requires_actor(self): + return False + class PlasmaNodeVariableInput(PlasmaNodeBase): def ensure_sockets(self, idname, name, identifier=None): @@ -149,3 +153,10 @@ class PlasmaNodeTree(bpy.types.NodeTree): @classmethod def poll(cls, context): return (context.scene.render.engine == "PLASMA_GAME") + + @property + def requires_actor(self): + for node in self.nodes: + if node.requires_actor: + return True + return False diff --git a/korman/properties/modifiers/avatar.py b/korman/properties/modifiers/avatar.py index a35185d..2131abb 100644 --- a/korman/properties/modifiers/avatar.py +++ b/korman/properties/modifiers/avatar.py @@ -102,3 +102,7 @@ class PlasmaSittingBehavior(PlasmaModifierProperties, PlasmaModifierLogicWiz): # this socket must be explicitly disabled, otherwise it automatically generates a default # facing target conditional for us. isn't that nice? clickable.find_input_socket("facing").allow_simple = False + + @property + def requires_actor(self): + return self.facing_enabled diff --git a/korman/properties/modifiers/logic.py b/korman/properties/modifiers/logic.py index 7eaaca1..d622c5f 100644 --- a/korman/properties/modifiers/logic.py +++ b/korman/properties/modifiers/logic.py @@ -36,6 +36,11 @@ class PlasmaAdvancedLogic(PlasmaModifierProperties): tree = bpy.data.node_groups[self.tree_name] tree.export(exporter, bo, so) + @property + def requires_actor(self): + tree = bpy.data.node_groups[self.tree_name] + return tree.requires_actor + class PlasmaSpawnPoint(PlasmaModifierProperties): pl_id = "spawnpoint"