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.
This commit is contained in:
Lukas Toenne 2012-12-21 11:31:59 +00:00
parent e5b457dbc9
commit 74ea6d93da

@ -717,3 +717,12 @@ class Menu(StructRNA, _GenericUI, metaclass=RNAMeta):
self.path_menu(bpy.utils.preset_paths(self.preset_subdir), self.path_menu(bpy.utils.preset_paths(self.preset_subdir),
self.preset_operator, self.preset_operator,
filter_ext=lambda ext: ext.lower() in {".py", ".xml"}) 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]