Skip to content

Commit

Permalink
Version 2.2 for Blender 2.92.x - 3.6.x (#189)
Browse files Browse the repository at this point in the history
* add mesh sequence info (#111)

Sequence size, number of cached meshes, and the path to the mesh sequence directory

* Enable keyframe-based sequence playback (#112)

* update the frame for every dependency graph change (#115)

This allow the sequence to update while the user is adjusting the keyframe curve.

* switch to depsgraph_update_pre instead of post (#116)

* Create new empty sequence (#132)

* initial commit

* seed mesh sequence, duplicate current mesh

* Finish new sequence creation and mesh duplication

Also added the Ctrl+Shift+D hotkey for duplicating the current mesh

* multiple imports using ';' (#136)

Co-authored-by: BOULEST <[email protected]>

* fix bug in multiple sequence import (#137)

* Fix stack overflow from streaming sequence import (#138)

* disable sequence frame changes while importing meshes

* version bump

* Fix importing multiple streaming sequences (#139)

Take care to build the full absolute path, then split it into the full directory name and the file prefix name

* Add Merge Duplicate Materials button (#140)

* Sequence shading: remove dependence on bpy.ops (#141)

* add support for X3D import (#144)

* Import only the first mesh in each file (#145)

Delete all other objects

* keep only first mesh per file for streaming sequences (#147)

* Give sequence objects a unique name (#148)

* Don't create a sequence object if it can't find any files (#149)

Also, report the offending file name prefixes to the user.

* Rename "Mesh Sequence" to "Stop Motion OBJ" (#150)

* Added better support for alembic export (#154)

* Added better support for alembic export

* Added a workaround for a crash when Depsgraph_Update_Pre is calling UpdateFrame

* Fixed code format

* Renamed UI naming for this feature

* Add Convert To Mesh Sequence button to Stop Motion OBJ object properties panel (#155)

* Add Convert to Sequence button to Stop Motion OBJ panel

Still doesn't work

* Code cleanup

I guess it works

* Auto export altered meshes (#157)

* Initial commit of pseuodocode

* mesh hash to detect mesh changes

* recalculate the mesh hash on load, start of export logic

* Basic functionality working

Choose between overwriting and saving to different directory. Check for invalid directory

* Add other file types, some cleanup

* Manually revert #154 (#158)

* Fixed wrong/no export issue (#159)

Note: this only works when a SINGLE mesh sequence is present

* Fix ConvertToMeshSequence operator (#160)

* Fix ConvertToMeshSequence operator

* Bump version

* Fix issue checkMeshChangesFrameChangePre (#162)

* Bump version

* Fixed no object selected in checkMeshChangesFrameChangePre

* Bump version

* Smooth shaded streaming sequences (#165)

* Streaming sequence smooth shading

* Version bump

* Fixed a few export UI bugs (#166)

* Version bump (#167)

* split versions for Blender 3.6 and 4.0

* Revert "split versions for Blender 3.6 and 4.0"

This reverts commit 218814a.

* initial commit for Blender 4.0 compatibility

* Update new import settings

* Enable fast OBJ for 3.3+

Disable for <3.3.0 and for streaming sequences
Disable everything for <2.92.0 and >=4.0.0

* Add support for VRML2 (.wrl) import/export

* final version bump for v2.2.0

* Update readme for 2.2.0

---------

Co-authored-by: Roibabouin <[email protected]>
Co-authored-by: BOULEST <[email protected]>
Co-authored-by: Christopher Remde <[email protected]>
Co-authored-by: Félix <[email protected]>
  • Loading branch information
5 people authored Apr 5, 2024
1 parent 4fd8bff commit f163205
Show file tree
Hide file tree
Showing 5 changed files with 983 additions and 173 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Stop Motion OBJ
[Tutorial](https://github.com/neverhood311/Stop-motion-OBJ/wiki#quick-start) | [Forum](https://blenderartists.org/t/stop-motion-obj-obj-stl-ply-sequence-importer/670105) | [Documentation](https://github.com/neverhood311/Stop-motion-OBJ/wiki) | [How to Support](#how-to-support)

Stop Motion OBJ is a tool that lets you import a sequence of mesh files (.obj, .stl, or .ply), play them back in real time, then render them out to an animation. Each mesh may have a different vertex count, poly count, and even different UVs. This is especially useful for importing fluid simulations, for visualization of scientific data, and for rendering of 4D scan data.
Stop Motion OBJ is a tool that lets you import a sequence of mesh files (.obj, .stl, .ply, .x3d, or .wrl), play them back in real time, then render them out to an animation. Each mesh may have a different vertex count, poly count, and even different UVs. This is especially useful for importing fluid simulations, for visualization of scientific data, and for rendering of 4D scan data.

Once a sequence is imported, you may perform many of the same operations on the sequence that you would on a single mesh. Many of the Object Modifiers work on the entire mesh sequence. Mesh sequences may be rendered in both Cycles and Eevee.

Expand All @@ -20,10 +20,12 @@ Stop Motion OBJ is able to import very complex mesh sequences that cannot fit in


# Download & Install
For Blender 2.80+, download the latest release [here](https://github.com/neverhood311/Stop-motion-OBJ/releases/latest). Make sure to download the file named Stop-motion-OBJ-v2.x.x.zip (don't download either of the “Source code” files).
For Blender 2.92+, download the latest release [here](https://github.com/neverhood311/Stop-motion-OBJ/releases/latest). Make sure to download the file named Stop-motion-OBJ-v2.x.x.zip (don't download either of the “Source code” files).

To install, just follow the normal procedure for installing Blender addons. Open Blender and click Edit > Preferences... > Add-ons. Then click Install… and find the .zip file you previously downloaded. Once you’ve enabled the add-on, it should be ready to use immediately.

For Blender 2.91 and earlier, download [r2.1.1](https://github.com/neverhood311/Stop-motion-OBJ/releases/tag/v2.1.1)

For Blender 2.79 and earlier, download [r1.1.1](https://github.com/neverhood311/Stop-motion-OBJ/releases/tag/0.2.79.2). Note that this version is deprecated and will not be supported.

# Quick Start Tutorial
Expand Down
42 changes: 38 additions & 4 deletions src/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# ##### BEGIN GPL LICENSE BLOCK #####
#
# Stop motion OBJ: A Mesh sequence importer for Blender
# Copyright (C) 2016-2020 Justin Jensen
# Copyright (C) 2016-2024 Justin Jensen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -23,41 +23,55 @@

bl_info = {
"name": "Stop motion OBJ",
"description": "Import a sequence of OBJ (or STL or PLY) files and display them each as a single frame of animation. This add-on also supports the .STL and .PLY file formats.",
"description": "Import a sequence of OBJ (or STL or PLY or X3D or VRML2) files and display them each as a single frame of animation. This add-on also supports the .STL, .PLY, .X3D, and .WRL file formats.",
"author": "Justin Jensen",
"version": (2, 1, 1),
"blender": (2, 80, 0),
"version": (2, 2, 0, "beta.1"),
"blender": (2, 92, 0),
"location": "File > Import > Mesh Sequence",
"warning": "",
"category": "Import",
"wiki_url": "https://github.com/neverhood311/Stop-motion-OBJ/wiki",
"tracker_url": "https://github.com/neverhood311/Stop-motion-OBJ/issues"
}

SMOKeymaps = []

def register():
bpy.app.handlers.frame_change_pre.append(checkMeshChangesFrameChangePre)
bpy.app.handlers.frame_change_post.append(checkMeshChangesFrameChangePost)

bpy.types.Mesh.inMeshSequence = bpy.props.BoolProperty()
bpy.types.Mesh.meshHash = bpy.props.StringProperty()
bpy.utils.register_class(SequenceVersion)
bpy.utils.register_class(MeshImporter)
bpy.utils.register_class(MeshNameProp)
bpy.utils.register_class(MeshSequenceSettings)
bpy.types.Object.mesh_sequence_settings = bpy.props.PointerProperty(type=MeshSequenceSettings)
bpy.app.handlers.load_post.append(initializeSequences)
bpy.app.handlers.frame_change_pre.append(updateFrame)

# note: Blender tends to crash in Rendered viewport mode if we set the depsgraph_update_post instead of depsgraph_update_pre
bpy.app.handlers.depsgraph_update_pre.append(updateFrame)
bpy.utils.register_class(ReloadMeshSequence)
bpy.utils.register_class(BatchShadeSmooth)
bpy.utils.register_class(BatchShadeFlat)
bpy.utils.register_class(BakeMeshSequence)
bpy.utils.register_class(DeepDeleteSequence)
bpy.utils.register_class(MergeDuplicateMaterials)
bpy.utils.register_class(ConvertToMeshSequence)
bpy.utils.register_class(DuplicateMeshFrame)
bpy.utils.register_class(SMO_PT_MeshSequencePanel)
# note: the order of the next few panels is the order they appear in the UI
bpy.utils.register_class(SMO_PT_MeshSequencePlaybackPanel)
bpy.utils.register_class(SMO_PT_MeshSequenceStreamingPanel)
bpy.utils.register_class(SMO_PT_MeshSequenceExportPanel)
bpy.utils.register_class(SMO_PT_MeshSequenceAdvancedPanel)
bpy.app.handlers.render_init.append(renderInitHandler)
bpy.app.handlers.render_complete.append(renderCompleteHandler)
bpy.app.handlers.render_cancel.append(renderCancelHandler)

bpy.types.TOPBAR_MT_file_import.append(menu_func_import_sequence)
bpy.types.VIEW3D_MT_object.append(menu_func_convert_to_sequence)

# the order here is important since it is the order in which these sections will be drawn
bpy.utils.register_class(SMO_PT_FileImportSettingsPanel)
Expand All @@ -69,10 +83,21 @@ def register():
bpy.app.handlers.load_post.append(makeDirPathsRelative)
bpy.app.handlers.save_pre.append(makeDirPathsRelative)

keyConfig = bpy.context.window_manager.keyconfigs.addon
if keyConfig:
spaceTypes = [('3D View', 'VIEW_3D'), ('Dopesheet', 'DOPESHEET_EDITOR'), ('Graph Editor', 'GRAPH_EDITOR')]
for spaceType in spaceTypes:
keyMap = keyConfig.keymaps.new(name=spaceType[0], space_type=spaceType[1])
keyMapItem = keyMap.keymap_items.new('ms.duplicate_mesh_frame', type='D', value='PRESS', shift=True, ctrl=True)
SMOKeymaps.append((keyMap, keyMapItem))

def unregister():
bpy.app.handlers.frame_change_pre.remove(checkMeshChangesFrameChangePre)
bpy.app.handlers.frame_change_post.remove(checkMeshChangesFrameChangePost)

bpy.app.handlers.load_post.remove(initializeSequences)
bpy.app.handlers.frame_change_pre.remove(updateFrame)
bpy.app.handlers.depsgraph_update_pre.remove(updateFrame)
bpy.app.handlers.render_init.remove(renderInitHandler)
bpy.app.handlers.render_complete.remove(renderCompleteHandler)
bpy.app.handlers.render_cancel.remove(renderCancelHandler)
Expand All @@ -81,14 +106,19 @@ def unregister():
bpy.utils.unregister_class(BatchShadeFlat)
bpy.utils.unregister_class(BakeMeshSequence)
bpy.utils.unregister_class(DeepDeleteSequence)
bpy.utils.unregister_class(MergeDuplicateMaterials)
bpy.utils.unregister_class(ConvertToMeshSequence)
bpy.utils.unregister_class(DuplicateMeshFrame)
bpy.utils.unregister_class(SMO_PT_MeshSequencePanel)
bpy.utils.unregister_class(SMO_PT_MeshSequencePlaybackPanel)
bpy.utils.unregister_class(SMO_PT_MeshSequenceStreamingPanel)
bpy.utils.unregister_class(SMO_PT_MeshSequenceExportPanel)
bpy.utils.unregister_class(SMO_PT_MeshSequenceAdvancedPanel)
bpy.utils.unregister_class(MeshSequenceSettings)
bpy.utils.unregister_class(MeshNameProp)

bpy.types.TOPBAR_MT_file_import.remove(menu_func_import_sequence)
bpy.types.VIEW3D_MT_object.remove(menu_func_convert_to_sequence)
bpy.utils.unregister_class(SMO_PT_FileImportSettingsPanel)
bpy.utils.unregister_class(SMO_PT_TransformSettingsPanel)
bpy.utils.unregister_class(SMO_PT_SequenceImportSettingsPanel)
Expand All @@ -102,5 +132,9 @@ def unregister():
bpy.app.handlers.load_post.remove(makeDirPathsRelative)
bpy.app.handlers.save_pre.remove(makeDirPathsRelative)

for km, kmi in SMOKeymaps:
km.keymap_items.remove(kmi)
SMOKeymaps.clear()

if __name__ == "__main__":
register()
Loading

0 comments on commit f163205

Please sign in to comment.