[Bf-extensions-cvs] [b714750] master: Node Wrangler back in blender render and textures

Bartek Skorupa noreply at git.blender.org
Tue Oct 21 21:48:27 CEST 2014


Commit: b714750bf00bd6aaf2c87afad533eb01b68861b8
Author: Bartek Skorupa
Date:   Tue Oct 21 21:48:21 2014 +0200
Branches: master
https://developer.blender.org/rBAb714750bf00bd6aaf2c87afad533eb01b68861b8

Node Wrangler back in blender render and textures

Node Wrangler now works in all node tree types.
Previously it was disabled for texture nodes and for blender render
material nodes because in those node types it was giving more errors
than advantages.
Now it works everywhere.

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

M	node_efficiency_tools.py

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

diff --git a/node_efficiency_tools.py b/node_efficiency_tools.py
index b252f7c..79071e9 100644
--- a/node_efficiency_tools.py
+++ b/node_efficiency_tools.py
@@ -19,7 +19,7 @@
 bl_info = {
     "name": "Node Wrangler (aka Nodes Efficiency Tools)",
     "author": "Bartek Skorupa, Greg Zaal",
-    "version": (3, 17),
+    "version": (3, 18),
     "blender": (2, 72, 0),
     "location": "Node Editor Properties Panel or Ctrl-Space",
     "description": "Various tools to enhance and speed up node-based workflow",
@@ -311,6 +311,137 @@ compo_layout_nodes_props = (
     ('NodeReroute', 'REROUTE', 'Reroute'),
     ('CompositorNodeSwitch', 'SWITCH', 'Switch'),
 )
+# Blender Render material nodes
+# (rna_type.identifier, type, rna_type.name)
+# Keeping mixed case to avoid having to translate entries when adding new nodes in operators.
+blender_mat_input_nodes_props = (
+    ('ShaderNodeMaterial', 'MATERIAL', 'Material'),
+    ('ShaderNodeCameraData', 'CAMERA', 'Camera Data'),
+    ('ShaderNodeLampData', 'LAMP', 'Lamp Data'),
+    ('ShaderNodeValue', 'VALUE', 'Value'),
+    ('ShaderNodeRGB', 'RGB', 'RGB'),
+    ('ShaderNodeTexture', 'TEXTURE', 'Texture'),
+    ('ShaderNodeGeometry', 'GEOMETRY', 'Geometry'),
+    ('ShaderNodeExtendedMaterial', 'MATERIAL_EXT', 'Extended Material'),
+)
+
+# (rna_type.identifier, type, rna_type.name)
+# Keeping mixed case to avoid having to translate entries when adding new nodes in operators.
+blender_mat_output_nodes_props = (
+    ('ShaderNodeOutput', 'OUTPUT', 'Output'),
+)
+
+# (rna_type.identifier, type, rna_type.name)
+# Keeping mixed case to avoid having to translate entries when adding new nodes in operators.
+blender_mat_color_nodes_props = (
+    ('ShaderNodeMixRGB', 'MIX_RGB', 'MixRGB'),
+    ('ShaderNodeRGBCurve', 'CURVE_RGB', 'RGB Curves'),
+    ('ShaderNodeInvert', 'INVERT', 'Invert'),
+    ('ShaderNodeHueSaturation', 'HUE_SAT', 'Hue/Saturation'),
+)
+
+# (rna_type.identifier, type, rna_type.name)
+# Keeping mixed case to avoid having to translate entries when adding new nodes in operators.
+blender_mat_vector_nodes_props = (
+    ('ShaderNodeNormal', 'NORMAL', 'Normal'),
+    ('ShaderNodeMapping', 'MAPPING', 'Mapping'),
+    ('ShaderNodeVectorCurve', 'CURVE_VEC', 'Vector Curves'),
+)
+
+# (rna_type.identifier, type, rna_type.name)
+# Keeping mixed case to avoid having to translate entries when adding new nodes in operators.
+blender_mat_converter_nodes_props = (
+    ('ShaderNodeValToRGB', 'VALTORGB', 'ColorRamp'),
+    ('ShaderNodeRGBToBW', 'RGBTOBW', 'RGB to BW'),
+    ('ShaderNodeMath', 'MATH', 'Math'),
+    ('ShaderNodeVectorMath', 'VECT_MATH', 'Vector Math'),
+    ('ShaderNodeSqueeze', 'SQUEEZE', 'Squeeze Value'),
+    ('ShaderNodeSeparateRGB', 'SEPRGB', 'Separate RGB'),
+    ('ShaderNodeCombineRGB', 'COMBRGB', 'Combine RGB'),
+    ('ShaderNodeSeparateHSV', 'SEPHSV', 'Separate HSV'),
+    ('ShaderNodeCombineHSV', 'COMBHSV', 'Combine HSV'),
+)
+
+# (rna_type.identifier, type, rna_type.name)
+# Keeping mixed case to avoid having to translate entries when adding new nodes in operators.
+blender_mat_layout_nodes_props = (
+    ('NodeReroute', 'REROUTE', 'Reroute'),
+)
+
+# Texture Nodes
+# (rna_type.identifier, type, rna_type.name)
+# Keeping mixed case to avoid having to translate entries when adding new nodes in operators.
+texture_input_nodes_props = (
+    ('TextureNodeCurveTime', 'CURVE_TIME', 'Curve Time'),
+    ('TextureNodeCoordinates', 'COORD', 'Coordinates'),
+    ('TextureNodeTexture', 'TEXTURE', 'Texture'),
+    ('TextureNodeImage', 'IMAGE', 'Image'),
+)
+
+# (rna_type.identifier, type, rna_type.name)
+# Keeping mixed case to avoid having to translate entries when adding new nodes in operators.
+texture_output_nodes_props = (
+    ('TextureNodeOutput', 'OUTPUT', 'Output'),
+    ('TextureNodeViewer', 'VIEWER', 'Viewer'),
+)
+
+# (rna_type.identifier, type, rna_type.name)
+# Keeping mixed case to avoid having to translate entries when adding new nodes in operators.
+texture_color_nodes_props = (
+    ('TextureNodeMixRGB', 'MIX_RGB', 'Mix RGB'),
+    ('TextureNodeCurveRGB', 'CURVE_RGB', 'RGB Curves'),
+    ('TextureNodeInvert', 'INVERT', 'Invert'),
+    ('TextureNodeHueSaturation', 'HUE_SAT', 'Hue/Saturation'),
+    ('TextureNodeCompose', 'COMPOSE', 'Combine RGBA'),
+    ('TextureNodeDecompose', 'DECOMPOSE', 'Separate RGBA'),
+)
+
+# (rna_type.identifier, type, rna_type.name)
+# Keeping mixed case to avoid having to translate entries when adding new nodes in operators.
+texture_pattern_nodes_props = (
+    ('TextureNodeChecker', 'CHECKER', 'Checker'),
+    ('TextureNodeBricks', 'BRICKS', 'Bricks'),
+)
+
+# (rna_type.identifier, type, rna_type.name)
+# Keeping mixed case to avoid having to translate entries when adding new nodes in operators.
+texture_textures_nodes_props = (
+    ('TextureNodeTexNoise', 'TEX_NOISE', 'Noise'),
+    ('TextureNodeTexDistNoise', 'TEX_DISTNOISE', 'Distorted Noise'),
+    ('TextureNodeTexClouds', 'TEX_CLOUDS', 'Clouds'),
+    ('TextureNodeTexBlend', 'TEX_BLEND', 'Blend'),
+    ('TextureNodeTexVoronoi', 'TEX_VORONOI', 'Voronoi'),
+    ('TextureNodeTexMagic', 'TEX_MAGIC', 'Magic'),
+    ('TextureNodeTexMarble', 'TEX_MARBLE', 'Marble'),
+    ('TextureNodeTexWood', 'TEX_WOOD', 'Wood'),
+    ('TextureNodeTexMusgrave', 'TEX_MUSGRAVE', 'Musgrave'),
+    ('TextureNodeTexStucci', 'TEX_STUCCI', 'Stucci'),
+)
+
+# (rna_type.identifier, type, rna_type.name)
+# Keeping mixed case to avoid having to translate entries when adding new nodes in operators.
+texture_converter_nodes_props = (
+    ('TextureNodeMath', 'MATH', 'Math'),
+    ('TextureNodeValToRGB', 'VALTORGB', 'ColorRamp'),
+    ('TextureNodeRGBToBW', 'RGBTOBW', 'RGB to BW'),
+    ('TextureNodeValToNor', 'VALTONOR', 'Value to Normal'),
+    ('TextureNodeDistance', 'DISTANCE', 'Distance'),
+)
+
+# (rna_type.identifier, type, rna_type.name)
+# Keeping mixed case to avoid having to translate entries when adding new nodes in operators.
+texture_distort_nodes_props = (
+    ('TextureNodeScale', 'SCALE', 'Scale'),
+    ('TextureNodeTranslate', 'TRANSLATE', 'Translate'),
+    ('TextureNodeRotate', 'ROTATE', 'Rotate'),
+    ('TextureNodeAt', 'AT', 'At'),
+)
+
+# (rna_type.identifier, type, rna_type.name)
+# Keeping mixed case to avoid having to translate entries when adding new nodes in operators.
+texture_layout_nodes_props = (
+    ('NodeReroute', 'REROUTE', 'Reroute'),
+)
 
 # list of blend types of "Mix" nodes in a form that can be used as 'items' for EnumProperty.
 # used list, not tuple for easy merging with other lists.
@@ -944,12 +1075,9 @@ class NWNodeWrangler(bpy.types.AddonPreferences):
 
 def nw_check(context):
     space = context.space_data
-    is_cycles = context.scene.render.engine == 'CYCLES'
     valid = False
     if space.type == 'NODE_EDITOR' and space.node_tree is not None:
-        type = space.node_tree.type
-        if type == 'COMPOSITING' or (type == 'SHADER' and is_cycles):
-            valid = True
+        valid = True
         
     return valid    
 
@@ -1362,10 +1490,11 @@ class NWEmissionViewer(Operator, NWBase):
 
     @classmethod
     def poll(cls, context):
+        is_cycles = context.scene.render.engine == 'CYCLES'
         valid = False
         if nw_check(context):
             space = context.space_data
-            if space.tree_type == 'ShaderNodeTree' and\
+            if space.tree_type == 'ShaderNodeTree' and is_cycles and\
                 (context.active_node.type != "OUTPUT_MATERIAL" or context.active_node.type != "OUTPUT_WORLD"):
                 valid = True
         return valid
@@ -1567,7 +1696,21 @@ class NWSwitchNodeType(Operator, NWBase):
         list(compo_vector_nodes_props) +
         list(compo_matte_nodes_props) +
         list(compo_distort_nodes_props) +
-        list(compo_layout_nodes_props),
+        list(compo_layout_nodes_props) +
+        list(blender_mat_input_nodes_props) +
+        list(blender_mat_output_nodes_props) +
+        list(blender_mat_color_nodes_props) +
+        list(blender_mat_vector_nodes_props) +
+        list(blender_mat_converter_nodes_props) +
+        list(blender_mat_layout_nodes_props) +
+        list(texture_input_nodes_props) +
+        list(texture_output_nodes_props) +
+        list(texture_color_nodes_props) +
+        list(texture_pattern_nodes_props) +
+        list(texture_textures_nodes_props) +
+        list(texture_converter_nodes_props) +
+        list(texture_distort_nodes_props) +
+        list(texture_layout_nodes_props)
     )
 
     def execute(self, context):
