[Bf-blender-cvs] [b571516237a] master: GPencil: Include new Brush random curves

Antonio Vazquez noreply at git.blender.org
Thu May 7 15:11:21 CEST 2020


Commit: b571516237a94e944b9182d233b9ba64819d92c4
Author: Antonio  Vazquez
Date:   Thu May 7 15:02:21 2020 +0200
Branches: master
https://developer.blender.org/rBb571516237a94e944b9182d233b9ba64819d92c4

GPencil: Include new Brush random curves

Now the brushes have several new random settings and use curves to define the effect. The curves have been moved below the parameter to keep UI standards and extra curve panels have been removed.

{F8505387}

The new curves are:

* Hue.
* Saturation.
* Value.

New option to random at stroke level instead to random at point level for the following values:

* Thickness.
* Strength.
* UV.
* Hue.
* Saturation.
* Value.

Curves have been moved below the corresponding parameter and only are displayed in properties panel. Display the curves in the popover made it unusable.

{F8505392}

Also, the Pressure random has been renamed to Radius because the old name was not clear enough.

Reviewed By: mendio, pablovazquez

Differential Revision: https://developer.blender.org/D7577

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

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_view3d.py
M	release/scripts/startup/bl_ui/space_view3d_toolbar.py
M	source/blender/blenkernel/intern/brush.c
M	source/blender/blenloader/intern/readfile.c
M	source/blender/blenloader/intern/versioning_280.c
M	source/blender/blenloader/intern/versioning_290.c
M	source/blender/blenloader/intern/writefile.c
M	source/blender/draw/intern/draw_cache_impl_gpencil.c
M	source/blender/editors/gpencil/gpencil_fill.c
M	source/blender/editors/gpencil/gpencil_intern.h
M	source/blender/editors/gpencil/gpencil_paint.c
M	source/blender/editors/gpencil/gpencil_primitive.c
M	source/blender/editors/gpencil/gpencil_utils.c
M	source/blender/editors/include/ED_gpencil.h
M	source/blender/makesdna/DNA_brush_types.h
M	source/blender/makesdna/DNA_gpencil_types.h
M	source/blender/makesrna/intern/rna_brush.c

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

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 5bb2fe1a7e4..64eda42c87a 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -44,38 +44,6 @@ def gpencil_stroke_placement_settings(context, layout):
         row.prop_enum(tool_settings, propname, 'CURSOR', text="Cursor")
 
 
-def gpencil_active_brush_settings_simple(context, layout):
-    tool_settings = context.tool_settings
-    brush = tool_settings.gpencil_paint.brush
-    if brush is None:
-        layout.label(text="No Active Brush")
-        return
-
-    col = layout.column()
-    col.label(text="Active Brush:      ")
-
-    row = col.row(align=True)
-    row.operator_context = 'EXEC_REGION_WIN'
-    row.operator_menu_enum("gpencil.brush_change", "brush", text="", icon='BRUSH_DATA')
-    row.prop(brush, "name", text="")
-
-    col.prop(brush, "size", slider=True)
-    row = col.row(align=True)
-    row.prop(brush, "use_random_pressure", text="", icon='RNDCURVE')
-    row.prop(brush, "pen_sensitivity_factor", slider=True)
-    row.prop(brush, "use_pressure", text="", icon='STYLUS_PRESSURE')
-    row = col.row(align=True)
-    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 = col.row(align=True)
-    row.prop(brush, "jitter", slider=True)
-    row.prop(brush, "use_jitter_pressure", text="", icon='STYLUS_PRESSURE')
-    row = col.row()
-    row.prop(brush, "angle", slider=True)
-    row.prop(brush, "angle_factor", text="Factor", slider=True)
-
-
 # XXX: To be replaced with active tools
 class AnnotationDrawingToolsPanel:
     # subclass must set
@@ -577,30 +545,6 @@ class AnnotationOnionSkin:
         sub.prop(gpl, "annotation_onion_after_range", text="After")
 
 
