[Closed] search for bitmap texture and replace
hello people,
I want to suppress every “blabla.jpg” texture entry in every materials in the scene and set channel to undefined. This entry can be find in opacity, specular, bump…every channel.
But I dont want to set channel to undefined if it s anopther texture
I try following but failed
for o in objects do
(
for ( o.material.opacityMap == Bitmaptexture fileName:“E:\blabla.jpg”) do
(
o.material.opacityMap = undefined
)
)
mapToSearch = "E:\blabla.jpg"
Mats = getClassInstances Standardmaterial
for m in Mats do
(
if (classOf m.opacityMap == Bitmaptexture) do
(
if (m.opacityMap.fileName == mapToSearch) do
(m.opacityMap = undefined)
)
)
that should do the trick
(
mapToSearch = "E:\blabla.jpg"
for i in scenematerials do
(
for m=1 to getNumSubTexmaps i where classof(getSubTexmap i m) == BitmapTexture do if (getSubTexmap i m).filename == mapToSearch then setSubTexmap i m undefined
)
)
This deletes the map from every material in the scene and from every map slot where it is. Cheers Loran!
Kameleon,
don’t be so naive…
does “e:\blabla.JPG” equal “E:\blabla.jpg” or “E:/blabla.jpg” equal “E:\\blabla.jpg” ?
I hate you, for moments, after writing this snippet I thought “uau, this is how being Denis feels” and now you’ve ruined it hehe
But now that you’re here… ok I get the case stuff, just do a tolower and we’re done, but I’m not seeing how you can resolve the \ and //// issues
why do you think max developers added not long ago the pathconfig structure to the mxs?
But the more you hate me, the more you will learn: I am hard, but I am fair!
(Full Metal Jacket, Stanley Kubrick)
Thanks Dennis, I’ll have a look at that tomorrow or better… today since I’m still awake and it’s morning… installing OSX on Windows is a pain Cyas!
Hey thank you guys
It s always a pleasure to ask something about maxscript down here. People answers quickly and so friendly…thks
actualy it s not working so well. the script delete the bitmap entry on the 1rst material only…