ZBrushCentral

Fibermesh pallet reset script.

Hya everyone!

Some people in the Fibermesh thread were asking about making a sort of “reset to defaults” thing for the fibermesh pallet as it gets very close to impossible to start from scratch with a new object.
I figured that sort of thing was what scripting is for so I made a script that does exactly that, it resets the fibermesh pallet.

I dont know squat about this stuff but I know that you guys do so I figured I would post it here and see what you think.
If there are any ways to make it better (like putting a “Reset” button at the bottom of the Fibermesh Pallet) that would be great too.

I tried this out and as near as I can tell it works great (its possible the settings are a tiny bit off but that will come out over time, there are a LOT of sliders and all I did was carefully record clicking them with out moving the mouse).

Anyhow here it is:

EDIT: This is fixed, I have three or four copies kicking about on this forum in different sections and threads and missed correcting this one. However Marcus has made it WAY better, look a few posts down.
Thanks Marcus and Jawa!!!

//Fibermesh Reset
//This script is in the public domain made by Mealea Ying
[IConfig,4.3]
[IButton,“Tool:FiberMesh:reset”]
[ISet,Tool:FiberMesh:MaxFibers,50.00000]
[ISet,Tool:FiberMesh:DeV,0.2]
[ISet,Tool:FiberMesh:ByMask,1]
[ISet,Tool:FiberMesh:ByArea,0.5]
[ISet,Tool:FiberMesh:Imbed,0]
[ISet,Tool:FiberMesh:Length,200.00000]
[ISet,Tool:FiberMesh:LeV,0.5]
[ISet,Tool:FiberMesh:Coverage,9.9999]
[ISet,Tool:FiberMesh:CoV,0.1]
[ISet,Tool:FiberMesh:Flare,0.25]
[ISet,Tool:FiberMesh:FlV,0]
[ISet,Tool:FiberMesh:FlareCenter,-1]
[ISet,Tool:FiberMesh:FlC,0.0]
[ISet,Tool:FiberMesh:FlareExp,0.5]
[ISet,Tool:FiberMesh:FlE,0.1]
[ISet,Tool:FiberMesh:ScaleRoot,1.25]
[ISet,Tool:FiberMesh:ScaleTip,0.75]
[ISet,Tool:FiberMesh:Slim,0]
[ISet,Tool:FiberMesh:SlV,0.2]
[ISet,Tool:FiberMesh:Twist,0.05]
[ISet,Tool:FiberMesh:TwV,0.05]
[ISet,Tool:FiberMesh:Gravity,0.5]
[ISet,Tool:FiberMesh:NoV,0.05]
[ISet,Tool:FiberMesh:HTangent,0]
[ISet,Tool:FiberMesh:HtV,0.05]
[ISet,Tool:FiberMesh:VTangent,0]
[ISet,Tool:FiberMesh:VtV,0.05]
[ISet,Tool:FiberMesh:Clumps,0]
[ISet,Tool:FiberMesh:ClV,0.1]
[ISet,Tool:FiberMesh:BColorize,0.5]
[ISet,Tool:FiberMesh:BCVar,0.1]
[ISet,Tool:FiberMesh:TColorize,1]
[ISet,Tool:FiberMesh:TCVar,0.1]
[ISet,Tool:FiberMesh:Profile,1]
[ISet,Tool:FiberMesh:Segments,3]
[ISet,Tool:FiberMesh:PRE Vis,75]
[ISet,Tool:FiberMesh:RootAniso,0]
[ISet,Tool:FiberMesh:TipAniso,75]
[ISet,Tool:FiberMesh:Subdiv,2]
[ISet,Tool:FiberMesh:Sides,4]
[ISet,Tool:FiberMesh:Radius,1]
]//end of button

Cheers!
Mealea

