#401230
I'm trying to remove the material from the scene, the code just doesn't work whatever use "free()" or "extract()", anyone can give me some tip?

scene = Cmaxwell(mwcallback_cb)
scene.readMXS(mxsFile)
material= CmaxwellMaterialIterator()
mat = material.first(scene)
while not mat.isNull():
mat.free()
mat = material.next()
scene.writeMXS(mxsFile)
User avatar
By Brany
#401235
I'm afraid you cannot delete a material from the scene and keep using the material interator. Try to store the materials you want to delete in a list, and then delete each one:
Code: Select all
scene = Cmaxwell(mwcallback_cb)
scene.readMXS(mxsFile)
material= CmaxwellMaterialIterator()
mat = material.first(scene)
matlist = []
while not mat.isNull():
    matlist.append(mat)
    mat = material.next()
for m in matlist:
    mat.free()
scene.writeMXS(mxsFile)
Will there be a Maxwell Render 6 ?

Let's be realistic. What's left of NL is only milk[…]