Fix assert weight painting after undo
[blender.git] / source / blender / blenloader / intern / readfile.c
index 08a45f367f4c12b5cd0f0b8fa95f9784bf3f44a6..9478c2e03516dcf217ed9677f7ce5b41ca120e39 100644 (file)
@@ -5683,7 +5683,13 @@ static void direct_link_object(FileData *fd, Object *ob)
        CLAMP(ob->rotmode, ROT_MODE_MIN, ROT_MODE_MAX);
 
        if (ob->sculpt) {
-               ob->sculpt = MEM_callocN(sizeof(SculptSession), "reload sculpt session");
+               if (ob->mode & OB_MODE_ALL_SCULPT) {
+                       ob->sculpt = MEM_callocN(sizeof(SculptSession), "reload sculpt session");
+                       ob->sculpt->mode_type = ob->mode;
+               }
+               else {
+                       ob->sculpt = NULL;
+               }
        }
 
        link_list(fd, &ob->lodlevels);