Message 1 of 2
Material to CME
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
What is wrong?
I'm trying to put material from a loaded library into the Material Editor's Active slot (Basic mode). In Max 2017/2018 - ok. But Max 2013 crash!
C#
IMtlBaseLib tempLib = MaxCore.Core.MaterialLibrary;
MaxCore.Core.LoadMaterialLib(materialLibPath, tempLib);
if (tempLib != null)
{
string matId = item.Id;
int matIdx = tempLib.FindMtlByName(ref matId);
if (matIdx != -1)
{
#if REL13
IMtlBase mat = tempLib[(IntPtr)matIdx];
#else
IMtlBase mat = tempLib[matIdx];
#endif
int actMtlSlot = MaxCore.Core.ActiveMtlSlot;
mat.Name = item.DisplayName;
MaxCore.Core.PutMtlToMtlEditor(mat, actMtlSlot);
// Some commented methods, currently inactive
MaxCore.Core.UpdateMtlEditorBrackets();
}
tempLib.DeleteAll();
tempLib.Dispose();
}