ZBrushCentral

auto save

Hi,

I’ve been trying to get a script which will load a predefined ztool (this will be hardcoded in the code) and save a bitmap to a predefined path.

is there a command which will do that? ive checked the Zscript command list but all I see is the MemCreate command…

Hi TigerZ,

For operations like this the simplest approach is to use the [FileNameSetNext,] command to set the file name (and path, if necessary) and then use [IPress,] to press the relevant ZB interface button. So you could export a canvas image by using [IPress,Document:Export] or load a tool by using [IPress,Tool:Load].

HTH,

thank for your response, but this doesnt save automatically, since I need it to open a ztl and save bitmaps as a batch process

any other suggestions? thanks

Hi TigerZ,
I’m not quite sure what you are trying to do, so you’ll have to explain in more detail before I can make any more suggestions. Alternatively, record a zscript of the actions that you want to replicate in your batch script, then examine the code to see what’s going on.

The problem I encountered when trying to load a Ztool using a script is that it opens a “open file” dialog which the user has to input a file before continuing. I need to skip the user input, and let the script load the Ztool automatically without a dialog from a hardcoded path.

as if I was loading it from the script (as an example):
model = loadZtool (“c:\models\mesh.ztl”);

I think the command you’re looking for is the IKeyPress command which can be used in this case to simulate hitting the Enter key after the fileload dialog box appears.

Try [IKeyPress, 13, [IPress, TOOL:Load ] ]

(13 = enter key)

You can hide the whole operation by enclosing it within IFreeze command brackets.

If you have the ZScript Reference Manual check out IKeyPress and the various other uses for it…

Sven

As Sven says, wrapping [IKeyPress, 13, ] around a command that returns a dialog box will prevent it appearing. But for loading a ztool this shouldn’t be necessary:

[IButton,"My ZScript",,
[FileNameSetNext, "C:\models\mesh.ztl"]
[IPress,Tool:Load Tool]
]

This code should work fine, providing there is a model called mesh.ztl. (Although apologies for the mistake with the Load Tool button path.) You can define the ztool as a variable if you wish:


[VarDef,model,""]
[VarSet,model, "C:\models\mesh.ztl"]

[IButton,"My ZScript",,
[FileNameSetNext, model]
[IPress,Tool:Load Tool]
]

ohh… thats a great idea

Thanks! ill try it out

very nice, it works!

one last question, I’ve been trying to clear Zbrush of models in memory, but I cant seem to be able to skip the “do you want to reset” dialog. Would there be an alternative ?

currently I’m using [IReset,2.0] command

[IReset,3] will just rest the tools. I can’t remember if that shoves up a dialog, but if it does just use Sven’s keypress tip above.

Tiger,

I’d be a little gun-shy about a button that deletes all of your Tools without confirmation. That’s the kind of thing that can bite you when you least need to be bit.

Sven