ZBrushCentral

Simple Pipeline Setup

Hey folks, Experienced developer/tech artist here taking first steps trying to integrate zbrush (even simply) into a pipeline workflow for my artists. We’re looking to have ztools as a base level asset that we can then process and extract meshes/textures from later in the pipe, and trying to avoid the back and forth of previous projects that usually results in me requesting that the artist give me the ztool so I can export it properly.

I’ve started out recording a Macro of my process in importing an FBX and saving it as a ztl – we want to be able to create meshes elsewhere, and the artist prefers to just stay in zbrush, so the ideal would be to give them a tool that’s already properly scaled.

When I run my freshly recorded macro, however, zbrush stops at the fbx import dialog, and never saves the ztl. I’m suspecting this is due to control passing to the FBX plugin (as I understand it, only one plugin can be active at a time). Does this mean I need to write my own importer/exporter DLL to call with FileExecute? (And, if so, is there even any way to do so? I can’t see any references to accessing mesh data to translate into FBX)

My next step on this is to do the same process with .ztl to fbx, and I’m concerned about running into the same issue there. We usually need to do a multi-map export with a select set of maps and the FBX of the lowest division level, so the workflow’s straightforward, but I’m concerned about what happens when we open the dialog.

My plan (given what I’d understood about the process) had been to have our pipeline code generate zscripts that had the specific parameters/filepaths for the assets we needed. It appears there’s a bit more to that than just having those scripts, however, as we then need to have a precompiled script that will load a text file from a fixed location and convert it to a zsc (since that itself needs to be a zsc).

Looking further down in the forum, I am seeing posts about 4R8 hopefully fixing the problems with scripting around note interfaces, but we’re a few versions on from that and it still looks to be a problem?

Is there any way to do these fairly simple imports and exports non-interactively?

I’ve got a script called SV_Tool, IF NAMED WILL SAVE OVER THE EXISTING FILE WITHOUT A PROMPT/DIALOG.

Hmm, I’m not sure I follow. The macro that’s generated comes out like this:

//RECORDED ZSCRIPT 2020
[IButton,Play,"Press to play this ZScript. ZScript can be aborted at anytime by pressing the ëescí key.",
[IReset,,2020]
[FileNameSetNext,"<My Source FBX Path>"][IPress,Tool:Import]
[IConfig,2020]
[IConfig,2020]
[IFreeze,
]
[FileNameSetNext,"ZBRUSH_/ZStartup\ZPLUGS64/ExportImportData_2020/PolyMesh.ztl"][IPress,Tool:Load Tool]
[FileNameSetNext,"C:\Users\Public\Documents/ZBrushData2020/ZPluginData/FBXExportImportData/box.obj"][IPress,Tool:Import]
[FileNameSetNext,"C:\Users\Public\Documents/ZBrushData2020/ZPluginData/FBXExportImportData/normal1.GoZ"][IPress,Tool:Import]
[FileNameSetNext,"<My Desired ZTL path>"][IPress,Tool:Save As]
]/*End of ZScript*/

Which for the first step of testing I modified to this:

[If, 1,
[IReset,,2020]
[FileNameSetNext,"<My Source FBX Path>"][IPress,Tool:Import]
[IConfig,2020]
[IConfig,2020]
[IFreeze,
]
[FileNameSetNext,"ZBRUSH_/ZStartup\ZPLUGS64/ExportImportData_2020/PolyMesh.ztl"][IPress,Tool:Load Tool]
[FileNameSetNext,"C:\Users\Public\Documents/ZBrushData2020/ZPluginData/FBXExportImportData/box.obj"][IPress,Tool:Import]
[FileNameSetNext,"C:\Users\Public\Documents/ZBrushData2020/ZPluginData/FBXExportImportData/normal1.GoZ"][IPress,Tool:Import]
[FileNameSetNext,"<My Desired ZTL path>"][IPress,Tool:Save As]
]

Obviously replacing the fbx and ztl paths with my input and output locations. What I glean from this is that FBX Import is handled through outputting a file into it’s plugin directory based on the shape name (I’ve just been testing with a simple cube with normals applied out of houdini, so the shape name is ‘normal1’).

This presents two challenges, first that I can’t guarantee shape names coming in (although as I said I could make an FBX processor that would rename them coming in), so while I could pretty easily move my files to a known location for the script to bring in and save, I’d still need to adapt the script to point to the named GoZ file which varies on import.

Second, I get multiple prompts in the process. If I’m just running the script (either from the command line or by double clicking it) I get this: image
That one’s pretty easy, I could just skip the initialisation step (as I said, I plan to run this non-interactively, but there’s no guarantee zbrush wouldn’t already be open)

But, then I get this:
image

Since I’m importing an FBX, that one’s harder to get around. And, after clicking on the ‘OK’ button, I’m left in zbrush with my FBX loaded as a tool, but no saved ZTL. As I said before, my suspicion there (would love to have just missed something) is that as soon as this dialog comes up we’re in the control of the FBXExportImport plugin, and my script is gone.

I suppose I could work on a pre-step that outputs an obj to import from, but still concerned about the other initialisation dialog that comes up at that stage.

Also, would love to see what others have done here, is SV_Tool available somewhere?

//Thanks to marcus_civis for this button that saves the current tool with the same file name
// or asks for a new name for ZBrush default tools

[IButton,"???",“SV_Tool, NO WARNINGS, IF NAMED, SAVES OVER THE EXISTING TOOL!!”,
[VarSet,toolPath,[ToolGetPath]]
[If,[StrLength,toolPath],
[If,([StrFind,"",toolPath]==-1)&&([StrFind,"/",toolPath]==-1),
//not a full path - use Save As"
[IPress,Tool:Save As]
,//else we have a full path
[VarSet,toolPath,[StrMerge,toolPath,".ztl"]]//must add on file extension
[FileNameSetNext,toolPath]
[IPress,Tool:Save As]
[NoteBar,[StrMerge,toolPath," saved…"]]
] //end if
]//end if
]//end button

oh nice, will have to check that out tonight :slight_smile: Thanks!

Were you able to make some headway?

I wasn’t yet. The script you have just saves the current tool without a prompt (which is great), but the issue I’m having appears to be around my script calling the import and then getting terminated by the FBX import plugin’s window, so having it import it and then save it out without interaction doesn’t seem possible. My next step is trying with an OBJ instead of FBX, but as I’m thinking about it, we’ll still have issues with i.e. scale of the object I’d suspect, so I’m not sure that we won’t be better off just using GoZ to get it to houdini and publishing from there, and then having a script to rebuild division levels for the artists (i.e. from proxy and hero meshes).

Im having the same problem. Did you manage to figure out a way around this?