UI: Center ID Blocks in Node Editor

See T55635
This commit is contained in:
William Reynish
2018-06-28 00:30:22 +02:00
committed by Pablo Vazquez
parent 252d1d8e22
commit 3e1b755ead

View File

@@ -57,6 +57,16 @@ class NODE_HT_header(Header):
ob = context.object
if snode.shader_type == 'OBJECT' and ob:
NODE_MT_editor_menus.draw_collapsible(context, layout)
# No shader nodes for Eevee lamps
if snode_id and not (context.engine == 'BLENDER_EEVEE' and ob.type == 'LAMP'):
row = layout.row()
row.prop(snode_id, "use_nodes")
layout.separator_spacer()
row = layout.row()
# disable material slot buttons when pinned, cannot find correct slot within id_from (#36589)
row.enabled = not snode.pin
@@ -67,56 +77,60 @@ class NODE_HT_header(Header):
if id_from and ob.type != 'LAMP':
row.template_ID(id_from, "active_material", new="material.new")
# No shader nodes for Eevee lamps
if snode_id and not (context.engine == 'BLENDER_EEVEE' and ob.type == 'LAMP'):
row.prop(snode_id, "use_nodes")
if snode.shader_type == 'WORLD':
NODE_MT_editor_menus.draw_collapsible(context, layout)
if snode.shader_type == 'WORLD':
row = layout.row()
row.enabled = not snode.pin
row.template_ID(scene, "world", new="world.new")
if snode_id:
row = layout.row()
row.prop(snode_id, "use_nodes")
NODE_MT_editor_menus.draw_collapsible(context, layout)
layout.separator_spacer()
row = layout.row()
row.enabled = not snode.pin
row.template_ID(scene, "world", new="world.new")
if snode.shader_type == 'LINESTYLE':
view_layer = context.view_layer
lineset = view_layer.freestyle_settings.linesets.active
if lineset is not None:
row = layout.row()
row.enabled = not snode.pin
row.template_ID(lineset, "linestyle", new="scene.freestyle_linestyle_new")
if lineset is not None:
NODE_MT_editor_menus.draw_collapsible(context, layout)
if snode_id:
row = layout.row()
row.prop(snode_id, "use_nodes")
layout.separator_spacer()
row = layout.row()
row.enabled = not snode.pin
row.template_ID(lineset, "linestyle", new="scene.freestyle_linestyle_new")
elif snode.tree_type == 'TextureNodeTree':
layout.prop(snode, "texture_type", text="", expand=True)
NODE_MT_editor_menus.draw_collapsible(context, layout)
if snode_id:
layout.prop(snode_id, "use_nodes")
layout.separator_spacer()
if id_from:
if snode.texture_type == 'BRUSH':
layout.template_ID(id_from, "texture", new="texture.new")
else:
layout.template_ID(id_from, "active_texture", new="texture.new")
if snode_id:
layout.prop(snode_id, "use_nodes")
elif snode.tree_type == 'CompositorNodeTree':
NODE_MT_editor_menus.draw_collapsible(context, layout)
elif snode.tree_type == 'CompositorNodeTree':
if snode_id:
layout.prop(snode_id, "use_nodes")
NODE_MT_editor_menus.draw_collapsible(context, layout)
layout.prop(snode, "use_auto_render")
layout.prop(snode, "show_backdrop")
if snode.show_backdrop:
@@ -125,9 +139,11 @@ class NODE_HT_header(Header):
else:
# Custom node tree is edited as independent ID block
layout.template_ID(snode, "node_tree", new="node.new_node_tree")
NODE_MT_editor_menus.draw_collapsible(context, layout)
layout.separator_spacer()
layout.template_ID(snode, "node_tree", new="node.new_node_tree")
layout.separator_spacer()
layout.prop(snode, "pin", text="")