[Bf-blender-cvs] [bd017dae28d] master: UI: Make Stroke panel consistent between Image Editor and 3D View texture painting

William Reynish noreply at git.blender.org
Tue Mar 19 18:39:10 CET 2019


Commit: bd017dae28d733779badacb2e5263483930c96c6
Author: William Reynish
Date:   Tue Mar 19 18:39:08 2019 +0100
Branches: master
https://developer.blender.org/rBbd017dae28d733779badacb2e5263483930c96c6

UI: Make Stroke panel consistent between Image Editor and 3D View texture painting

This should probably become de-duplicated, but at least they look consistent now

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

M	release/scripts/startup/bl_ui/space_image.py
M	release/scripts/startup/bl_ui/space_view3d_toolbar.py

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

diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py
index 7702338a776..8866d221099 100644
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -1100,33 +1100,29 @@ class IMAGE_PT_paint_stroke(BrushButtonsPanel, Panel):
         tool_settings = context.tool_settings.image_paint
         brush = tool_settings.brush
 
-        col = layout.column()
+        layout.use_property_split = True
+        layout.use_property_decorate = False
 
-        col.label(text="Stroke Method:")
+        col = layout.column()
 
-        col.prop(brush, "stroke_method", text="")
+        col.prop(brush, "stroke_method")
 
         if brush.use_anchor:
-            col.separator()
             col.prop(brush, "use_edge_to_edge", text="Edge To Edge")
 
         if brush.use_airbrush:
-            col.separator()
             col.prop(brush, "rate", text="Rate", slider=True)
 
         if brush.use_space:
-            col.separator()
             row = col.row(align=True)
             row.prop(brush, "spacing", text="Spacing")
             row.prop(brush, "use_pressure_spacing", toggle=True, text="")
 
         if brush.use_line or brush.use_curve:
-            col.separator()
             row = col.row(align=True)
             row.prop(brush, "spacing", text="Spacing")
 
         if brush.use_curve:
-            col.separator()
             col.template_ID(brush, "paint_curve", new="paintcurve.new")
             col.operator("paintcurve.draw")
 
@@ -1134,27 +1130,47 @@ class IMAGE_PT_paint_stroke(BrushButtonsPanel, Panel):
         col.separator()
 
         row = col.row(align=True)
-        row.prop(brush, "use_relative_jitter", icon_only=True)
         if brush.use_relative_jitter:
             row.prop(brush, "jitter", slider=True)
         else:
             row.prop(brush, "jitter_absolute")
+        row.prop(brush, "use_relative_jitter", icon_only=True)
         row.prop(brush, "use_pressure_jitter", toggle=True, text="")
 
-        col = layout.column()
-        col.separator()
+        col.prop(tool_settings, "input_samples")
+
+
+class IMAGE_PT_paint_stroke_smooth_stroke(BrushButtonsPanel, Panel):
+    bl_context = ".paint_common_2d"  # dot on purpose (access from topbar)
+    bl_label = "Smooth Stroke"
+    bl_parent_id = "IMAGE_PT_paint_stroke"
+    bl_options = {'DEFAULT_CLOSED'}
 
+    @classmethod
+    def poll(cls, context):
+        settings = context.tool_settings.image_paint
+        brush = settings.brush
         if brush.brush_capabilities.has_smooth_stroke:
-            col.prop(brush, "use_smooth_stroke")
+            return True
 
-            sub = col.column()
-            sub.active = brush.use_smooth_stroke
-            sub.prop(brush, "smooth_stroke_radius", text="Radius", slider=True)
-            sub.prop(brush, "smooth_stroke_factor", text="Factor", slider=True)
+    def draw_header(self, context):
+        settings = context.tool_settings.image_paint
+        brush = settings.brush
 
-            col.separator()
+        self.layout.prop(brush, "use_smooth_stroke", text="")
 
-        col.prop(tool_settings, "input_samples")
+    def draw(self, context):
+        layout = self.layout
+        layout.use_property_split = True
+        layout.use_property_decorate = False
+
+        settings = context.tool_settings.image_paint
+        brush = settings.brush
+
+        col = layout.column()
+        col.active = brush.use_smooth_stroke
+        col.prop(brush, "smooth_stroke_radius", text="Radius", slider=True)
+        col.prop(brush, "smooth_stroke_factor", text="Factor", slider=True)
 
 
 class IMAGE_PT_paint_curve(BrushButtonsPanel, Panel):
@@ -1495,6 +1511,7 @@ classes = (
     IMAGE_PT_tools_brush_texture,
     IMAGE_PT_tools_mask_texture,
     IMAGE_PT_paint_stroke,
+    IMAGE_PT_paint_stroke_smooth_stroke,
     IMAGE_PT_paint_curve,
     IMAGE_PT_tools_brush_display,
     IMAGE_PT_tools_imagepaint_symmetry,
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index b4bffadf489..b343825631b 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -881,9 +881,7 @@ class VIEW3D_PT_tools_brush_stroke(Panel, View3DPaintPanel):
             row.prop(brush, "use_relative_jitter", icon_only=True)
             row.prop(brush, "use_pressure_jitter", toggle=True, text="")
 
-            col = layout.column()
-
-        layout.prop(settings, "input_samples")
+        col.prop(settings, "input_samples")
 
 
 class VIEW3D_PT_tools_brush_stroke_smooth_stroke(Panel, View3DPaintPanel):



More information about the Bf-blender-cvs mailing list