[Bf-blender-cvs] [c118b670f6b] greasepencil-object: GPencil: First step to fix damaged UI by Brush panel refactor done in master

Antonio Vazquez noreply at git.blender.org
Sun Dec 15 20:30:59 CET 2019


Commit: c118b670f6b13b48e96b785a2ac58944d20933a9
Author: Antonio Vazquez
Date:   Sun Dec 15 20:30:49 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rBc118b670f6b13b48e96b785a2ac58944d20933a9

GPencil: First step to fix damaged UI by Brush panel refactor done in master

The patch done in master was done before the Sculpt and Weight brushes were real brushes and also before the Vertex Paint mode was implemented. As result of that, the merge of master has broken almost all panels of brushes and all Vertex Paint mode.

This commit only fix part of the damages.

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

M	release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M	release/scripts/startup/bl_ui/properties_paint_common.py
M	release/scripts/startup/bl_ui/space_image.py
M	release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
M	release/scripts/startup/bl_ui/space_topbar.py
M	release/scripts/startup/bl_ui/space_view3d.py
M	release/scripts/startup/bl_ui/space_view3d_toolbar.py

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

diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index b28b6f89250..d1cb9147446 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -108,6 +108,11 @@ class AnnotationDrawingToolsPanel:
         sub.operator("gpencil.blank_frame_add", icon='FILE_NEW')
         sub.operator("gpencil.active_frames_delete_all", icon='X', text="Delete Frame(s)")
 
+        #sub = col.column(align=True)
+        #sub.prop(context.tool_settings, "use_gpencil_draw_additive", text="Additive Drawing")
+        #sub.prop(context.tool_settings, "use_gpencil_continuous_drawing", text="Continuous Drawing")
+        #sub.prop(context.tool_settings, "use_gpencil_draw_onback", text="Draw on Back")
+
         col.separator()
         col.separator()
 
@@ -127,11 +132,13 @@ class AnnotationDrawingToolsPanel:
 
 
 class GreasePencilSculptOptionsPanel:
-    bl_label = "Options"
+    bl_label = "Sculpt Strokes"
 
     @classmethod
     def poll(cls, context):
-        brush = context.tool_settings.gpencil_sculpt_paint.brush
+        tool_settings = context.scene.tool_settings
+        settings = tool_settings.gpencil_sculpt_paint
+        brush = settings.brush
         tool = brush.gpencil_sculpt_tool
 
         return bool(tool in {'SMOOTH', 'RANDOMIZE'})
@@ -140,20 +147,22 @@ class GreasePencilSculptOptionsPanel:
         layout = self.layout
         layout.use_property_split = True
         layout.use_property_decorate = False
-        ts = context.tool_settings
-        brush = ts.gpencil_sculpt_paint.brush
-        gp_settings = brush.gpencil_settings
+
+        tool_settings = context.scene.tool_settings
+        settings = tool_settings.gpencil_sculpt_paint
+        brush = settings.brush
         tool = brush.gpencil_sculpt_tool
 
         if tool in {'SMOOTH', 'RANDOMIZE'}:
-            layout.prop(gp_settings, "use_edit_position", text="Affect Position")
-            layout.prop(gp_settings, "use_edit_strength", text="Affect Strength")
-            layout.prop(gp_settings, "use_edit_thickness", text="Affect Thickness")
+            layout.prop(settings, "use_edit_position", text="Affect Position")
+            layout.prop(settings, "use_edit_strength", text="Affect Strength")
+            layout.prop(settings, "use_edit_thickness", text="Affect Thickness")
 
             if tool == 'SMOOTH':
-                layout.prop(gp_settings, "use_edit_pressure")
+                layout.prop(brush, "use_edit_pressure")
+
+            layout.prop(settings, "use_edit_uv", text="Affect UV")
 
-            layout.prop(gp_settings, "use_edit_uv", text="Affect UV")
 
 # GP Object Tool Settings
 class GreasePencilDisplayPanel:
