From 74ea6d93da5c72616c15f756702fcde68ce0eec1 Mon Sep 17 00:00:00 2001 From: Lukas Toenne Date: Fri, 21 Dec 2012 11:31:59 +0000 Subject: [PATCH] Explicit python class for NodeSocket RNA type in bpy_types. This defines a utility property for getting links to or from a node socket, as discussed on bf-committers: http://lists.blender.org/pipermail/bf-committers/2012-December/038555.html Note: NodeTree and Node currently use standard python classes generated by bpy for now. The customnodes branch defines such classes as well, with specialized metaclasses for use with ID properties. Not needed in trunk yet. --- release/scripts/modules/bpy_types.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py index e42ae43aed6..a32feda5d0c 100644 --- a/release/scripts/modules/bpy_types.py +++ b/release/scripts/modules/bpy_types.py @@ -717,3 +717,12 @@ class Menu(StructRNA, _GenericUI, metaclass=RNAMeta): self.path_menu(bpy.utils.preset_paths(self.preset_subdir), self.preset_operator, filter_ext=lambda ext: ext.lower() in {".py", ".xml"}) + + +class NodeSocket(StructRNA, metaclass=RNAMeta): + __slots__ = () + + @property + def links(self): + """List of node links from or to this socket""" + return [link for link in self.id_data.links if link.from_socket == self or link.to_socket == self]