Tweaks for Node Header UI code:

* Don't show "New material" operator, when object type can't have materials
* Don't show "Use Nodes" for lamps in Blender Internal.
This commit is contained in:
Thomas Dinges 2012-01-06 16:37:07 +00:00
parent 667ae778b9
commit 7ff5a17ff2

@ -49,11 +49,14 @@ class NODE_HT_header(Header):
layout.prop(snode, "shader_type", text="", expand=True)
if not scene.render.use_shading_nodes or snode.shader_type == 'OBJECT':
if id_from:
layout.template_ID(id_from, "active_material", new="material.new")
else:
# Show material.new when no active ID/slot exists
if not id_from and ob.type in {'MESH', 'CURVE', 'SURFACE', 'FONT', 'METABALL'}:
layout.template_ID(ob, "active_material", new="material.new")
if snode_id:
# Material ID, but not for Lamps
if id_from and ob.type != 'LAMP':
layout.template_ID(id_from, "active_material", new="material.new")
# Don't show "Use Nodes" Button when Engine is BI for Lamps
if snode_id and not (scene.render.use_shading_nodes == 0 and ob.type == 'LAMP'):
layout.prop(snode_id, "use_nodes")
elif snode.tree_type == 'TEXTURE':