ZBrushCentral

Can this Toggle Both Trays script be modified to work with Zbrush 2019

I want a macro that closes both trays with one button.

I found this script on the forum that Marcus wrote.

It closes or opens both trays with one button, but its not working with ZB 2019
I thought it was due to the double clicking now used to open / close trays. I tried to alter it to work, but could not get it to work. Can any one show me how it might be done ? Thanks.

//ZBRUSH MACRO - save file to ZStartup/Macros/Misc folder

[IButton,???,“Toggle trays open/closed”,
//create memory block to store tray states if necessary
[If,[MemGetSize,ToggleTrays_Mem],
[MVarDef,ToggleTrays_Mem,1,3]
]
[IFreeze,
//check tray states
[If,(([IHPos,1000]>0)||([IHPos,1001]+[IWidth,1001]<[IWidth,Title])),//if either tray is open
[MVarSet,ToggleTrays_Mem,0,0]
[If,[IHPos,1000]>0,//the left tray is open
[MVarSet,ToggleTrays_Mem,0,1]
[IClick,1000]
]
[If,[IHPos,1001]+[IWidth,1001]<[IWidth,Title],//the right tray is open
[MVarSet,ToggleTrays_Mem,0,[MVarGet,ToggleTrays_Mem,0]+2]
[IClick,1001]
]
,//else both trays are closed so open them as required
[If,(([MVarGet,ToggleTrays_Mem,0]==1)||([MVarGet,ToggleTrays_Mem,0]==3)),//open left tray
[IClick,1000]
]
[If,([MVarGet,ToggleTrays_Mem,0]>1),//open right tray
[IClick,1001]
]
]
]

,.5]//button half palette width

Apologies, I’ve been busy and forgot to reply to this!

Try this. Copy to a plain text file and save to the ZStartup/Macros/Misc folder. Make sure you don’t change any of the commas etc.

//ZBRUSH MACRO - save file to ZStartup/Macros/Misc folder


[IButton,???,"Toggle trays open or closed",
	[IConfig,2020]
	//create memory block to store tray states if necessary
	[If,[MemGetSize,ToggleTrays_Mem],,
		[MVarDef,ToggleTrays_Mem,1,3]
	]
	[IFreeze,
	//check tray states
		[If,(([IHPos,1000]>0)||([IHPos,1001]+[IWidth,1001]<[IWidth,Title])),//if either tray is open
			[MVarSet,ToggleTrays_Mem,0,0]
			[If,[IHPos,1000]>0,//the left tray is open
				[MVarSet,ToggleTrays_Mem,0,1]
					[Loop,5,
						[If,[IHPos,1000]>0,
							[IClick,1000]
						,
							[LoopExit]
						]
					]
			]
			[If,[IHPos,1001]+[IWidth,1001]<[IWidth,Title],//the right tray is open
				[MVarSet,ToggleTrays_Mem,0,[MVarGet,ToggleTrays_Mem,0]+2]
					[Loop,5,
						[If,[IHPos,1001]+[IWidth,1001]<[IWidth,Title],
							[IClick,1001]
						,
							[LoopExit]
						]
					]
			]
		,//else both trays are closed so open them as required
			[If,(([MVarGet,ToggleTrays_Mem,0]==1)||([MVarGet,ToggleTrays_Mem,0]==3)),//open left tray
					[Loop,5,
						[If,[IHPos,1000]<50,
							[IClick,1000]
						,
							[LoopExit]
						]
					]
			]
			[If,([MVarGet,ToggleTrays_Mem,0]>1),//open right tray
					[Loop,5,
						[If,[IHPos,1001]>[IHPos,Layout>],
							[IClick,1001]
						,
							[LoopExit]
						]
					]
			]
		]
	]

,,.5]//button half palette width
1 Like