Fix T57934: non-empty duplicators don't render
authorCampbell Barton <ideasman42@gmail.com>
Tue, 11 Dec 2018 04:02:58 +0000 (15:02 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 11 Dec 2018 04:02:58 +0000 (15:02 +1100)
Convert non-empty duplicators to empties.

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

index ff069bcbe794f961919a1eefec026925c5542062..2ccee7a4a68eeb8f4bb4ffe1493922912a1486c6 100644 (file)
@@ -349,6 +349,8 @@ bool BKE_object_modifier_update_subframe(
         struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob,
         bool update_mesh, int parent_recursion, float frame, int type);
 
+void BKE_object_type_set_empty_for_versioning(struct Object *ob);
+
 bool BKE_image_empty_visible_in_view3d(const struct Object *ob, const struct RegionView3D *rv3d);
 
 #ifdef __cplusplus
index b5dfb5d82447d1d8212ed5375dc2235bb8b924b6..9c166d154a378d0587284ee8decf52a8c03a7088 100644 (file)
@@ -4048,6 +4048,18 @@ bool BKE_object_modifier_update_subframe(
        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;
+}
+
 bool BKE_image_empty_visible_in_view3d(const Object *ob, const RegionView3D *rv3d)
 {
        int visibility_flag = ob->empty_image_visibility_flag;
index 9e6f64586ae114ac4ee334d740a8cd20b9ae0af8..d10d86de2bc24cfc106ceb604666bcbc745b3446 100644 (file)
@@ -2509,6 +2509,13 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
                for (Camera *ca = bmain->camera.first; ca; ca = ca->id.next) {
                        ca->drawsize *= 2.0f;
                }
+               for (Object *ob = bmain->object.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);
+                               }
+                       }
+               }
        }
 
        {