ZBrushCentral

Dynamesh value

Hi,

How do i get the current dynamesh value for the currently selected subtool?
I’m not sure how you go about extracting values that appear in the UI elements. :confused:

Cheers

Not sure what you mean by the Dynamesh value? Do you mean the resolution?

Yup, the resolution value that gets applied. It may also be prudent at this point to ask how to work out if a UI (dynamesh) button has been applied or not. Similar sort of thing, once you know, I’d imagine.

Thanks for moving the post from the wrong place.

You can find what the Resolution slider is set to by using:

[IGet,Tool:Geometry:Resolution]

So, to set a variable to that amount you could write:

[VarSet,dynaRes,[IGet,Tool:Geometry:Resolution]]

You can also find out if the DynaMesh button is active or not by using:

[IGet,Tool:Geometry:Dynamesh]

which will return 1 if it is on, and 0 if it is off.

That’s really the only way you can tell if DynaMesh has been used, so if the user has turned the button off again then you can’t know.

Thanks Marcus,

The code now picks up the dynamesh resolution, but I can seem to increment it on the button press. A the dynamesh resolution doesn’t actually change value so the script is pretty useless. :wink: And B the value only increases once, which wasn’t what I was after. Any chance you could look and spot the deliberate mistake?

// Dynamesh button
[IButton, “Dynamesh resolution”, “Dynamesh button”,

[VarSet, inc, 100]

// get dynamesh resolution
[VarDef,dynaStr,"-"]

// get dynamesh resolution
[VarSet,dynaRes,[IGet,Tool:Geometry:Resolution]]

// is it switched on?
[VarSet,dynaBool,[IGet,Tool:Geometry: Dynamesh]]

[If, dynaBool == 1
, // then…
[VarSet, dynaStr, “on”]

// increase by ammount [VarSet, dynaRes, dynaRes+=inc] [ISet,Tool:Geometry:Dynamesh, dynaRes] , // else.. [VarSet, dynaStr, "off"]

]

// set a string
[VarDef, msg, [StrMerge, "Dynamesh resolution: ", dynaRes, "
Poly count: " , polyCount, "
Dynamesh is switched ", dynaStr]]

// Set a note; for a second
[Note, msg, 2]

] // end button
// eos

You need to watch your use of VarDef because it’s for declaring the variable and won’t update (such as the msg variable). If you use number variables in StrMerge then wrap them in [Val]. And you were trying to set the DynaMesh button with your incremented resolution!

// Dynamesh button
[IButton, “Dynamesh resolution”, “Dynamesh button”,

[VarSet, inc, 100]

// get dynamesh resolution
[VarDef,dynaStr,"-"]

// get dynamesh resolution
[VarSet,dynaRes,[IGet,Tool:Geometry:Resolution]]

// is it switched on?
[VarSet,dynaBool,[IGet,Tool:Geometry: Dynamesh]]

[If, (dynaBool == 1),
// then…
[VarSet, dynaStr, “on”]

// increase by ammount
//[VarSet, dynaRes, dynaRes+=inc]
[VarAdd,dynaRes,inc]

[ISet,Tool:Geometry:Resolution, dynaRes]

, // else…
[VarSet, dynaStr, “off”]
]

[VarSet,polyCount,0]
[Mesh3DGet,1,polyCount]

// set a string
[VarSet, msg, [StrMerge, "Dynamesh resolution: ", [Val,dynaRes], "
Poly count: " , [Val,polyCount], "
Dynamesh is switched ", dynaStr]]

// Set a note; for a second
[Note, msg, 2]

] // end button
// eos