@@ -168,22 +177,24 @@ class GreasePencilDisplayPanel:
             if context.mode == 'PAINT_GPENCIL':
                 return brush.gpencil_tool != 'ERASE'
             else:
-                # GP Sculpt and Weight Paint always have Brush Tip panel.
+                # GP Sculpt, Vertex and Weight Paint always have Brush Tip panel.
                 return True
 
     def draw_header(self, context):
         if self.is_popover: return
 
+        tool_settings = context.tool_settings
         if context.mode == 'PAINT_GPENCIL':
-            brush = context.tool_settings.gpencil_paint.brush
-            gp_settings = brush.gpencil_settings
-
-            self.layout.prop(gp_settings, "use_cursor", text="")
-        elif context.mode in ('SCULPT_GPENCIL', 'WEIGHT_GPENCIL'):
-            settings = context.tool_settings.gpencil_sculpt
-            brush = settings.brush
-
-            self.layout.prop(brush, "use_cursor", text="")
+            settings = tool_settings.gpencil_paint
+        elif context.mode == 'SCULPT_GPENCIL':
+            settings = tool_settings.gpencil_sculpt_paint
+        elif context.mode == 'WEIGHT_GPENCIL':
+            settings = tool_settings.gpencil_weight_paint
+        elif context.mode == 'VERTEX_GPENCIL':
+            settings = tool_settings.gpencil_vertex_paint
+        brush = settings.brush
+        if brush:
+            self.layout.prop(settings, "show_brush", text="")
 
     def draw(self, context):
         layout = self.layout
@@ -191,28 +202,27 @@ class GreasePencilDisplayPanel:
         layout.use_property_decorate = False
 
         tool_settings = context.tool_settings
-        ob = context.active_object
-        brush = None
-        if ob.mode == 'PAINT_GPENCIL':
+        if context.mode == 'PAINT_GPENCIL':
             settings = tool_settings.gpencil_paint
-        elif ob.mode == 'SCULPT_GPENCIL':
+        elif context.mode == 'SCULPT_GPENCIL':
             settings = tool_settings.gpencil_sculpt_paint
-        elif ob.mode == 'WEIGHT_GPENCIL':
+        elif context.mode == 'WEIGHT_GPENCIL':
             settings = tool_settings.gpencil_weight_paint
-        elif ob.mode == 'VERTEX_GPENCIL':
+        elif context.mode == 'VERTEX_GPENCIL':
             settings = tool_settings.gpencil_vertex_paint
-
         brush = settings.brush
-        if brush:
-            gp_settings = brush.gpencil_settings
+        gp_settings = brush.gpencil_settings
+
+        ob = context.active_object
+        if ob.mode == 'PAINT_GPENCIL':
 
             if self.is_popover:
                 row = layout.row(align=True)
-                row.prop(gp_settings, "use_cursor", text="")
+                row.prop(settings, "show_brush", text="")
                 row.label(text="Display Cursor")
 
             col = layout.column(align=True)
-            col.active = gp_settings.use_cursor
+            col.active = settings.show_brush
 
             if brush.gpencil_tool == 'DRAW':
                 col.prop(gp_settings, "show_lasso", text="Show Fill Color While Drawing")
@@ -220,94 +230,35 @@ class GreasePencilDisplayPanel:
             if brush.gpencil_tool == 'FILL':
                 col.prop(brush, "cursor_color_add", text="Cursor Color")
 
-            col = layout.column()
-            col.active = settings.show_brush
-
-            if self.is_popover:
-                row = layout.row(align=True)
-                row.prop(brush, "use_cursor", text="")
-                row.label(text="Display Cursor")
-
+        elif ob.mode == 'SCULPT_GPENCIL':
             col = layout.column(align=True)
