Skip to content

Commit

Permalink
keep only first mesh per file for streaming sequences (#147)
Browse files Browse the repository at this point in the history
  • Loading branch information
neverhood311 authored Oct 25, 2021
1 parent 4ac238c commit e7bb780
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": "",
Expand Down
13 changes: 9 additions & 4 deletions src/stop_motion_obj.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

0 comments on commit e7bb780

Please sign in to comment.