Reset textruemap _path of ZIP and copy allfiles to samepackage
2010-07-27 21:04
435 查看
----------------收集所有场景文件到同一目录下------------------
try(destroyDialog test)catch()
rollout test "资源收集工具"
(
button setpath ".........." pos:[12,75] width:60 height:25
button help "?" pos:[310,135] width:15 height:15
button setziptextrue "处理ZIP包内贴图为绝对路径" pos:[12,125] width:180 height:20
button getalltogether "( 0●︶ω︶●0 )--------@开始收集@-------( ╮(╯▽╰)╭~ )" pos:[12,20] width:300 height:45
label lab1 "<softimagewht@yahoo.com.cn>" pos:[220,128] color:red
edittext displaypath fieldWidth:225 labelOnTop:true pos:[85,80] readOnly:true text:"功能---将MAX文件及贴图收集到同一目录"
groupBox grp4 "" pos:[6,2] width:315 height:110
local commonfileSavepath
on help pressed do
(
w = newscript()
help01="处理ZIP包内贴图为绝对路径:把相对路径改为绝对路径
........:设置保存路径
( 0●︶ω︶●0 )--------@开始收集@-------( ╮(╯▽╰)╭~ ):收集所有文件到设置的路径内
?:帮助文件"
print help01 to:w
)
------------处理ZIP贴图的相对路径为绝对路径--------------
on setziptextrue pressed do
(
getmaxpath = maxFilepath
try
(
for r in objects where superclassof r == GeometryClass do
(
if classof r.material == Multimaterial then
(
material_number = r.material.count
for s = 1 to material_number do
(
tempstring =""
gettextruepath = r.material[s].diffusemap.filename
filterstringarray = filterstring gettextruepath "\\"
for i = 2 to (filterstringarray.count) do tempstring+=filterstringarray[i]+"\\"
tempstring
tempstring01 = getmaxpath+tempstring
get_textruepath = substring tempstring01 1 (tempstring01.count-1)
r.material[s].diffusemap.filename = get_textruepath
)
)
else
(
tempstring =""
gettextruepath = r.material.diffusemap.filename
filterstringarray = filterstring gettextruepath "\\"
for i = 2 to (filterstringarray.count) do tempstring+=filterstringarray[i]+"\\"
tempstring
tempstring01 = getmaxpath+tempstring
get_textruepath = substring tempstring01 1 (tempstring01.count-1)
r.material.diffusemap.filename = get_textruepath
)
)
)catch()
messagebox "打包的贴图已经绝对路径化了,最好你还是检查下是否我做的有疏漏"
)
--------------设置新的路径---------------------------
on setpath pressed do
(
commonfileSavepath = getSavepath()
displaypath.text = "路径:"+commonfileSavepath as string
)
---------------拷贝MAX文件和贴图到同一目录-----------------
on getalltogether pressed do
(
try
(
for i in objects where superclassof i == GeometryClass do
(
if classof i.material == Multimaterial then
(
material_number = i.material.count
for z = 1 to material_number do
(
getbitmap_name = getfilenamefile i.material[z].diffusemap.filename
getbitmap_type = getfilenametype i.material[z].diffusemap.filename
get_oldbitmappath = i.material[z].diffusemap.filename
set_newbitmappath = commonfileSavepath+"\\"+getbitmap_name+getbitmap_type
copyfile get_oldbitmappath set_newbitmappath
i.material[z].diffusemap.filename = set_newbitmappath
)
set_newmaxfile = commonfileSavepath+"\\"+maxFileName
savemaxfile set_newmaxfile
messagebox "累死我了,终于干完活了,现在打开的是你另存的MAX文件,注意是TEMPXXX.max"
)
else
(
getbitmap_name = getfilenamefile i.material.diffusemap.filename
getbitmap_type = getfilenametype i.material.diffusemap.filename
get_oldbitmappath = i.material.diffusemap.filename
set_newbitmappath = commonfileSavepath+"\\"+getbitmap_name+getbitmap_type
copyfile get_oldbitmappath set_newbitmappath
i.material.diffusemap.filename = set_newbitmappath
set_newmaxfile = commonfileSavepath +"\\"+ maxFileName
savemaxfile set_newmaxfile
messagebox "累死我了,终于干完活了"
)
)
)catch()
)
)
createdialog test 325 150
try(destroyDialog test)catch()
rollout test "资源收集工具"
(
button setpath ".........." pos:[12,75] width:60 height:25
button help "?" pos:[310,135] width:15 height:15
button setziptextrue "处理ZIP包内贴图为绝对路径" pos:[12,125] width:180 height:20
button getalltogether "( 0●︶ω︶●0 )--------@开始收集@-------( ╮(╯▽╰)╭~ )" pos:[12,20] width:300 height:45
label lab1 "<softimagewht@yahoo.com.cn>" pos:[220,128] color:red
edittext displaypath fieldWidth:225 labelOnTop:true pos:[85,80] readOnly:true text:"功能---将MAX文件及贴图收集到同一目录"
groupBox grp4 "" pos:[6,2] width:315 height:110
local commonfileSavepath
on help pressed do
(
w = newscript()
help01="处理ZIP包内贴图为绝对路径:把相对路径改为绝对路径
........:设置保存路径
( 0●︶ω︶●0 )--------@开始收集@-------( ╮(╯▽╰)╭~ ):收集所有文件到设置的路径内
?:帮助文件"
print help01 to:w
)
------------处理ZIP贴图的相对路径为绝对路径--------------
on setziptextrue pressed do
(
getmaxpath = maxFilepath
try
(
for r in objects where superclassof r == GeometryClass do
(
if classof r.material == Multimaterial then
(
material_number = r.material.count
for s = 1 to material_number do
(
tempstring =""
gettextruepath = r.material[s].diffusemap.filename
filterstringarray = filterstring gettextruepath "\\"
for i = 2 to (filterstringarray.count) do tempstring+=filterstringarray[i]+"\\"
tempstring
tempstring01 = getmaxpath+tempstring
get_textruepath = substring tempstring01 1 (tempstring01.count-1)
r.material[s].diffusemap.filename = get_textruepath
)
)
else
(
tempstring =""
gettextruepath = r.material.diffusemap.filename
filterstringarray = filterstring gettextruepath "\\"
for i = 2 to (filterstringarray.count) do tempstring+=filterstringarray[i]+"\\"
tempstring
tempstring01 = getmaxpath+tempstring
get_textruepath = substring tempstring01 1 (tempstring01.count-1)
r.material.diffusemap.filename = get_textruepath
)
)
)catch()
messagebox "打包的贴图已经绝对路径化了,最好你还是检查下是否我做的有疏漏"
)
--------------设置新的路径---------------------------
on setpath pressed do
(
commonfileSavepath = getSavepath()
displaypath.text = "路径:"+commonfileSavepath as string
)
---------------拷贝MAX文件和贴图到同一目录-----------------
on getalltogether pressed do
(
try
(
for i in objects where superclassof i == GeometryClass do
(
if classof i.material == Multimaterial then
(
material_number = i.material.count
for z = 1 to material_number do
(
getbitmap_name = getfilenamefile i.material[z].diffusemap.filename
getbitmap_type = getfilenametype i.material[z].diffusemap.filename
get_oldbitmappath = i.material[z].diffusemap.filename
set_newbitmappath = commonfileSavepath+"\\"+getbitmap_name+getbitmap_type
copyfile get_oldbitmappath set_newbitmappath
i.material[z].diffusemap.filename = set_newbitmappath
)
set_newmaxfile = commonfileSavepath+"\\"+maxFileName
savemaxfile set_newmaxfile
messagebox "累死我了,终于干完活了,现在打开的是你另存的MAX文件,注意是TEMPXXX.max"
)
else
(
getbitmap_name = getfilenamefile i.material.diffusemap.filename
getbitmap_type = getfilenametype i.material.diffusemap.filename
get_oldbitmappath = i.material.diffusemap.filename
set_newbitmappath = commonfileSavepath+"\\"+getbitmap_name+getbitmap_type
copyfile get_oldbitmappath set_newbitmappath
i.material.diffusemap.filename = set_newbitmappath
set_newmaxfile = commonfileSavepath +"\\"+ maxFileName
savemaxfile set_newmaxfile
messagebox "累死我了,终于干完活了"
)
)
)catch()
)
)
createdialog test 325 150
相关文章推荐
- How to copy all view private files and Derived objects between views
- Kettle解析JSON错误,We MUST have the same number of values for all paths,We can not find and data with path [$.
- make and build package, copy files to dest dir
- How to copy all view private files and Derived objects between views
- Copy files to a folder which need have Administrator approve and overwrite the existing same readonly files
- Display a Directory Tree of all Subdirectories and Files
- win7 U盘出错日志---We were unable to copy your files. Please check your USB device and the selected ISO f
- cpio - archiver to copy and back up files
- QUESTION 66 To recover from the loss of the entire database, including all current control files, al
- SharePoint 报错: The specified file or folder name is too long. The URL path for all files and folders must be 260 characters or less
- Eicar zip archives virus test files and TMG’s malware inspection Attempt to clean files that are found to be infected option
- Given a list of presentations with begin and end time that all need to use a conference room.
- Package that speeds up loading of JavaScript, CSS and image files
- wo or more files with the name of logging.cc will produce outputs to the same location.
- How to create and extract zip, tar, tar.gz and tar.bz2 files in Linux
- Cmake environmental variables: how to make find_package, find_path and find_library work
- 10 Useful du (Disk Usage) Commands to Find Disk Usage of Files and Directories
- Cannot map handler 'algorithmPlatform' to URL path [/execute.do]: There is already handler of type
- Use Flex and JavaScript to get the full path of a local File
- How to Output a List of Files to a File and Sort Them in Linux