Commit: 7de712e1e54e6a94cccee25cef207169898507c5
Author: Campbell Barton
Date:   Wed Nov 21 17:56:10 2018 +1100
Branches: blender2.8
https://developer.blender.org/rB7de712e1e54e6a94cccee25cef207169898507c5

Fix uv-sculpt use w/ tool-system

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

M       release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
M       source/blender/blenkernel/BKE_paint.h
M       source/blender/blenkernel/intern/paint.c

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

diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py 
b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index 3c3d43ac8bd..436e420ee7e 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -1002,7 +1002,7 @@ class _defs_image_uv_sculpt:
         return generate_from_enum_ex(
             context,
             icon_prefix="brush.uv_sculpt.",
-            data=context.tool_settings,
+            type=bpy.types.ToolSettings,
             attr="uv_sculpt_tool",
         )
 
diff --git a/source/blender/blenkernel/BKE_paint.h 
b/source/blender/blenkernel/BKE_paint.h
index e09aed4b372..00425de50e0 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -90,6 +90,8 @@ typedef enum ePaintMode {
        PAINT_MODE_INVALID = 7,
 } ePaintMode;
 
+#define PAINT_MODE_HAS_BRUSH(mode) !ELEM(mode, PAINT_MODE_SCULPT_UV)
+
 /* overlay invalidation */
 typedef enum eOverlayControlFlags {
        PAINT_OVERLAY_INVALID_TEXTURE_PRIMARY = 1,
diff --git a/source/blender/blenkernel/intern/paint.c 
b/source/blender/blenkernel/intern/paint.c
index 24782af4d22..9445981538e 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -689,29 +689,30 @@ bool BKE_paint_ensure(const ToolSettings *ts, struct 
Paint **r_paint)
 
        paint->flags |= PAINT_SHOW_BRUSH;
 
+       *r_paint = paint;
+
        BKE_paint_runtime_init(ts, paint);
 
-       *r_paint = paint;
        return false;
 }
 
 void BKE_paint_init(Main *bmain, Scene *sce, ePaintMode mode, const char 
col[3])
 {
        UnifiedPaintSettings *ups = &sce->toolsettings->unified_paint_settings;
-       Brush *brush;
        Paint *paint = BKE_paint_get_active_from_paintmode(sce, mode);
 
        /* If there's no brush, create one */
-       brush = BKE_paint_brush(paint);
-       if (brush == NULL) {
-               eObjectMode ob_mode = 
BKE_paint_object_mode_from_paintmode(mode);
-               brush = BKE_brush_first_search(bmain, ob_mode);
-
-               if (!brush) {
-                       brush = BKE_brush_add(bmain, "Brush", ob_mode);
-                       id_us_min(&brush->id);  /* fake user only */
+       if (PAINT_MODE_HAS_BRUSH(mode)) {
+               Brush *brush = BKE_paint_brush(paint);
+               if (brush == NULL) {
+                       eObjectMode ob_mode = 
BKE_paint_object_mode_from_paintmode(mode);
+                       brush = BKE_brush_first_search(bmain, ob_mode);
+                       if (!brush) {
+                               brush = BKE_brush_add(bmain, "Brush", ob_mode);
+                               id_us_min(&brush->id);  /* fake user only */
+                       }
+                       BKE_paint_brush_set(paint, brush);
                }
-               BKE_paint_brush_set(paint, brush);
        }
 
        memcpy(paint->paint_cursor_col, col, 3);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to