[Closed] select by bitmap type?
hy code-god!
seems i´m getting the most frequent “questionier”
i have a huuuge max file (a city scape) with obsolete and/or wrong bitmaps assigned. mostly big *.psd photoshop files…
now i wanna search and replace materials and objects by their bitmap type. e.g. select by Photoshop file…i know that there are scrips quite similar to what i´m seeking for at scriptspot but not exactly like i want.
is there a possibility to highlight objects by bitmap type selection?
regards
anselm
This function should do the trick:
fn selectByBitmapType bmType mapType:"diffuseMap" = (
local mtlFlags = #{}
for nMtl = 1 to sceneMaterials.count do (
mtl = sceneMaterials[nMtl]
local map = execute ("mtl." + mapType)
if map != undefined do (
local bm = map.bitmap
if bm != undefined and (classOf bm) == Bitmap do (
local bmExt = getFileNameType bm.fileName
mtlFlags[nMtl] = (bmExt == bmType)
)
)
)
clearSelection()
for obj in geometry do (
if obj.material != undefined do (
local mtlIndex = findItem sceneMaterials obj.material
if mtlIndex != 0 do (
if mtlFlags[mtlIndex] do (
selectMore obj
)
)
)
)
)
So if you type:
selectByBitmapType ".bmp"
It will select the objects whose diffuse map (that’s the default value for the parameter ) has a bitmap with the extension bmp. But you can select by the bitmap of any map. For example:
selectByBitmapType ".psd" mapType:"bumpMap"
It will select all objects whose bump map has a psd assigned. Don’t forget to specify the “.” before the extension.
The possible values for the <mapType> parameter are (for a standard material):
[ul]
[li]ambientMap
[/li][li]diffuseMap
[/li][li]specularMap
[/li][li]specularLevelMap
[/li][li]glossinessMap
[/li][li]selfIllumMap
[/li][li]opacityMap
[/li][li]filterMap
[/li][li]bumpMap
[/li][li]reflectionMap
[/li][li]refractionMap
[/li][li]displacementMap
[/li][/ul]
Hope that helps.
thank you for the quick reply!
ill deal with the other maptypes
regards
anselm