我想在blender中导入obj文件 [英] I want to import obj files in blender

查看:3481
本文介绍了我想在blender中导入obj文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在我的代码如下:

import os
import bpy

path_to_objdir = os.path.join('C:\\','Users\vincent.martel\Documents\Data\full_mesh')
file_list = sorted(os.listdir(path_to_objdir))
obj_list = [item for item in file_list if item.endswith('.obj')]
for item in obj_list:
    path_to_file = os.path.join(path_to_objdir, item)
    bpy.ops.import_scene.obj(filepath = path_to_file, split_mode = "OFF")

当我运行此代码时,控制台输出错误并突出显示我初始化我的file_list但没有说出任何其他内容的行(blender控制台甚至没有命名错误)。

When I run this code, the console outputs an error and highlights the line where I initialize my file_list but does not say anything else (blender console does not even name the error).

有人能找到修复方法吗?

Can anyone find a fix?

推荐答案

打印出变量的值 path_to_objdir 并在Windows控制台上将其复制/粘贴到 dir 语句中。它有用吗?如果没有,则修复该值以使其起作用。我没有你的系统所以我无法验证这一点,但我会尝试的第一件事是

Print out the value of your variable path_to_objdir and copy/paste it into a dir statement at the Windows console. Does it work? If not, then fix the value so that it does work. I don't have your system so I can't verify this, but the first thing I would try is

path_to_objdir = os.path.join('C:','Users','vincent.martel','Documents','Data','full_mesh')

这篇关于我想在blender中导入obj文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