[Bf-blender-cvs] [a1810fae58f] greasepencil-object: GPencil: Reorganize Masking parameters in modifiers

Antonio Vazquez noreply at git.blender.org
Sun Feb 23 17:42:19 CET 2020


Commit: a1810fae58f7c80b8e168a770756e69fc5c9ec0f
Author: Antonio Vazquez
Date:   Sun Feb 23 17:42:12 2020 +0100
Branches: greasepencil-object
https://developer.blender.org/rBa1810fae58f7c80b8e168a770756e69fc5c9ec0f

GPencil: Reorganize Masking parameters in modifiers

- Removed duplicated code
- Make more compact the list

===================================================================

M	release/scripts/startup/bl_ui/properties_data_modifier.py

===================================================================

diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index c9990dc466a..147c3d320d9 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -1748,8 +1748,38 @@ class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, Panel):
     # ...to avoid lengthy if statements
     # so each type must have a function here.
 
-    def GP_NOISE(self, layout, ob, md):
+    def gpencil_masking(self, layout, ob, md, use_vertex):
         gpd = ob.data
+        layout.separator()
+        layout.label(text="Masking:")
+
+        split = layout.split(factor=0.7)
+
+        col1 = split.column()
+        col2 = split.column()
+
+        row = col1.row(align=True)
+        row.prop_search(md, "layer", gpd, "layers", text="Layer Mask", icon='GREASEPENCIL')
+        row.prop(md, "invert_layers", text="", icon='ARROW_LEFTRIGHT')
+
+        row = col2.row(align=True)
+        row.prop(md, "layer_pass", text="Pass")
+        row.prop(md, "invert_layer_pass", text="", icon='ARROW_LEFTRIGHT')
+
+        row = col1.row(align=True)
+        row.prop_search(md, "material", gpd, "materials", text="Material Mask", icon='SHADING_TEXTURE')
+        row.prop(md, "invert_materials", text="", icon='ARROW_LEFTRIGHT')
+
+        row = col2.row(align=True)
+        row.prop(md, "pass_index", text="Pass")
+        row.prop(md, "invert_material_pass", text="", icon='ARROW_LEFTRIGHT')
+
+        if use_vertex:
+            row = col1.row(align=True)
+            row.prop_search(md, "vertex_group", ob, "vertex_groups", text="Vertex Group")
+            row.prop(md, "invert_vertex", text="", icon='ARROW_LEFTRIGHT')
+
+    def GP_NOISE(self, layout, ob, md):
         split = layout.split()
 
         col = split.column()
@@ -1773,37 +1803,9 @@ class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, Panel):
         row.prop(md, "use_edit_thickness", text="Thickness", icon='LINE_DATA', toggle=True)
         row.prop(md, "use_edit_uv", text="UV", icon='MOD_UVPROJECT', toggle=True)
 
-        col = layout.column()
-        col.separator()
-        col.label(text="Vertex Group:")
-        row = col.row(align=True)
-        row.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
-        row.prop(md, "invert_vertex", text="", icon='ARROW_LEFTRIGHT')
-
-        col = layout.column()
-        col.separator()
-
-        col.label(text="Material:")
-        row = col.row(align=True)
-        row.prop_search(md, "material", gpd, "materials", text="", icon='SHADING_TEXTURE')
-        row.prop(md, "invert_materials", text="", icon='ARROW_LEFTRIGHT')
-        row = layout.row(align=True)
-        row.prop(md, "pass_index", text="Pass")
-        row.prop(md, "invert_material_pass", text="", icon='ARROW_LEFTRIGHT')
-
-        col = layout.column()
-        col.separator()
-
-        col.label(text="Layer:")
-        row = col.row(align=True)
-        row.prop_search(md, "layer", gpd, "layers", text="", icon='GREASEPENCIL')
-        row.prop(md, "invert_layers", text="", icon='ARROW_LEFTRIGHT')
-        row = layout.row(align=True)
-        row.prop(md, "layer_pass", text="Pass")
-        row.prop(md, "invert_layer_pass", text="", icon='ARROW_LEFTRIGHT')
+        self.gpencil_masking(layout, ob, md, True)
 
     def GP_SMOOTH(self, layout, ob, md):
-        gpd = ob.data
         col = layout.column()
         col.prop(md, "factor")
         col.prop(md, "step")
@@ -1815,64 +1817,16 @@ class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, Panel):
         row.prop(md, "use_edit_thickness", text="Thickness", icon='LINE_DATA', toggle=True)
         row.prop(md, "use_edit_uv", text="UV", icon='MOD_UVPROJECT', toggle=True)
 
-        col.separator()
-        col.label(text="Vertex Group:")
-        row = col.row(align=True)
-        row.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
-        row.prop(md, "invert_vertex", text="", icon='ARROW_LEFTRIGHT')
-
-        col = layout.column()
-        col.separator()
-
-        col.label(text="Material:")
-        row = col.row(align=True)
-        row.prop_search(md, "material", gpd, "materials", text="", icon='SHADING_TEXTURE')
-        row.prop(md, "invert_materials", text="", icon='ARROW_LEFTRIGHT')
-        row = layout.row(align=True)
-        row.prop(md, "pass_index", text="Pass")
-        row.prop(md, "invert_material_pass", text="", icon='ARROW_LEFTRIGHT')
-
-        col = layout.column()
-        col.separator()
-
-        col.label(text="Layer:")
-        row = col.row(align=True)
-        row.prop_search(md, "layer", gpd, "layers", text="", icon='GREASEPENCIL')
-        row.prop(md, "invert_layers", text="", icon='ARROW_LEFTRIGHT')
-        row = layout.row(align=True)
-        row.prop(md, "layer_pass", text="Pass")
-        row.prop(md, "invert_layer_pass", text="", icon='ARROW_LEFTRIGHT')
+        self.gpencil_masking(layout, ob, md, True)
 
     def GP_SUBDIV(self, layout, ob, md):
