ZBrushCentral

I am looking for material cycling script

Hi
I need a script that cycles materials via shortcut. I searched the forum but have not seen such thing. Does anyone know any script or way to cycle-toggle materials?

thanks

Wouldn’t it be possible to sequentially load a sequence of materials to apply, and then have them advance through time or another means?

I am not a zscripter but that should be possible. In the end probably the user would not want to cycle all the materials, rather a select list of materials would be great. Also a nice interface can be neat as well which would streamline this.

What is a material cycling script? Can you describe what it would do or how it would function?

Well, basically it will change the active object`s material squentially. So instead of clicking material menu and clicking on materials to try materials one by one, this way user will just press the same key to cycle through predefined set of materials

That’s not too difficult to do if you use the ZFileUtils [see the sticky thread at the top of this forum] to get the files in a folder. Here’s a basic script, though you may want to adapt for your needs.

Note that the dll should be in its own data folder.

EDIT: I added in a default settings so it will reload the last used list.

EDIT2: Plugin operation - buttons in the Material palette. Code included.

God ,YES!!! :smiley:
You did it!
This is so helpful,I’m always baking zbrush shaders in my texture works
and I’m not always sure which shader is better ,so not being forced to
click on each of them is awesome
(especially when you got hundreds of them) .

I think you should post it in the zscript utilities forum,it’s
something that I’m sure a lot of people baking shaders would find useful.
Thanx again !

Hello Christian, :slight_smile:

I updated the script to save the last used folder, so download again. :slight_smile:

Perhaps I’ll make into a plugin if it would be useful.

EDIT: if you change the ‘fileMax’ value (to say 300 instead of 100 so as to cycle thru more mats) you will need to delete the ‘settings.zvr’ file in the LoadMatsData folder or you’ll get an error.

Thanks,

Nice. A button pair similar to these might be useful added to the ZMats library plugin too. Maybe I’ll try an update after 3.5 arrives and we see what else Pixolator has in store. :smiley:

Sven

hmm, I am getting an error. It says its skipping loadmats due to error.

Btw, how do you use this tool? I think I have managed to load the script fine(through zscript menu this time), but I do not see any button anywhere?

With a model in edit mode, click on the handle at the bottom of the screen (opens the tutorial window) and the two buttons become visible. First click Getfolder and select the materials directory and choose a material, then click Cyclemats to loop through the other materials.

That is exactly what I am talking about!! Amazing, life is easier now. :cool:

Marcus
when you have time, one more addition would be helpful actually. It would be nice to have another button for calling the original shader. So the user would not deal with material window again :small_orange_diamond:)

Svengali, thanks for the help. It was nto very obvious for me for some reason :slight_smile:

ok here is a better wish list for next possible update if you will :slight_smile:

-Previous-next material buttong (so that one can go back and forth hopefully)
-Folder profiles. I guess you would put one button per folder. I would think that 5-6 profiles should be sufficient
-Button for calling the original shader

This is great Marcus, seriously this was bothering me for a while. I hate the material window :frowning: I mean It is nice, it has nice preview but it was not working well with a shortcut. Thanks again

kursadk,

I’m glad you found the script useful. I intended it as an example of what might be done rather than a solution. I may develop something similar at some stage but I’m too busy to take this further at the moment. Should you or anyone else like to try then you are free to do so.

Here is first bug report. After first use, the buttons disappears from the tray. I do not have clear step to reproduce but I need tor restart to bring it back again.

Thanks for your help! I am not a scriptter so this would be out of my league but I hope that someone might pick it up from here.

kursadk, the buttons are disappearing most likely because you are using another zscript or a plugin, zbrush only allows one at a time(something that i think is a major flaw and really could benefit from being fixed).

I see, it makes sense. Is it possible to run this script without button, only through shortcut maybe?

OK, I’ve updated the script to operate as a plugin. Unzip to your hard drive and copy the files and folder to you ZStartup/ZPlugs folder. Make sure the unzipping doesn’t create an extra folder. The .zsc & .txt files, and the data folder with the dll inside, should be in the ZPlugs. Restart ZBrush and you will find the buttons at the bottom of the material palette.

You can move the buttons to the interface if you want by following intructions for customizing the interface here. You can also assign hotkeys by Ctrl+clicking on the buttons.

I’ve refined the operation for moving forward and backward thru the list. If you have a model in Edit mode and wish to be able to return to the original material, switch to a different material in the material palette before using the plugin. That way you can reselect your original mat from the palette as needed.