2017-02-26 74 views
1

我想使某些操作自动化。但是我在烘烤后导出图像遇到了一些麻烦。首先尝试使用“bpy.ops.object.bake_image ()“来烘烤图像,但结果图像不能在uv编辑器中激活。 The bake was success,but the result image didn't appear in the uv editor.It need selected so that I could export the file.如何使用python导出烘焙图像形式的搅拌机

所以我搜索文档,并发现其他命令“bpy.ops.object.bake()”,它有一个参数“save_mode”,但我还是一直在使用这种command.It遇到了一些障碍指出我“RuntimeError:错误:在材质”材质“(0)中找不到对象”1.001“中的活动图像”“。 下面是关于这个两个命令的正式文件:
https://docs.blender.org/api/blender_python_api_2_78a_release/bpy.ops.object.html?highlight=bake#bpy.ops.object.bake

任何人都可以尝试给我一些解决方案或一些建议,我怎么能做出这件事情吧。

+0

Hers是我尝试自动操作的链接:https://software.intel.com/zh-cn/blogs/2015/03/27/intel-realsense-3d-scanning-how- to-import-to-unity – RyanChen

回答

0

许多搅拌机操作员需要一定的环境才能工作,bpy.ops.image.save()包括具有活动图像的UV /图像编辑器。虽然there are waysoverride the current context为使它们工作,但使用其他方法通常会更容易。

Image对象本身可以是save()。如果是新图片,您首先需要将其设置为filepath,您可能还需要将其设置为file_format

img = bpy.data.images['imagename'] 
img.filepath = '/path/to/save/imagename.png' 
img.file_format = 'PNG' 
img.save() 
+0

谢谢!这是工作! – RyanChen