ZBrushCentral

Question: run a command after saveDialog is closed

Hey, Newb coder here. I just started doing zscripting this weekend and I have one question. what’s the code that would identify if the user has closed the save dialog box?

I’ve gone through the zscript tutorial on zcentral and I’m writing my first zscript. When the user presses the button on the zscript, zbrush goes through multiple commands and then tells the user to save the texture. Now I want the script to execute one more command right after the user saves the texture, and then exit the zscript. This is probably very simple and I’m just overlooking something. Any help is appreciated.

You could use the [FileNameGetLastUsed] command. If your code includes [IPress,Texture:Export], so that the Save As dialog automatically pops up then [FileNameGetLastUsed] will return the file name used or an empty string if the user cancelled. If you are leaving it up to the user to press the Texture:Export button then you can’t really test with certainty.

However the best method is to ask the user for a filename using [FileNameAsk]. If the user cancels (when the dialog will return an empty string) you have control to let the plugin exit gracefully. If the user enters a filename you can use it to save the file like this:

[FileNameSetNext,#filepath]
[IPress,Texture:Export]

You can then carry on with your code knowing everything is all right.

HTH,

thanks! i’ll go over this once i get home :+1: