Vertex Paint: projection options
[blender-staging.git] / source / blender / blenloader / intern / versioning_270.c
index ba985ef50865ccda0631703d02da71840f588fd6..b374e49fc836c1f4ebca6b3f51a87ce12cb6b940 100644 (file)
@@ -60,6 +60,7 @@
 #include "DNA_genfile.h"
 
 #include "BKE_animsys.h"
+#include "BKE_brush.h"
 #include "BKE_colortools.h"
 #include "BKE_library.h"
 #include "BKE_main.h"
@@ -1652,6 +1653,23 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
                        }
                }
 
+               {
+                       Brush *br;
+                       br = (Brush *)BKE_libblock_find_name_ex(main, ID_BR, "Average");
+                       if (!br) {
+                               br = BKE_brush_add(main, "Average", OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT);
+                               br->vertexpaint_tool = PAINT_BLEND_AVERAGE;
+                               br->ob_mode = OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT;
+                       }
+
+                       br = (Brush *)BKE_libblock_find_name_ex(main, ID_BR, "Smear");
+                       if (!br) {
+                               br = BKE_brush_add(main, "Smear", OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT);
+                               br->vertexpaint_tool = PAINT_BLEND_SMEAR;
+                               br->ob_mode = OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT;
+                       }
+               }
+
                FOREACH_NODETREE(main, ntree, id) {
                        if (ntree->type == NTREE_COMPOSIT) {
                                do_versions_compositor_render_passes(ntree);
@@ -1671,6 +1689,31 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
                        CustomData_set_layer_name(&me->vdata, CD_MDEFORMVERT, 0, "");
                }
        }
+
+       {
+               /* Fix for invalid state of screen due to bug in older versions. */
+               for (bScreen *sc = main->screen.first; sc; sc = sc->id.next) {
+                       for (ScrArea *sa = sc->areabase.first; sa; sa = sa->next) {
+                               if(sa->full && sc->state == SCREENNORMAL) {
+                                       sa->full = NULL;
+                               }
+                       }
+               }
+
+               if (!DNA_struct_elem_find(fd->filesdna, "VPaint", "char", "falloff_shape")) {
+                       for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
+                               ToolSettings *ts = scene->toolsettings;
+                               for (int i = 0; i < 2; i++) {
+                                       VPaint *vp = i ? ts->vpaint : ts->wpaint;
+                                       if (vp != NULL) {
+                                               /* remove all other flags */
+                                               vp->flag &= (VP_FLAG_SPRAY | VP_FLAG_VGROUP_RESTRICT);
+                                               vp->normal_angle = 80;
+                                       }
+                               }
+                       }
+               }
+       }
 }
 
 void do_versions_after_linking_270(Main *main)