Notifications
Clear all

[Closed] Strip all usedMaps() paths

Okay, so when I used this code… (note the comment addressing what you just mentioned)


-- false?  Whoops.  Perhaps it doesn't like some file in there, but we can't tell which.  Perhaps [i]the max file because it's in use[/i], perhaps the filter thing.  So let's try with just our bitmap.
newArray = #(fileArray[3])
  ATSOps.SelectFiles &newArray
  ATSOps.SetPathOnSelection "C:\\Documents and Settings\\My Username\\My Documents\\3dsmax\\sceneassets\\"
  false
  
  -- still false.  What gives?
  ATSOps.SelectFiles &fileArray
  ATSOps.numFilesSelected()
  0

What happened, other than -not- selecting the third item in the original array?
I take it you need the refresh; which the help states refreshes a dialog (which to me would imply it makes sure a GUI element gets updated to reflect the internal state) but I guess would actually mean “make sure the internal state actually -is- what you just told it to be”?

Let’s try the original example (with your added refresh) and add some prints and refreshes… I’ll give output per line.


fileArray = #()
[color=Blue]#()
ATSOps.Refresh()
OK
 ATSOps.GetFiles &fileArray --collect all scene files and paths
2
 deleteItem fileArray 1 --remove the actual scene file path
#("c:	emp	est.bmp")
 for infile in fileArray.count to 1 by -1 do ( --remove output file paths
	 if ATSOps.IsInputFile fileArray[infile] != true do (
		 deleteItem fileArray infile
	 )
 )
OK
fileArray
#("c:	emp	est.bmp")
 ATSOps.SelectFiles &fileArray --select files for path stripping
OK
 ATSOps.SetPathOnSelection "c:\	emp2\\" --this path exists.
false -- hmm?
 ATSOps.numFilesSelected()
0 -- ah?
fileArray
#("c:	emp	est.bmp") -- okay, it's still there.
 ATSOps.SelectFiles &fileArray --select files for path stripping
OK -- should be selected, no?
 ATSOps.numFilesSelected()
0 -- I guess not.
ATSOps.Refresh()
OK -- refreshed
 ATSOps.numFilesSelected()
0 -- nope

Is it just me?
[/color]

Thanks for this code PiXeL_MoNKeY but it really works partially. It does strip the path of the bitmaps and HDRIs but doesn’t with proxies, point chashe, xref (it change the path of the first one only)
Please have a look at the print screen of the AT after I run the script. Green – it did. Red – it didn’t.

Ill look at it later, but the script I posted worked on a file with 180 files, and stripped the path of 178 files (the other being an output path and the actual scene file that is open). When I ran it I had the ATS dialog open, which may be the difference.

-Eric

kamel47, you may try removing the IsInputFile check. As Richard stated in another thread the file can give a false negative if the file can be an input and output file.

-Eric

Edit: If you literally want everything to have its path stripped try just this one line:

ATSOps.SetPath ""

:lightbulb Turns out that it is. So…


ATSOps.visible = true
-- work with the bugger
ATSOps.visible = false

Next up, change the path in one map, but not in another

PiXeL_MoNKeY I did try

ATSOps.SetPath ""

but still I had the same rezolt. Only one of the Xrefs was stripped.

I have no idea what is going on, kinda hard to diagnose without having a scene that exhibits the problems you are seeing. Did you run the Maxscript commands with the dialog open or closed? Did you also call ATSOps.Refresh() to refresh the list?

-Eric

It is very strage. Works fine on my workstation 32 and 64bit, but on laptop or low spec machine dosen’t.

It appears that you need to have the dialog open for some of the maxscript ATSOps commands to work. So try something like:

ATSOps.visible = true
ATSOps.Refresh()
ATSOps.SetPath ""
ATSOps.visible = false

That should just be a matter of extracting the paths from the filelist array and running ATSOps.SetPathOnSelection “NewPath” on the desired path(s).

-Eric

1 Reply
(@zeboxx2)
Joined: 11 months ago

Posts: 0

I was just being difficult – and not clear enough at that

If you have two maps, both pointing to “c: emp est.bmp”, and you want to change the path for just one of those two maps, would have been the challenge.
The asset tracker just sees it as a single asset, and you can’t get what’s actually referencing that asset out of it.

And yes, I know, .RetargetAssets That only helps if you already know which MaxObject you want to poke at, though.

Page 2 / 2