Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/startup/bl_ui/space_node.py
| Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | def draw(self, context): | ||||
| toolsettings = context.tool_settings | toolsettings = context.tool_settings | ||||
| row = layout.row(align=True) | row = layout.row(align=True) | ||||
| row.template_header() | row.template_header() | ||||
| NODE_MT_editor_menus.draw_collapsible(context, layout) | NODE_MT_editor_menus.draw_collapsible(context, layout) | ||||
| layout.prop(snode, "tree_type", text="", expand=True) | layout.prop(snode, "tree_type", text="", expand=True) | ||||
| use_shading_nodes = scene.view_render.use_shading_nodes or context.view_render.use_shading_nodes | |||||
| if snode.tree_type == 'ShaderNodeTree': | if snode.tree_type == 'ShaderNodeTree': | ||||
| if scene.render.use_shading_nodes: | if use_shading_nodes: | ||||
| layout.prop(snode, "shader_type", text="", expand=True) | layout.prop(snode, "shader_type", text="", expand=True) | ||||
| ob = context.object | ob = context.object | ||||
| if (not scene.render.use_shading_nodes or snode.shader_type == 'OBJECT') and ob: | if (not use_shading_nodes or snode.shader_type == 'OBJECT') and ob: | ||||
| row = layout.row() | row = layout.row() | ||||
| # disable material slot buttons when pinned, cannot find correct slot within id_from (#36589) | # disable material slot buttons when pinned, cannot find correct slot within id_from (#36589) | ||||
| row.enabled = not snode.pin | row.enabled = not snode.pin | ||||
| # Show material.new when no active ID/slot exists | # Show material.new when no active ID/slot exists | ||||
| if not id_from and ob.type in {'MESH', 'CURVE', 'SURFACE', 'FONT', 'METABALL'}: | if not id_from and ob.type in {'MESH', 'CURVE', 'SURFACE', 'FONT', 'METABALL'}: | ||||
| row.template_ID(ob, "active_material", new="material.new") | row.template_ID(ob, "active_material", new="material.new") | ||||
| # Material ID, but not for Lamps | # Material ID, but not for Lamps | ||||
| if id_from and ob.type != 'LAMP': | if id_from and ob.type != 'LAMP': | ||||
| row.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 | # 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'): | if snode_id and not (use_shading_nodes == 0 and ob.type == 'LAMP'): | ||||
| layout.prop(snode_id, "use_nodes") | layout.prop(snode_id, "use_nodes") | ||||
| if scene.render.use_shading_nodes and snode.shader_type == 'WORLD': | if use_shading_nodes and snode.shader_type == 'WORLD': | ||||
| row = layout.row() | row = layout.row() | ||||
| row.enabled = not snode.pin | row.enabled = not snode.pin | ||||
| row.template_ID(scene, "world", new="world.new") | row.template_ID(scene, "world", new="world.new") | ||||
| if snode_id: | if snode_id: | ||||
| row.prop(snode_id, "use_nodes") | row.prop(snode_id, "use_nodes") | ||||
| if scene.render.use_shading_nodes and snode.shader_type == 'LINESTYLE': | if use_shading_nodes and snode.shader_type == 'LINESTYLE': | ||||
| rl = context.scene.render.layers.active | rl = context.scene.render.layers.active | ||||
| lineset = rl.freestyle_settings.linesets.active | lineset = rl.freestyle_settings.linesets.active | ||||
| if lineset is not None: | if lineset is not None: | ||||
| row = layout.row() | row = layout.row() | ||||
| row.enabled = not snode.pin | row.enabled = not snode.pin | ||||
| row.template_ID(lineset, "linestyle", new="scene.freestyle_linestyle_new") | row.template_ID(lineset, "linestyle", new="scene.freestyle_linestyle_new") | ||||
| if snode_id: | if snode_id: | ||||
| row.prop(snode_id, "use_nodes") | row.prop(snode_id, "use_nodes") | ||||
| ▲ Show 20 Lines • Show All 466 Lines • Show Last 20 Lines | |||||