Thank you very much @denisT
This is what I ended up with. I will probably need to try it out in different situations, for example what happens if I donât have Vray?
- clearing all textures, VrayHDRI and Proxys
-- This script clears all available instances of bitmap textures, VrayHDRI maps and VrayProxy file links
-- Thanks to denisT for helping with the maxscript for finding and clearing the textures
format "----------------------------------------------------------------------------------\n"
format "Clearing all available instances of bitmap textures and VrayProxy file links in this scene\n"
format "----------------------------------------------------------------------------------\n"
txs = getclassinstances BitmapTexture + getclassinstances VRayProxy
for tx in txs do
(
print tx.filename
tx.filename = ""
)
format "-----------------------------------------------------------\n"
format "Clearing all available instances of VrayHDRI maps in this scene\n"
format "-----------------------------------------------------------\n"
Htxs = getclassinstances VRayHDRI
for tx in Htxs do
(
print tx.HDRIMapName
tx.HDRIMapName = ""
)
atsops.refresh()
- Secret or not, this is my solution for how to clear the unresolved textures. Even though I am grateful for the AssetTracker-code (se credit below) I hope someone might know a cleaner way to resolve paths:
-- This script clears all missing instances of bitmap textures, VrayHDRI maps and VrayProxy file links
-- Credit goes to TreeDwannaB for the path resolving solution (https://forums.cgsociety.org/t/get-texture-absolute-path/1685901/13)
-- Thanks to denisT for helping with the maxscript for finding and clearing the textures
fn clearFiles =
(
txs = getclassinstances BitmapTexture + getclassinstances VRayProxy -- clears all Bitmap textures and VrayProxy files
for tx in txs do
(
if not doesfileexist tx.filename do
(
print tx.filename
tx.filename = ""
)
)
Htxs = getclassinstances VRayHDRI -- clears all VrayHDRI textures
for tx in Htxs do
(
if not doesfileexist tx.HDRIMapName do
(
print tx.HDRIMapName
tx.HDRIMapName = ""
)
)
)
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()
gc()
)
fn ATnClear =
(
if ATSOps.Visible == false then
(
ATSOps.Visible = true
resovlepaths()
print "Resolved Paths Done"
print "Clearing missing or non resolved file path:"
clearFiles()
atsops.refresh()
ATSOps.Visible = false
)
else
(
resovlepaths()
print "Resolved Paths Done"
clearFiles()
atsops.refresh()
)
)
ATnClear()