Collect Images in material

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

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
JokerMartini's picture

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
)

John Martini
Digital Artist
http://www.JokerMartini.com (new site)

Anubis's picture

here is...

here is a function posted by Denis.

my recent MAXScripts RSS (archive here)

fajar's picture

anubis : are you bobo in

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

thanks anubis.

Anubis's picture

thanks for the nice words!

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

my recent MAXScripts RSS (archive here)

JokerMartini's picture

Thank you Anubis for the

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

John Martini
Digital Artist
http://www.JokerMartini.com (new site)

mjbg's picture

havent tryied this much but

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))
)
Anubis's picture

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.

my recent MAXScripts RSS (archive here)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.