Cycles / Nodes:
authorThomas Dinges <blender@dingto.org>
Fri, 6 Jan 2012 01:31:36 +0000 (01:31 +0000)
committerThomas Dinges <blender@dingto.org>
Fri, 6 Jan 2012 01:31:36 +0000 (01:31 +0000)
* Make it possible to add a new material from the Node header, if no material exists in the (active) material slot.

release/scripts/startup/bl_ui/space_node.py

index 318ba8eab8ad7f21be8f036be94eecd88754d811..4bd0b22779e6e5618a0e75d476a7c28a5f95691a 100644 (file)
@@ -28,6 +28,7 @@ class NODE_HT_header(Header):
         layout = self.layout
 
         scene = context.scene
+        ob = context.object
         snode = context.space_data
         snode_id = snode.id
         id_from = snode.id_from
@@ -50,6 +51,8 @@ class NODE_HT_header(Header):
             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:
+                    layout.template_ID(ob, "active_material", new="material.new")
                 if snode_id:
                     layout.prop(snode_id, "use_nodes")