Selecting Faces by diffusemap
I am trying to write a script which will check all the objects(geometry) in a scene individually....and detach the faces having a material with diffuse texture name ending with "_alpha".....then naming and grouping the newly created object (the easiest part). I am able to do this for single material objects.....but the problem starts when multi-subobject materials are there. I am not able to select the faces with specific mat id having a diffuse texture name ending with "_alpha".
the only working part of my script is:
if classof mat.diffuseMap == Bitmaptexture then
stringSS = getFileNameFile mat.diffusemap.bitmap.filename
stringcount = stringSS.count
start = stringcount - 5
end = start + 6
TextureName = substring stringSS start end
if TextureName == "_alpha" then
objname = $.name
$.name = objname +"_alpha"
....need help :(