@@ -1784,6 +1927,8 @@ class NWMergeNodes(Operator, NWBase):
             node_type = 'CompositorNode'
         elif tree_type == 'SHADER':
             node_type = 'ShaderNode'
+        elif tree_type == 'TEXTURE':
+            node_type = 'TextureNode'
         nodes, links = get_nodes_links(context)
         mode = self.mode
         merge_type = self.merge_type
@@ -2268,7 +2413,7 @@ class NWAddTextureSetup(Operator, NWBase):
         valid = False
         if nw_check(context):
             space = context.space_data
-            if space.tree_type == 'ShaderNodeTree':
+            if space.tree_type == 'ShaderNodeTree' and context.scene.render.engine == 'CYCLES':
                 valid = True
         return valid
 
@@ -2682,7 +2827,9 @@ class NWLinkToOutputNode(Operator, NWBase):
         tree_type = context.space_data.tree_type
         output_types_shaders = [x[1] for x in shaders_output_nodes_props]
         output_types_compo = ['COMPOSITE']
-        output_types = output_types_shaders + output_types_compo
+        output_types_blender_mat = ['OUTPUT']
+        output_types_textures = ['OUTPUT']
+        output_types = output_types_shaders + output_types_compo + output_types_blender_mat
         for node in nodes:
             if node.type in output_types:
                 output_node = node
@@ -2690,9 +2837,14 @@ class NWLinkToOutputNode(Operator, NWBase):
         if not output_node:
             bpy.ops.node.select_all(action="DESELECT")
             if tree_type == 'ShaderNodeTree':
-                output_node = nodes.new('ShaderNodeOutputMaterial')
+                if context.scene.render.engine == 'CYCLES':
+                    output_node = nodes.new

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list