[Bf-blender-cvs] [2fb54ef86e5] master: Fix T65054: Blender 2.80 crashes when opening a scene created by blender 2.7x with hierarchy duplication set to "group".

Bastien Montagne noreply at git.blender.org
Tue Jun 4 15:24:31 CEST 2019


Commit: 2fb54ef86e57598e4d27987066db7a06a8269413
Author: Bastien Montagne
Date:   Tue Jun 4 15:18:37 2019 +0200
Branches: master
https://developer.blender.org/rB2fb54ef86e57598e4d27987066db7a06a8269413

Fix T65054: Blender 2.80 crashes when opening a scene created by blender 2.7x with hierarchy duplication set to "group".

Regression introduced by rB7fe3d1e7d718 (fixing T57934).

This effectively reverts rBrB7fe3d1e7d718, since changing the type of an
object is a very bad idea in general, and would need a careful and
complex check of all of its usages (many object usages assume a specific
type of object...).

Instead, we simply remove duplicollection on those objects, and give a
warning in case dupligroup was effectively used (in many reported cases,
dupligroup was a 'mistake setting', without actually instancing
aniything).

Note that the otehr idea to fix that versioning issue (to create a new
empty object for the instancing) is much less easy than it might look
(one would need to take into account potential animations, relations
between objects, etc.). Doable probably, but way overkill for a
corner-case 'bad' usage of the feature in the first place.

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

M	source/blender/blenkernel/BKE_object.h
M	source/blender/blenkernel/intern/object.c
M	source/blender/blenloader/intern/readfile.c
M	source/blender/blenloader/intern/versioning_280.c

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

diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index 78bc03413e4..fdd61580d9e 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -388,8 +388,6 @@ bool BKE_object_modifier_update_subframe(struct Depsgraph *depsgraph,
                                          float frame,
                                          int type);
 
-void BKE_object_type_set_empty_for_versioning(struct Object *ob);
-
 bool BKE_object_empty_image_frame_is_visible_in_view3d(const struct Object *ob,
                                                        const struct RegionView3D *rv3d);
 bool BKE_object_empty_image_data_is_visible_in_view3d(const struct Object *ob,
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index ce1316480a7..b673c882e21 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -4453,17 +4453,6 @@ bool BKE_object_modifier_update_subframe(Depsgraph *depsgraph,
   return false;
 }
 
-void BKE_object_type_set_empty_for_versioning(Object *ob)
-{
-  ob->type = OB_EMPTY;
-  ob->data = NULL;
-  if (ob->pose) {
-    BKE_pose_free_ex(ob->pose, false);
-    ob->pose = NULL;
-  }
-  ob->mode = OB_MODE_OBJECT;
-}
-
 /* Updates select_id of all objects in the given bmain. */
 void BKE_object_update_select_id(struct Main *bmain)
 {
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index d110af60a83..32f0d35cd53 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -5220,6 +5220,15 @@ static void lib_link_object(FileData *fd, Main *main)
         ob->instance_collection = newlibadr_us(fd, ob->id.lib, ob->instance_collection);
       }
       else {
+        if (ob->instance_collection != NULL) {
+          ID *id = newlibadr(fd, ob->id.lib, ob->instance_collection);
+          blo_reportf_wrap(fd->reports,
+                           RPT_WARNING,
+                           TIP_("Non-Empty object '%s' cannot duplicate collection '%s' "
+                                "anymore in Blender 2.80, removed instancing"),
+                           ob->id.name + 2,
+                           id->name + 2);
+        }
         ob->instance_collection = NULL;
         ob->transflag &= ~OB_DUPLICOLLECTION;
       }
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index c4436cc8128..152cde0c0dc 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -2742,13 +2742,6 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
     for (Camera *ca = bmain->cameras.first; ca; ca = ca->id.next) {
       ca->drawsize *= 2.0f;
     }
-    for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
-      if (ob->type != OB_EMPTY) {
-        if (UNLIKELY(ob->transflag & OB_DUPLICOLLECTION)) {
-          BKE_object_type_set_empty_for_versioning(ob);
-        }
-      }
-    }
 
     /* Grease pencil primitive curve */
     if (!DNA_struct_elem_find(



More information about the Bf-blender-cvs mailing list