neverhood311 / Stop-motion-OBJ

A Blender add-on for importing a sequence of OBJ meshes as frames
GNU General Public License v3.0
688 stars 53 forks source link

Could you add a feature to keep vertices? #88

Closed j20232 closed 4 years ago

j20232 commented 4 years ago

About

Current implementation may have a bug not to keep vertex indices when we load .obj meshes at Blender 2.83.0.

The bug is caused by not setting split_mode="OFF" which is attributes of bpy.ops.import_scene.obj. Reference: https://docs.blender.org/api/current/bpy.ops.import_scene.html#bpy.ops.import_scene.obj

In naive implementation, I can fix the bug as follows.

def importFuncFromTypeNumber(_typeNumber):
    # OBJ
    if (_typeNumber == 0):
        return bpy.ops.import_scene.obj, {"split_mode": "OFF"}
    # STL
    elif (_typeNumber == 1):
        return bpy.ops.import_mesh.stl, {}
    # PLY
    elif (_typeNumber == 2):
        return bpy.ops.import_mesh.ply, {}
    return None
importFunc, kwargs = importFuncFromTypeNumber(
            int(_obj.mesh_sequence_settings.fileFormat))
importFunc(filepath=file, **kwargs)

Could you fix the bug?

neverhood311 commented 4 years ago

Which version of Stop Motion OBJ are you using?

j20232 commented 4 years ago

Thank you for your reply. The version is 2.0.2.

neverhood311 commented 4 years ago

I don't really consider that a bug, more of a feature request. In version 2.0.2 and earlier, I don't use any non-default import settings (as you've seen in the code).

However, all of that is changing in version 2.1. You'll be able to specify most of the built-in import settings for each file format as you're importing a mesh sequence. Version 2.1 is in the Beta phase so all of the new functionality is in place, I'm just working on finding and fixing bugs now. If you'd like to try out the Beta, feel free to grab it from the releases page. And please report any bugs you find. (and take a look at the project wiki; the way you import a mesh sequence has changed.)