【bug】blender AttributeError: Calling operator “bpy.ops.import_scene.obj“ error, could not be found

【bug】blender AttributeError: Calling operator “bpy.ops.import_scene.obj” error, could not be found

环境

blender 4.3.0

问题详情

import bpy
bpy.ops.import_scene.obj(filepath="D:/3dfile/car.obj")

Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
  File "C:\Program Files\Blender Foundation\Blender 4.3\4.3\scripts\modules\bpy\ops.py", line 109, in __call__
    ret = _op_call(self.idname_py(), kw)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: Calling operator "bpy.ops.import_scene.obj" error, could not be found

这是在使用blender 软件通过Python脚本导入obj 格式3d模型时弹出的错误。

错误原因是该API在blender 4.x已经不存在了,改为bpy.ops.wm.obj_import(filepath=obj_path) 了。

解决方法

将导入函数改为

import bpy
bpy.ops.wm.obj_import(filepath="D:/3dfile/car.obj")

.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值