Houdini/Houdini Python

Export Bat File

민은남자 2023. 3. 22. 13:30
 

Bat 파일을 익스포트 해줄 수 있도록 만든 스크립트


def export_bat(kwargs): 

     

    parent = kwargs['node'] 

    child = parent.node("./render") 

 

     

    hip_path = str(hou.hipFile.path()) 

    file_path = hou.getenv("HIP") 

     

    start= str(int(parent.parm('f1').eval())) 

    end= str(int(parent.parm('f2').eval())) 

    

    node_path = str(parent.path()) 

    child_path = str(child.path()) 

    node_name = str(parent.name()) 

    file_name = parent.name() 

     

    ##Write to text file 

    lines = [ 

    '@echo HOUDINI Batch Render'+'\n' 

    '@echo off'+'\n' 

    'COLOR 4f'+'\n' 

    '\n' 

    'set cmdFile=%0.cmd'+'\n' 

    '\n' 

    '@title HOUDINI Batch Render     :     %0'+'\n' 

    '\n' 

    'if exist %cmdFile% (' +'\n' 

    '               del %cmdFile%' +'\n' 

    ')' 

    '\n' 

    '\n' 

    '\n' 

    'echo mread ' + hip_path + ' >> %cmdFile%'+'\n' 

    '\n' 

    'echo render -V -f ' + start + (' ') + end + (' ') + '-i 1 ' + child_path + '>> %cmdFile%'+'\n' 

    '\n' 

    'echo quit >> %cmdFile%'+'\n' 

    '\n' 

    '\n' 

    '"C:\Program Files\Side Effects Software\Houdini 17.0.352'+'\\'+'bin\hscript.exe"'  + (' ') + '%cmdFile%'+'\n' 

    '\n' 

    '\n' 

    'COLOR 2f'+'\n' 

    'if exist %cmdFile% ('+'\n' 

    '               del %cmdFile%'+'\n' 

    ')'+'\n' 

    'pause'+'\n' 

     

    ] 

 

    #export text file 

    path = file_path + '//' + file_name + '.bat' 

    f = open(path, 'w') 

    f.writelines(lines) 

    f.close() 

 


 

Parmameter > Callback Script 

 

hou.pwd().hm().export_bat(kwargs) 

 

'Houdini > Houdini Python' 카테고리의 다른 글

Export All Pieces  (0) 2023.03.22