[Bf-blender-cvs] [a0439804a6e] greasepencil-object: UI: Create a new panel for Brush options

Antonio Vazquez noreply at git.blender.org
Tue Aug 22 18:58:50 CEST 2017


Commit: a0439804a6ee1d1a4defdcdff189b0543f991ddc
Author: Antonio Vazquez
Date:   Tue Aug 22 18:58:25 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rBa0439804a6ee1d1a4defdcdff189b0543f991ddc

UI: Create a new panel for Brush options

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

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 a42600850c3..cf635021415 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -363,8 +363,39 @@ class GreasePencilBrushPanel:
             row.prop(brush, "use_random_strength", text='', icon='RNDCURVE')
             row.prop(brush, "strength", slider=True)
             row.prop(brush, "use_strength_pressure", text='', icon='STYLUS_PRESSURE')
-            row = layout.row(align=True)
-            row.prop(brush, "random_press", slider=True)
+
+            row = layout.row(align=False)
+            row.prop(context.tool_settings, "use_gpencil_draw_onback", text="Draw on Back")
+
+
+class GreasePencilBrushOptionsPanel:
+    # subclass must set
+    # bl_space_type = 'IMAGE_EDITOR'
+    bl_label = "Brush Options"
+    bl_category = "Tools"
+    bl_region_type = 'TOOLS'
+    bl_options = {'DEFAULT_CLOSED'}
+
+    @classmethod
+    def poll(cls, context):
+        is_3d_view = context.space_data.type == 'VIEW_3D'
+        if is_3d_view:
+            if context.gpencil_data is None:
+                return False
+
+            gpd = context.gpencil_data
+            return bool(gpd.is_stroke_paint_mode)
+        else:
+            return True
+
+    @staticmethod
+    def draw(self, context):
+        layout = self.layout
+        brush = context.active_gpencil_brush
+        if brush is not None:
+            col = layout.column(align=True)
+            col.label(text="Settings:")
+            col.prop(brush, "random_press", slider=True)
 
             row = layout.row(align=True)
             row.prop(brush, "jitter", slider=True)
@@ -373,8 +404,8 @@ class GreasePencilBrushPanel:
             row.prop(brush, "angle", slider=True)
             row.prop(brush, "angle_factor", text="Factor", slider=True)
 
-            box = layout.box()
-            col = box.column(align=True)
+            row = layout.row(align=True)
+            col = row.column(align=True)
             col.label(text="Stroke Quality:")
             col.prop(brush, "pen_smooth_factor")
             col.prop(brush, "pen_smooth_steps")
@@ -384,10 +415,9 @@ class GreasePencilBrushPanel:
             row.prop(brush, "random_subdiv", text='Randomness', slider=True)
 
             row = layout.row(align=False)
-            row.prop(context.tool_settings, "use_gpencil_draw_onback", text="Draw on Back")
-
-            row = layout.row(align=False)
-            row.prop(context.user_preferences.edit, "grease_pencil_eraser_radius", text="Eraser")
+            col = row.column(align=True)
+            col.label(text="Eraser:")
+            col.prop(context.user_preferences.edit, "grease_pencil_eraser_radius", text="Radius")
 
 
 class GreasePencilStrokeSculptPanel:
@@ -474,6 +504,7 @@ class GreasePencilAppearancePanel:
     bl_label = "Appearance"
     bl_category = "Options"
     bl_region_type = 'TOOLS'
+    bl_options = {'DEFAULT_CLOSED'}
 
     @classmethod
     def poll(cls, context):
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index fca060d6b1f..e396e8de78c 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -27,6 +27,7 @@ from bl_ui.properties_grease_pencil_common import (
         GreasePencilInterpolatePanel,
         GreasePencilStrokeSculptPanel,
         GreasePencilBrushPanel,
+        GreasePencilBrushOptionsPanel,
         GreasePencilBrushCurvesPanel,
         GreasePencilAppearancePanel
         )
@@ -2049,6 +2050,10 @@ class VIEW3D_PT_tools_grease_pencil_sculpt(GreasePencilStrokeSculptPanel, Panel)
 class VIEW3D_PT_tools_grease_pencil_brush(GreasePencilBrushPanel, Panel):
     bl_space_type = 'VIEW_3D'
 
+# Grease Pencil drawing brushes options
+class VIEW3D_PT_tools_grease_pencil_brush_option(GreasePencilBrushOptionsPanel, Panel):
+    bl_space_type = 'VIEW_3D'
+
 # Grease Pencil drawingcurves
 class VIEW3D_PT_tools_grease_pencil_brushcurves(GreasePencilBrushCurvesPanel, Panel):
     bl_space_type = 'VIEW_3D'
@@ -2090,6 +2095,7 @@ classes = (
     VIEW3D_PT_tools_grease_pencil_edit,
     VIEW3D_PT_tools_grease_pencil_sculpt,
     VIEW3D_PT_tools_grease_pencil_brush,
+    VIEW3D_PT_tools_grease_pencil_brush_option,
     VIEW3D_PT_tools_grease_pencil_brushcurves,
     VIEW3D_PT_tools_grease_pencil_draw,
     VIEW3D_PT_tools_relations,



More information about the Bf-blender-cvs mailing list