[Bf-blender-cvs] [063b535] object_nodes: Moved the socket converter function into the socket_type module.

Lukas Tönne noreply at git.blender.org
Mon Dec 7 08:49:48 CET 2015


Commit: 063b5351df12afd5019c4d9b97be00d0eee46005
Author: Lukas Tönne
Date:   Sun Dec 6 17:25:56 2015 +0100
Branches: object_nodes
https://developer.blender.org/rB063b5351df12afd5019c4d9b97be00d0eee46005

Moved the socket converter function into the socket_type module.

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

M	release/scripts/nodes/node_compiler.py
M	release/scripts/nodes/socket_types.py

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

diff --git a/release/scripts/nodes/node_compiler.py b/release/scripts/nodes/node_compiler.py
index 0584670..1d57428 100644
--- a/release/scripts/nodes/node_compiler.py
+++ b/release/scripts/nodes/node_compiler.py
@@ -19,7 +19,7 @@
 # <pep8-80 compliant>
 
 from collections import OrderedDict
-from socket_types import socket_type_to_bvm
+from socket_types import socket_type_to_bvm, convert_sockets
 
 # Utility dict type that works like RNA collections,
 # i.e. accepts both string keys and integer indices
@@ -40,41 +40,6 @@ class StringDict(OrderedDict):
 # RNA does not allow collections of temporary (node,socket) pairs,
 # so we use python wrappers to pass them around as a single object
 
-def convert_sockets(compiler, from_typedesc, to_typedesc):
-    from_type = from_typedesc.base_type
-    to_type = to_typedesc.base_type
-
-    if to_type == from_type:
-        node = compiler.add_node("PASS_%s" % to_type)
-        return {node.inputs[0]}, node.outputs[0]
-
-    if to_type == 'FLOAT':
-        if from_type == 'INT':
-            node = compiler.add_node("INT_TO_FLOAT")
-            return {node.inputs[0]}, node.outputs[0]
-        elif from_type == 'FLOAT3':
-            node = compiler.add_node("SET_FLOAT3")
-            return {node.inputs[0], node.inputs[1], node.inputs[2]}, node.outputs[0]
-        elif from_type == 'FLOAT4':
-            node = compiler.add_node("SET_FLOAT4")
-            return {node.inputs[0], node.inputs[1], node.inputs[2], node.inputs[3]}, node.outputs[0]
-    
-    elif to_type == 'FLOAT3':
-        pass
-    
-    elif to_type == 'FLOAT4':
-        pass
-    
-    elif to_type == 'INT':
-        if from_type == 'FLOAT':
-            node = compiler.add_node("FLOAT_TO_INT")
-            return {node.inputs[0]}, node.outputs[0]
-    
-    elif to_type == 'MATRIX44':
-        pass
-
-    return set(), None
-
 class InputWrapper:
     def __init__(self, gnode, ginput):
         self.gnode = gnode
diff --git a/release/scripts/nodes/socket_types.py b/release/scripts/nodes/socket_types.py
index 89d2aa1..dba8f93 100644
--- a/release/scripts/nodes/socket_types.py
+++ b/release/scripts/nodes/socket_types.py
@@ -72,6 +72,41 @@ def socket_type_to_bvm(socket):
     elif isinstance(socket, bpy.types.GeometrySocket):
         return 'MESH'
 
+def convert_sockets(compiler, from_typedesc, to_typedesc):
+    from_type = from_typedesc.base_type
+    to_type = to_typedesc.base_type
+
+    if to_type == from_type:
+        node = compiler.add_node("PASS_%s" % to_type)
+        return {node.inputs[0]}, node.outputs[0]
+
+    if to_type == 'FLOAT':
+        if from_type == 'INT':
+            node = compiler.add_node("INT_TO_FLOAT")
+            return {node.inputs[0]}, node.outputs[0]
+        elif from_type == 'FLOAT3':
+            node = compiler.add_node("SET_FLOAT3")
+            return {node.inputs[0], node.inputs[1], node.inputs[2]}, node.outputs[0]
+        elif from_type == 'FLOAT4':
+            node = compiler.add_node("SET_FLOAT4")
+            return {node.inputs[0], node.inputs[1], node.inputs[2], node.inputs[3]}, node.outputs[0]
+    
+    elif to_type == 'FLOAT3':
+        pass
+    
+    elif to_type == 'FLOAT4':
+        pass
+    
+    elif to_type == 'INT':
+        if from_type == 'FLOAT':
+            node = compiler.add_node("FLOAT_TO_INT")
+            return {node.inputs[0]}, node.outputs[0]
+    
+    elif to_type == 'MATRIX44':
+        pass
+
+    return set(), None
+
 ###############################################################################
 
 def register():




More information about the Bf-blender-cvs mailing list