[Closed] batch files make assets get absolute path
Hi,
I am new to maxscript and I just started learning it. I would need some help to write a script to make the assets in my files pointing to the absolute path, but in a batch process as I have a couple of files to be edited.
All the max files are located in the same folder and the textures in a subfolder called ‘textures’. I found a useful script that works but I cannot incorporate it in the batch process. This is what I did but I get an error at resovlepaths() function.
[i]files = getFiles (@“c:\ emp”)
for i = 1 to files.count do
(
loadmaxFile files[i] useFileUnits:true quiet:true
scName = maxFileName
fn resovlepaths =
(
ATSOps.ExcludeOutputFiles = true
actionMan.executeAction -841213575 "2" -- Asset Tracking System: Highlight Editable Assets
actionMan.executeAction -841213575 "16" -- Asset Tracking System: Make Path Relative to Project Folder
actionMan.executeAction -841213575 "2" -- Asset Tracking System: Highlight Editable Assets
actionMan.executeAction -841213575 "17" -- Asset Tracking System: Make Path Absolute
ATSOps.ClearSelection()
atsops.refresh()
gc()
)
fn closeOpenATSops =
(
if ATSOps.Visible == false then
(
ATSOps.Visible = true
resovlepaths()
ATSOps.Visible = false
print "Resolved Paths Done"
)
else
(
resovlepaths()
print "Resolved Paths Done"
)
)
closeOpenATSops()
–
– savemaxFile (@“c:\ emp” + scName) overwrite:on
)[/i]
Many thanks
You can change Max File asset paths without opening the files.
Have a look at getMAXFileAssetMetadata and setMAXFileAssetMetadata
I wrote a tool for work that does massive find/replace on all .max files in a given folder. It is super fast (and very dangerous if you make a mistake!) It will change paths of both assets like bitmaps, proxies, pointcaches etc and the paths of output images.
It can be used to force UNC/absolute paths on .max files throughout our system. It is great to get a look at where people are pulling their assets from, the number of duplicate files out there, etc.
Thanks mate!
I don’t know if you wanted to share a link to the script or just some images but I managed to have a look online and I bumped into an older script of yours I presume.
It looks like it works but when it combines the absolute path with the asset’s file name it doesn’t add the “\” between them, so the final path is wrong.
http://www.scriptspot.com/3ds-max/scripts/batch-asset-re-path-tool
I tried to add a + “\” + myself in the newFname substitution but I get an error. Could you please advise?
Thanks
[…]
format “Asset: %
” fName
if matchpattern fName pattern:(edt_Find.text +”*”)
then
(
newFName = substituteString fName edt_Find.text edt_Replace.text
metaArray[x].filename = newFName
format “Replacing %
with %
” fname newFName
)
else
(
format “No Matching Path String
“
)
[…]
Also in the unique asset paths window I dont get any paths and in the listener i get this ” “
One more thing…
The script works but only for the files that already have a path. For the ones that don’t it doesn’t change the path, it’s left blank as it was.
Is there something I can do about it or am I doing something wrong?