ScriptSpot

Forum topic · General Scripting

Automatically remapped bitmaps

By tomshannon · 2008-04-08

Description

Is there a way to return the actual location of the bitmap file loaded rather than the location specified in the bitmap?

Not entirely sure how to phrase this other than to explain it the long way.

Let's say you have a scene file "object.max"
This scene file has an object "teapot01"
This object has a material with a bitmap in the diffuse slot "bitmap.png"
The bitmap is in a folder called "maps" in the same folder as the max file

This scene file was created a while back on an old computer. Now, residing on a new computer, the map is pointing to "c:\oldComputer\maps\bitmap.png"

Since the map is below the max file in the file structure, Max finds it and applies it wothout any fuss. Unfortunately, it's still pointing at "c:\oldComputer\maps\bitmap.png" rather than the file that has actually loaded "c:\newComputer\maps\bitmap.png"

Is there a way to return the actual location of the bitmap file loaded rather than the location specified in the bitmap?

Comments (2)

tomshannon · 2008-04-10

Naturally, I have found my answer soon after posting online.

the trick seems to be to interrogate the bitmap reference using :

theRealPath = usedMaps (theBitmapReference)

then I can set the filename on them to the correct place:

theBitmapReference.filename = theRealPath[1] as String

Viola! Now rather than trying to find a network server/computer that's long gone, we're pointing to where Max found the file.

hope this helps somebody out there!

--Tom