批量渲染烘焙贴图工具

Global thePath 
Global thePath01 

fn BakeDiffuseAndLighting obj size tempPath tempChannel=
(
    obj.iNodeBakeProperties.removeAllBakeElements() 
    be2 = LightingMap() 
    be2.outputSzX = be2.outputSzY = size
    if thePath01 != undefined do(be2.fileType = ( tempPath + "\\" + obj.name + "_L.tga" ))--定义path为按下button-- lightmap path的路径
    be2.fileName = filenameFromPath be2.fileType
    be2.filterOn = true 
    be2.shadowsOn =true
    be2.enabled = true

    obj.INodeBakeProperties.addBakeElement be2 
    obj.INodeBakeProperties.bakeEnabled = true 
    obj.INodeBakeProperties.bakeChannel = tempChannel
    obj.INodeBakeProperties.nDilations = 1 
    select obj 

    render rendertype:#bakeSelected vfb:off progressBar:true outputSize:[size,size]
)


rollout wht "批量烘焙工具 V 1.00" width:150 height:112
(
    button savePath ".." pos:[379,27] width:17 height:23
    editText edt1 "" pos:[131,28] width:246 height:18 readonly:true
    label lbl1 "烘焙贴图保存路径:" pos:[16,30] width:115 height:22
    button getMaxDir ".." pos:[379,56] width:17 height:23
    editText edt2 "" pos:[131,59] width:246 height:18 readonly:true
    label lbl2 "uv通道:" pos:[74,121] width:54 height:22
    editText edt3 "" pos:[132,90] width:59 height:18 text:"256"
    label lbl3 "指定MAX文件目录:" pos:[18,61] width:110 height:22
    button bakeNow "批量处理" pos:[197,89] width:198 height:50
    groupBox grp1 "批量烘焙" pos:[7,8] width:401 height:139
    label lbl4 "烘焙贴图大小:" pos:[39,94] width:86 height:22
    spinner spn1 "" pos:[136,120] width:56 height:16 type:#integer range:[1,5,1]
    
    on savePath pressed  do 
    (
        thePath01 = getSavePath()
        if thePath01 != undefined do edt1.text = thePath01
    )
    on getMaxDir pressed  do 
    (
        thePath = getSavePath()
        if thePath != undefined do edt2.text = thePath
    )        
     
    on bakeNow pressed  do 
    (
        if edt2.text != "" and edt3.text != "" do 
        (
            theFiles = getFiles (edt2.text+"\\*.max")
            
            for f in theFiles do
            (
                loadMaxFile f quiet:false
                for w in geometry do try((BakeDiffuseAndLighting w (edt3.text as number) edt1.text spn1.value))catch(print (w.name+"烘焙出错")) 
            )
            --resetMaxFile #noPrompt 
        )
    )
)
createDialog wht 417 161 style:#(#style_titlebar,#style_sysmenu,#style_minimizebox);

 

 


 

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值