-class GreasePencilToolsPanel:
-    # For use in "2D" Editors without their own toolbar
-    # subclass must set
-    # bl_space_type = 'IMAGE_EDITOR'
-    bl_label = "Grease Pencil Settings"
-    bl_region_type = 'UI'
-    bl_options = {'DEFAULT_CLOSED'}
-
-    @classmethod
-    def poll(cls, _context):
-        # XXX - disabled in 2.8 branch.
-        # return (context.gpencil_data is not None)
-        return False
-
-    def draw(self, context):
-        layout = self.layout
-
-        gpencil_active_brush_settings_simple(context, layout)
-
-        layout.separator()
-
-        gpencil_stroke_placement_settings(context, layout)
-
-
 class GreasePencilMaterialsPanel:
     # Mix-in, use for properties editor and top-bar.
     def draw(self, context):
diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py
index 6de1b38a615..dfaf574f1d0 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -1076,9 +1076,21 @@ def brush_basic_gpencil_paint_settings(layout, context, brush, *, compact=False)
         row = layout.row(align=True)
         row.prop(brush, "size", text="Radius")
         row.prop(gp_settings, "use_pressure", text="", icon='STYLUS_PRESSURE')
+
+        if gp_settings.use_pressure and context.area.type == 'PROPERTIES':
+            col = layout.column()
+            col.template_curve_mapping(gp_settings, "curve_sensitivity", brush=True,
+                                      use_negative_slope=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 gp_settings.use_strength_pressure and context.area.type == 'PROPERTIES':
+            col = layout.column()
+            col.template_curve_mapping(gp_settings, "curve_strength", brush=True,
+                                        use_negative_slope=True)
+
         if brush.gpencil_tool == 'TINT':
             row = layout.row(align=True)
             row.prop(gp_settings, "vertex_mode", text="Mode")
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 3e4a3f5de4c..926219ed207 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -125,7 +125,6 @@ class VIEW3D_HT_tool_header(Header):
 
                     if brush.gpencil_tool not in {'FILL', 'TINT'}:
                         layout.popover("VIEW3D_PT_tools_grease_pencil_brush_stroke")
-                        layout.popover("VIEW3D_PT_tools_grease_pencil_brushcurves")
 
                     layout.popover("VIEW3D_PT_tools_grease_pencil_paint_appearance")
         elif tool_mode == 'SCULPT_GPENCIL':
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 04a3e6f62ea..fa49aa7e6a5 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1606,7 +1606,9 @@ class VIEW3D_PT_tools_grease_pencil_brush_random(View3DPanel, Panel):
         layout.use_property_split = True
         layout.use_property_decorate = False
 
-        brush = context.tool_settings.gpencil_paint.brush
+        tool_settings = context.tool_settings
+        brush = tool_settings.gpencil_paint.brush
+        mode = tool_settings.gpencil_paint.color_mode
         gp_settings = brush.gpencil_settings
 
         if self.is_popover:
@@ -1615,83 +1617,68 @@ class VIEW3D_PT_tools_grease_pencil_brush_random(View3DPanel, Panel):
             row.label(text=self.bl_label)
 
         col = layout.column()
-        col.active = gp_settings.use_settings_random
-
-        col.prop(gp_settings, "random_pressure", text="Pressure", slider=True)
-        col.prop(gp_settings, "random_strength", text="Strength", slider=True)
-        col.prop(gp_settings, "uv_random", text="UV", slider=True)
+        col.enabled = gp_settings.use_settings_random
 
         row = col.row(align=True)
-        row.prop(gp_settings, "pen_jitter", slider=True)
-        row.prop(gp_settings, "use_jitter_pressure", text="", icon='STYLUS_PRESSURE')
-
-
-# Grease Pencil drawingcurves
-class VIEW3D_PT_tools_grease_pencil_brushcurves(View3DPanel, Panel):
-    bl_context = ".greasepencil_paint"
-    bl_parent_id = 'VIEW3D_PT_tools_grease_pencil_brush_settings'
-    bl_label = "Curves"
-    bl_category = "Tool"
-    bl_options = {'DEFAULT_CLOSED'}
-
-    @classmethod
-    def poll(cls, context):
-        brush = context.tool_settings.gpencil_paint.brush
-        return brush is not None and brush.gpencil_tool not in {'ERASE', 'FILL', 'TINT'}
-
-    def draw(self, context):
-        pass
-
-
-class VIEW3D_PT_tools_grease_pencil_brushcurves_sensitivity(View3DPanel, Panel):
-    bl_context = ".greasepencil_paint"
-    bl_label = "Sensitivity"
-    bl_category = "Tool"
-    bl_parent_id = "VIEW3D_PT_tools_grease_pencil_brushcurves"
-
-    def draw(self, context):
-        layout = self.layout
-        layout.use_property_split = True
-
-        brush = context.tool_settings.gpencil_paint.brush
-        gp_settings = brush.gpencil_settings
-
-        layout.template_curve_mapping(gp_settings, "curve_sensitivity", brush=True,
-                                      use_negative_slope=True)
-
-
-class VIEW3D_PT_tools_grease_pencil_brushcurves_strength(View3DPanel, Panel):
-    bl_context = ".greasepencil_paint"
-    bl_label = "Strength"
-    bl_category = "Tool"
-    bl_parent_id = "VIEW3D_PT_tools_grease_pencil_brushcurves"
-
-    def draw(self, context):
-        layout = self.layout
-        layout.use_property_split = True
-
-        brush = context.tool_settings.gpencil_paint.brush
-        gp_settings = brush.gpencil_settings
+        row.prop(gp_settings, "random_pressure", text="Radius", slider=True)
+        row.prop(gp_settings, "use_stroke_random_radius", text="", icon='GP_SELECT_STROKES')
+        row.prop(gp_settings, "use_random_press_radius", text="", icon='STYLUS_PRESSURE')
+        if gp_settings.use_random_press_radius and self.is_popover is False:
+            col.template_curve_mapping(gp_settings, "curve_random_pressure", brush=True,
+                                use_negative_slope=True)
 
-        layout.template_curve_mapping(gp_settings, "curve_strength", brush=True,
-                                      use_negative_slope=True)
+        row = col.row(align=True)
+        row.prop(gp_settings, "random_strength", text="Strength", slider=True)
+        row.prop(gp_settings, "use_stroke_random_strength", text="", icon='GP_SELECT_STROKES')
+        row.prop(gp_settings, "use_random_press_strength", text="", icon='STYLUS_PRESSURE')
+        if gp_settings.use_random_press_strength and self.is_popover is False:
+            col.template_curve_mapping(gp_settings, "curve_random_strength", brush=True,
+                                use_negative_slope=True)
 
+        row = col.row(align=True)
+        row.prop(gp_settings, "uv_random", text="UV", slider=True)
+        row.prop(gp_settings, "use_stroke_random_uv", text="", icon='GP_SELECT_STROKES')
+        row.prop(gp_settings, "use_random_press_uv", text="", icon='STYLUS_PRESSURE')
+        if gp_settings.use_random_press_uv and self.is_popover is False:
+            col.template_curve_mapping(gp_settings, "curve_random_uv", brush=True,
+                                use_negative_slope=True)
 
-class VIEW3D_PT_tools_grease_pencil_brushcurves_jitter(View3DPanel, Panel):
-    bl_context = ".greasepencil_paint"
-    bl_label = "Jitter"
-    bl_category = "Tool"
-    bl_parent_id = "VIEW3D_PT_tools_grease_pencil_brushcurves"
+        col.separator()
 
-    def draw(self, context):
-        layout = self.layout
-        layout.use_property_split = True
+        col1 = col.column(align=True)
+        col1.enabled = mode == 'VERTEXCOLOR' and gp_settings.use_settings_random
+        row = col1.row(align=True)
+        row.prop(gp_settings, "random_hue_factor", slider=True)
+        row.prop(gp_settings, "use_stroke_random_hue", text="",

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list