forked from bartvdbraak/blender
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.
This commit is contained in:
parent
870ff57557
commit
562313bfd3
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user