ZBrushCentral

Question : Scripting "expert mode" for ZBrush

Hello everyone,

I am looking for a way to close/reopen all trays and menus in Zbrush at the click of a button/switch.
Say for instance I have my Floating Menu and Right tray opened. I press a Hotkey/Button/Switch and my Zscript hides these 2 elements. When I press the hotkey again, I want the same elements to reappear.

I have managed this to a point for the Floating Menu as this changes value when it’s turned on/off using the [IGet] command, but that doesnt work for the left and right tray because both of them have the same ID = 0 and they don’t apprear to have any Height or Width.

here is the code for the Floating Menu Toggle.

[VarDef,center,0]

[ISubPalette, “ZScript:Misc Utilities”,0]
[ISwitch,“ZScript:Misc Utilities:ClickMe”, 1, “Info text”,

[VarSet,center,[IGet,5392]]
[if,center = 1,
[IUnPress,5392]
,//else
]//end if statement

,//switch
[if,center=1,
[IPress,5392]
,//else
]//if statement end

Please excuse the lack of knowlede in Zscripting I am a beginner.

Thanks for the help.

There was a post a while back, I don’t think you can.

If all you want is a toggle then you don’t really need to test for the state, simply ‘clicking’ the divider will open it if it’s closed and close it if it’s open. I’d use a button rather than a switch; firstly because for the trays you can see which state they are in anyway, and secondly, a zscripted switch can’t monitor the interface so its state won’t necessarily reflect the state of the trays. (If you do use a switch and you are making a plugin, remember to put an [IEnable,“ZPlugin:Misc Utilities:ClickMe”] at the bottom of the code (outside the switch). This will make sure the switch stays enabled should you use a different plugin at any time. Also, you’ve used ‘ZScript’ in your example code; this needs to be ‘ZPlugin’ for a plugin. You can’t add plugin buttons to the ZScript menu.)

However, if you want to test for the state of the dividers then you can do it by getting their horizontal position using [IHPos]. In my example code below they will just close if they are open but not reopen if closed:


[If,[IHPos,1000]>0,//the left tray is open
[IClick,1000]
]
[If,[IHPos,1001]+[IWidth,1001]<[IWidth,Title],//the right tray is open
[IClick,1001]
]

(The ‘Title’ in this code is the Title bar at the top of the interface. It’s width will be the full width of the ZBrush interface.)

Note that for the right tray when closed you need to add the width of the divider to its position, so that you are using its right-hand edge.

HTH,

Hello marcus,

Thank you very much for your feedback, very helpful. I’ll try to implement that as soon as I have the time again and i will share the results.

It’s strange though that Pixologic hasn’t thought of making this kind of function available. I have a laptop and the screen is not big enough to handle all the ui and its a waste of time to always move your pointer around to click stuff.

Thanks once again. I’ll come back to this.

Cheers

Pressing TAB on the keyboard will show/hide the float menu.