ZBrushCentral

BPR Render Pass Export in Macro [Answered]

How can I automate BPR render pass exporting? I want to put this into a macro, but I get a ‘Interface item could not be found’ error message when the macro gets to the point where you’d manually click the render pass thumbnail icon.

Any suggestions greatly appreciated. Thank you in advance!

Rory

There’s a little plugin for that, which may save you the trouble:
http://www.zbrushcentral.com/showthread.php?94752-Useful-small-ZScripts-and-Macros-for-ZBrush-4-amp-4R2&p=907347&viewfull=1#post907347

Marcus, you are a miracle worker! :slight_smile:

…However, my project lead programmer has included this variables set-up into my images exporter macro:-

// Variable defs
[VarDef,fullName,""]
[VarDef,filePath,""]
[VarDef,filePathandName,""]
[VarDef,tifFile,""]

////////////////////////////////////////////////

[FileNameAsk, “****”, “*****”]

[VarSet,fullName,[FileNameGetLastUsed]]
[VarSet,filePath,[FileNameExtract, fullName, 1]]
[VarSet,filePathandName,[FileNameExtract, fullName, 1+2]]

…so I’d be happier still if the active ingredients of your script could be incorporated into the macro. Your script as it stands can’t be called from the macro; I get the same ‘Interface Item’ error message.

I know this is looking the gift horse in the mush, but I have to try my luck! :slight_smile:

Thank you again,

Rory

Can you either post the whole macro, or the bit where it fails? I don’t see any reference to the Render Pass thumbnails in the code you have posted.

This is the relevant bit of the macro. It gets preceded by the Variable defs code I showed you above. I replaced the specific filepath and file name line, (that pressing a BPR render pass thumbnail icon creates) with the [FileNameSetNext,tifFile] part of my regular Document Export code.

// Front Colour
[IPress,Tool:SubTool:Back]
[IUnPress,Tool:SubTool:Back]
[IPress,Tool:SubTool:Front]
[IPress,Material:MatCap White01]
[IPress,Render:Render Properties:Shadows]
[IPress,Render:Render Best Preview]

[VarSet,tifFile,[StrMerge, filePathandName, “_FC.tif”]]
[FileNameSetNext,tifFile] [IPress,Render:BPR RenderPass:Img]
[VarSet,tifFile,[StrMerge, filePathandName, “_FCShadow.tif”]]
[FileNameSetNext,tifFile] [IPress,Render:BPR RenderPass:Shdw]
[VarSet,tifFile,[StrMerge, filePathandName, “_FCAO.tif”]]
[FileNameSetNext,tifFile] [IPress,Render:BPR RenderPass:AmOc]
///////////////////////

There are more renders of different combinations of materials and subtools before and after this section, and a dll gets called at the end, to combine them all into one texture page, but that doesn’t have a bearing on this code here.

Thank you for your continuing support: you are a wonderful resource!

OK, thanks. :slight_smile:

This will work if you use the numerical IDs for the image icons. (You can find the IDs for interface items by placing the cursor over the item and looking at the Preferences>Utilities>View Window Id slider.) I have also included a test that I use to check that there is actually an image to export, though note that the image is not cleared between BPR renders, so if you (for example) turn off Shadows after a BPR render with shadows the previous pass will be exported.
The [FileNameSetNext] (without a value) is just a precautionary measure - it clears the previous file name - and is not strictly necessary.

//image export		
		[If,([StrFind,"Width=",[IGetInfo,2209]]>-1),
			[VarSet,tifFile,[StrMerge, filePathandName, "_FC.tif"]]
			[FileNameSetNext,tifFile]
			[IPress,2209]
		]//image done
		[FileNameSetNext]//clear value	
		//shadow export		
		[If,([StrFind,"Width=",[IGetInfo,2211]]>-1),
			[VarSet,tifFile,[StrMerge, filePathandName, "_FCShadow.tif"]]
			[FileNameSetNext,tifFile] 
			[IPress,2211]
		]//shadow done
		[FileNameSetNext]
		//AO export	
		[If,([StrFind,"Width=",[IGetInfo,2212]]>-1),
			[VarSet,tifFile,[StrMerge, filePathandName, "_FCAO.tif"]]
			[FileNameSetNext,tifFile]
			[IPress,2212]
		]//AO	done
		[FileNameSetNext]

HTH,

Fantastic! You should get a credit in our game! I really don’t know how you manage to do your regular job with all of us pestering you with these maddening questions!

Much appreciated!

Rory