jayanam / jremesh-tools

Blender addon for quad remeshing
GNU General Public License v3.0
309 stars 32 forks source link

Getting a python error. #7

Open SyRaza opened 1 year ago

SyRaza commented 1 year ago

I have no idea what this means but this is the error I'm getting. I'm on blender 3.3.1

Python: Traceback (most recent call last):
  File "C:\Users\Sy\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\jremesh-tools-main\jrt_remesh_op.py", line 74, in execute
    bpy.ops.export_scene.obj(filepath=orig,
  File "C:\Program Files\Blender Foundation\Blender 3.3\3.3\scripts\modules\bpy\ops.py", line 113, in __call__
    ret = _op_call(self.idname_py(), None, kw)
AttributeError: Calling operator "bpy.ops.export_scene.obj" error, could not be found
bekmeh commented 1 year ago

I had the same error, and resolved it by enabling the plugin called "Import-Export: Wavefront OBJ format (legacy)"

jakub-bak commented 1 year ago

I had the same error, and resolved it by enabling the plugin called "Import-Export: Wavefront OBJ format (legacy)"

That resolves the issue indeed, worth mentioning in the DOCS as some users disabled that legacy importer for startup time savings.

dfsadfsfsa commented 1 year ago

Ive just had the same error using Blender 4.0.
Wavefront OBJ Import/Export is built in to Blender as of v3.3 hence no option to install addon.

ZackHaronOriginal commented 11 months ago

I'm getting the same error has anyone found a solution to this?

Stefanizam commented 11 months ago

Any solutions for blender 4.0 ?

natahnd commented 11 months ago

For blender 3.3 and 4.0, the OBJ Import/Export is now built into the system, so the API calls bpy.ops.export_scene.obj and bpy.ops.import_scene.obj no longer exist. I dug into the blender API changes and found the new functions for OBJ Import/Export and implemented those but I'm not entirely sure it is the correct fix, as some of the arguments from the original functions aren't in the new functions.

However, for someone else to test and verify if they would like, these are the changes I made inside the failing file:

On line 73, I changed the OBJ export command from:

# Export original object
bpy.ops.export_scene.obj(filepath=orig,
                            use_selection=True,
                            use_mesh_modifiers=True,
                            use_edges=True,
                            use_smooth_groups=False,
                            use_smooth_groups_bitflags=False,
                            use_normals=True,
                            use_uvs=True)

to

# Export original object
bpy.ops.wm.obj_export(filepath=orig,
                            check_existing=False,
                            export_selected_objects=True,
                            apply_modifiers=True,
                            export_smooth_groups=False,
                            smooth_group_bitflags=False,
                            export_normals=True,
                            export_uv=True)

On line 96, I changed the OBJ Import command from:

# Import remeshed object
bpy.ops.import_scene.obj(filepath=output,
                             use_smooth_groups=False)
                             use_image_search=False)

to

# Import remeshed object
bpy.ops.wm.obj_import(filepath=output,
                             use_split_objects=False)

If someone else could verify if these are the correct changes then would be as appreciated as this is the first time using this plugin for me in Blender, so I'm not sure if the results are correct or not, and I haven't installed the older versions to verify. Cheers

ddkro commented 11 months ago

If someone else could verify if these are the correct changes then would be as appreciated as this is the first time using this plugin for me in Blender, so I'm not sure if the results are correct or not, and I haven't installed the older versions to verify. Cheers

4.0, it's not working

CiPH3R-NFS commented 10 months ago

@natahnd i ran your fix and got this error

image

arrafi-musabbir commented 10 months ago

Turns out bpy.ops.import_scene.obj was removed at bpy>=4 which is the latest blender-api for python, hence the error. In bpy>4 you have to use bpy.ops.wm.obj_import(filepath='')

I just downgraded to bpy==3.60 and it worked for me:

pip install bpy=3.6.0
jayanam commented 10 months ago

I am in the process of migrating all my addons to Blender >= 4

On Sat, Jan 13, 2024 at 3:08 PM Musabbir Arrafi @.***> wrote:

Turns out bpy.ops.import_scene.obj was removed at bpy>=4 which is the latest blender-api for python, hence the error. In bpy>4 you have to use bpy.ops.wm.obj_import(filepath='')

I just downgraded to bpy==3.60 and it worked for me:

pip install bpy=3.6.0

— Reply to this email directly, view it on GitHub https://github.com/jayanam/jremesh-tools/issues/7#issuecomment-1890468029, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEJUGIGTVM3R5J5TOMCL6MTYOKIOBAVCNFSM6AAAAAASUDZ7VCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJQGQ3DQMBSHE . You are receiving this because you are subscribed to this thread.Message ID: @.***>

arrafi-musabbir commented 10 months ago

that would be great, thank you!

natahnd commented 10 months ago

@natahnd i ran your fix and got this error

image

The error you're reporting suggests that the changes haven't been applied in your Blender correctly. This likely requires a restart of Blender if you changed the python script whilst it was open. The reason I can tell its not updated is it's saying:

"calling operator bpy.ops.export_scene.obj error" whereas the new function name, if updated correctly is bpy.ops.wm.obj_export.

That said I would wait for the official update as indicated in the above comments :)