[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53243] trunk/blender/release/scripts/ modules/bpy_types.py: Explicit python class for NodeSocket RNA type in bpy_types.

Lukas Toenne lukas.toenne at googlemail.com
Fri Dec 21 12:32:03 CET 2012


Revision: 53243
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53243
Author:   lukastoenne
Date:     2012-12-21 11:31:59 +0000 (Fri, 21 Dec 2012)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/release/scripts/modules/bpy_types.py

Modified: trunk/blender/release/scripts/modules/bpy_types.py
===================================================================
--- trunk/blender/release/scripts/modules/bpy_types.py	2012-12-21 11:13:46 UTC (rev 53242)
+++ trunk/blender/release/scripts/modules/bpy_types.py	2012-12-21 11:31:59 UTC (rev 53243)
@@ -717,3 +717,12 @@
         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]




More information about the Bf-blender-cvs mailing list