ZBrushCentral

Numerical pad for slider input

First let me explain why i’m trying to do this, i don’t like having to switch between my tablet and my keyboard, i try not to use it as much as possible, but you need to if you want to enter values into zbrush’s sliders.
So I searched for a way to do this within zbrush and discovered Mulvo’s Zcalculator script, which sometimes can set the numbers punched in into a slider. However, its old and will not work with the Deformation sliders, which i really need it for.
Is there a way to do this? I’ve so far heavily mod/cannibalized his script to make it a plugin hoping this might help eventually. I’ve removed the calculator functions. but have retained his “set” function.
As it is right now, it has buttons that function as a plugin and in the zscript window, unfortunately the numerical display only shows up in the zscript window, is there a way to make it function in the plugin palette? I’d rather have it as a plugin in the end.
Also could someone help me with getting the values to enter the Deformation sliders, it also only works half the time in other silders and sometimes adds an extra digit.
Yes i’m a total noob to zscripting, but not zbrush. Hopefully if/when this works it could help other users who don’t want to keep switching hands. :slight_smile:

Thanks to Mulvo for his script, it taught me a lot so far.Link to his zscript:http://www.zbrushcentral.com/zbc/showthread.php?t=3916&highlight=calculator

Have no idea, Im also a a scripting n00b.
But sounds nice, good luck :slight_smile:

There are a couple of problems here:

  1. If you have a plugin button that gets the current interface item ID from the ViewWindowID slider then it will always return its own ID unless you assign a hotkey to it and use that.

  2. The Deformation sliders don’t have window IDs that can be got using the method above - at least, not that are usable on their own for anything. (I’ve no idea why this is.) One solution, though I don’t know if it would be reliable in all situations, is to use a sort of look-up-table to assign the right interface path and then the slider can be set.

For your plugin interface problem there are a couple of methods. One is to use a slider to show the output - I use that method in my version of your script. The other way would be to use a Note Interface that used NoteIButtons for the number pad and a disabled NoteIButton for the display.

HTH,

marcus, thank you so much! :smiley:
I had thought about using a slider but really didn’t have a clue how, but now i see how it works.
I increased the size of the main slider to 1000, is that okay?
I’ve added some more sliders that it can interact with, mostly ones i use, i may still add the Primative sliders.
I also added the Routine call, Display into the Decimal button which seems to work better, you just have to punch in you number then hit the Decimal button until its in the right place.
I’ve tested it a lot so far and have not run into problems. Should i expect any in particular?
I want to say thanks to you and Mulvo, i learned alot about zscripting and have wanted this plugin forever.
heres the version i’m using now, please let me know if you see anything that’s wrong or needs to be changed.

spaceboy412,

That all looks good. I don’t think it matters that the slider goes up to 1000 - if you add in more than the maximum for a slider it will simply set to the max. And I don’t think you’ll get any problems - I remembered that TVeyes used a similar method for the Deformation sliders and I don’t think there were any with his plugin. You can take out the ‘reload plug’ button when you’re happy with it, of course!

Cheers,

i have run into one snag, i’ve copied the buttons over to my custom popup menu, however as with the normal popup once you hit one button it disappears, is there a way to keep the popup open until i close it with some sort of command, or for a finite amount of time, like 5 seconds? If not its okay i’ll just use the buttons while they are in the plugin menu.

Yeah, that is a problem. I don’t know of a way of keeping the popup showing while you press more than one button.

You might decide that a Note Interface is the better option for what you’re trying to do. With some clever scripting that TVeyes demonstrated with his XYZ Adjust script you can get the Note to popup at the cursor position when you press a hotkey. That means that you can code things to select the slider you want just by mousing over it. Here is an example of how you might do it.

Notes:

  • It’s best to assign a hotkey by Ctrl+clicking on the plugin button and entering the hotkey you want to use. Coded hotkeys seem to work sporadically.
  • Select the slider you want and then press the hotkey. The popup will appear and you can set values before entering them in the slider.
    *I corrected an error I’d made in the earlier code so this version will work with most of the interface sliders, including ones you didn’t specify. For any interface item that won’t work there’s a popup message.

This was the error - I left off the 1:


[IGetTitle,#WindowID,1]//the 1 ensures the whole button path is returned

  • To exit the popup without assigning a value to the slider, press Enter or the Spacebar on the keyboard. Pressing the ‘e’ button when the display has been cleared will also exit without setting a value.
  • Very small numbers will show some inaccuracy normal to float data.
  • I changed the decimal point so it worked like a calculator.

Marcus i am so overly estatic and grateful. :smiley: Thank you for taking the time to write this and to add all your notes so to better help me understand scripting.
I had thought note interface would be the right direction, especially after reading your “extending note interfaces” thread, i tried to understand your script and read up on the zscripting wiki but really it was beyond me at this point, its just not as clear to me as it should be.
I may tweak this so i can better understand its functions, so far it works great.
Just curious you have it figure out zbrush’s interface size, why is that relevant? On a similar note i was thinking about trying to write a script that would match the size of a plane3d to the document/texture size, so far i don’t see a way to do this with precision. the reason for this is so you do a crop/fill of a reference image then scale out the plane3d so your tex fits perfectly, however its always a few pixels off.
Thanks again marcus.

spaceboy412,

I’m glad you found the script helpful. It’s a great idea and I think I shall use it myself. :slight_smile:

The script calculates the interface size because that’s needed to place the Note Interface accurately. A standard Note Interface will be placed in the middle of the screen - you can’t say where it should go; to place it somewhere else you need to cheat a little. What’s actually happening here is there’s an invisible NoteIButton - the first in the list - which covers the whole UI. The other buttons are then placed relative to that, and in this case, the Mouse position as well. That means that the interfaces pops up just where we want it. (It doesn’t have to use the Mouse position - we could use any known position we wanted.)

I didn’t test the number display thoroughly so there may be an error in there somewhere.

I use a method to match a Plane3D to the canvas size in my Image Plane plugin but it is not single-pixel accurate. So far, I haven’t found a way that is; there is generally a row of pixels missing somewhere.

Another masterclass in ZScripting - God bless the mothers of invention. :smiley:

Learned one or two new things here myself, thanks!

Sven