ScriptSpot home

Forum topic · General Scripting

Collect Images in material

By JokerMartini · 2011-11-14

Description

Is there an easy way to collect all the images used within a material?

for example:

source_mtl=meditMaterials[1]
- diffuse = image.jpeg
- bump = image2.png
- opacity = images5.png

Comments (7)
JokerMartini

delete

is there a way I can delete it?


bitmapsArr = getClassInstances BitmapTexture asTrackViewPick:on

for tx in bitmapsArr where doesFileExist tx.anim.filename != true do
(
--delete tx since the image is invalid
)

fajar

anubis : are you bobo in 2011, many usefull post posted by you ....im gratefull for that.

thanks anubis.

Reply to fajar
Panayot Karabakalov

thanks for the nice words!

haha, many thanks! but bobo is titan and i think i not yet deserve so high praise :)

JokerMartini

Thank you Anubis for the quick response. I'm working on a easier way of duplicating a shader and swatching out images randomly from a desired folder.

Thanks

mjbg

havent tryied this much but this should do it


source_mtl = meditMaterials[1]
arrayImages = #()

for o in 1 to (getNumSubTexmaps source_mtl) do
(
	if classof (getSubTexmap source_mtl o) == Bitmaptexture do
	append arrayImages ((getSubTexmapSlotName (source_mtl) o)+" = "+((getSubTexmap source_mtl o).filename))
)
Panayot Karabakalov

getClassInstances

mat = meditMaterials[1]
btxs = getClassInstances BitmapTexture target:mat asTrackViewPick:on
imgs = for tx in btxs where doesFileExist tx.anim.filename collect tx.anim.filename

you can check this topic as well.