ZBrushCentral

Question: Launching ZBrush and running a ZScript through a batch?

Separating complex objects and manually exporting the various pieces can become a long process to manage. I would like to automate this process on our render farm using the extra ZBrush licenses that we have. Is there a way to automatically launch ZBrush and run a ZScript through a batch command so that our render farm manager could automatically manage the export of many objects on multiple machines and be informed when the process is done so the render manager can launch the next phase of processing that exported data?

ZBrush can be launched from a BAT file provided the full path is used:


@echo off
start "" "C:\Program Files (x86)\Pixologic\ZBrush 4R2\ZBrush.exe"

The DefaultZScript.txt (\Pixologic\ZBrush 4R2\ZScripts\DefaultZScript.txt) runs on startup, so you can use that either to carry out commands directly or launch another zscript (which may be easier to manage). For example, if you edit the DefaultZScript like this:


//startup
[If,1,
[FileNameSetNext,"DoItZScript.txt"]
[IPress,ZScript:Load]
]
[pd]

it will then launch a zscript named “DoItZScript.txt” which resides in the same folder. That zscript might contain code something like this:


[If,1,
[IPress,Tool:PolyMesh3D]
[FileNameSetNext,"C:\Program Files (x86)\Pixologic\ZBrush 4R2\ZExportImport\PolyMesh.OBJ"]
[IPress,Tool:Export]
[IPress,CLOSE]
]

which will export the PolyMesh3D Star, then close ZBrush. (Note that in the above example the code is wrapped in an [If…] statement that is always true so that second level commands can be used without the need for a button container.)

Note also that you cannot run or set options for another plugin/zscript from within a zscript without control passing to the second plugin/zscript. In other words, you can’t get your script to, for example, assign UVs using UV Master then export maps using MultiMapExporter.

HTH,

OK. Great! I think I can work with that. I’ll look into it and let you guys know if I have any other questions/blocking. Thank you for the information. Much appreciated.

-Mathieu

Hello, I recently wrote a script to show 100 kinds of expressions in the model, and save the model files of the expression state at that time. There are also 100 corresponding model files. For example, crying, storing a model, laughing, storing a model, and there are many kinds of expressions. My zscript was finished, and I found it when I was running. As a result, the expression attributes were all operated before being stored, which led to 100 duplicate data of the last expression. Looking forward to your answer as soon as possible, I am really sorry to disturb you!

Hi,
Welcome to ZBC.

It’s really not possible to say what might be the problem without seeing the code you have written. Please start a new thread (as it’s not the best idea to add to existing threads with new questions) and be sure to post some of your code. I will then see if I can find what is wrong.

Thanks,
Marcus