diff --git a/src/__init__.py b/src/__init__.py index 5d9d91d..6f4fc42 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -25,7 +25,7 @@ "name": "Stop motion OBJ", "description": "Import a sequence of OBJ (or STL or PLY or X3D) files and display them each as a single frame of animation. This add-on also supports the .STL, .PLY, and .X3D file formats.", "author": "Justin Jensen", - "version": (2, 2, 0, "alpha.12"), + "version": (2, 2, 0, "alpha.13"), "blender": (2, 83, 0), "location": "File > Import > Mesh Sequence", "warning": "", diff --git a/src/stop_motion_obj.py b/src/stop_motion_obj.py index a3eca52..b0b2cc5 100644 --- a/src/stop_motion_obj.py +++ b/src/stop_motion_obj.py @@ -806,15 +806,20 @@ def importStreamedFile(obj, idx): mss.fileImporter.load(mss.fileFormat, filename) lockLoadingSequence(False) - tmpObject = getSelectedObjects()[0] + selectedObjects = getSelectedObjects() + tmpObject = next(filter(lambda meshObj: meshObj.type == 'MESH', selectedObjects), None) tmpMesh = tmpObject.data + # make a list of the objects we're going to delete + objsToDelete = selectedObjects.copy() + + # now delete all selected objects + for obj in objsToDelete: + bpy.data.objects.remove(obj, do_unlink=True) + # we want to make sure the cached meshes are saved to the .blend file tmpMesh.use_fake_user = True tmpMesh.inMeshSequence = True - deselectAll() - tmpObject.select_set(state=True) - bpy.data.objects.remove(tmpObject) mss.meshNameArray[idx].key = tmpMesh.name mss.meshNameArray[idx].inMemory = True mss.numMeshesInMemory += 1 diff --git a/src/version.py b/src/version.py index 7078885..f7dc602 100644 --- a/src/version.py +++ b/src/version.py @@ -2,5 +2,5 @@ # (major, minor, revision, development) # example dev version: (1, 2, 3, "beta.4") # example release version: (2, 3, 4) -currentScriptVersion = (2, 2, 0, "alpha.12") +currentScriptVersion = (2, 2, 0, "alpha.13") legacyScriptVersion = (2, 0, 2, "legacy")