//Fibermesh Reset
//This script is in the public domain made by MealeaYing
[IConfig,4.3]
[IButton,“Tool:FiberMesh:reset”]
[ISet,Tool:FiberMesh:MaxFibers,50.00000]
[ISet,Tool:FiberMesh:DeV,0.2]
[ISet,Tool:FiberMesh:ByMask,1]
[ISet,Tool:FiberMesh:ByArea,0.5]
[ISet,Tool:FiberMesh:Imbed,0]
[ISet,Tool:FiberMesh:Length,200.00000]
[ISet,Tool:FiberMesh:LeV,0.5]
[ISet,Tool:FiberMesh:Coverage,9.9999]
[ISet,Tool:FiberMesh:CoV,0.1]
[ISet,Tool:FiberMesh:Flare,0.25]
[ISet,Tool:FiberMesh:FlV,0]
[ISet,Tool:FiberMesh:FlareCenter,-1]
[ISet,Tool:FiberMesh:FlC,0.0]
[ISet,Tool:FiberMesh:FlareExp,0.5]
[ISet,Tool:FiberMesh:FlE,0.1]
[ISet,Tool:FiberMesh:ScaleRoot,1.25]
[ISet,Tool:FiberMesh:ScaleTip,0.75]
[ISet,Tool:FiberMesh:Slim,0]
[ISet,Tool:FiberMesh:SlV,0.2]
[ISet,Tool:FiberMesh:Twist,0.05]
[ISet,Tool:FiberMesh:TwV,0.05]
[ISet,Tool:FiberMesh:Gravity,0.5]
[ISet,Tool:FiberMesh:NoV,0.05]
[ISet,Tool:FiberMesh:HTangent,0]
[ISet,Tool:FiberMesh:HtV,0.05]
[ISet,Tool:FiberMesh:VTangent,0]
[ISet,Tool:FiberMesh:VtV,0.05]
[ISet,Tool:FiberMesh:Clumps,0]
[ISet,Tool:FiberMesh:ClV,0.1]
[ISet,Tool:FiberMesh:BColorize,0.5]
[ISet,Tool:FiberMesh:BCVar,0.1]
[ISet,Tool:FiberMesh:TColorize,1]
[ISet,Tool:FiberMesh:TCVar,0.1]
[ISet,Tool:FiberMesh:Profile,1]
[ISet,Tool:FiberMesh:Segments,3]
[ISet,Tool:FiberMesh:PRE Vis,75]
[ISet,Tool:FiberMesh:RootAniso,0]
[ISet,Tool:FiberMesh:TipAniso,75]
[ISet,Tool:FiberMesh:Subdiv,2]
[ISet,Tool:FiberMesh:Sides,4]
[ISet,Tool:FiberMesh:Radius,1]
]//end of button

A few Changes Highlighted above.
As the the script refreshes the view every change it is a waste to use this without checking the variable but I failed to get the syntax right even after and hour of two of fiddling maybe Marcus will see this and be able to fix my crap scripting posted in line
Marcus could you see this could you fix complete the script modification attached?

Hi guys,

Nice work. :slight_smile:

