Notifications
Clear all

[Closed] Change User Path for textures

I added the file opening and saving part to what kikialex had already posted.

Alrighty, here’s the script:

 
/* first a couple of variables --*/
 
theDir = "C:\\directory_Where_MaxFiles_Are\\*.max"
 
myFiles = getfiles myDir
 
newPath = "C:\\directory_Where_Textures_Are\\"
 
/* run through each file --*/
 
for f in myFiles do
 
(
 
/* open each file --*/
 
loadMaxFile f quiet:true
 
 
 
/* get all missing maps --*/
 
mMaps = getClassInstances bitmaptexture
 
 
 
/* run through all missing maps --*/
 
for m in mMaps do
 
(
 
/* rename all missing maps --*/
 
fName = getFileNameFile m.filename
 
fExt = getFileNameType m.filename
 
newName = newPath+fName+fExt
 
)
 
 
 
/* save and close current file */
 
saveMaxFile ((getFileNameFile f)+"_updated.max")
 
)
 
messageBox "Done updating "+(myFiles.count)+" files."
 

Incase you’re not familiar with maxscript, just open a new maxscript window from the maxscript pulldown, copy and paste the code above into the window and hit control-e or from the file pull down select “evaluate all” and it should start working.

The only thing I have to warn is that once it starts it won’t stop unless you keep escape pressed or you wait for the script to run through all the files. So test it on a small group of files first to make sure it’s doing what you want.

Let me know if you run into any problems. Good luck!

Please note: the above will not search recursive sub-directories, check the max script help file for a recursive searching function.

Thanks guys! i’ll try those scripts. I’ll give you a feedback soon

In response to moondoggie,
I meant for the files to all be placed in one directory (I assume orlenka, you can move all the files into one directory?) It will create a new copy of each file with “_updated” attached to the end.

Also, for the maps to all be placed in one directory. If you plan on setting up a more specific directory structure for this, then the script would have to be modified.

yes i can move the files where we want. Thanks for warning me

Absolutely, my comment was merely a warning, I can’t count how many times I’ve done something and it works, then I realize it missed a bunch of files, etc.

yeah i clearly see what you mean, i was confronted with some scripts mistakes today…i haven’t imagined there were so many things to think about to finalyze a well working tool 😮

Page 2 / 2