Fix T69964: GPencil: Fill options are not shown on a properties editor
authorCharlie Jolly <mistajolly@gmail.com>
Fri, 11 Oct 2019 11:26:57 +0000 (12:26 +0100)
committerCharlie Jolly <mistajolly@gmail.com>
Fri, 11 Oct 2019 11:26:57 +0000 (12:26 +0100)
Differential Revision: https://developer.blender.org/D6041

release/scripts/startup/bl_ui/properties_paint_common.py
release/scripts/startup/bl_ui/space_view3d.py
release/scripts/startup/bl_ui/space_view3d_toolbar.py

index 23b2556eddb88cf52e85ac6fd2d140068915eb9a..c201ccbe7f8f718e667da53bef69bc86ef524446 100644 (file)
@@ -367,7 +367,7 @@ def brush_basic_sculpt_settings(layout, context, brush, *, compact=False):
         layout.row().prop(brush, "direction", expand=True, **({"text": ""} if compact else {}))
 
 
-def brush_basic_gpencil_paint_settings(layout, _context, brush, *, compact=True):
+def brush_basic_gpencil_paint_settings(layout, _context, brush, tool, *, compact=True, is_toolbar=False):
     gp_settings = brush.gpencil_settings
 
     # Brush details
@@ -395,6 +395,23 @@ def brush_basic_gpencil_paint_settings(layout, _context, brush, *, compact=True)
         row = layout.row(align=True)
         row.prop(gp_settings, "fill_draw_mode", text="Boundary")
         row.prop(gp_settings, "show_fill_boundary", text="", icon='GRID')
+        # Fill options
+        if is_toolbar:
+            settings = _context.tool_settings.gpencil_sculpt
+            row = layout.row(align=True)
+            sub = row.row(align=True)
+            sub.popover(
+                panel="TOPBAR_PT_gpencil_fill",
+                text="Fill Options",
+            )
+        else:
+            row = layout.row(align=True)
+            row.prop(gp_settings, "fill_factor", text="Resolution")
+            if gp_settings.fill_draw_mode != 'STROKE':
+                row = layout.row(align=True)
+                row.prop(gp_settings, "show_fill", text="Ignore Transparent Strokes")
+                row = layout.row(align=True)
+                row.prop(gp_settings, "fill_threshold", text="Threshold")
     else:  # brush.gpencil_tool == 'DRAW':
         row = layout.row(align=True)
         row.prop(brush, "size", text="Radius")
@@ -402,6 +419,25 @@ def brush_basic_gpencil_paint_settings(layout, _context, brush, *, compact=True)
         row = layout.row(align=True)
         row.prop(gp_settings, "pen_strength", slider=True)
         row.prop(gp_settings, "use_strength_pressure", text="", icon='STYLUS_PRESSURE')
+    
+    if tool.idname in {"builtin.arc", "builtin.curve", "builtin.line", "builtin.box", "builtin.circle"}:
+        settings = _context.tool_settings.gpencil_sculpt
+        if is_toolbar:
+            row = layout.row(align=True)
+            row.prop(settings, "use_thickness_curve", text="", icon='CURVE_DATA')
+            sub = row.row(align=True)
+            sub.active = settings.use_thickness_curve
+            sub.popover(
+                panel="TOPBAR_PT_gpencil_primitive",
+                text="Thickness Profile",
+            )
+        else:
+            row = layout.row(align=True)
+            row.prop(settings, "use_thickness_curve", text="Use Thickness Profile")
+            sub = row.row(align=True)
+            if settings.use_thickness_curve:
+                # Curve
+                layout.template_curve_mapping(settings, "thickness_primitive_curve", brush=True)
 
 
 def brush_basic_gpencil_sculpt_settings(layout, context, brush, *, compact=False):
index 7d13c9c41128080864d434cc148adf4bd0fad95e..5ad1dec9480ba214c886cf4640477f009d3efc4e 100644 (file)
@@ -351,28 +351,7 @@ class _draw_tool_settings_context_mode:
         from bl_ui.properties_paint_common import (
             brush_basic_gpencil_paint_settings,
         )
-        brush_basic_gpencil_paint_settings(layout, context, brush, compact=True)
-
-        # FIXME: tools must use their own UI drawing!
-        if tool.idname in {"builtin.arc", "builtin.curve", "builtin.line", "builtin.box", "builtin.circle"}:
-            settings = context.tool_settings.gpencil_sculpt
-            row = layout.row(align=True)
-            row.prop(settings, "use_thickness_curve", text="", icon='CURVE_DATA')
-            sub = row.row(align=True)
-            sub.active = settings.use_thickness_curve
-            sub.popover(
-                panel="TOPBAR_PT_gpencil_primitive",
-                text="Thickness Profile",
-            )
-
-        if brush.gpencil_tool == 'FILL':
-            settings = context.tool_settings.gpencil_sculpt
-            row = layout.row(align=True)
-            sub = row.row(align=True)
-            sub.popover(
-                panel="TOPBAR_PT_gpencil_fill",
-                text="Fill Options",
-            )
+        brush_basic_gpencil_paint_settings(layout, context, brush, tool, compact=True, is_toolbar=True)
 
     @staticmethod
     def SCULPT_GPENCIL(context, layout, tool):
index 3aee14e0239bbb0c9c6742a7bf73336762a163aa..8da5ba6718744f2d7f6913fc1d516aaa5f151266 100644 (file)
@@ -1873,7 +1873,8 @@ class VIEW3D_PT_tools_grease_pencil_brush(View3DPanel, Panel):
                 from bl_ui.properties_paint_common import (
                     brush_basic_gpencil_paint_settings,
                 )
-                brush_basic_gpencil_paint_settings(layout, context, brush, compact=True)
+                tool = context.workspace.tools.from_space_view3d_mode(context.mode, create=False)
+                brush_basic_gpencil_paint_settings(layout, context, brush, tool, compact=True, is_toolbar=False)
 
 
 # Grease Pencil drawing brushes options