[Closed] Material to IMtlBase
Since maxscript don’t allow to set material id channel value over 15, I have to use this workaround.
Maybe there’s a better way of referencing particular material between maxscript and c# sdk?
fn setMtlEffectsChannel mtl ch = (
index = medit.GetActiveMtlSlot()
tmp = meditMaterials[ index ]
meditMaterials[ index ] = mtl
(dotnetclass "Autodesk.Max.GlobalInterface").Instance.MtlEditInterface.CurMtl.GbufID = ch
meditMaterials[ index ] = tmp
ok
)
It works, yes. I can even put multiple materials in temporary multi-material to pass them to the other side.
But I’d like to bypass all of these intermediate steps if possible.
Maybe customattribues #materialTab could do the trick?
ps. it’s not matter of only material to imtlbase actually, it’s more about mxs value > c# value
You can execute a string to get access the scenematerials library or a custom array rather than using the material editor if you want to?
myMat = “carpaint”
((GlobalInterface.Instance.ExecuteScript (CreateStr (“scenematerials[” + myMat + “]”)) true).ToMtlbase).GbufID = 0
Thanks, David.
G = (dotnetclass "Autodesk.Max.GlobalInterface").Instance
ss = G.StringStream.Create "scenematerials[3]"
val = G.ExecuteScript ss true
mtl = val.ToMtlbase
mtl.GbufID = 33