-            col.active = brush.use_cursor
-
-            if tool in {'THICKNESS', 'STRENGTH'}:
-                col.prop(brush, "cursor_color_add", text="Add Cursor Color")
-                col.prop(brush, "cursor_color_sub", text="Subtract Cursor Color")
-            elif tool == 'PINCH':
-                col.prop(brush, "cursor_color_add", text="Pinch Cursor Color")
-                col.prop(brush, "cursor_color_sub", text="Inflate Cursor Color")
-            elif tool == 'TWIST':
-                col.prop(brush, "cursor_color_add", text="CCW Cursor Color")
-                col.prop(brush, "cursor_color_sub", text="CW Cursor Color")
-            else:
-                col.prop(brush, "cursor_color_add", text="Cursor Color")
+            col.active = settings.show_brush
 
-            if ob.mode == 'WEIGHT_GPENCIL':
+            if brush.gpencil_tool in {'THICKNESS', 'STRENGTH', 'PINCH', 'TWIST'}:
                 col.prop(brush, "cursor_color_add", text="Add")
                 col.prop(brush, "cursor_color_subtract", text="Subtract")
-
-            if ob.mode == 'VERTEX_GPENCIL':
+            else:
                 col.prop(brush, "cursor_color_add", text="Add")
 
-            col = layout.column()
-            col.prop(brush, "use_custom_icon")
-
-            sub = col.column()
-            sub.active = brush.use_custom_icon
-            sub.prop(brush, "icon_filepath", text="")
-
-
-class GreasePencilBrushFalloff:
-    bl_label = "Falloff"
-    bl_options = {'DEFAULT_CLOSED'}
-
-    @classmethod
-    def poll(cls, context):
-        ts = context.tool_settings
-        settings = None
-        if context.mode == 'PAINT_GPENCIL':
-            settings = ts.gpencil_paint
-        if context.mode == 'SCULPT_GPENCIL':
-            settings = ts.gpencil_sculpt_paint
-        elif context.mode == 'WEIGHT_GPENCIL':
-            settings = ts.gpencil_weight_paint
-        elif context.mode == 'VERTEX_GPENCIL':
-            settings = ts.gpencil_vertex_paint
-
-        return (settings and settings.brush and settings.brush.curve)
-
-    def draw(self, context):
-        layout = self.layout
-        ts = context.tool_settings
-        settings = None
-        if context.mode == 'PAINT_GPENCIL':
-            settings = ts.gpencil_paint
-        if context.mode == 'SCULPT_GPENCIL':
-            settings = ts.gpencil_sculpt_paint
-        elif context.mode == 'WEIGHT_GPENCIL':
-            settings = ts.gpencil_weight_paint
-        elif context.mode == 'VERTEX_GPENCIL':
-            settings = ts.gpencil_vertex_paint
+        elif ob.mode == 'WEIGHT_GPENCIL':
+            col = layout.column(align=True)
+            col.active = settings.show_brush
 
-        if settings:
-            brush = settings.brush
+            col.prop(brush, "cursor_color_add", text="Add")
+            col.prop(brush, "cursor_color_subtract", text="Subtract")
 
+        elif ob.mode == 'VERTEX_GPENCIL':
             col = layout.column(align=True)
-            row = col.row(align=True)
-            row.prop(brush, "curve_preset", text="")
+            col.active = settings.show_brush
 
-            if brush.curve_preset == 'CUSTOM':
-                layout.template_curve_mapping(brush, "curve", brush=True)
+            col.prop(brush, "cursor_color_add", text="Add")
 
-                col = layout.column(align=True)
-                row = col.row(align=True)
-                row.operator("brush.curve_preset", icon='SMOOTHCURVE', text="").shape = 'SMOOTH'
-                row.operator("brush.curve_preset", icon='SPHERECURVE', text="").shape = 'ROUND'
-                row.operator("brush.curve_preset", icon='ROOTCURVE', text="").shape = 'ROOT'
-                row.operator("brush.curve_preset", icon='SHARPCURVE', text="").shape = 'SHARP'
-                row.operator("brush.curve_preset", icon='LI

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list