ScriptSpot

Forum topic · Scripts Wanted

Rename Bitmaps for exporting

By roamn · 2013-11-23

Description

Hi
Is there any script out there that allows me to rename the bitmaps used in my scene and update the name in 3ds max materials?
I have for example bitmaps used in scene:

Wood_cgtextures_01_VeryCOOL Lighting_Effect.jpg
Just Another Wood material Name With Spaces in its name.tga
etc.

And i want to rename these bitmaps (both in 3ds max and "windows" so they "match") to a name i would like (of my choise)+ automaticly append numbers, so for example

TEX001.jpg
TEX002.tga

I need this for proper exporting to some formats (like 3ds for example).

I didnt find any script that does this, i like Neil Blevins Name manager from soulburn scripts, but it doesnt handle renaming the bitmaps (just maps, materials etc. not really bitmaps)

Does such a "simple" but needed script exist please?

Comments (12)

`

pixamoon · 2015-07-01

Hi,
Try Bitmap Tracking / Resizing
Demo should work up to 3 bitmaps at one time. For more you need full version.
I can send you full test version too. Just send me your e-mail.
Best,

Finally, is there any script like this freely available now?

nnq2603 · 2015-06-24

I'm curious if there's a free script do this task well at the moment. I also search for weeks and not really find out anything work as expected.

There's one called "duberBitmapCollector" that closest to this request, but in my PC I couldn't got it work well.

Is there any popular/famous script doing this task (which perhaps I'm not aware of). Please tell me, any suggestion welcome.

Suggestion of scripts

nnq2603 · 2015-06-25

Thanks for suggestions. Anyway, your tools is theoritically great. Of course it might be really good but seem it doesn't provide test version that contain features that I ask above.
"Note:
None of functions works in demo version. It is only inteface for now"

Well i would like a universal

roamn · 2013-11-24

Well i would like an universal script if possible, i dont need to "fix" just one file, ill need it also in future for fixing other files (a LOT of files), so i would prefer universal script where i can enter a name of my choice + automatic counter
I will be using short names to be able to export the model and TEXTURES correctly to the format *.3ds which supports only 8 characters for a texture (bitmap) name.

So i would like the names for textures as

SN001.jpg
SN002.jpg
SN003.tga
SN004.png
SN005.jpg
Etc.
Where the "SN" is a name of my choice entered (for a SNow tree for example) and the 001-005 is automaticly added counting number.

Just simple stuf with automatic number adding (001 az 999)

Is it possible please?

barigazy · 2013-11-24

Yup. But can be too slow for sure

roamn · 2013-11-24

:-) i dont understand :-)? Do you mean with that its time consuming to script it? Or that the runnning of such script/processing of the scene textures could be slow (few minutes)?

barigazy · 2013-11-24

I mean both. Beacause of that meny threats related to this topic are not finished

roamn · 2013-11-25

Oh... i didnt know what i thought its easy, i dont need any collector or something like that "just" the renamer :-(...

So you wont be able to do that :-(?

roamn · 2013-11-24

Hello and thanks :-), but im not sure how to use it, i have a scene with vray or standard materials (i tried them both) assigned on the objects and also in the material editor, i have selected all scene objects and try to run the script, but it gives me just a warning "Bitmap File not exist!", what am i doing wrong and how should one exactly use your script?

BTw about the collectin the bitmaps into one folder, theres no need for special script, since max has a default feature in Utilities called "resource collector", so collecting resources into one folder is covered, but i did not managed yet to rename them succesfully, what am i doing wrong please?

(Neverthless thanks for the script of course :-)! )

I am using 3ds max 2009 64 bit (window 7) by the way.

barigazy · 2013-11-24

Send me or post here a small test file (archived) and tell me which names you want to use for renaming.

barigazy · 2013-11-23

This is a simple example how to rename and update bitmap.
Supports only bitmap textures.
If you want more complex solution search on this forum recursive function which
will help you to collect all maps with filemane. Anyway...

fn renameBmpFile source target =
(
local sioFile = dotNetClass "System.IO.File"
local sysStr = dotNetClass "System.String"

if not (sioFile.Exists source) then messageBox "Bitmap File not exist!" title:"Warning" beep:off else
(
if sioFile.Exists target then messageBox "You already used this name!" title:"Warning" beep:off else
(
local bitmaps = getClassInstances Bitmaptex
if bitmaps.count == 0 then messageBox "No Bitmaps In The Scene" title:"Warning" beep:off else
(
local bmpArr = for b in bitmaps where isKindOf b.filename String and (sysStr.Compare source b.filename true) == 0 collect b
if bmpArr.count == 0 then messageBox "This Bitmap Is Not Assigned!" title:"Warning" beep:off else
(
sioFile.Move source target
for b in bmpArr do setProperty b #filename target
free bmpArr
)
free bitmaps
)
)
)
)
-- example
sceneMapString = @"c:\Users\Maps\Bark map.jpg"
newFileName = @"c:\Users\Maps\Wood_Bark.tiff"
renameBmpFile sceneMapString newFileName