Blender:从脚本中调用自定义菜单操作

问题描述 投票:0回答:1

我在使用Blender 2.80,并安装了一个附加组件(不是我开发的)。这个插件增加了一些新的功能,允许用户用自定义的扩展名导出场景(为了做到这一点,它在文件--> Export中增加了一个新的选项)。

现在我正在开发一个新的python脚本,能够打开一个新的blender场景,进行一些操作,然后使用自定义扩展名保存它,但我不知道如何调用自定义导出选项。

简单来说,这是我到现在为止所做的事情。

import os
import bpy

bpy.ops.wm.open_mainfile(filepath="path//to//file.blend")

# some actions...

# not what I want since this export the scene as obj file...
bpy.ops.export_scene.obj(filepath="path//to//target.obj")
python blender bpy
1个回答
0
投票

在偏好设置中启用 "Python Tooltips "和 "Developer Extras"。

然后进入 "file > Export "并将光标悬停在该菜单项上,它会告诉你操作员的调用。

你可以在脚本中使用该调用来运行它。

© www.soinside.com 2019 - 2024. All rights reserved.