diff options
author | Lukas Toenne <lukas.toenne@googlemail.com> | 2012-12-21 15:31:59 +0400 |
---|---|---|
committer | Lukas Toenne <lukas.toenne@googlemail.com> | 2012-12-21 15:31:59 +0400 |
commit | 74ea6d93da5c72616c15f756702fcde68ce0eec1 (patch) | |
tree | a9a2826ebd4e529c5681a571e539fb713e50b868 /release/scripts | |
parent | e5b457dbc9f009740fe3cca2c8cb44fa88f1f03a (diff) |
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.
Diffstat (limited to 'release/scripts')
-rw-r--r-- | release/scripts/modules/bpy_types.py | 9 |
1 files changed, 9 insertions, 0 deletions
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] |