Скрипт собирает все файлы в сцене.
Update - обновление путей в сцене
Move files - перемещение файлов
Simple collect - сборка в одну папку
Почти тоже самое, что архивация сцены, только с бонусами:
- умеет работать с "*.ifl" и "*.xml" -> "*.mc"
- возможность собирать по категориям - Proxy, PointCache, Bitmap
- возможность собирать только с выделенных объектов
------------------------------------------------------start
-- tested in 3DMax 2014
try destroyDialog ResourceCollector catch()
global ResourceCollector
global arrData = #(#(),#(),#(),#(),#(),#(),#())
--functions
--bitmaps
fn MakingDir FilePath PathForCollection = (
local outData = false
if PathForCollection != undefined do(
if FilePath != undefined and doesFileExist FilePath then
(
arPath = filterString FilePath "\\"
-- if other NetworkPath
if pathIsNetworkPath FilePath do (
local NewPath = "\\"
for i = 3 to arPath.count-1 do NewPath += (arPath[i] + "\\")
if (makeDir (PathForCollection + NewPath) all:true) do outData = PathForCollection + NewPath
)
-- if not NetworkPath
if pathIsNetworkPath FilePath == false do(
local NewPath = "\\"
for i = 2 to arPath.count-1 do NewPath += (arPath[i] + "\\")
if (makeDir (PathForCollection + NewPath) all:true) do outData = PathForCollection + NewPath
)
)else append arrData[1] ("Wrong files: "+ (FilePath as string))
)
return outData
)
fn arrBitMapSel =
(
local arBitMap = #()
for obj in selection where obj.material != undefined do for bm in (getclassinstances bitmapTexture target:obj) do appendIfUnique arBitMap bm
return arBitMap
)
--proxy
fn selGoodProxy =(
local theAllGoodProxy = #()
for i in selection where (classOf i == VRayProxy or classOf i == CProxy) do if doesFileExist i.filename do appendIfUnique theAllGoodProxy i
theAllGoodProxy
)
fn allGoodProxy =(
local theAllGoodProxy = #()
for i in objects where(classOf i == VRayProxy or classOf i == CProxy) do if doesFileExist i.filename do appendIfUnique theAllGoodProxy i
theAllGoodProxy
)
--pointcache
fn arrPointCacheSel =
(
local arPC = #()
for obj in selection do for pc in (getclassinstances Point_Cache target:obj) do appendIfUnique arPC pc
for obj in selection do for pc in (getclassinstances Point_CacheSpacewarpModifier target:obj) do appendIfUnique arPC pc
return arPC
)
rollout ResourceCollector "ResourceCollector"
(
--Interface
checkbox theUpd "Update" checked:false align:#left
checkbox delFile "Move files" checked:false align:#left
checkbox simCol "Simple collect" checked:false align:#left
checkbox theAll "All scene" checked:true align:#left
checkbox withProxy "Proxy" checked:false align:#left enabled:false
checkbox withPointCache "PointCache" checked:false align:#left enabled:false
checkbox withBitmap "Bitmap" checked:false align:#left enabled:false
checkbox selObj "Selection objects" checked:false align:#left enabled:false
button btn_browse "Browse--->" width:150 height:24 align:#left toolTip:"Please pick path for collections."
button do_it "Start collection" width:150 height:24 align:#left enabled:false
--button stripPathes "Strip path" width:150 height:24 align:#left enabled:false
local FolderPathForCollection = undefined
on theAll changed theState do(
if theState then (
withProxy.enabled = false
withProxy.checked = false
withPointCache.enabled = false
withPointCache.checked = false
withBitmap.enabled = false
withBitmap.checked = false
selObj.enabled = false
selObj.checked = false
) else (
withProxy.enabled = true
withPointCache.enabled = true
withBitmap.enabled = true
withBitmap.enabled = true
selObj.enabled = true
)
)
on btn_browse pressed do
(
FolderPathForCollection = getSavePath caption: "Pick folder" initialDir:"\\\\fs\\projects\\"
btn_browse.text = FolderPathForCollection as string
btn_browse.toolTip = FolderPathForCollection as string
if FolderPathForCollection != undefined then do_it.enabled = true else( do_it.enabled = false; btn_browse.text = "Browse--->")
)
on do_it pressed do(
if FolderPathForCollection != undefined do(
if theAll.state then(
tempAr = #()
clearlistener()
progressstart "Collecting..."
-- refresh asset tracking files
atsops.Refresh()
-- collect all the assets
origAssets = for i = 1 to AssetManager.GetNumAssets() collect (AssetManager.GetAssetByIndex i)
sceneroot = (for r in (refs.dependents rootnode) where (classof r == Scene) collect r)[1]
theNum = origAssets.count
for AUIO = 1 to theNum do(
AFile = origAssets[AUIO].getfilename()
if simCol.state then(
NewPath = FolderPathForCollection+ "\\" + (filenameFromPath AFile)
if matchpattern AFile pattern:"*.ifl" do(
if doesFileExist NewPath == false do copyFile AFile NewPath
f = openFile AFile mode:"r"
while not eof f do
(
newLine = readLine f
NewPathIFL = FolderPathForCollection+ "\\" + newLine
if doesFileExist NewPathIFL == false do if copyFile ((getFilenamePath AFile) + newLine) NewPathIFL then(
append tempAr #(origAssets[AUIO], ((getFilenamePath AFile) + newLine), NewPathIFL)
if delFile.state do try(deleteFile newLine)catch()
)
-- delete old files
)
close f
)
if doesFileExist NewPath == false do if copyFile AFile NewPath do(
append tempAr #(origAssets[AUIO], AFile, NewPath)
if delFile.state do try(deleteFile AFile)catch()
)
)else (
crFolder = MakingDir AFile FolderPathForCollection
if crFolder != false do(
NewPath = crFolder + (filenameFromPath AFile)
if matchpattern AFile pattern:"*.ifl" do(
f = openFile AFile mode:"r"
while not eof f do
(
newLine = readLine f
NewPathIFL = crFolder + newLine
if doesFileExist NewPathIFL == false do if copyFile ((getFilenamePath AFile) + newLine) NewPathIFL then(
append tempAr #(origAssets[AUIO], ((getFilenamePath AFile) + newLine), NewPathIFL)
if delFile.state do try(deleteFile ((getFilenamePath AFile) + newLine))catch()
)
-- delete old files
)
close f
)
if doesFileExist NewPath == false do if copyFile AFile NewPath do(
append tempAr #(origAssets[AUIO], AFile, NewPath)
if delFile.state do try(deleteFile ((getFilenamePath AFile) + NewPath))catch()
)
)
)
progressupdate (AUIO*100.0/theNum)
)
progressend ()
--update pathes
if theUpd.state do(
progressstart "Update pathes..."
nta = tempAr.count
for i = 1 to nta do(
try(atsops.RetargetAssets sceneroot tempAr[i][2] tempAr[i][3] CreateOutputFolder:false)catch()
progressupdate (i*100.0/nta)
)
progressend ()
)
) else(
local arBMTex_newPath=#()
local arProxy_newPath=#()
local arPC_newPath = #()
-- bitmap collections
if withBitmap.state do(
arBitMapTexture = if selObj.state then arrBitMapSel() else getclassinstances bitmapTexture
if arBitMapTexture.count != 0 do(
progressstart "Collecting textures..."
local num = 1
local numAll = arBitMapTexture.count
for bm in arBitMapTexture do(
if bm.filename != undefined do(
if simCol.state then(
NewPath = FolderPathForCollection+ "\\" + (filenameFromPath bm.filename)
--copy files
if getFilenameType bm.filename == ".ifl" then(
if doesFileExist NewPath == false do if copyFile bm.filename NewPath do append arrData[2] ("Copied textures: " + bm.filename)
f = openFile bm.filename mode:"r"
while not eof f do
(
newLine = readLine f
NewPathIFL = FolderPathForCollection+ "\\" + newLine
if doesFileExist NewPathIFL == false do if copyFile ((getfilenamePath bm.filename) + newLine) NewPathIFL do(
--append arBMTex_newPath #(bm,NewPathIFL,newLine)
append arrData[2] ("Copied textures: " + ((getfilenamePath bm.filename) + newLine))
)
-- delete old files
if delFile.state do try(deleteFile ((getfilenamePath bm.filename) + newLine))catch(append arrData[3] ("Undeleted textures: " + ((getfilenamePath bm.filename) + newLine)))
)
close f
)else if doesFileExist NewPath == false do if copyFile bm.filename NewPath do append arrData[2] ("Copied textures: " + bm.filename)
-- delete old files
--update
append arBMTex_newPath #(bm,NewPath,bm.filename)
progressupdate (num*100.0/numAll)
num+=1
)else (
local crFolder = MakingDir bm.filename FolderPathForCollection
if crFolder != false do(
NewPath = crFolder + (filenameFromPath bm.filename)
--copy files
if getFilenameType bm.filename == ".ifl" then(
if doesFileExist NewPath == false do if copyFile bm.filename NewPath do append arrData[2] ("Copied textures: " + bm.filename)
f = openFile bm.filename mode:"r"
while not eof f do
(
newLine = readLine f
NewPathIFL = crFolder + newLine
if doesFileExist NewPathIFL == false do if copyFile ((getFilenamePath bm.filename) + newLine) NewPathIFL do(
--append arBMTex_newPath #(bm,NewPathIFL,((getFilenamePath bm.filename) + newLine))
append arrData[2] ("Copied textures: " + ((getFilenamePath bm.filename) + newLine))
)
-- delete old files
if delFile.state do try(deleteFile ((getFilenamePath bm.filename) + newLine))catch(append arrData[3] ("Undeleted textures: " + ((getFilenamePath bm.filename) + newLine)))
)
close f
)else if doesFileExist NewPath == false do if copyFile bm.filename NewPath do append arrData[2] ("Copied textures: " + bm.filename)
append arBMTex_newPath #(bm,NewPath,bm.filename)
progressupdate (num*100.0/numAll)
num+=1
)
)
)
)
progressend ()
)--end if arBitMapTexture.count != 0
)--end if withBitmap.state do
-- proxy collections
if withProxy.state do(
arProxy = if selObj.state then selGoodProxy() else allGoodProxy()
if arProxy.count != 0 do(
progressstart "Collecting proxy..."
local num = 1
local numAll = arProxy.count
for p in arProxy do(
if p.filename != undefined do(
if simCol.state then(
NewPath = FolderPathForCollection+ "\\" + (filenameFromPath p.filename)
--copy files
if doesFileExist NewPath == false do if copyFile p.filename NewPath do append arrData[4] ("Copied Proxy: " + p.filename)
-- delete old files
if delFile.state do try(deleteFile p.filename)catch(append arrData[5] ("Undeleted Proxy: " + p.filename))
--update
append arProxy_newPath #(p,NewPath,p.filename)
progressupdate (num*100.0/numAll)
num+=1
)else (
local crFolder = MakingDir p.filename FolderPathForCollection
if crFolder != false do(
NewPath = crFolder + (filenameFromPath p.filename)
--copy files
if doesFileExist NewPath == false do if copyFile p.filename NewPath do append arrData[4] ("Copied Proxy: " + p.filename)
-- delete old files
if delFile.state do try(deleteFile p.filename)catch(append arrData[5] ("Undeleted Proxy: " + p.filename))
--update
append arProxy_newPath #(p, NewPath, p.filename)
progressupdate (num*100.0/numAll)
num+=1
)
)
)
)
progressend ()
)--end if arProxy.count != 0
)--end if withProxy.state do
-- pointcache collections
if withPointCache.state do(
arPC = if selObj.state then arrPointCacheSel() else(
(getclassinstances Point_Cache)+(getclassinstances Point_CacheSpacewarpModifier)
)
if arPC.count != 0 do(
progressstart "Collecting Point Cache..."
local num = 1
local numAll = arPC.count
for pc in arPC do(
if pc.filename != undefined do(
if simCol.state then(
NewPath = FolderPathForCollection+ "\\" + (filenameFromPath pc.filename)
--copy files
if (getFilenameType pc.filename) == ".xml" then(
if doesFileExist NewPath == false do if copyFile pc.filename NewPath do append arrData[6] ("Copied PointCache: " + pc.filename)
allMC = getFiles ((getFilenamePath pc.filename) + (getFilenameFile pc.filename) + "*.mc")
for i in allMC do if copyFile i (FolderPathForCollection + "\\" + (filenameFromPath i)) do(
--append arPC_newPath #(pc,(FolderPathForCollection + "\\" + (filenameFromPath i)),i)
append arrData[6] ("Copied PointCache: " + i)
)
)else if doesFileExist NewPath == false do if copyFile pc.filename NewPath do append arrData[6] ("Copied PointCache: " + pc.filename)
append arPC_newPath #(pc,NewPath,pc.filename)
progressupdate (num*100.0/numAll)
num+=1
)else(
local crFolder = MakingDir pc.filename FolderPathForCollection
if crFolder != false do(
NewPath = crFolder + (filenameFromPath pc.filename)
--copy files
if (getFilenameType pc.filename) == ".xml" then(
if doesFileExist NewPath == false do if copyFile pc.filename NewPath do append arrData[6] ("Copied PointCache: " + pc.filename)
allMC = getFiles ((getFilenamePath pc.filename) + (getFilenameFile pc.filename) + "*.mc")
for i in allMC do if copyFile i (crFolder + (filenameFromPath i)) do(
--append arPC_newPath #(pc,(crFolder + (filenameFromPath i)),i)
append arrData[6] ("Copied PointCache: " + i)
)
)else if doesFileExist NewPath == false do if copyFile pc.filename NewPath do append arrData[6] ("Copied PointCache: " + pc.filename)
append arPC_newPath #(pc,NewPath,pc.filename)
progressupdate (num*100.0/numAll)
num+=1
)
)
)
)
)--end if arProxy.count != 0
)--end if withProxy.state do
--update pathes
if theUpd.state do(
for i in arBMTex_newPath do i[1].filename = i[2]
for i in arProxy_newPath do i[1].filename = i[2]
for i in arPC_newPath do i[1].filename = i[2]
)
-- delete old files
if delFile.state do(
for i in arBMTex_newPath do try(deleteFile i[3])catch(append arrData[7] ("Undeleted Bitmap: " + i[3]))
for i in arProxy_newPath do try(deleteFile i[3])catch(append arrData[7] ("Undeleted Proxy: " + i[3]))
for i in arPC_newPath do try(deleteFile i[3])catch(append arrData[7] ("Undeleted PointCache: " + i[3]))
)
clearlistener()
progressend ()
for i in arrData do print i
arrData = #(#(),#(),#(),#(),#(),#(),#())
arBMTex_newPath=#()
arProxy_newPath=#()
arPC_newPath = #()
) -- end else
--stripPathes.enabled = true
)
)
/*
on stripPathes pressed do (
ATSOps.SetPath ""
ATSOps.Refresh()
)
*/
)
createDialog ResourceCollector width:180
-- Created Alex Yakushev
------------------------------------------------------end
Update - обновление путей в сцене
Move files - перемещение файлов
Simple collect - сборка в одну папку
Почти тоже самое, что архивация сцены, только с бонусами:
- умеет работать с "*.ifl" и "*.xml" -> "*.mc"
- возможность собирать по категориям - Proxy, PointCache, Bitmap
- возможность собирать только с выделенных объектов
------------------------------------------------------start
-- tested in 3DMax 2014
try destroyDialog ResourceCollector catch()
global ResourceCollector
global arrData = #(#(),#(),#(),#(),#(),#(),#())
--functions
--bitmaps
fn MakingDir FilePath PathForCollection = (
local outData = false
if PathForCollection != undefined do(
if FilePath != undefined and doesFileExist FilePath then
(
arPath = filterString FilePath "\\"
-- if other NetworkPath
if pathIsNetworkPath FilePath do (
local NewPath = "\\"
for i = 3 to arPath.count-1 do NewPath += (arPath[i] + "\\")
if (makeDir (PathForCollection + NewPath) all:true) do outData = PathForCollection + NewPath
)
-- if not NetworkPath
if pathIsNetworkPath FilePath == false do(
local NewPath = "\\"
for i = 2 to arPath.count-1 do NewPath += (arPath[i] + "\\")
if (makeDir (PathForCollection + NewPath) all:true) do outData = PathForCollection + NewPath
)
)else append arrData[1] ("Wrong files: "+ (FilePath as string))
)
return outData
)
fn arrBitMapSel =
(
local arBitMap = #()
for obj in selection where obj.material != undefined do for bm in (getclassinstances bitmapTexture target:obj) do appendIfUnique arBitMap bm
return arBitMap
)
--proxy
fn selGoodProxy =(
local theAllGoodProxy = #()
for i in selection where (classOf i == VRayProxy or classOf i == CProxy) do if doesFileExist i.filename do appendIfUnique theAllGoodProxy i
theAllGoodProxy
)
fn allGoodProxy =(
local theAllGoodProxy = #()
for i in objects where(classOf i == VRayProxy or classOf i == CProxy) do if doesFileExist i.filename do appendIfUnique theAllGoodProxy i
theAllGoodProxy
)
--pointcache
fn arrPointCacheSel =
(
local arPC = #()
for obj in selection do for pc in (getclassinstances Point_Cache target:obj) do appendIfUnique arPC pc
for obj in selection do for pc in (getclassinstances Point_CacheSpacewarpModifier target:obj) do appendIfUnique arPC pc
return arPC
)
rollout ResourceCollector "ResourceCollector"
(
--Interface
checkbox theUpd "Update" checked:false align:#left
checkbox delFile "Move files" checked:false align:#left
checkbox simCol "Simple collect" checked:false align:#left
checkbox theAll "All scene" checked:true align:#left
checkbox withProxy "Proxy" checked:false align:#left enabled:false
checkbox withPointCache "PointCache" checked:false align:#left enabled:false
checkbox withBitmap "Bitmap" checked:false align:#left enabled:false
checkbox selObj "Selection objects" checked:false align:#left enabled:false
button btn_browse "Browse--->" width:150 height:24 align:#left toolTip:"Please pick path for collections."
button do_it "Start collection" width:150 height:24 align:#left enabled:false
--button stripPathes "Strip path" width:150 height:24 align:#left enabled:false
local FolderPathForCollection = undefined
on theAll changed theState do(
if theState then (
withProxy.enabled = false
withProxy.checked = false
withPointCache.enabled = false
withPointCache.checked = false
withBitmap.enabled = false
withBitmap.checked = false
selObj.enabled = false
selObj.checked = false
) else (
withProxy.enabled = true
withPointCache.enabled = true
withBitmap.enabled = true
withBitmap.enabled = true
selObj.enabled = true
)
)
on btn_browse pressed do
(
FolderPathForCollection = getSavePath caption: "Pick folder" initialDir:"\\\\fs\\projects\\"
btn_browse.text = FolderPathForCollection as string
btn_browse.toolTip = FolderPathForCollection as string
if FolderPathForCollection != undefined then do_it.enabled = true else( do_it.enabled = false; btn_browse.text = "Browse--->")
)
on do_it pressed do(
if FolderPathForCollection != undefined do(
if theAll.state then(
tempAr = #()
clearlistener()
progressstart "Collecting..."
-- refresh asset tracking files
atsops.Refresh()
-- collect all the assets
origAssets = for i = 1 to AssetManager.GetNumAssets() collect (AssetManager.GetAssetByIndex i)
sceneroot = (for r in (refs.dependents rootnode) where (classof r == Scene) collect r)[1]
theNum = origAssets.count
for AUIO = 1 to theNum do(
AFile = origAssets[AUIO].getfilename()
if simCol.state then(
NewPath = FolderPathForCollection+ "\\" + (filenameFromPath AFile)
if matchpattern AFile pattern:"*.ifl" do(
if doesFileExist NewPath == false do copyFile AFile NewPath
f = openFile AFile mode:"r"
while not eof f do
(
newLine = readLine f
NewPathIFL = FolderPathForCollection+ "\\" + newLine
if doesFileExist NewPathIFL == false do if copyFile ((getFilenamePath AFile) + newLine) NewPathIFL then(
append tempAr #(origAssets[AUIO], ((getFilenamePath AFile) + newLine), NewPathIFL)
if delFile.state do try(deleteFile newLine)catch()
)
-- delete old files
)
close f
)
if doesFileExist NewPath == false do if copyFile AFile NewPath do(
append tempAr #(origAssets[AUIO], AFile, NewPath)
if delFile.state do try(deleteFile AFile)catch()
)
)else (
crFolder = MakingDir AFile FolderPathForCollection
if crFolder != false do(
NewPath = crFolder + (filenameFromPath AFile)
if matchpattern AFile pattern:"*.ifl" do(
f = openFile AFile mode:"r"
while not eof f do
(
newLine = readLine f
NewPathIFL = crFolder + newLine
if doesFileExist NewPathIFL == false do if copyFile ((getFilenamePath AFile) + newLine) NewPathIFL then(
append tempAr #(origAssets[AUIO], ((getFilenamePath AFile) + newLine), NewPathIFL)
if delFile.state do try(deleteFile ((getFilenamePath AFile) + newLine))catch()
)
-- delete old files
)
close f
)
if doesFileExist NewPath == false do if copyFile AFile NewPath do(
append tempAr #(origAssets[AUIO], AFile, NewPath)
if delFile.state do try(deleteFile ((getFilenamePath AFile) + NewPath))catch()
)
)
)
progressupdate (AUIO*100.0/theNum)
)
progressend ()
--update pathes
if theUpd.state do(
progressstart "Update pathes..."
nta = tempAr.count
for i = 1 to nta do(
try(atsops.RetargetAssets sceneroot tempAr[i][2] tempAr[i][3] CreateOutputFolder:false)catch()
progressupdate (i*100.0/nta)
)
progressend ()
)
) else(
local arBMTex_newPath=#()
local arProxy_newPath=#()
local arPC_newPath = #()
-- bitmap collections
if withBitmap.state do(
arBitMapTexture = if selObj.state then arrBitMapSel() else getclassinstances bitmapTexture
if arBitMapTexture.count != 0 do(
progressstart "Collecting textures..."
local num = 1
local numAll = arBitMapTexture.count
for bm in arBitMapTexture do(
if bm.filename != undefined do(
if simCol.state then(
NewPath = FolderPathForCollection+ "\\" + (filenameFromPath bm.filename)
--copy files
if getFilenameType bm.filename == ".ifl" then(
if doesFileExist NewPath == false do if copyFile bm.filename NewPath do append arrData[2] ("Copied textures: " + bm.filename)
f = openFile bm.filename mode:"r"
while not eof f do
(
newLine = readLine f
NewPathIFL = FolderPathForCollection+ "\\" + newLine
if doesFileExist NewPathIFL == false do if copyFile ((getfilenamePath bm.filename) + newLine) NewPathIFL do(
--append arBMTex_newPath #(bm,NewPathIFL,newLine)
append arrData[2] ("Copied textures: " + ((getfilenamePath bm.filename) + newLine))
)
-- delete old files
if delFile.state do try(deleteFile ((getfilenamePath bm.filename) + newLine))catch(append arrData[3] ("Undeleted textures: " + ((getfilenamePath bm.filename) + newLine)))
)
close f
)else if doesFileExist NewPath == false do if copyFile bm.filename NewPath do append arrData[2] ("Copied textures: " + bm.filename)
-- delete old files
--update
append arBMTex_newPath #(bm,NewPath,bm.filename)
progressupdate (num*100.0/numAll)
num+=1
)else (
local crFolder = MakingDir bm.filename FolderPathForCollection
if crFolder != false do(
NewPath = crFolder + (filenameFromPath bm.filename)
--copy files
if getFilenameType bm.filename == ".ifl" then(
if doesFileExist NewPath == false do if copyFile bm.filename NewPath do append arrData[2] ("Copied textures: " + bm.filename)
f = openFile bm.filename mode:"r"
while not eof f do
(
newLine = readLine f
NewPathIFL = crFolder + newLine
if doesFileExist NewPathIFL == false do if copyFile ((getFilenamePath bm.filename) + newLine) NewPathIFL do(
--append arBMTex_newPath #(bm,NewPathIFL,((getFilenamePath bm.filename) + newLine))
append arrData[2] ("Copied textures: " + ((getFilenamePath bm.filename) + newLine))
)
-- delete old files
if delFile.state do try(deleteFile ((getFilenamePath bm.filename) + newLine))catch(append arrData[3] ("Undeleted textures: " + ((getFilenamePath bm.filename) + newLine)))
)
close f
)else if doesFileExist NewPath == false do if copyFile bm.filename NewPath do append arrData[2] ("Copied textures: " + bm.filename)
append arBMTex_newPath #(bm,NewPath,bm.filename)
progressupdate (num*100.0/numAll)
num+=1
)
)
)
)
progressend ()
)--end if arBitMapTexture.count != 0
)--end if withBitmap.state do
-- proxy collections
if withProxy.state do(
arProxy = if selObj.state then selGoodProxy() else allGoodProxy()
if arProxy.count != 0 do(
progressstart "Collecting proxy..."
local num = 1
local numAll = arProxy.count
for p in arProxy do(
if p.filename != undefined do(
if simCol.state then(
NewPath = FolderPathForCollection+ "\\" + (filenameFromPath p.filename)
--copy files
if doesFileExist NewPath == false do if copyFile p.filename NewPath do append arrData[4] ("Copied Proxy: " + p.filename)
-- delete old files
if delFile.state do try(deleteFile p.filename)catch(append arrData[5] ("Undeleted Proxy: " + p.filename))
--update
append arProxy_newPath #(p,NewPath,p.filename)
progressupdate (num*100.0/numAll)
num+=1
)else (
local crFolder = MakingDir p.filename FolderPathForCollection
if crFolder != false do(
NewPath = crFolder + (filenameFromPath p.filename)
--copy files
if doesFileExist NewPath == false do if copyFile p.filename NewPath do append arrData[4] ("Copied Proxy: " + p.filename)
-- delete old files
if delFile.state do try(deleteFile p.filename)catch(append arrData[5] ("Undeleted Proxy: " + p.filename))
--update
append arProxy_newPath #(p, NewPath, p.filename)
progressupdate (num*100.0/numAll)
num+=1
)
)
)
)
progressend ()
)--end if arProxy.count != 0
)--end if withProxy.state do
-- pointcache collections
if withPointCache.state do(
arPC = if selObj.state then arrPointCacheSel() else(
(getclassinstances Point_Cache)+(getclassinstances Point_CacheSpacewarpModifier)
)
if arPC.count != 0 do(
progressstart "Collecting Point Cache..."
local num = 1
local numAll = arPC.count
for pc in arPC do(
if pc.filename != undefined do(
if simCol.state then(
NewPath = FolderPathForCollection+ "\\" + (filenameFromPath pc.filename)
--copy files
if (getFilenameType pc.filename) == ".xml" then(
if doesFileExist NewPath == false do if copyFile pc.filename NewPath do append arrData[6] ("Copied PointCache: " + pc.filename)
allMC = getFiles ((getFilenamePath pc.filename) + (getFilenameFile pc.filename) + "*.mc")
for i in allMC do if copyFile i (FolderPathForCollection + "\\" + (filenameFromPath i)) do(
--append arPC_newPath #(pc,(FolderPathForCollection + "\\" + (filenameFromPath i)),i)
append arrData[6] ("Copied PointCache: " + i)
)
)else if doesFileExist NewPath == false do if copyFile pc.filename NewPath do append arrData[6] ("Copied PointCache: " + pc.filename)
append arPC_newPath #(pc,NewPath,pc.filename)
progressupdate (num*100.0/numAll)
num+=1
)else(
local crFolder = MakingDir pc.filename FolderPathForCollection
if crFolder != false do(
NewPath = crFolder + (filenameFromPath pc.filename)
--copy files
if (getFilenameType pc.filename) == ".xml" then(
if doesFileExist NewPath == false do if copyFile pc.filename NewPath do append arrData[6] ("Copied PointCache: " + pc.filename)
allMC = getFiles ((getFilenamePath pc.filename) + (getFilenameFile pc.filename) + "*.mc")
for i in allMC do if copyFile i (crFolder + (filenameFromPath i)) do(
--append arPC_newPath #(pc,(crFolder + (filenameFromPath i)),i)
append arrData[6] ("Copied PointCache: " + i)
)
)else if doesFileExist NewPath == false do if copyFile pc.filename NewPath do append arrData[6] ("Copied PointCache: " + pc.filename)
append arPC_newPath #(pc,NewPath,pc.filename)
progressupdate (num*100.0/numAll)
num+=1
)
)
)
)
)--end if arProxy.count != 0
)--end if withProxy.state do
--update pathes
if theUpd.state do(
for i in arBMTex_newPath do i[1].filename = i[2]
for i in arProxy_newPath do i[1].filename = i[2]
for i in arPC_newPath do i[1].filename = i[2]
)
-- delete old files
if delFile.state do(
for i in arBMTex_newPath do try(deleteFile i[3])catch(append arrData[7] ("Undeleted Bitmap: " + i[3]))
for i in arProxy_newPath do try(deleteFile i[3])catch(append arrData[7] ("Undeleted Proxy: " + i[3]))
for i in arPC_newPath do try(deleteFile i[3])catch(append arrData[7] ("Undeleted PointCache: " + i[3]))
)
clearlistener()
progressend ()
for i in arrData do print i
arrData = #(#(),#(),#(),#(),#(),#(),#())
arBMTex_newPath=#()
arProxy_newPath=#()
arPC_newPath = #()
) -- end else
--stripPathes.enabled = true
)
)
/*
on stripPathes pressed do (
ATSOps.SetPath ""
ATSOps.Refresh()
)
*/
)
createDialog ResourceCollector width:180
-- Created Alex Yakushev
------------------------------------------------------end