Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Zaal <gregzzmail@gmail.com>2015-01-29 16:42:27 +0300
committerGreg Zaal <gregzzmail@gmail.com>2015-01-29 16:42:27 +0300
commit1bfb67e65117d89eb4552be42ace4dd5052107b4 (patch)
tree3797391cba32b3179d7bc0b8b76f1cf78baf5937 /node_wrangler.py
parent06e88a87815f9e275e525885f8b1ad1a30557eef (diff)
Node Wrangler: Fix emission viewer using material output for lamps.
Now correctly uses lamp output.
Diffstat (limited to 'node_wrangler.py')
-rw-r--r--node_wrangler.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/node_wrangler.py b/node_wrangler.py
index ce8cfb9a..e4409d3f 100644
--- a/node_wrangler.py
+++ b/node_wrangler.py
@@ -1502,11 +1502,18 @@ class NWEmissionViewer(Operator, NWBase):
return False
def invoke(self, context, event):
- shader_type = context.space_data.shader_type
+ space = context.space_data
+ shader_type = space.shader_type
if shader_type == 'OBJECT':
- shader_output_type = "OUTPUT_MATERIAL"
- shader_output_ident = "ShaderNodeOutputMaterial"
- shader_viewer_ident = "ShaderNodeEmission"
+ if space.id not in [lamp for lamp in bpy.data.lamps]: # cannot use bpy.data.lamps directly as iterable
+ shader_output_type = "OUTPUT_MATERIAL"
+ shader_output_ident = "ShaderNodeOutputMaterial"
+ shader_viewer_ident = "ShaderNodeEmission"
+ else:
+ shader_output_type = "OUTPUT_LAMP"
+ shader_output_ident = "ShaderNodeOutputLamp"
+ shader_viewer_ident = "ShaderNodeEmission"
+
elif shader_type == 'WORLD':
shader_output_type = "OUTPUT_WORLD"
shader_output_ident = "ShaderNodeOutputWorld"
@@ -1517,7 +1524,7 @@ class NWEmissionViewer(Operator, NWBase):
select_node = bpy.ops.node.select(mouse_x=mlocx, mouse_y=mlocy, extend=False)
if 'FINISHED' in select_node: # only run if mouse click is on a node
nodes, links = get_nodes_links(context)
- in_group = context.active_node != context.space_data.node_tree.nodes.active
+ in_group = context.active_node != space.node_tree.nodes.active
active = nodes.active
output_types = [x[1] for x in shaders_output_nodes_props]
valid = False