ZBrushCentral

making a script that automatically enters a slider mode.

I’m having a hard time finding the words for exactly what I’m trying to do. The closest thing is looking at what was done in the Zadjustor plugin. with that plugin, you assign a hotkey to a button and as you hold the hotkey, it goes into a mode where you move the cursor left and right and it slides the brush size up and down. It would be great if I could make a button where it performs some commands, goes into a slider that slides the Morph slider left and right, and then when you click, it locks in the morph slider and performs some more commands.

If that’s too complicated, I wonder if I could make a slider popup like zbrush has by default with the spacebar. but instead of a whole UI menu thing, just making the Morph slider popup?

thanks!

You can make a slider pop up at the cursor simply by assigning it a hotkey. You could write code in a plugin that automatically assigned the hotkey but it’s probably simpler to allow the user to assign their own.

The Adjust plugin (in the Zplugin palette) adjusts various sliders by moving the mouse while holding a hotkey. It’s similar to what the ZAdjuster plugin does rather more elegantly, but using just zscript. If you’re keen to try that method I’ll share some of the code.

Cool, thanks! I would like to see the code that the adjust plugin uses. Is it possible to combo some commands with it so that when you hold the hotkey it runs some commands before letting you slide the slider? And then when you release, it executes a few more?

cheers

Here’s the code. I think it would be difficult to do what you want satisfactorily. The problem is that the hotkey is held down while you adjust the slider. What’s happening is that the zscript is run repeatedly, so you’d have to find a way to only run your other code once.

There is sort of a solution using [Sleep] but unfortunately the option to capture the key UP doesn’t seem to work. In the attached example I’ve used Mouse Down instead. (I’ve put in setting the Focal Shift to two different values just as a test.)

DrawSize.txt (1.06 KB)DrawSize.txt (1.06 KB)