Skip to content

Instantly share code, notes, and snippets.

@jaforsgren
Created September 27, 2018 07:50
Show Gist options
  • Save jaforsgren/2b854e0063691ce0240fa97def6e015b to your computer and use it in GitHub Desktop.
Save jaforsgren/2b854e0063691ce0240fa97def6e015b to your computer and use it in GitHub Desktop.
repoints paths to the location of the max files
-- swiped from https://forums.cgsociety.org/t/getting-a-list-of-scene-bitmap-paths/1545447/8
gc() -- just for this example, to make sure everything is nice and clean
-- find the scene root. The rootnode, medit, etc are references off this scene root
sceneroot = (for r in (refs.dependents rootnode) where (classof r == Scene) collect r)[1]
-- collect all the assets
origAssets = for i = 1 to AssetManager.GetNumAssets() collect (AssetManager.GetAssetByIndex i)
-- for each of the assets...
for AUIO in origAssets do
(
-- dump info on the asset
local AID = AUIO.GetAssetId() --get the Asset’s ID
local AType = AUIO.getType() --get the Asset’s Type
local AFile = AUIO.getfilename() --get the Asset’s File Name
format "ID:% Type:% File:%
" AID AType AFile --format the info
-- generate new filename, prepend "XXXX_"
local lFile = filenameFromPath AFile
local lPath = getFileNamePath AFile
local lNewName = lPath + "\\" + "XXXX_" + lFile
-- do the retargetting
atsops.RetargetAssets sceneroot AFile lNewName CreateOutputFolder:false
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment