ZBrushCentral

Macro to toggle between XYZ and Y rotation, doesn't work (SOLVED)

Hi guys!

I’m trying to create a macro to TOGGLE between “Rotate on all axis” and “Rotate on Y axis”

This is what I have, but it does not work:

//ZBrush macro - save to ZBrush 2019.1\ZStartup\Macros\Misc\ folder

[IButton,???,"Toggle Trackball",
	[IShowActions,0]
	[IConfig,2019]
	[Loop,1,
		[If,([IsEnabled,Transform:Rot XYZ]==1), // if XYZ is enabled
			[IPress,Transform:Rot Y] // press Y
			[LoopExit]
		]
		[If,([IsEnabled,Transform:Rot Y]==1), // if Y is enabled
			[IPress,Transform:Rot XYZ] // press XYZ
			[LoopExit]
		]
		[If,([IsEnabled,Transform:Rot Z]==1), // if Z is enabled (just in case)
			[IPress,Transform:Rot Y] // press Y
			[LoopExit]
		]
	]    		
,,0.5] // half palette width button

It just change from XYZ to Y (and also from Z to Y) but the next time I press it nothing occurs: it does not change from Y to XYZ

What I’m doing wrong?

Thanks! :slight_smile:

Hi,

You’re nearly there. The problem is that the [IsEnabled] command checks to see if the button can be turned on/off (i.e. that it’s not disabled). What you need is to check whether the button is pressed down or not. (It’s a good idea to keep the [IsEnabled] as a check that we have a model in Edit mode.) Try this:

//ZBrush macro - save to ZBrush 2019.1\ZStartup\Macros\Misc\ folder

[IButton,???,"Toggle Trackball",
	[IShowActions,0]
	[IConfig,2019]
	[If,([IsEnabled,Transform:Rot XYZ]==1), // if XYZ is enabled
		[Loop,1,
			[If,([IGet,Transform:Rot XYZ]==1), // if XYZ is pressed
				[IPress,Transform:Rot Y] // press Y
				[LoopExit]
			]
			[If,([IGet,Transform:Rot Y]==1), // if Y is pressed
				[IPress,Transform:Rot XYZ] // press XYZ
				[LoopExit]
			]
			[If,([IGet,Transform:Rot Z]==1), // if Z is pressed(just in case)
				[IPress,Transform:Rot Y] // press Y
				[LoopExit]
			]
		]   
	] 		
,,0.5] // half palette width button

HTH,
Marcus

1 Like

Thank you SOOO much, Marcus!!!

It works like silk! :smiley:

Thanks also for your detailed explanation.

Step by step I will learning to polish my macros, thanks you the good people of this forum.

Have a nice weekend, Marcus!

You’re welcome! (I edited the comments in my post to make more sense!)

Enjoy your weekend too!
-Marcus