ZBrushCentral

How to choose material by number, not by name?

Hello,
How to choose material by number, not by name?
example:

[Ibutton, “Zplugin:SAF:Change Preview Material”, “Change Tools Preview Material. ZBrush Will Restart!”,[MessageOK, “Choose new material file.”, " "]
[IFreeze,

[IUnPress,Transform: Edit]

[IPress,Material:SkinShade4]

[IPress,Material:Load]

[IPress,Layer:Clear]

[IPress,Draw:Mrgb]

[ISet,Draw: Z Intensity,1]

[ISet,Draw:Draw Size,1]

[CanvasStroke,(ZObjStrokeV02n3=YH20V18p3BH20V19p46H20V19P)]

[IPress,Document:Save As Startup Doc]

]
[MessageOK, “Restart ZBrush!”, " "]
[IPress,CLOSE]
]

All runs only one time. Somehow need to select material number 71

[If, 71,…
]

only works if material already selected

SubtoolMaster will fill all the subtools with M, RGB or MRGB for you. Material slot numbers might change, hardcode filename for best results.

Interesting, thanks
but it is a bit different

I just want update script to 4r7
http://www.youtube.com/watch?v=2N_nQBpYiyA
4r6 material was 1, now it was changed to 71

I posted a bunch of scripts and files. They might be useful :wink:

You can select a material by using the item info slider:

[ISet,Material:Item Info,71]

but note that SkinShade4 is at already at 71, so that code won’t make any difference to simply selecting the material. In the code you’ve copied, the

[If,1,
]

bit doesn’t actually do anything except run the code it encloses. Changing it to

[If,71,
]

won’t make any difference, as essentially all it’s saying is “If this is true, run this code” and both 1 and 71 are regarded as “true”.

The code below should do what you want. This will ask you to load two materials from disk. The first one will replace the default Red Wax material and the second one will replace SkinShade4 which is the ‘preview’ material that displays in the tool palette.

[ISubPalette,“Zplugin:SAF”]

[IButton, “Zplugin:SAF:Change Preview Material”, “Change Tools Preview Material. ZBrush Will Restart!”,
[MessageOK, “Choose new material file.”, " "]
[IFreeze,
[IUnPress,Transform: Edit]
[ISet,Material:Item Info,1]
[IPress,Material:Load]
[IPress,Layer:Clear]
[IPress,Draw:Mrgb]
[ISet,Draw: Z Intensity,1]
[ISet,Draw:Draw Size,1]
[CanvasClick,1,1,1,4]
[ISet,Material:Item Info,71]
[IPress,Material:Load]
[CanvasClick,4,1,4,4]
[IPress,Document:Save As Startup Doc]
]
[MessageOK, “Restart ZBrush!”, " "]
[IPress,CLOSE]
]

thx, Marcus
My temporary solution was:
[Ibutton, “ZPlugin:SAF:Change Preview Material”, " ",[IFreeze,

[IPress,Material:Modifiers:CopySH]

[ISet,Material:SkinShade4,71]

[IPress,Material:Modifiers:PasteSH]

[IUnPress,Transform: Edit]

[IPress,Layer:Clear]

[IPress,Draw:Mrgb]

[ISet,Draw: Z Intensity,1]

[ISet,Draw:Draw Size,1]

[CanvasClick, 10, 10, 20, 20]

[IPress,Document:Save As Startup Doc]

]
[MessageOK, “Restart ZBrush!”, " "]
[IPress,CLOSE]
]
[Ibutton, “ZPlugin:SAF:Restore Preview Material”, " ",[IFreeze,

[IUnPress,Transform: Edit]

[IPress,Layer:Clear]

[IPress,Document:Save As Startup Doc]

]
[MessageOK, “Restart ZBrush!”, " "]
[IPress,CLOSE]
]

That looks OK, though note that

[ISet,Material:SkinShade4,71]

should be either

[IPress,Material:SkinShade4]

(to select the material named SkinShade4)

Or

[ISet,Material:Item Info,71]

(to select the material at slot 71)