[Bf-blender-cvs] [debd9f6ea12] master: Fix T53171: lamp specials strength tweak fails with renamed emission nodes.

Brecht Van Lommel noreply at git.blender.org
Thu Nov 23 19:14:56 CET 2017


Commit: debd9f6ea1286533d4d5c9262fa6724c862fe35e
Author: Brecht Van Lommel
Date:   Thu Nov 23 19:13:31 2017 +0100
Branches: master
https://developer.blender.org/rBdebd9f6ea1286533d4d5c9262fa6724c862fe35e

Fix T53171: lamp specials strength tweak fails with renamed emission nodes.

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

M	release/scripts/startup/bl_ui/space_view3d.py

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

diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index c7e05a4173e..096c164d7d0 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -1550,18 +1550,21 @@ class VIEW3D_MT_object_specials(Menu):
             layout.operator_context = 'INVOKE_REGION_WIN'
 
             if scene.render.use_shading_nodes:
-                try:
-                    value = lamp.node_tree.nodes["Emission"].inputs["Strength"].default_value
-                except AttributeError:
-                    value = None
-
-                if value is not None:
+                emission_node = None
+                if lamp.node_tree:
+                    for node in lamp.node_tree.nodes:
+                        if getattr(node, "type", None) == 'EMISSION':
+                            emission_node = node
+                            break
+
+                if emission_node is not None:
                     props = layout.operator("wm.context_modal_mouse", text="Strength")
                     props.data_path_iter = "selected_editable_objects"
-                    props.data_path_item = "data.node_tree.nodes[\"Emission\"].inputs[\"Strength\"].default_value"
+                    props.data_path_item = "data.node_tree" \
+                                           ".nodes[\"" + emission_node.name + "\"]" \
+                                           ".inputs[\"Strength\"].default_value"
                     props.header_text = "Lamp Strength: %.3f"
                     props.input_scale = 0.1
-                del value
 
                 if lamp.type == 'AREA':
                     props = layout.operator("wm.context_modal_mouse", text="Size X")



More information about the Bf-blender-cvs mailing list