Redshift Material Library as Buttons -Questions Script

Discussions regarding Materials, Material-Compounds or Shaders, etc.
Post Reply
juanloredo
Posts: 26
Joined: 18 Sep 2014, 23:24

Redshift Material Library as Buttons -Questions Script

Post by juanloredo » 21 Apr 2016, 01:32

Hi all,

I'm trying to create a material library presets for redshift. (see image) As you know, when you create a shelf you can put a tab that contains a folder, and you can filter it to show only presets. If you save a preset and have the option "use render region as image in preset" the preset gets that image (NICE). the only problem with this is that in the tab, you don't have control over the size of the thumbnail, the default size is pretty small, also when you drag the preset into multiple files, it creates a duplicate material for every object you have selected, which is not optimal.

A solution for this is to create a toolbar, populate it with buttons, each button with it's own bitmap, that way you can set the size of the image. Also you can use this line of code and it will only create one instance of the material even if multiple objects are selected: Application.SICreateMaterial("$XSI_USERHOME\\Addons\\Juan Shaders\\Data\\DSPresets\\Shaders\\Material\\Metal\\MTL_Metal_Gold_Shiny_Clean.Preset", "MTL_Metal_Gold_Shiny_Clean", "", "", "", "")

The problem that I'm facing right now is that this process es very time consuming: Apply the material to the object, render it (as tiff), converted it into bmp, apply a label in photoshop, re-save it, create individual buttons, modify that one line of code, REPEAT.
Also i have to save every material as preset (I know you can save the whole library and export it and import it back, that's not what I'm looking for here)

Now I would like to know if there's a way to make some of this repetitive process faster with a script.

SAVING THE PRESETS.
Question 1: Is there a way to get the materials in a library as an array?, so that I can use a for loop to save all the materials at once, with this code:

Application.SavePreset("Sources.Materials.RedShift_Metal_Lib.MTL_Metal_Aluminum_Anodized_Orange_Rough_Clean", "C:\\Users\\Juan\\SOFTIMAGE\\DSPresets\\Materials\\Redshift\\MTL_Metal_Aluminum_Anodized_Orange_Rough_Clean.Preset", "", "", "", False, "")

RENDERING THE THUMBNAILS
Question 2: Is there a way to apply a different material to the same object per frame?. So that if I want the 50 materials, it will apply a different one every frame, and then render all the thumbnails in one pass from frame 0-49 ( Or is there another way to render all this multiple thumbnails in a single pass?

Maybe this is too complicated. There's another guy who made a similar library for mental ray, it's somewhere here in the forum, i think his name is Max, or at least the library is called Max Shaders. He did say that he was burn out after making all the materials. I guess I'm just trying to figure out if there's a faster way of doing this and in the process learn a bit more about scripting in softimage.

Thanks,

Juan
Attachments
Screen_02_matlib.jpg
Screen_01_matlib.jpg

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest