diff --git a/korman/nodes/node_conditions.py b/korman/nodes/node_conditions.py index f5ca156..6075383 100644 --- a/korman/nodes/node_conditions.py +++ b/korman/nodes/node_conditions.py @@ -141,9 +141,13 @@ class PlasmaClickableNode(idprops.IDPropObjectMixin, PlasmaNodeBase, bpy.types.N else: return (None, parent_so) - def harvest_actors(self): - if self.clickable_object: - return (self.clickable_object.name,) + def harvest_actors(self, bo): + actors = set() + if self.clickable_object is not None: + actors.add(self.clickable_object.name) + else: + actors.add(bo.name) + return actors @classmethod def _idprop_mapping(cls): diff --git a/korman/nodes/node_core.py b/korman/nodes/node_core.py index 74bbd04..927c19d 100644 --- a/korman/nodes/node_core.py +++ b/korman/nodes/node_core.py @@ -139,7 +139,7 @@ class PlasmaNodeBase: if idname == node.bl_idname: yield i - def harvest_actors(self): + def harvest_actors(self, bo): return set() @property @@ -368,12 +368,12 @@ class PlasmaNodeTree(bpy.types.NodeTree): return node return None - def harvest_actors(self): + def harvest_actors(self, bo): actors = set() for node in self.nodes: harvest_method = getattr(node, "harvest_actors", None) if harvest_method is not None: - actors.update(harvest_method()) + actors.update(harvest_method(bo)) elif not isinstance(node, PlasmaNodeBase): raise ExportError("Plasma Node Tree '{}' Node '{}': is not a valid node for this tree".format(self.id_data.name, node.name)) return actors diff --git a/korman/nodes/node_logic.py b/korman/nodes/node_logic.py index 7d5e10d..812571d 100644 --- a/korman/nodes/node_logic.py +++ b/korman/nodes/node_logic.py @@ -84,7 +84,7 @@ class PlasmaExcludeRegionNode(idprops.IDPropObjectMixin, PlasmaNodeBase, bpy.typ self.raise_error("Region must be set") return exporter.mgr.find_create_key(plExcludeRegionModifier, bl=self.region_object, name=self.key_name) - def harvest_actors(self): + def harvest_actors(self, bo): return [i.safepoint.name for i in self.find_input_sockets("safe_points") if i.safepoint is not None] def export(self, exporter, bo, parent_so): diff --git a/korman/nodes/node_messages.py b/korman/nodes/node_messages.py index 6c90411..7ac4f09 100644 --- a/korman/nodes/node_messages.py +++ b/korman/nodes/node_messages.py @@ -560,9 +560,13 @@ class PlasmaOneShotMsgNode(idprops.IDPropObjectMixin, PlasmaMessageWithCallbacks else: return exporter.mgr.find_create_key(plOneShotMod, name=name, so=so) - def harvest_actors(self): + def harvest_actors(self, bo): + actors = set() if self.pos_object: - return (self.pos_object.name,) + actors.add(self.pos_object.name) + else: + actors.add(bo.name) + return actors @property def has_callbacks(self): diff --git a/korman/nodes/node_python.py b/korman/nodes/node_python.py index c0ca09d..4b863cb 100644 --- a/korman/nodes/node_python.py +++ b/korman/nodes/node_python.py @@ -306,6 +306,15 @@ class PlasmaPythonFileNode(PlasmaVersionedNode, bpy.types.Node): if i.attribute_id == idx: yield i + def harvest_actors(self, bo): + actors = set() + actors.add(bo.name) + + so_nodes = (i.links[0].from_node for i in self.inputs + if i.is_linked and i.attribute_type in {"ptAttribSceneobject", "ptAttribSceneobjectList"}) + actors.update((i.target_object for i in so_nodes if i.target_object is not None)) + return actors + @property def key_name(self): # PFM names ***must*** be valid Python identifiers, but Blender likes inserting diff --git a/korman/properties/modifiers/logic.py b/korman/properties/modifiers/logic.py index 7a99ed4..f291462 100644 --- a/korman/properties/modifiers/logic.py +++ b/korman/properties/modifiers/logic.py @@ -81,7 +81,7 @@ class PlasmaAdvancedLogic(PlasmaModifierProperties): actors = set() for i in self.logic_groups: if i.node_tree is not None: - actors.update(i.node_tree.harvest_actors()) + actors.update(i.node_tree.harvest_actors(self.id_data)) return actors