-        gpd = ob.data
         layout.row().prop(md, "subdivision_type", expand=True)
         split = layout.split()
         col = split.column()
         row = col.row(align=True)
         row.prop(md, "level")
 
-        col = layout.column()
-        col.separator()
-
-        col.label(text="Material:")
-        row = col.row(align=True)
-
-        row.prop_search(md, "material", gpd, "materials", text="", icon='SHADING_TEXTURE')
-        row.prop(md, "invert_materials", text="", icon='ARROW_LEFTRIGHT')
-        row = layout.row(align=True)
-        row.prop(md, "pass_index", text="Pass")
-        row.prop(md, "invert_material_pass", text="", icon='ARROW_LEFTRIGHT')
-
-        col = layout.column()
-        col.separator()
-
-        col.label(text="Layer:")
-        row = col.row(align=True)
-        row.prop_search(md, "layer", gpd, "layers", text="", icon='GREASEPENCIL')
-        row.prop(md, "invert_layers", text="", icon='ARROW_LEFTRIGHT')
-        row = layout.row(align=True)
-        row.prop(md, "layer_pass", text="Pass")
-        row.prop(md, "invert_layer_pass", text="", icon='ARROW_LEFTRIGHT')
+        self.gpencil_masking(layout, ob, md, False)
 
     def GP_SIMPLIFY(self, layout, ob, md):
         gpd = ob.data
@@ -1894,30 +1848,9 @@ class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, Panel):
         elif md.mode == 'MERGE':
             col.prop(md, "distance")
 
-        col = layout.column()
-        col.separator()
-
-        col.label(text="Material:")
-        row = col.row(align=True)
-        row.prop_search(md, "material", gpd, "materials", text="", icon='SHADING_TEXTURE')
-        row.prop(md, "invert_materials", text="", icon='ARROW_LEFTRIGHT')
-        row = layout.row(align=True)
-        row.prop(md, "pass_index", text="Pass")
-        row.prop(md, "invert_material_pass", text="", icon='ARROW_LEFTRIGHT')
-
-        col = layout.column()
-        col.separator()
-
-        col.label(text="Layer:")
-        row = col.row(align=True)
-        row.prop_search(md, "layer", gpd, "layers", text="", icon='GREASEPENCIL')
-        row.prop(md, "invert_layers", text="", icon='ARROW_LEFTRIGHT')
-        row = layout.row(align=True)
-        row.prop(md, "layer_pass", text="Pass")
-        row.prop(md, "invert_layer_pass", text="", icon='ARROW_LEFTRIGHT')
+        self.gpencil_masking(layout, ob, md, False)
 
     def GP_THICK(self, layout, ob, md):
-        gpd = ob.data
         split = layout.split()
 
         col = split.column()
@@ -1934,37 +1867,9 @@ class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, Panel):
             if md.use_custom_curve:
                 col.template_curve_mapping(md, "curve")
 
-        col = layout.column()
-        col.separator()
-        col.label(text="Vertex Group:")
-        row = col.row(align=True)
-        row.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
-        row.prop(md, "invert_vertex", text="", icon='ARROW_LEFTRIGHT')
-
-        col = layout.column()
-        col.separator()
-
-        col.label(text="Material:")
-        row = col.row(align=True)
-        row.prop_search(md, "material", gpd, "materials", text="", icon='SHADING_TEXTURE')
-        row.prop(md, "invert_materials", text="", icon='ARROW_LEFTRIGHT')
-        row = layout.row(align=True)
-        row.prop(md, "pass_index", text="Pass")
-        row.prop(md, "invert_material_pass", text="", icon='ARROW_LEFTRIGHT')
-
-        col = layout.column()
-        col.separator()
-
-        col.label(text="Layer:")
-        row = col.row(align=True)
-        row.prop_search(md, "layer", gpd, "layers", text="", icon='GREASEPENCIL')
-        row.prop(md, "invert_layers", text="", icon='ARROW_LEFTRIGHT')
-        row = layout.row(align=True)
-        row.prop(md, "layer_pass", text="Pass")
-        row.prop(md, "invert_layer_pass", text="", icon='ARROW_LEFTRIGHT')
+        self.gpencil_masking(layout, ob, md, True)
 
     def GP_TINT(self, layout, ob, md):
-        gpd = ob.data
         split = layout.split()
 
         col = split.column()
@@ -1974,27 +1879,7 @@ class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, Panel):
         row = layout.row()
         row.prop(md, "modify_color")
 
-        col = layout.column()
-        col.separator()
-
-        col.label(text="Material:")
-        row = col.row(align=True)
-        row.prop_search(md, "material", gpd, "materials", text="", icon='SHADING_TEXTURE')
-        row.prop(md, "invert_materials", text="", icon='ARROW_LEFTRIGHT')
-        row = layout.row(align=True)
-        row.prop(md, "pass_index", text="Pass")
-        row.prop(md, "invert_material_pass", text="", icon='ARROW_LEFTRIGHT')
-
-        col = layout.column()
-        col.separator()
-
-        col.label(text="Layer:")
-        row = col.row(align=True)
-        row.prop_search(md, "layer", gpd, "layers", text="", icon='GREASEPENCIL')
-        row.prop(md, "invert_layers", text="", icon='ARROW_LEFTRIGHT')
-        row = layout.row(align=True)
-        row.prop(md, "layer_pass", text="Pass")
-        row.prop(md, "invert_layer_pass", text="", icon='ARROW_LEFTRIGHT')
+        self.gpencil_masking(layout, ob, md, False)
 
     def GP_TIME(se

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list