快捷导航

[MaxScripts] 在max保存的目录下创建的maps文件夹

[复制链接]
2015-1-24 05:10 / 查看: 7715 / 回复: 10
V5CG提示您:本文由zxcvb12发表,如需商业用途或转载请与zxcvb12联系授权,谢谢配合!
zxcvb12
积分:20
最新注册
这个脚本想实现
1、在max保存的目录下创建的maps文件夹
2、自动打通路径
代码有点乱
现在打通路径有问题,这样写只能打通普通的标准材质,
而且执行出来有问题
哪位朋友知道支个招!

  1. checkForSave()
  2.         Maps_Floder = #("Maps") [1]  
  3.         now_path = maxFilePath
  4.         maps_path = maxFilePath + Maps_Floder + "\"
  5.         makeDir maps_path
  6.         

  7.         maps_in_scene = usedMaps()
  8.         max_ini_file = getMAXIniFile()
  9.         get_last_open_file = getinisetting max_ini_file "FileList" "File1"
  10.         path_of_file = getFilenamePath get_last_open_file
  11.         path_of_collection = maps_path
  12.         
  13.         
  14. --路径设置函数
  15.         fn editMaps item thePath =
  16.         (
  17.                 local Props = getClassInstances BitmapTexture,vraymtl
  18.                 try ( props=getPropNames item )
  19.                         catch ( return undefined )
  20.                                 for aProp in props do
  21.                                 (
  22.                                         newItem=item
  23.                                         aProp="newItem.'"+aProp+"'"
  24.                                         aProp=execute aProp
  25.                                                 try (
  26.                                                         if (classof aProp)== BitmapTexture do
  27.                                                                 (
  28.                                                                         aProp.filename=(thePath + "\" + getFilenameFile(aProp.filename) +
  29.                                                                         getFilenameType(aProp.filename))
  30.                                                                 )
  31.                                                         ) catch ()

  32.                                                         editMaps aProp thePath
  33.                                 )
  34.         )        
  35.         
  36. --复制文件到max目录下脚本创建的maps文件夹
  37.         if path_of_collection != undefined do
  38.                 (
  39.                         rollout cellect_map_floater "Archive Scene" width:250 height:88
  40.                         (
  41.                                 progressBar prog_bar_copy "ProgressBar" pos:[4,16] width:240 height:16 color:(color 0 40 180)
  42.                                 label file_copy_text "" pos:[16,40] width:240 height:32
  43.                                 
  44.                                 on cellect_map_floater open do
  45.                                 (
  46.                                         for i in 1 to maps_in_scene.count do
  47.                                                 (
  48.                                                         prog_bar_copy.value = 100.*i/maps_in_scene.count
  49.                                                         file_copy_text.text = maps_in_scene[i]
  50.                                                         copyfile maps_in_scene[i] (path_of_collection + "\" + getFilenameFile maps_in_scene[i] + getFilenameType maps_in_scene[i])
  51.                                                 )
  52.                                         copyfile get_last_open_file (path_of_collection + "\" + getFilenameFile get_last_open_file + getFilenameType get_last_open_file)
  53.                                         DestroyDialog cellect_map_floater
  54.                                 --设置路径
  55.                                         ObjArray = #()
  56.                                         newpath = maxFilePath + Maps_Floder + "\"
  57.                                         editMaps sceneMaterials newpath               
  58.                                        
  59.                                 )
  60.                         )
  61.                         createdialog cellect_map_floater --style:#(#style_toolwindow)
  62.                 )
复制代码


加入土豪吧,爽!
~太傻~ -2015-1-24 15:39:34 | 显示全部楼层
不错啊,强烈支持楼主ing……
会跳舞的鞋 -2015-1-24 20:15:14 | 显示全部楼层
本来在潜水,看到LZ的矿世奇功,实在忍不住出来冒个泡泡!
cyc1111 -2015-1-25 11:25:42 | 显示全部楼层
我楼主朋友,我就是特地来顶楼主的!,嘿嘿
絕對在乎祢 -2015-1-25 16:57:01 | 显示全部楼层
有竞争才有进步嘛
烄爿姒哋泩萿 -2015-1-25 17:29:18 | 显示全部楼层
简洁,明了,然后执行效率还很高。这样的代码就是我们应该追求的吧?我估计
感梦 -2015-1-26 13:11:59 | 显示全部楼层
看到这个,我和我的小伙伴们都惊呆了...
sxyzy -2015-1-26 13:42:05 | 显示全部楼层
大家一起多交流啊,集思广益
冷锋 -2015-1-26 15:42:18 | 显示全部楼层
小手一抖,积分到手!不过这里没积分的我也顶楼主~我就是特地来顶楼主的!
陈银山 -2015-1-26 17:12:48 | 显示全部楼层
我只是来回帖的,无回帖,不论坛,这才是人道。
榕叶 -2015-1-26 20:48:18 | 显示全部楼层
如果有代码的部分,可以详细介绍下代码的意思吗?谢谢
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则