From 1edc2417e618c96e62a51c0b499a0e6cf7483a6f Mon Sep 17 00:00:00 2001
From: Campbell Barton <ideasman42@gmail.com>
Date: Sun, 25 Sep 2011 03:20:48 +0000
Subject: [PATCH] fix [#28405] Importing certain 3DS files takes a very long
 time

---
 io_scene_3ds/import_3ds.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/io_scene_3ds/import_3ds.py b/io_scene_3ds/import_3ds.py
index f39fe0e5e..d8ecb12f0 100644
--- a/io_scene_3ds/import_3ds.py
+++ b/io_scene_3ds/import_3ds.py
@@ -755,12 +755,16 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
         putContextMesh(contextMesh_vertls, contextMesh_facels, contextMeshMaterials)
 
     # Assign parents to objects
+    # check _if_ we need to assign first because doing so recalcs the depsgraph
     for ind, ob in enumerate(object_list):
         parent = object_parent[ind]
         if parent == ROOT_OBJECT:
-            ob.parent = None
+            if ob.parent is not None:
+                ob.parent = None
         else:
-            ob.parent = object_list[parent]
+            if ob.parent != object_list[parent]:
+                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
     for ind, ob in enumerate(object_list):
-- 
GitLab