Hi everyone
I'm creating a small script to manage material inside libraries and instance them in the slate editor.
But for now i'm stuck with two things:
- I can import a material in the slate viewport directly from a library but I don't find how can I select it and put it in the parameter editor
- I'd like to sort materials inside the library by alphabetical order
If any of you have any ideas, you are welcome :)
By
Comments (8)
Comment policy
Thanks this will be helpful :)
I said that because for the parameter editor, the only thing I missed what this line:
sme.SetMtlInParamEditor mtl
So when I saw it in your post, I realized I was very tired and I could not think well enough, beacuse actually that was pretty simple... So you now, when you can't think well, just take a good night :)
Otherwise you clearly saved me a lot of research so thanks :)
SME have too many limitations ei. it's not exposed in mxs as it should.
On this forum you can find a few useful topics about SME if you're interested.
Anyway if you want to see all available SME methods just type in Listener
showinterface sme
ok...
Sometimes I think I should just go to sleep...
Anyway a big thank for your help :)
Why? Now is time for action:)
Tell me is it my last post save your time or what? :)
Thanks a lot !
Yes the parameter editor:
in slate editor material, you have 4 views:
- Material/Map Browser
- The viewport
- Navigator
- Parameter Editor (where you change your material properties)
So when I load a material in the viewport, I'd also like to select it and load it in the parameter editor
Anyway, thanks again for your help
example
b = Box material:(standard name:"BoxMtl" diffuse:red)
mtl = b.material
activView = sme.GetView 1
activView.CreateNode mtl [0,0]
sme.SetMtlInParamEditor mtl
if not sme.IsOpen() do sme.Open()
In the "Parameter Editor"?
Anyway to sort materials in materialLibrary use this fn
fn sortMatLibMtlsByName mLib: =
(
if (tmpLib = loadTempMaterialLibrary mLib) != undefined do
(
local mtls = sort (for m in tmpLib collect m.name)
local newLib = MaterialLibrary()
for n in mtls where (idx = findItem tmpLib tmpLib[n]) != 0 do append newLib tmpLib[idx]
if newLib.count == tmpLib.count do saveTempMaterialLibrary newLib mLib
)
)
sortMatLibMtlsByName mLib:@"c:\folder\anyMatlib.mat" -- change this filepath