MaxPlus : rename a material

Hi,

I’m trying to simply reset all material editor slots, and can’t manage to set the material name.
The function :


def resetMedit():
    medit = MaxPlus.MaterialEditor
    for i in xrange(24):
        mtlName = "%s - Defaultxxx" %str(i).zfill(2)
        m = MaxPlus.Factory.CreateDefaultStdMat()
        m.Name = mtlName
        print "[%s] %s" % (m.GetClassName(), m.GetName())
        medit.SetSlot(i, m)
#

it just set an unamed material … Have tried also SetName but error.
Any idea ?

ok, silly, but sometimes string needs to be not python string, but MaxPlus.WStr(’)


def resetMedit(): #OK
    medit = MaxPlus.MaterialEditor
    medit.SetActiveSlot(0)

    for i in xrange(24):
        mtlName = "%s - Default" %str(i).zfill(2)
        mtl = MaxPlus.Factory.CreateDefaultStdMat()
        mtl.SetName(MaxPlus.WStr(mtlName))
        medit.SetSlot(i, mtl)
#