Fix T53171: lamp specials strength tweak fails with renamed emission nodes.
This commit is contained in:
@@ -1550,18 +1550,21 @@ class VIEW3D_MT_object_specials(Menu):
|
|||||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
layout.operator_context = 'INVOKE_REGION_WIN'
|
||||||
|
|
||||||
if scene.render.use_shading_nodes:
|
if scene.render.use_shading_nodes:
|
||||||
try:
|
emission_node = None
|
||||||
value = lamp.node_tree.nodes["Emission"].inputs["Strength"].default_value
|
if lamp.node_tree:
|
||||||
except AttributeError:
|
for node in lamp.node_tree.nodes:
|
||||||
value = None
|
if getattr(node, "type", None) == 'EMISSION':
|
||||||
|
emission_node = node
|
||||||
|
break
|
||||||
|
|
||||||
if value is not None:
|
if emission_node is not None:
|
||||||
props = layout.operator("wm.context_modal_mouse", text="Strength")
|
props = layout.operator("wm.context_modal_mouse", text="Strength")
|
||||||
props.data_path_iter = "selected_editable_objects"
|
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.header_text = "Lamp Strength: %.3f"
|
||||||
props.input_scale = 0.1
|
props.input_scale = 0.1
|
||||||
del value
|
|
||||||
|
|
||||||
if lamp.type == 'AREA':
|
if lamp.type == 'AREA':
|
||||||
props = layout.operator("wm.context_modal_mouse", text="Size X")
|
props = layout.operator("wm.context_modal_mouse", text="Size X")
|
||||||
|
Reference in New Issue
Block a user