[Bf-blender-cvs] [4500e100bb7] temp-eevee-gpencil-rewrite: Changes in Material panels
Antonio Vazquez
noreply at git.blender.org
Wed Oct 6 18:24:27 CEST 2021
Commit: 4500e100bb70e069bf03724cbad6bcb552ca2b7f
Author: Antonio Vazquez
Date: Wed Oct 6 17:07:51 2021 +0200
Branches: temp-eevee-gpencil-rewrite
https://developer.blender.org/rB4500e100bb70e069bf03724cbad6bcb552ca2b7f
Changes in Material panels
===================================================================
M release/scripts/startup/bl_ui/properties_material.py
M release/scripts/startup/bl_ui/properties_material_gpencil.py
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_material.py b/release/scripts/startup/bl_ui/properties_material.py
index 1c7f3639f0a..c74578d47d2 100644
--- a/release/scripts/startup/bl_ui/properties_material.py
+++ b/release/scripts/startup/bl_ui/properties_material.py
@@ -64,7 +64,7 @@ class MaterialButtonsPanel:
@classmethod
def poll(cls, context):
mat = context.material
- return mat and (context.engine in cls.COMPAT_ENGINES) and not mat.grease_pencil
+ return mat and (((context.engine in cls.COMPAT_ENGINES) and not mat.grease_pencil) or (mat.grease_pencil and mat.use_nodes))
class MATERIAL_PT_preview(MaterialButtonsPanel, Panel):
@@ -72,6 +72,11 @@ class MATERIAL_PT_preview(MaterialButtonsPanel, Panel):
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_EEVEE'}
+ @classmethod
+ def poll(cls, context):
+ mat = context.material
+ return mat and (((context.engine in cls.COMPAT_ENGINES) and not mat.grease_pencil) or (mat.grease_pencil and mat.use_nodes))
+
def draw(self, context):
self.layout.template_preview(context.material)
diff --git a/release/scripts/startup/bl_ui/properties_material_gpencil.py b/release/scripts/startup/bl_ui/properties_material_gpencil.py
index 9d099ff2231..d7dace27c8c 100644
--- a/release/scripts/startup/bl_ui/properties_material_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_material_gpencil.py
@@ -120,12 +120,19 @@ class MATERIAL_PT_gpencil_slots(GreasePencilMaterialsPanel, Panel):
class MATERIAL_PT_gpencil_surface(GPMaterialButtonsPanel, Panel):
bl_label = "Surface"
+ @classmethod
+ def poll(cls, context):
+ mat = context.material
+ return (mat and mat.use_nodes is False)
+
def draw_header_preset(self, _context):
MATERIAL_PT_gpencil_material_presets.draw_panel_header(self.layout)
- def draw(self, _context):
+ def draw(self, context):
layout = self.layout
- layout.use_property_split = True
+ mat = context.material
+ layout.prop(mat, "use_nodes", icon='NODETREE')
+ layout.separator()
class MATERIAL_PT_gpencil_strokecolor(GPMaterialButtonsPanel, Panel):
@@ -239,6 +246,11 @@ class MATERIAL_PT_gpencil_preview(GPMaterialButtonsPanel, Panel):
COMPAT_ENGINES = {'BLENDER_EEVEE'}
bl_options = {'DEFAULT_CLOSED'}
+ @classmethod
+ def poll(cls, context):
+ mat = context.material
+ return (mat and mat.grease_pencil and mat.use_nodes is False)
+
def draw(self, context):
ma = context.material
self.layout.label(text=ma.name)
@@ -250,15 +262,51 @@ class MATERIAL_PT_gpencil_custom_props(GPMaterialButtonsPanel, PropertyPanel, Pa
_context_path = "object.active_material"
_property_type = bpy.types.Material
+ @classmethod
+ def poll(cls, context):
+ mat = context.material
+ return (mat and mat.grease_pencil and mat.use_nodes is False)
+
+
+def draw_material_settings(self, context):
+ layout = self.layout
+ layout.use_property_split = True
+ layout.use_property_decorate = False
+
+ mat = context.material
+
+ layout.prop(mat, "use_backface_culling")
+ layout.prop(mat, "blend_method")
+ layout.prop(mat, "shadow_method")
+
+ row = layout.row()
+ row.active = ((mat.blend_method == 'CLIP') or (mat.shadow_method == 'CLIP'))
+ row.prop(mat, "alpha_threshold")
+
+ if mat.blend_method not in {'OPAQUE', 'CLIP', 'HASHED'}:
+ layout.prop(mat, "show_transparent_back")
+
+ layout.prop(mat, "use_screen_refraction")
+ layout.prop(mat, "refraction_depth")
+ layout.prop(mat, "use_sss_translucency")
+ layout.prop(mat, "pass_index")
+
class MATERIAL_PT_gpencil_settings(GPMaterialButtonsPanel, Panel):
bl_label = "Settings"
bl_options = {'DEFAULT_CLOSED'}
+ @classmethod
+ def poll(cls, context):
+ mat = context.material
+ return (mat and mat.grease_pencil and mat.use_nodes is False)
+
def draw(self, context):
+ draw_material_settings(self, context)
+
+ # TODO: Remove prop pass_index and move to material struct
layout = self.layout
layout.use_property_split = True
-
ma = context.material
gpcolor = ma.grease_pencil
layout.prop(gpcolor, "pass_index")
More information about the Bf-blender-cvs
mailing list