diff options
author | Lukas Toenne <lukas.toenne@googlemail.com> | 2013-08-28 13:05:09 +0400 |
---|---|---|
committer | Lukas Toenne <lukas.toenne@googlemail.com> | 2013-08-28 13:05:09 +0400 |
commit | 562313bfd3479fc64b205388e0fbf1891c1ff7b1 (patch) | |
tree | 35d8eb732bda19b6bfe6f92bf258af5c3abf3d70 /release/scripts/startup/bl_ui/space_node.py | |
parent | 870ff57557e23a83d0c5e9102c6870eaf15b47b6 (diff) |
Fix for #36589 Node Editor displays incorrect Material name when Pinning.
The material button displayed in the node editor header is the "active_material" of the active object. When pinning the node tree this should ideally be the pinned node tree's material slot, but this
would require adding even more confusing info in SpaceNode to find the correct slot in addition to the id_from datablock. Solution for now is to just disable these buttons when pinning to communicate
better.
Diffstat (limited to 'release/scripts/startup/bl_ui/space_node.py')
-rw-r--r-- | release/scripts/startup/bl_ui/space_node.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/release/scripts/startup/bl_ui/space_node.py b/release/scripts/startup/bl_ui/space_node.py index da41f9c6bef..59fa52525ad 100644 --- a/release/scripts/startup/bl_ui/space_node.py +++ b/release/scripts/startup/bl_ui/space_node.py @@ -28,7 +28,6 @@ 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 @@ -49,21 +48,26 @@ class NODE_HT_header(Header): if scene.render.use_shading_nodes: layout.prop(snode, "shader_type", text="", expand=True) + ob = context.object if (not scene.render.use_shading_nodes or snode.shader_type == 'OBJECT') and ob: + row = layout.row() + # disable material slot buttons when pinned, cannot find correct slot within id_from (#36589) + row.enabled = not snode.pin # 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") + row.template_ID(ob, "active_material", new="material.new") # Material ID, but not for Lamps if id_from and ob.type != 'LAMP': - layout.template_ID(id_from, "active_material", new="material.new") + row.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") if snode.shader_type == 'WORLD': - layout.template_ID(scene, "world", new="world.new") + row.template_ID(scene, "world", new="world.new") if snode_id: - layout.prop(snode_id, "use_nodes") + row.prop(snode_id, "use_nodes") elif snode.tree_type == 'TextureNodeTree': layout.prop(snode, "texture_type", text="", expand=True) |