[Bf-blender-cvs] [6f99c84] object_nodes: Introduced a UI node socket type for affine transforms.

Lukas Tönne noreply at git.blender.org
Mon Dec 7 10:10:21 CET 2015


Commit: 6f99c84123f1793f5f9bf63cce94b277f5cb53f1
Author: Lukas Tönne
Date:   Mon Dec 7 09:31:48 2015 +0100
Branches: object_nodes
https://developer.blender.org/rB6f99c84123f1793f5f9bf63cce94b277f5cb53f1

Introduced a UI node socket type for affine transforms.

This matches the matrix44 internal bvm type. It is useful particulary
for describing rotations.

===================================================================

M	release/scripts/nodes/socket_types.py

===================================================================

diff --git a/release/scripts/nodes/socket_types.py b/release/scripts/nodes/socket_types.py
index e386f4e..a7d59c9 100644
--- a/release/scripts/nodes/socket_types.py
+++ b/release/scripts/nodes/socket_types.py
@@ -25,6 +25,17 @@ from bpy.props import *
 ###############################################################################
 # Socket Types
 
+class TransformSocket(NodeSocket):
+    '''Affine 3D transformation'''
+    bl_idname = 'TransformSocket'
+    bl_label = 'Transform'
+
+    def draw(self, context, layout, node, text):
+        layout.label(text)
+
+    def draw_color(self, context, node):
+        return (0.59, 0.67, 0.00, 1.00)
+
 class GeometrySocket(NodeSocket):
     '''Geometry data socket'''
     bl_idname = 'GeometrySocket'
@@ -48,6 +59,7 @@ socket_type_items = [
     ("VECTOR", "Vector", "3D vector", 0, 2),
     ("COLOR", "Color", "RGBA color", 0, 3),
     ("MESH", "Mesh", "Mesh data", 0, 4),
+    ("TRANSFORM", "Transform", "Affine transformation", 0, 5),
     ]
 
 def socket_type_to_rna(base_type):
@@ -57,6 +69,7 @@ def socket_type_to_rna(base_type):
         "VECTOR" : bpy.types.NodeSocketVector,
         "COLOR" : bpy.types.NodeSocketColor,
         "MESH" : bpy.types.GeometrySocket,
+        "TRANSFORM" : bpy.types.TransformSocket,
         }
     return types.get(base_type, None)
 
@@ -71,6 +84,8 @@ def socket_to_bvm_type(socket):
         return 'INT'
     elif isinstance(socket, bpy.types.GeometrySocket):
         return 'MESH'
+    elif isinstance(socket, bpy.types.TransformSocket):
+        return 'MATRIX44'
 
 # determines if a conversion is necessary and possible
 # and returns a new input socket to link




More information about the Bf-blender-cvs mailing list