[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59590] trunk/blender/release/scripts/ startup/bl_ui/space_node.py: Fix for #36589 Node Editor displays incorrect Material name when Pinning.

Lukas Toenne lukas.toenne at googlemail.com
Wed Aug 28 11:05:09 CEST 2013


Revision: 59590
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59590
Author:   lukastoenne
Date:     2013-08-28 09:05:09 +0000 (Wed, 28 Aug 2013)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_ui/space_node.py

Modified: trunk/blender/release/scripts/startup/bl_ui/space_node.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_node.py	2013-08-28 07:09:36 UTC (rev 59589)
+++ trunk/blender/release/scripts/startup/bl_ui/space_node.py	2013-08-28 09:05:09 UTC (rev 59590)
@@ -28,7 +28,6 @@
         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 @@
             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)




More information about the Bf-blender-cvs mailing list