Fix T57934: non-empty duplicators don't render

Convert non-empty duplicators to empties.
This commit is contained in:
Campbell Barton 2018-12-11 15:02:58 +11:00
parent 8216e9f8a2
commit 7fe3d1e7d7
Notes: blender-bot 2023-02-14 05:00:05 +01:00
Referenced by commit 2fb54ef86e, Fix T65054: Blender 2.80 crashes when opening a scene created by blender 2.7x with hierarchy duplication set to "group".
Referenced by issue #63004, Linked Instanced collection data loss
Referenced by issue #57934, Regression in classroom benchmark scene
3 changed files with 21 additions and 0 deletions

View 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

View 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;

View 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);
}
}
}
}
{