Eevee: UI add world and material nodetree layout.
This commit is contained in:
@@ -21,7 +21,7 @@ import bpy
|
|||||||
from bpy.types import Menu, Panel, UIList
|
from bpy.types import Menu, Panel, UIList
|
||||||
from rna_prop_ui import PropertyPanel
|
from rna_prop_ui import PropertyPanel
|
||||||
from bpy.app.translations import pgettext_iface as iface_
|
from bpy.app.translations import pgettext_iface as iface_
|
||||||
|
from bpy_extras.node_utils import find_node_input, find_output_node
|
||||||
|
|
||||||
def active_node_mat(mat):
|
def active_node_mat(mat):
|
||||||
# TODO, 2.4x has a pipeline section, for 2.5 we need to communicate
|
# TODO, 2.4x has a pipeline section, for 2.5 we need to communicate
|
||||||
@@ -1114,6 +1114,28 @@ class EEVEE_MATERIAL_PT_context_material(MaterialButtonsPanel, Panel):
|
|||||||
split.separator()
|
split.separator()
|
||||||
|
|
||||||
|
|
||||||
|
def panel_node_draw(layout, ntree, output_type):
|
||||||
|
node = find_output_node(ntree, output_type)
|
||||||
|
|
||||||
|
if node:
|
||||||
|
def display_input(layout, ntree, node, input_name):
|
||||||
|
input = find_node_input(node, input_name)
|
||||||
|
layout.template_node_view(ntree, node, input)
|
||||||
|
|
||||||
|
display_input(layout, ntree, node, 'Base Color')
|
||||||
|
if output_type == 'OUTPUT_METALLIC':
|
||||||
|
display_input(layout, ntree, node, 'Metallic')
|
||||||
|
display_input(layout, ntree, node, 'Specular')
|
||||||
|
display_input(layout, ntree, node, 'Roughness')
|
||||||
|
display_input(layout, ntree, node, 'Emissive Color')
|
||||||
|
display_input(layout, ntree, node, 'Transparency')
|
||||||
|
display_input(layout, ntree, node, 'Normal')
|
||||||
|
display_input(layout, ntree, node, 'Ambient Occlusion')
|
||||||
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
class EEVEE_MATERIAL_PT_surface(MaterialButtonsPanel, Panel):
|
class EEVEE_MATERIAL_PT_surface(MaterialButtonsPanel, Panel):
|
||||||
bl_label = "Surface"
|
bl_label = "Surface"
|
||||||
bl_context = "material"
|
bl_context = "material"
|
||||||
@@ -1132,9 +1154,13 @@ class EEVEE_MATERIAL_PT_surface(MaterialButtonsPanel, Panel):
|
|||||||
layout.prop(mat, "use_nodes", icon='NODETREE')
|
layout.prop(mat, "use_nodes", icon='NODETREE')
|
||||||
layout.separator()
|
layout.separator()
|
||||||
|
|
||||||
if not mat.use_nodes:
|
if mat.use_nodes:
|
||||||
|
if not panel_node_draw(layout, mat.node_tree, 'OUTPUT_METALLIC'):
|
||||||
|
if not panel_node_draw(layout, mat.node_tree, 'OUTPUT_SPECULAR'):
|
||||||
|
layout.label(text="No output node")
|
||||||
|
else:
|
||||||
raym = mat.raytrace_mirror
|
raym = mat.raytrace_mirror
|
||||||
layout.prop(mat, "diffuse_color", text="Diffuse")
|
layout.prop(mat, "diffuse_color", text="Base Color")
|
||||||
layout.prop(raym, "reflect_factor", text="Metallic")
|
layout.prop(raym, "reflect_factor", text="Metallic")
|
||||||
layout.prop(mat, "specular_intensity", text="Specular")
|
layout.prop(mat, "specular_intensity", text="Specular")
|
||||||
layout.prop(raym, "gloss_factor", text="Roughness")
|
layout.prop(raym, "gloss_factor", text="Roughness")
|
||||||
|
@@ -20,6 +20,7 @@
|
|||||||
import bpy
|
import bpy
|
||||||
from bpy.types import Panel
|
from bpy.types import Panel
|
||||||
from rna_prop_ui import PropertyPanel
|
from rna_prop_ui import PropertyPanel
|
||||||
|
from bpy_extras.node_utils import find_node_input, find_output_node
|
||||||
|
|
||||||
|
|
||||||
class WorldButtonsPanel:
|
class WorldButtonsPanel:
|
||||||
@@ -264,7 +265,20 @@ class EEVEE_WORLD_PT_surface(WorldButtonsPanel, Panel):
|
|||||||
|
|
||||||
world = context.world
|
world = context.world
|
||||||
|
|
||||||
layout.prop(world, "horizon_color", text="Color")
|
layout.prop(world, "use_nodes", icon='NODETREE')
|
||||||
|
layout.separator()
|
||||||
|
|
||||||
|
if world.use_nodes:
|
||||||
|
ntree = world.node_tree
|
||||||
|
node = find_output_node(ntree, 'OUTPUT_WORLD')
|
||||||
|
|
||||||
|
if not node:
|
||||||
|
layout.label(text="No output node")
|
||||||
|
else:
|
||||||
|
input = find_node_input(node, 'Surface')
|
||||||
|
layout.template_node_view(ntree, node, input)
|
||||||
|
else:
|
||||||
|
layout.prop(world, "horizon_color", text="Color")
|
||||||
|
|
||||||
|
|
||||||
classes = (
|
classes = (
|
||||||
|
Reference in New Issue
Block a user