[Bf-blender-cvs] [9a1ba7b122e] greasepencil-object: UI: Move Eraser radius to Option tab as new panel

Antonio Vazquez noreply at git.blender.org
Thu Aug 31 17:33:31 CEST 2017


Commit: 9a1ba7b122e5a8f64c07f4c18e2202ac23fe070a
Author: Antonio Vazquez
Date:   Thu Aug 31 16:43:00 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rB9a1ba7b122e5a8f64c07f4c18e2202ac23fe070a

UI: Move Eraser radius to Option tab as new panel

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

M	release/scripts/startup/bl_ui/properties_grease_pencil_common.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 7d02e8e716d..952c784f085 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -414,11 +414,6 @@ class GreasePencilBrushOptionsPanel:
             row.prop(brush, "pen_subdivision_steps")
             row.prop(brush, "random_subdiv", text='Randomness', slider=True)
 
-            row = layout.row(align=False)
-            col = row.column(align=True)
-            col.label(text="Eraser:")
-            col.prop(context.user_preferences.edit, "grease_pencil_eraser_radius", text="Radius")
-
 
 class GreasePencilStrokeSculptPanel:
     # subclass must set
@@ -539,6 +534,30 @@ class GreasePencilAppearancePanel:
             row.prop(brush, "cursor_color_sub", text="Subtract")
 
 
+class GreasePencilEraserPanel:
+    bl_label = "Eraser"
+    bl_category = "Options"
+    bl_region_type = 'TOOLS'
+    bl_options = {'DEFAULT_CLOSED'}
+
+    @classmethod
+    def poll(cls, context):
+        if context.gpencil_data is None:
+            return False
+
+        is_paintmode = context.active_object and context.active_object.mode in ('GPENCIL_PAINT')
+        if context.active_object and is_paintmode:
+            return True
+        else:
+            return False
+
+    @staticmethod
+    def draw(self, context):
+        layout = self.layout
+        col = layout.column(align=True)
+        col.prop(context.user_preferences.edit, "grease_pencil_eraser_radius", text="Radius")
+
+
 class GreasePencilBrushCurvesPanel:
     # subclass must set
     # bl_space_type = 'IMAGE_EDITOR'
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index e396e8de78c..9516edf8af1 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -29,7 +29,8 @@ from bl_ui.properties_grease_pencil_common import (
         GreasePencilBrushPanel,
         GreasePencilBrushOptionsPanel,
         GreasePencilBrushCurvesPanel,
-        GreasePencilAppearancePanel
+        GreasePencilAppearancePanel,
+        GreasePencilEraserPanel
         )
 from bl_ui.properties_paint_common import (
         UnifiedPaintPanel,
@@ -2062,6 +2063,9 @@ class VIEW3D_PT_tools_grease_pencil_brushcurves(GreasePencilBrushCurvesPanel, Pa
 class VIEW3D_PT_tools_grease_pencil_appearance(GreasePencilAppearancePanel, Panel):
     bl_space_type = 'VIEW_3D'
 
+# Grease Pencil drawing brushes options
+class VIEW3D_PT_tools_grease_pencil_eraser(GreasePencilEraserPanel, Panel):
+    bl_space_type = 'VIEW_3D'
 
 # Note: moved here so that it's always in last position in 'Tools' panels!
 class VIEW3D_PT_tools_history(View3DPanel, Panel):
@@ -2142,6 +2146,7 @@ classes = (
     VIEW3D_PT_sculpt_symmetry,
     VIEW3D_PT_tools_brush_appearance,
     VIEW3D_PT_tools_grease_pencil_appearance,
+    VIEW3D_PT_tools_grease_pencil_eraser,
     VIEW3D_PT_tools_weightpaint,
     VIEW3D_PT_tools_weightpaint_options,
     VIEW3D_PT_tools_vertexpaint,



More information about the Bf-blender-cvs mailing list