I’ve made a couple of changes. The tests won’t all work properly without checking the actual amounts as values of 0 would return false (and you can’t specify the value actually in the [IGet command). Also I have included a test to see if the Fibermesh Preview is on so the sliders are only reset if you have actually got some fibers.

I’ve also put the button in the main Tool palette. This means it will appear at the bottom which is less convenient but you will get issues if you try and put it in the Fibermesh menu.

HTH,

Good to see this progressing! I tried the first version and had a tool that happened to have a mask painted on it, and it went into endless loop heaven.

This is great! Thanks Marcus and Jawa!

Marcus:
What are IExist and IGet actually doing?
Is that sort of "get setting, setting exists, set setting? and why the == ? What is that doing?
And if so how does it know something is different (Mine just assumes it is and sets stuff even if it doesn’t need to)
Also, where is the part that makes that lovely button?!?
Inquiring minds want to know!

Cheers!
Mealea

Wait! I think I see how this is done:
[IButton,“Tool:FiberMesh Reset”,“Reset all Fibers settings to defaults”,

But what is putting it into the tool pallet??
If its the 1 in:
,1]//End of button
Does that mean that the tool pallet is the first pallet in ZBrush? and if so what is number two? (and so on) Or am I off on the wrong track here?

Mealea,

The IExist finds out if the interface item actually exists. Some things only ‘exist’ on the interface when certain other things are selected. For example, in this case you need to have a polymesh selected before the FiberMesh menu becaomes available (there’s no FiberMesh for the Simple Brush!). If you ran your script with the Simple Brush selected you’d get an error message saying that so-and-so couldn’t be found. The IExist test in my code avoids that.

The IGet code just gets the current value of an interface item. If the item is a slider then IGet will give whatever the slider is currently set at. If it’s a switch then the value will be 1 if the switch is on, and 0 if the switch is off. So my code first finds out if the FiberMesh Preview switch is on. If Preview is on, the rest of the code runs; if it is off, nothing more happens.

Each test can be written in plain English like this:

If the <interface item> is set to <default value>, then do nothing, otherwise set the <interface item> to <default value>.

The == is just the test for equality. It’s testing that the value on this side of the == is the same as the value on the other side.
So when the code has:

[If,[IGet,Tool:FiberMesh:MaxFibers] == 50.00000,

what that is in plain English is:

If the value that the MaxFibers slider is currently set to is equal to 50

The button code is wrapped around the whole lot. It looks something like this:

[IButton,“Button name”,“Pop-up info about what this button does”,
//code here that runs when button pressed
,1]//End of button

The 1 just before the end of the button is the width of the button. 1 is for a button the width of a palette. 0.5 woud be half a palette width, and so on.

If you are interested you can find out more on ZScripting here:
http://www.pixologic.com/docs/index.php/ZScripting

EDIT: Just seen your question about the button in the Tool palette. That’s done by putting the ‘button path’ in the name part of the button code. In this case the button path is Tool:Fibermesh Reset. The Tool: is for the Tool palette. This method is basically the same as creating a plugin button. But be careful, unexpected things can happen if you mess around with the interface like that! If you want to try stuff I suggest you read up on Zscripting (see above).

HTH,

Oh my god this is SO COOL MARCUS!!!

There are a TON of things I get sick of having to do (sheer laziness on my part and I’m always forgetting stuff, like hitting Edit) and after getting to page three (nuts and bolts) I see that I can automate all sorts of tedious things.

So for example all the things I do when I start ZBrush and want to make something with dynamesh:

//RECORDED ZSCRIPT 4.3
[IButton,Play,“Hit Me!!!.”,
[IConfig,4.3]
[IPress,Movie:TimeLapse]
[IUnPress,Movie:Modifiers:Skip Menus]
[ISet,Preferences:Tablet:Size Sensitivity,1]
[ISet,Preferences:Tablet:Z Sensitivity,1]
[ISet,Preferences:Tablet:Color Sensitivity,1]
[IPress,Render:Render Properties:Sss]
[IPress,Render:Render Properties:WaxPreview]
[IPress,Render:Render Properties:Fibers]
[IPress,Render:Render Properties:SoftZ]
[IPress,Render:Render Properties:SoftRGB]
[IPress,Render:Render Properties:HDGeometry]
[IPress,Render:Render Properties:Af]
[IPress,Render:Render Properties:View Blur]
[IPress,Render:Render Properties:Transparent]
[IPress,Render:Render Properties:AOcclusion]
[ISet,Render:BPR Shadow:Angle,0] //Something wrong here, this should have been set to 22…
[ISet,Render:Render Properties:Materials Blend-Radius,3]
[ISet,Document:Range,0]
[IPress,Tool:SimpleBrush]
[IPress,Tool:Sphere3D]
[CanvasStroke,(ZObjStrokeV02n64=YH25AV158K1XH259V158H257V166H257V169H257V16B
H256V16FH256V172H255V177H254V17BH253V180H252V186H252V18AH252V192H252V199H254V1A3H256V1AAH258V1B2H259V1B9H25AV1C0H25BV1C6H25BV1CBH25CV1CFH25CV1D3H25CV1D6H25BV1DAH25BV1DCH25AV1DEH259V1E0H259V1E1H259V1E3H258V1E4H258V1E5H258V1E6H258V1E7H258V1E8H258V1ECH258V1EDH257V1F1H257V1F3H256V1F7H256V1F8H256V1FAH256V1FDH256V1FFH256V204H256V20AH255V211H254V218H251V220H24EV227H24CV230H24BV235H24AV23DH248V246H246V24EH245V254H245V256H245V258H245V259H245V25BH244V25BH242V25BH240V25BH240V25B)]
[IPress,Transform: Edit]
[IPress,Draw:Floor]
[CanvasStroke,(ZObjStrokeV03n13%P25AP158PNNn-FB94sB80FA7sB80FA7sB80FA7Z=
H3C0V1BFH3C1V1BFYH3C2V1BFK1XH3C2V1BFH3C3V1BFH3C4V1BFH3C6V1BFH3C8V1BFh3C77Fv1B780h3C87Fv1B680h3C97Fv1B580h3CAFFV1B4h3CAFFV1B4)]
[IPress,Draw:Perspective]
[IPress,Tool:Make PolyMesh3D]
[IPress,Tool:Geometry:DynaMesh]
[IPress,Transform:Activate Symmetry]
]/End of ZScript/

This is great, I could use this to generate hugely complex tutorials (with the slight problem of getting rid of the programing bits).
One of the things I find tricky about tutorials is that if I skip one thing because its a habit the person using the tutorial is screwed, for example if I forget to tell them to turn on Edit.

I’m very very glad people asked about a reset button, it taught me a lot, and thank you Marcus for clarifying this stuff and the link to the scripting stuff.
Now I think I will attempt to automate making a Fibermesh tree.
Just kidding, what I actually want to do is automate making RANDOM fibermesh trees… hehehehehe… and fibermesh Mandelbrot sets…
and and and…

Cheers!
Mealea

@marcus_civis Thank you It works very well. :+1:

@MealeaYing you are very welcome, glad to be of help even if I needed help.:grimacing:

hi,

might be a dumb question, but how do i execute this fibermesh-reset script?

if i load it via zscript>load, nothing happens… the fibermesh settings stay the same…

thx

The .zsc “plugin” file of the same name should have been made automatically in the folder that you opened the script from But this plugin was written before settings could be loaded or saved so it is majorly outmoded by making a preset of the defaults by hitting preview with the default settings upon opening and saving the default in the zbrush main folder under the fibermesh presets etc. note it will take a screenshot of your doc when you do this.

ok… very simple workaround, that makes sense :slight_smile:

thanks for your help!