Notifications
Clear all

[Closed] Clean_MultiMaterial : UtilityPlugin ???

I have perhaps strange question but it seems to me like some commands want work or is it me?

So the point is that I want to reach Clean_MultiMaterial form UtilityPlugins panel by maxscript, I have to detect if there are some unused submaterial slots and go on with next action to clean it up. So two actions all in total, 1 – detect, 2 – clean
I checked maxscript help already:
http://docs.autodesk.com/3DSMAX/15/ENU/MAXScript-Help/index.html?url=files/GUID-1CA15ED1-5921-494E-BCD7-47BCA3E92D50.htm,topicNumber=d30e610857

, there are some commands to fire this Clean_MultiMaterial utility up and operate it by maxscript however no matter which command I use, just nothing happen. Could somebody check if this is maxscript fault or maybe my brain is overload:).
I would be very appreciate due to I blew up enormous amount of time to figure this simple thing out but I gave up on this at some point, form the other hand there is no threads anywhere about faulty working Clean_MultiMaterial tool and any code using – examples as well.

8 Replies

do you want this??

MMClean.CleanMaterailsAll()

i this is is what you want:

MMClean.fixAll prompt:false

when you have an interface, you should use the Alias of the interfaces to use its methods.

not it works:)
But is is possible to find unused sub-slots without using MMClean interface?, something like(but this wont work, operation don`t give true or false):

multimaterialsarray=(for o in objects where o.material != undefined and classof o.material == Multimaterial collect o)
unusedmultimats=MMClean.findAll &multimaterialsarray
if unusedmultimats==true then MMClean.fix &multimaterialsarray prompt:false

which is the error you get??
For me works in max 2011 but I just tried it in max 2013 and it doesn’t work. No unused materials…

problem is “MMClean.findAll &multimaterialsarray” dont generate true or false so I can only clean multimaterials but I can`t detect if there are such.

use
MMClean.findAll &multimaterialsarray
if multimaterialsarray.count > 0 do …

you dont need to loop the objects, findAlldo it.

if I will use “if multimaterialsarray.count > 0 do …” it still do nothing because in such case “multimaterialsarray=(for o in objects where o.material != undefined and classof o.material == Multimaterial collect o) ” only collect multiaterials and I want check if given multimaterial can be cleaned before user will take decision to clean it or not. This dont generate false,true or any countable results, only “ok” – unusedmultimats=MMClean.findAll &multimaterialsarray.

I think I am not wrong.

let’s break this down:

multimaterialsarray=(for o in objects where o.material != undefined and classof o.material == Multimaterial collect o)

That code get an array of objects in variable “multimaterialsarray”. If you want an array of multimaterials you need:

multimaterialsarray=(for o in objects where o.material != undefined and classof o.material == Multimaterial collect o.material)

but this line do the same, but only collecting the multimaterials with unused materials:

MMClean.findAll &multimaterialsarray

&multimaterialsarray is a by reference parameter. So, findAll save the materials array found in multimaterialsarray; overwrite the previous value.