Revert "Fix T60044: Sculpting brush is not visible on file load"
authorDalai Felinto <dfelinto@gmail.com>
Tue, 8 Jan 2019 20:31:36 +0000 (18:31 -0200)
committerDalai Felinto <dfelinto@gmail.com>
Tue, 8 Jan 2019 20:31:36 +0000 (18:31 -0200)
This reverts commit 4d8ed937f226f4cdfa6f62fde5306b14c217e9c5.

An alternative fix will come soon as a patch, since this introduced an issue.
Rolling back since the original fix (sculpt cursor on load) is less important
than the issue it introduced (crash on weight paint undo/redo).

Fix T60322.

source/blender/blenloader/intern/readfile.c

index 2817f3a..316a98c 100644 (file)
@@ -5645,7 +5645,15 @@ static void direct_link_object(FileData *fd, Object *ob)
        /* in case this value changes in future, clamp else we get undefined behavior */
        CLAMP(ob->rotmode, ROT_MODE_MIN, ROT_MODE_MAX);
 
-       ob->sculpt = NULL;
+       if (ob->sculpt) {
+               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);
        ob->currentlod = ob->lodlevels.first;