ScriptSpot home

Forum topic · Scripts Wanted

Bitmap collector

By brit · 2012-09-12

Description

Hi,
Does anyone know wether bitmap collector by neil belvin works with 2013 or is there another script, or a way within max to copy all bitmaps and place them within one folder ?
Cheers

Comments (4)
Branko Živković

try this code

How to use:
1.run the copySceneBmp function
2.next you can run simply

copySceneBmp()

then pick folder where you want to store bitmaps or you can run

copySceneBmp toDir:@"C:\Temp"

(specyfy your path if you not use @"C:\Temp") and thats it.

fn copySceneBmp toDir: =
(
local usedSceneBitmaps = (getClassInstances bitmaptex)
local bmpPats = #()
local SIOFile = dotNetClass "System.IO.File"
local SIOPath = dotNetClass "System.IO.Path"
if usedSceneBitmaps.count != 0 do
(
for b in usedSceneBitmaps do
(
if bmpPats.count == 0 then append bmpPats b.filename else
(
--next line this method performs a lower case comparison of strings
--is more precise then *appendIfUnique*
if (for i = 1 to bmpPats.count where stricmp bmpPats[i] b.filename == 0 collect i).count == 0 do
append bmpPats b.filename
)
)
if bmpPats.count != 0 do
(
targetDir = if toDir != unsupplied then toDir else (getsavepath caption:"Select the folder for bitmaps")
if targetDir != undefined do
(
for sFile in bmpPats do
(
tFile = targetDir +"\\"+(SIOPath.GetFileName sFile)
SIOFile.Copy sFile tFile
)
free bmpPats ; free usedSceneBitmaps
)
)
)
)

Reply to Branko Živković
zahid hasan

nice and simple.
would you explain the dotnet part. how it is helping to copy the file.often files are not in the exact path but in some other asset path. how the script is handling this.sorry for bothering with basic questions.thanks