[Bf-blender-cvs] [b3bfc89] object_nodes: Leave the creation of proxies for bNode inputs/outputs to the node compiler.

Lukas Tönne noreply at git.blender.org
Sun Dec 6 13:44:45 CET 2015


Commit: b3bfc8915ea4d153db17c356488bdc9e73857d3d
Author: Lukas Tönne
Date:   Sun Dec 6 13:01:32 2015 +0100
Branches: object_nodes
https://developer.blender.org/rBb3bfc8915ea4d153db17c356488bdc9e73857d3d

Leave the creation of proxies for bNode inputs/outputs to the node compiler.

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

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

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

diff --git a/release/scripts/nodes/common_nodes.py b/release/scripts/nodes/common_nodes.py
index ded9e7e..0377118 100644
--- a/release/scripts/nodes/common_nodes.py
+++ b/release/scripts/nodes/common_nodes.py
@@ -20,10 +20,9 @@
 
 import bpy
 import nodeitems_utils
-from bpy.types import Operator, ObjectNode, NodeTree, Node, NodeSocket
+from bpy.types import Operator, ObjectNode
 from bpy.props import *
-from node_compiler import NodeCompiler, NodeWrapper, InputWrapper, OutputWrapper, StringDict
-from socket_types import socket_type_to_bvm
+from node_compiler import NodeCompiler, NodeWrapper, InputWrapper, OutputWrapper
 
 class NodeTreeBase():
     def bvm_compile(self, context, graph):
@@ -40,23 +39,7 @@ class NodeTreeBase():
             if not hasattr(bnode, "compile"):
                 continue
 
-            # proxies for inputs/outputs
-            bnode_inputs = StringDict()
-            for binput in bnode.inputs:
-                proxy = compiler.add_proxy(socket_type_to_bvm(binput))
-                bnode_inputs[binput.identifier] = proxy.outputs[0]
-                input_map[(bnode, binput)] = proxy.inputs[0]
-
-                if hasattr(binput, "default_value"):
-                    proxy.inputs[0].set_value(binput.default_value)
-            
-            bnode_outputs = StringDict()
-            for boutput in bnode.outputs:
-                proxy = compiler.add_proxy(socket_type_to_bvm(boutput))
-                bnode_outputs[boutput.identifier] = proxy.inputs[0]
-                output_map[(bnode, boutput)] = proxy.outputs[0]
-
-            compiler.push(bnode, bnode_inputs, bnode_outputs)
+            compiler.push(bnode, input_map, output_map)
             bnode.compile(compiler)
             compiler.pop()
 
diff --git a/release/scripts/nodes/node_compiler.py b/release/scripts/nodes/node_compiler.py
index a2c0ffa..c306f7a 100644
--- a/release/scripts/nodes/node_compiler.py
+++ b/release/scripts/nodes/node_compiler.py
@@ -19,6 +19,7 @@
 # <pep8-80 compliant>
 
 from collections import OrderedDict
+from socket_types import socket_type_to_bvm
 
 # Utility dict type that works like RNA collections,
 # i.e. accepts both string keys and integer indices
@@ -110,7 +111,23 @@ class NodeCompiler:
         self.graph = graph
         self.bnode_stack = []
 
-    def push(self, bnode, bnode_inputs, bnode_outputs):
+    def push(self, bnode, input_map, output_map):
+        # proxies for inputs/outputs
+        bnode_inputs = StringDict()
+        for binput in bnode.inputs:
+            proxy = self.add_proxy(socket_type_to_bvm(binput))
+            bnode_inputs[binput.identifier] = proxy.outputs[0]
+            input_map[(bnode, binput)] = proxy.inputs[0]
+
+            if hasattr(binput, "default_value"):
+                proxy.inputs[0].set_value(binput.default_value)
+        
+        bnode_outputs = StringDict()
+        for boutput in bnode.outputs:
+            proxy = self.add_proxy(socket_type_to_bvm(boutput))
+            bnode_outputs[boutput.identifier] = proxy.inputs[0]
+            output_map[(bnode, boutput)] = proxy.outputs[0]
+
         self.bnode_stack.append((bnode, bnode_inputs, bnode_outputs))
 
     def pop(self):




More information about the Bf-blender-cvs mailing list