[Bf-blender-cvs] [f54431efe72] greasepencil-object: GPencil: Fix topbar popover for Fill tool

Antonio Vazquez noreply at git.blender.org
Fri Nov 22 19:40:46 CET 2019


Commit: f54431efe722a8ba60e8514826cfe474607b2b80
Author: Antonio Vazquez
Date:   Fri Nov 22 19:40:37 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rBf54431efe722a8ba60e8514826cfe474607b2b80

GPencil: Fix topbar popover for Fill tool

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

M	release/scripts/startup/bl_ui/properties_paint_common.py
M	release/scripts/startup/bl_ui/space_topbar.py
M	release/scripts/startup/bl_ui/space_view3d_toolbar.py

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

diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py
index 9bee49cbdb1..c59dc6227df 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -392,26 +392,6 @@ def brush_basic_gpencil_paint_settings(layout, _context, brush, tool, *, compact
         row.prop(brush, "size", text="Thickness")
         row = layout.row(align=True)
         row.prop(gp_settings, "fill_simplify_level", text="Simplify")
-        # 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_draw_mode", text="Boundary")
-            row.prop(gp_settings, "show_fill_boundary", text="", icon='GRID')
-            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")
diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py
index 80da131ad53..1bf5b0e3cf9 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -665,33 +665,6 @@ class TOPBAR_PT_gpencil_primitive(Panel):
         layout.template_curve_mapping(settings, "thickness_primitive_curve", brush=True)
 
 
-# Grease Pencil Fill
-class TOPBAR_PT_gpencil_fill(Panel):
-    bl_space_type = 'VIEW_3D'
-    bl_region_type = 'HEADER'
-    bl_label = "Advanced"
-    bl_ui_units_x = 13
-
-    def draw(self, context):
-        paint = context.tool_settings.gpencil_paint
-        brush = paint.brush
-        gp_settings = brush.gpencil_settings
-
-        layout = self.layout
-        # Fill
-        row = layout.row(align=True)
-        row.prop(gp_settings, "fill_draw_mode", text="Boundary")
-        row.prop(gp_settings, "show_fill_boundary", text="", icon='GRID')
-
-        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")
-
-
 # Only a popover
 class TOPBAR_PT_name(Panel):
     bl_space_type = 'TOPBAR'  # dummy
@@ -779,7 +752,6 @@ classes = (
     TOPBAR_MT_help,
     TOPBAR_PT_gpencil_layers,
     TOPBAR_PT_gpencil_primitive,
-    TOPBAR_PT_gpencil_fill,
     TOPBAR_PT_name,
 )
 
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 5d3eb5b0c6c..16e7ebb6ca1 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1850,6 +1850,9 @@ class VIEW3D_PT_tools_grease_pencil_brush(View3DPanel, Panel):
         if is_3d_view:
             if context.gpencil_data is None:
                 return False
+            brush = context.tool_settings.gpencil_paint.brush
+            if brush is None or brush.gpencil_tool in {'ERASE', 'TINT'}:
+                return False
 
             gpd = context.gpencil_data
             return bool(gpd.is_stroke_paint_mode)
@@ -2248,6 +2251,39 @@ class VIEW3D_PT_tools_grease_pencil_brushcurves_jitter(View3DPanel, Panel):
         layout.template_curve_mapping(gp_settings, "curve_jitter", brush=True,
                                       use_negative_slope=True)
 
+# Grease Pencil Fill
+class VIEW3D_PT_tools_grease_pencil_brush_fill(View3DPanel, Panel):
+    bl_context = ".greasepencil_paint"
+    bl_parent_id = 'VIEW3D_PT_tools_grease_pencil_brush'
+    bl_label = "Options"
+    bl_category = "Tool"
+
+    @classmethod
+    def poll(cls, context):
+        brush = context.tool_settings.gpencil_paint.brush
+        return brush is not None and brush.gpencil_tool == 'FILL'
+
+    def draw(self, context):
+        paint = context.tool_settings.gpencil_paint
+        brush = paint.brush
+        gp_settings = brush.gpencil_settings
+
+        layout = self.layout
+        layout.use_property_split = True
+        layout.use_property_decorate = False
+
+        # Fill
+        row = layout.row(align=True)
+        row.prop(gp_settings, "fill_draw_mode", text="Boundary")
+        row.prop(gp_settings, "show_fill_boundary", text="", icon='GRID')
+
+        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")
 
 # Grease Pecil Vertex Paint tools
 class VIEW3D_PT_tools_grease_pencil_vertex_brush(View3DPanel, Panel):
@@ -2673,6 +2709,7 @@ classes = (
     VIEW3D_PT_tools_grease_pencil_brushcurves_sensitivity,
     VIEW3D_PT_tools_grease_pencil_brushcurves_strength,
     VIEW3D_PT_tools_grease_pencil_brushcurves_jitter,
+    VIEW3D_PT_tools_grease_pencil_brush_fill,
     VIEW3D_PT_tools_grease_pencil_sculpt,
     VIEW3D_PT_tools_grease_pencil_weight_paint,
     VIEW3D_PT_tools_grease_pencil_paint_appearance,



More information about the Bf-blender-cvs mailing list