zoukankan      html  css  js  c++  java
  • 批量渲染烘焙贴图工具

    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" 150 height:112
    (
        button savePath ".." pos:[379,27] 17 height:23
        editText edt1 "" pos:[131,28] 246 height:18 readonly:true
        label lbl1 "烘焙贴图保存路径:" pos:[16,30] 115 height:22
        button getMaxDir ".." pos:[379,56] 17 height:23
        editText edt2 "" pos:[131,59] 246 height:18 readonly:true
        label lbl2 "uv通道:" pos:[74,121] 54 height:22
        editText edt3 "" pos:[132,90] 59 height:18 text:"256"
        label lbl3 "指定MAX文件目录:" pos:[18,61] 110 height:22
        button bakeNow "批量处理" pos:[197,89] 198 height:50
        groupBox grp1 "批量烘焙" pos:[7,8] 401 height:139
        label lbl4 "烘焙贴图大小:" pos:[39,94] 86 height:22
        spinner spn1 "" pos:[136,120] 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);
    
     
    
     
    
    
     
  • 相关阅读:
    利用ssh的私钥登录Linux server
    PSR-2 代码风格规范
    MySQL的四种事务隔离级别
    table添加横向滚动条
    转换图片大小
    百度地图Label 样式:label.setStyle
    鼠标的几种常用样式
    百度地图API-自定义图标覆盖物
    微信公众号自定义菜单中可加入的表情
    微信公众号项目总结
  • 原文地址:https://www.cnblogs.com/softimagewht/p/1787288.html
Copyright © 2011-2022 走看看