Notifications
Clear all

[Closed] loop through all slots in material


 fn cleanBitmapTextures mat = 
 (
   for tx in (getclassinstances bitmaptexture target:mat asTrackViewPick:on) where 
 	not doesfileexist tx.anim.filename do tx.client[tx.subNum].value = undefined
 )
 
4 Replies
(@panayot)
Joined: 11 months ago

Posts: 0

Hi Denis, on which Max version you test this function?
Due to the docs [b]GetClassInstances/b is fixed in Max 2011.
Not tested by me, am still on Max 2009 and here it is a real disaster.

I test your function with Blend material. The result is – Mask slot is not cleaned,
and the most worst – the materials are removed from Blend slots.

(@denist)
Joined: 11 months ago

Posts: 0

getclassinstance in max 2009 and 2010 has bug and sometime doesn’t return trackpickvalue right.
the function returns wrong subNum value.
it’s fixed in 2011…

here is a version to trick it:


 fn cleanBitmapTextures mat =
 (
 	for tx in (getclassinstances bitmaptexture target:mat asTrackViewPick:on) where 
 		not doesfileexist tx.anim.filename do 
 		(
 			for s=1 to tx.client.numsubs where tx.client[s].value == tx.anim do tx.client[s].value = undefined
 		)
 )
 
(@panayot)
Joined: 11 months ago

Posts: 0

Yes, that works in Max 2009. Thanks for the reply.

(@stigatle)
Joined: 11 months ago

Posts: 0

Thank you, this works!

Page 2 / 2