ZBrushCentral

ZScript Problem: Can't export/save render

Hello,
I’m trying to create render passes export macro. I really need it to process and showcase a lot of models, so creating automatization is essential for this process.
So far everything is going fine until I needed to automate saving Mask, Depth, and BPR render to seperate psd files. When I try to record pressing and saving either the BPR, Mask or Depth it seems not possible. What I get is

ZScript Note: Interface item could not be found.
ERROR: Render:BPRRenderPass:Com
IN: [IPress,Render:BPRRenderPass:Com]

I tried doing it several different ways but the problem stays the same. This is what the script looks like when I record saving single Render Pass.
What I need is essentially export these three passes to either one or seperate files, so later on Photoshop Actions can pick it up and process it further.

//ZBRUSH MACRO - Recorded in ZBrush version 2021
[IButton,???,“Press to run this macro. Macros can be aborted by pressing the ëescí key.”,
[IShowActions,0]
[IConfig,2021]
[FileNameSetNext,“C:_Prep_Portfolio\BPR_Composite.psd”][IPress,Render:BPR RenderPass:Com]
]

Thanks!

1 Like

To specify further, I can’t seem to macro or script export/save render result in any way. I can macro/script BPR for example to render but there is no way I can export it and then proceed to another timeline track and render different view and export it.

try that:

[RoutineDef, Export_BPR_Pass,

	//2206 = Composite
	//2207 = shaded
	//2208 = depth
	//2209 = shadow
	//2210 = AO
	//2211 = Mask
	//2315 = SSS
	//2316 = floor
	[VarSet, filename, ""]

	[If, (type == 2206),
		[VarSet, filename, "render_composite.psd"]
		[FileNameSetNext, filename]
		[If,([StrFind,"Width=",[IGetInfo, type]]>-1),[IPress,type]]
	]	
,type]

[IButton, "Zplugin:My Plugin:Export BRP Pass","Export to psd accordingly to the pass type passed as argument.",

	[RoutineCall, Export_BPR_Pass, 2206]

,,1]
1 Like

Thank you kindly for that piece of code @facelessmindz
Although I must admit I can’t seem to wrap my head around scripting. I was really hoping I could make it happen with recording script/macros. Can you advise me how to better understand the zbrush scripting and learn how to implement for example that lines you provided?

Thanks,

All right, let me explain a little.

so Zscript can be different type, MAcro, Zscripts or Plugin:
the code i had posted is a plugin, you put it in Zbrush 2021/zstartup/zplugs64/
and to load it, you just use Zscript:load, and a load the txt file.
so it will create a new subpalette into Zplugin, and then you can see the IButton interface with (Zplugin:My plugin::Export BRP Pass)

now if you prefer to have it working for composite render pass but as a Macro:
use that code:

[IButton, "???","Export to psd accordingly to the pass type passed as argument.",

	//2206 = Composite
	//2207 = shaded
	//2208 = depth
	//2209 = shadow
	//2210 = AO
	//2211 = Mask
	//2315 = SSS
	//2316 = floor
	[VarSet, filename, ""]

	[If, (type == 2206),
		[VarSet, filename, "render_composite.psd"]
		[FileNameSetNext, filename]
		[If,([StrFind,"Width=",[IGetInfo, type]]>-1),[IPress,type]]
	]

,,1]

just change the path, or it will export in the same directory where the Macro/plugin is located

Thank you, that is very helpful and I appreciate your effort in explaining this issue better to me.