ZBrushCentral

Question: selecting new alpha through zscript

what would be the best way to select a alpha that has been generated by the displacement function through zscript. It has to be universal (eg, cant be the name of one model baked into the script, must call the name of whatever the current tool is).

The alpha that is most recently created will be the highest numbered alpha when you look at the Alpha>Item Info slider. There may be an easier way to determine it (I’m really not the ZScripting whiz that some other members are), but I would run a loop to assign increasingly high values to that slider until it can’t go any higher. That will be the displacement map you’re looking for, and you can assign its number to a variable to be recalled at any time.

As Aurick says, the most recently created alpha will have the highest index number. Zbrush2 gives you the IGetMax command that will find it directly with one line:

[VarSet, MaxAlpha, [IGetMax, ALPHA:ItemInfo ] ] // locates the alpha

[ISet, ALPHA:ItemInfo, MaxAlpha ] // selects that as the current alpha

Sven

thanks a bunch guys, I’ll give it a go.

:slight_smile:

Thanks, svengali. :smiley:

If (as your other question) you still need the name of the current alpha then you can use:

[IGetTitle,Alpha:ItemInfo].

And remember that if you export an alpha with a different name (using the Save As dialog or, in scripting, [FileNameSetNext,…]) then the name is also changed in the alpha palette.

awesome, it worked great! :+1: