diff options
author | Lucas Boutrot <thornydre> | 2018-12-07 02:43:07 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-12-07 02:57:20 +0300 |
commit | d40bffa17f6dabac3f4aef229d11824c2554bba3 (patch) | |
tree | 1da528cb7b4c10485ec299712aeb10bbc02a146f /release | |
parent | 5fdf739e7f2076bdb00f67fabfa1e1ff49c5db70 (diff) |
UI: add material settings in shader editor sidebar.
Differential Revision: https://developer.blender.org/D3926
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/startup/bl_ui/properties_material.py | 22 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_node.py | 41 |
2 files changed, 54 insertions, 9 deletions
diff --git a/release/scripts/startup/bl_ui/properties_material.py b/release/scripts/startup/bl_ui/properties_material.py index 89c1f32ed2d..aa3166febee 100644 --- a/release/scripts/startup/bl_ui/properties_material.py +++ b/release/scripts/startup/bl_ui/properties_material.py @@ -204,8 +204,8 @@ class EEVEE_MATERIAL_PT_volume(MaterialButtonsPanel, Panel): panel_node_draw(layout, mat.node_tree, 'OUTPUT_MATERIAL', "Volume") -class EEVEE_MATERIAL_PT_options(MaterialButtonsPanel, Panel): - bl_label = "Options" +class EEVEE_MATERIAL_PT_settings(MaterialButtonsPanel, Panel): + bl_label = "Settings" bl_context = "material" COMPAT_ENGINES = {'BLENDER_EEVEE'} @@ -214,12 +214,11 @@ class EEVEE_MATERIAL_PT_options(MaterialButtonsPanel, Panel): engine = context.engine return context.material and (engine in cls.COMPAT_ENGINES) - def draw(self, context): + @staticmethod + def draw_shared(self, mat): layout = self.layout layout.use_property_split = True - mat = context.material - layout.prop(mat, "blend_method") if mat.blend_method != 'OPAQUE': @@ -236,6 +235,9 @@ class EEVEE_MATERIAL_PT_options(MaterialButtonsPanel, Panel): layout.prop(mat, "refraction_depth") layout.prop(mat, "use_sss_translucency") + def draw(self, context): + self.draw_shared(self, context.material) + class MATERIAL_PT_viewport(MaterialButtonsPanel, Panel): bl_label = "Viewport Display" @@ -246,9 +248,8 @@ class MATERIAL_PT_viewport(MaterialButtonsPanel, Panel): def poll(cls, context): return context.material - def draw(self, context): - mat = context.material - + @staticmethod + def draw_shared(self, mat): layout = self.layout layout.use_property_split = True @@ -257,6 +258,9 @@ class MATERIAL_PT_viewport(MaterialButtonsPanel, Panel): col.prop(mat, "metallic") col.prop(mat, "roughness") + def draw(self, context): + self.draw_shared(self, context.material) + classes = ( MATERIAL_MT_specials, @@ -265,7 +269,7 @@ classes = ( EEVEE_MATERIAL_PT_context_material, EEVEE_MATERIAL_PT_surface, EEVEE_MATERIAL_PT_volume, - EEVEE_MATERIAL_PT_options, + EEVEE_MATERIAL_PT_settings, MATERIAL_PT_viewport, MATERIAL_PT_custom_props, ) diff --git a/release/scripts/startup/bl_ui/space_node.py b/release/scripts/startup/bl_ui/space_node.py index d799251fe30..1674940b77f 100644 --- a/release/scripts/startup/bl_ui/space_node.py +++ b/release/scripts/startup/bl_ui/space_node.py @@ -27,6 +27,10 @@ from .properties_grease_pencil_common import ( AnnotationDataPanel, GreasePencilToolsPanel, ) +from .properties_material import ( + EEVEE_MATERIAL_PT_settings, + MATERIAL_PT_viewport +) class NODE_HT_header(Header): @@ -552,6 +556,41 @@ class NODE_PT_grease_pencil_tools(GreasePencilToolsPanel, Panel): # toolbar, but which may not necessarily be open +class EEVEE_NODE_PT_material_settings(Panel): + bl_space_type = 'NODE_EDITOR' + bl_region_type = 'UI' + bl_category = "Node" + bl_label = "Settings" + COMPAT_ENGINES = {'BLENDER_EEVEE'} + + @classmethod + def poll(cls, context): + snode = context.space_data + return (context.engine in cls.COMPAT_ENGINES) and \ + snode.tree_type == 'ShaderNodeTree' and snode.id + + def draw(self, context): + material = context.space_data.id + EEVEE_MATERIAL_PT_settings.draw_shared(self, material) + + +class NODE_PT_material_viewport(Panel): + bl_space_type = 'NODE_EDITOR' + bl_region_type = 'UI' + bl_category = "Node" + bl_label = "Viewport Display" + bl_options = {'DEFAULT_CLOSED'} + + @classmethod + def poll(cls, context): + snode = context.space_data + return snode.tree_type == 'ShaderNodeTree' and snode.id + + def draw(self, context): + material = context.space_data.id + MATERIAL_PT_viewport.draw_shared(self, material) + + def node_draw_tree_view(layout, context): pass @@ -574,6 +613,8 @@ classes = ( NODE_UL_interface_sockets, NODE_PT_grease_pencil, NODE_PT_grease_pencil_tools, + EEVEE_NODE_PT_material_settings, + NODE_PT_material_viewport, ) |