Getting bitmaptexture node by filename path

Hi there

its always easy to accsess a child property via a structure like this (§ = ...) I think everybody knows... but how about trying it the other way around...

Is there a way to get a bitmaptexture node only with its specific filepath?

lets say i have "Z:\test\afolder\amap.jpg" and i want to get the bitmap where amap.jpg is in...

can anyone help please?

by the way: my first post here, so Hello and greetings to everyone!


Comment viewing options

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

Invert this

I would like to simply, get the filename and place it on the map and material name.
is that dificult?

br0t's picture

Hey and welcome ;)I don't

Hey and welcome ;)

I don't think there is a "reverse" way to easily get this; you'll have to loop over all bitmap instances in the scene and compare their filenames to the one you search for like so:

fullPath = "Z:\test\afolder\amap.jpg"
imgName = "amap.jpg"
bMaps = getClassInstances Bitmaptexture
for i = 1 to bMaps.count do
	currImgName = getFileNameFile(bMaps[i].filename) + getFileNameType(bMaps[i].filename)
	-- see if it matches the image name:
	if currImgName == imgName do
		print("Found matching image name in:" + i as String)
	)--end if
	-- see if it matches the full path
	if bMaps[i].filename == fullPath do
		print("Found matching path in: " + i as String)
	)--end if
)--end for


Never get low & slow & out of ideas

Phasma's picture


but sadly i cant do that.

I wrote a script where you easily can relink missing bitmaps... at the beginning this script loops through all instances like you have done it in this example...
the problem is, although it found and relinked all bitmap textures, in some scenes max still shows missing maps (on local disks and stuff...) but they do not appear in the getclassinstances bitmaptexture array... so they are not really used in the scene anymore... at least they are listed in the asset tracker, so i extracted all the listed bitmaps in the asset tracking and combined both arrays of bitmaps to extract only those wich are really not used in the scene but shown as missing when you open the file... so i just have the asset tracking functions (but in the maxscript help there is no function to get the node from it) and the filepath... I looked for a function like the getnodebyname function, just for bitmaps... also getnodebyID or something like that would be helpful, but there is none...

the goal is to eliminate the hidden "missing" unused maps to make that start screen "missing maps" disapear... once I have those nodes, i can set them undefined

br0t's picture

Hm okay, so you have some

Hm okay, so you have some bitmaps that are not used inside the scene and are not found by the asset tracker. Maybe there are some places in 3ds max where you would've to look manually, like inside any render options or any modifiers? But I'm just guessing here :/

I don't know if you just need a script for relinking or if you need this to be a part of a larger script, if its the prior one there are existing ones like :
and more recently:

Both sadly are encrypted, but should do what you are trying to achieve. If these won't help you out, maybe their creators can. Worth a try to contact them I think :)

If you find a solution for this "getNodeFromBitmapFilename"-problem, I would be very interested in it :)

Good luck!

Never get low & slow & out of ideas

Comment viewing options

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