Fix failing assert & uninitialized paint settings in empty scene
authorJulian Eisel <eiseljulian@gmail.com>
Fri, 14 Feb 2020 15:58:32 +0000 (16:58 +0100)
committerJulian Eisel <eiseljulian@gmail.com>
Fri, 14 Feb 2020 16:15:15 +0000 (17:15 +0100)
Steps to reproduce were:
* Add new (empty) scene
* Add some mesh object
* Change to texture paint mode

While it can be argued that we should already init the settings when
creating a new scene (so that the texture tab can show up),
BKE_paint_init() should always ensure paint settings are initialized
either way.

Related to T73611.

source/blender/blenkernel/intern/paint.c

index e72540ed499f8720960fd82d006120964d09c034..2cc1681d436d3bde06d74d8b2b7ddce96c5469da 100644 (file)
@@ -771,6 +771,8 @@ void BKE_paint_init(Main *bmain, Scene *sce, ePaintMode mode, const char col[3])
   UnifiedPaintSettings *ups = &sce->toolsettings->unified_paint_settings;
   Paint *paint = BKE_paint_get_active_from_paintmode(sce, mode);
 
+  BKE_paint_ensure_from_paintmode(sce, mode);
+
   /* If there's no brush, create one */
   if (PAINT_MODE_HAS_BRUSH(mode)) {
     Brush *brush = BKE_paint_brush(paint);