From 92ebf635ee2a9ddbc7fbf4a0c06b9732ee555b27 Mon Sep 17 00:00:00 2001
From: Philipp Oeser <info@graphics-engineer.com>
Date: Fri, 16 Nov 2018 14:22:59 +0100
Subject: [PATCH] Fix T57632: 3DS Importer Exception when assigning an object
 as a parent to its self

---
 io_scene_3ds/import_3ds.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/io_scene_3ds/import_3ds.py b/io_scene_3ds/import_3ds.py
index 862fe2a73..b9de42d52 100644
--- a/io_scene_3ds/import_3ds.py
+++ b/io_scene_3ds/import_3ds.py
@@ -828,7 +828,10 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
                 ob.parent = None
         else:
             if ob.parent != object_list[parent]:
-                ob.parent = object_list[parent]
+                if ob == object_list[parent]:
+                    print('   warning: Cannot assign self to parent ', ob)
+                else:
+                    ob.parent = object_list[parent]
 
             # pivot_list[ind] += pivot_list[parent]  # XXX, not sure this is correct, should parent space matrix be applied before combining?
     # fix pivots
-- 
GitLab