ZBrushCentral

Question Regarding ISwitches and IButtons

Update:

See last post for question.

I’m not sure I understand what you’re trying to do. Do you mean modify an existing curve (such as the smoothing curve) or create a curve of your own for storing/restoring values?

I meant creating a curve for storing / restoring values, a curve similar to the many curves in Zbrush as modifiers etc. like y against x values etc

Well in that case all you need to do is define some values and then interpolate between them:

http://www.pixologic.com/docs/index.php/ZScript_Command_Reference#Calculations

Thanks for your reply Marcus!

But the problem is that I want users to be able to define the curve and input basically, just like all the other curves in Zbrush, is there a way?

No, I’m afraid I can’t think of one. You’d need to b able to get the values out again and I don’t think you can do that through scripting either.

New question, same thread. How do you go about making more interesting looking slider, buttons and in ZScript ??

I guess you sorted out your floor/ceiling dilemma. If you didn’t then it’s easy enough to create routines to return the right values by making use of the INT function which always returns the integer that remains afer the fraction is taken off. See the text file for a demo script.

And for your next question: you can add images to buttons :

[IButton,“Button Name”,“Pop up text”,
//commands
,/button width/,“MyDataFolder\buttonImage.psd”,/button height/]

But there’s no way to do the same with sliders.

HTH,

Hey thanks for your replies Marcus, much appreciated!

Yea I sorted the floor/ceiling thing manually, I was just asking if there was function for it but there isn’t like you said.

Finally, one last question.

Is there a way to make an ISwitch or IButton in ZScript and then delete it through ZScript and create another new switch or button in the middle of the script?

If not, then even better, is there at least a way in which to change the text or image file or other attributes of the switch or button afterwards in ZScript without deleting it later on throughout the script?

Thanks in advance and real sorry to bother as it seems you’re the only one replying Marcus, but I really appreciate it though.

For a zscript that uses the ZScript Window for its interface you can use ‘zscript:reload’ to update and show changes. This means you can store different button names or image names in variables. The attached file shows the basic method.

However, this doesn’t work for plugins. With plugins you can use ‘IShow’ and ‘IHide’ to show and hide different buttons (the method used for the orange highlight behind the brush buttons in PaintStop).

HTH,

Thanks Marcus

And is there a way in which to create many similar buttons through a loop (many small buttons) or must each be manually created only every time? thanks!

Also is there a way in which to specify a specific position to draw your button on the window? thats important! or are they drawn based on which was defined first only?

Finally, how can u simulate a button press of one of your ZScript’s own button’s or toggle a switch for one of your own ISwitch’s through ZScript using buttonPress command i.e. how do you specify what that button’s path is if it’s your ZScript button, or for example set a value on a slider using buttonset through ZScript if it’s your own ZScript slider?

thanks!

Another question

For interpolate, is there a way in which to interpolate over 1 list of values, not over 2, coz I have a list containing many individual values that i wanna interpolate over.

Thanks

I don’t see why a loop shouldn’t work but it will depend on what you’re doing so you’ll need to experiment. The button path for a button in the zscript window is “zscript:ButtonName”, so you can use
[IPress,zscript:ButtonName]
to press a button. [IPress,n] where n is the number relative to the position of the button that contains the command will also work.

Have you looked at the examples on the Wiki? There’s stuff in those that you may find useful and the Command Reference gives all the stuff for positioning buttons and so on:
http://www.pixologic.com/docs/index.php/ZScript_Command_Reference#Display_in_the_ZScript_Tutorial_Window

http://www.pixologic.com/docs/index.php/ZScript_Example:_Tutorial_Window_interface

With Interpolate you can use a Loop if you’ve a lot of numbers.

Thanks again Marcus, u always have the answer!

Yea loop doesn’t work for creating several buttons as they must be top level commands, I tried, but never mind.

Thanks for the tutorial links checked em out! Yea they had the answers.

As for interopolate Im still not sure about the method u would go about looping.

Say you’ve got an interval u wanna interpolate i.e. point at 0.5 (middle) on graph, and then you wish to interpolate over 10 values, do u loop to interpolate first over first 4, then over second four, then take average or what you mean? This should be the last major point.

Thanks again.

Also really what Im trying to do is smooth the graph by replacing all the values with interpolated values from noisy points on the graph, or does the interpolate function not really do this at all with a smooth curve?

thanks

Here’s a test script so that you can play around with interpolating. It demonstrates interpolating values and lists. For the values, put a sphere in Edit mode and scale it small. Position on one side of the canvas and press the ‘Start’ button. Scale it larger and position somewhere else then press the End button. Now press the zscript ‘Render’ button. Experiment with the Mid position buttons.