Python SDK Questions - FBX Import and Folder / Subtool Management
-
Hello everyone,
I'm trying to get started with the new python API, and I'm struggling to get things working. I’d appreciate any insight on the following:Importing FBX
I'm unable to automate fbx importing, from the documentation I figured something like this would work, but the file explorer dialog keeps opening.
import zbrush.commands as zbc zbc.set_next_filename("c:\\MyModel.fbx") zbc.press("Zplugin:FBX ExportImport:Import")Folder Creation
I want to automate folder creation and naming
zbc.press("Tool:SubTool:New Folder")This correctly calls the "New Folder" button, but how can I automate what gets typed into the popup dialog? Can I create folders with a specific name without user typing the name?
Subtool Renaming
Is there any way to rename the subtools inside a tool? I guess this is a similar question to the Folder creation, if I can fill the text in the popup from the ui button, this would be easy.
The closest thing I got was renaming just the first subtool by renaming the tool itself:zbc.set_tool_path(zbc.get_active_tool_index(), f"MyFirstSubtool")Is there a way to fill or interact with these popup dialogs?
Thanks in advance
-
新的py我不知道,但是旧的 我觉得能达到你的要求,虽然我没这样尝试。一般子工具重命名有两种方式: 一种 通过设置 FileNameSetNext 导出空文件 的方式,利用程序导出时自动改名来重命名。还有一个是 调用ZFileUtils64.dll中的 重命名函数,修改:
···
// 设置要使用的名称,而不是询问用户
// @str:将替换为用户输入的文本/字符串[RoutineDef, ZFU_RenameSetNext,
[FileExecute, [Var, dllPath], RenameSetNext, str]
, str]// 通过为请求重命名框的按钮提供路径来重命名 “something”
// @buttonPath:要求用户重命名“某物”的按钮的路径
// @str:将替换为用户输入的文本/字符串[RoutineDef, ZFU_RenameFromButtonPath,
[If, (([IExists, buttonPath]) && ([IsEnabled, buttonPath])),
[FileExecute, [Var, dllPath], RenameSetNext, str]
[IPress, buttonPath]
]
, buttonPath, str]// 重命名当前 SubTool
// @str:新的 SubTool 名称[RoutineDef, ZFU_RenameCurrentSubTool,
[RoutineCall, ZFU_RenameFromButtonPath, "Tool:SubTool:Rename", str]
, str]
···
个人建议 :批量重命名还是在外部处理好 再导入最佳。而且ZB支持bat 等外部执行方式。