◆◆◆◆New Tool◆◆◆◆
source_nodes = hou.selectedNodes() for m in source_nodes: allsub_nodes = m.allSubChildren() for n in allsub_nodes: if n.type().name() == 'file': print n.path() print n.evalParm('file') print '----'
◆◆◆◆string replace◆◆◆◆ fp_bas = 'v02' fp_tar = 'v03' print "############################################################" source_node = hou.selectedNodes() for n in source_node: # if n.type().name()=='geo' or n.type().name()=='arnold_procedural': fp = n.name() fpn = fp.replace(fp_bas,fp_tar) n.setName(fpn) print n.path() print fpn print "----" ◆◆◆◆Chk fCache Reload◆◆◆◆ node = hou.pwd() root = hou.node('/obj') all_nodes = hou.selectedNodes() for n in all_nodes: # if n.type().name() == n.type().name() == 'filecache': if n.type().name() == n.type().name() == 'file': n.parm('reload').pressButton() print n.path() print '########################' ◆◆◆◆Cam Bake◆◆◆◆ import hou selectedNode = hou.selectedNodes()[0] bakingNode = hou.node('/obj').createNode('cam', selectedNode.name() + '_bake') hou.setFrame(int(hou.playbar.playbackRange()[0])) for f in range(int(hou.playbar.playbackRange()[0]), int(hou.playbar.playbackRange()[1])+1): hou.setFrame(f) bakingNode.setWorldTransform(selectedNode.worldTransform()) bakingNode.parm("tx").setKeyframe(hou.Keyframe(bakingNode.parm("tx").eval())) bakingNode.parm("ty").setKeyframe(hou.Keyframe(bakingNode.parm("ty").eval())) bakingNode.parm("tz").setKeyframe(hou.Keyframe(bakingNode.parm("tz").eval())) bakingNode.parm("rx").setKeyframe(hou.Keyframe(bakingNode.parm("rx").eval())) bakingNode.parm("ry").setKeyframe(hou.Keyframe(bakingNode.parm("ry").eval())) bakingNode.parm("rz").setKeyframe(hou.Keyframe(bakingNode.parm("rz").eval())) bakingNode.parm('focal').setKeyframe(hou.Keyframe(selectedNode.parm('focal').eval())) bakingNode.parm('aperture').setKeyframe(hou.Keyframe(selectedNode.parm('aperture').eval())) bakingNode.parm('near').setKeyframe(hou.Keyframe(selectedNode.parm('near').eval())) bakingNode.parm('far').setKeyframe(hou.Keyframe(selectedNode.parm('far').eval())) bakingNode.parm('resx').setKeyframe(hou.Keyframe(selectedNode.parm('resx').eval())) bakingNode.parm('resy').setKeyframe(hou.Keyframe(selectedNode.parm('resy').eval())) bakingNode.parm('winsizex').setKeyframe(hou.Keyframe(selectedNode.parm('winsizex').eval())) bakingNode.parm('winsizey').setKeyframe(hou.Keyframe(selectedNode.parm('winsizey').eval())) bakingNode.parm('shutter').setKeyframe(hou.Keyframe(selectedNode.parm('shutter').eval())) bakingNode.parm('aspect').setKeyframe(hou.Keyframe(selectedNode.parm('aspect').eval())) ◆◆◆◆Set Version◆◆◆◆ #ADD "version" Pram ''' ptg = file_cache.parmTemplateGroup() version = hou.IntParmTemplate("ver", "version", 1, default_value=(1,), min=1, max=99) #ptg.insertAfter("file", version) ptg.insertAfter("filename", version) file_cache.setParmTemplateGroup(ptg) ''' ptg = hou.selectedNodes()[0].parmTemplateGroup() version = hou.IntParmTemplate("ver", "version", 1, default_value=(1,), min=1, max=99) #ptg.insertAfter("file", version) ptg.insertAfter("vm_picture", version) #ptg.insertAfter("filename", version) #ptg.insertAfter("sopoutput", version) #ptg.insertAfter("picture", version) #ptg.insertAfter("ar_picture", version) hou.selectedNodes()[0].setParmTemplateGroup(ptg) ◆◆◆◆Cache OUT◆◆◆◆ #SET Global cachepath = '`$HIP`/geo/`$OS`/v`padzero(2,chs("ver"))`/`$OS`.$FF.bgeo.sc' cacheout_color = hou.Color((0.475,0.812,0.204)) source_node = hou.selectedNodes()[0] source_node_out = source_node.outputs()[0] #CREAT cache file file_cache = source_node.parent().createNode('filecache') file_cache.setParms({'file':cachepath}) #CREAT cache file - modify name file_cache_n = source_node.name().split('_') file_cache_n.pop(0) file_cache_new = '_'.join(file_cache_n) file_cache.setName(file_cache_new) file_cache.setInput(0, source_node, 0) file_cache.moveToGoodPosition() file_cache.setColor(cacheout_color) #ADD "version" Pram ptg = file_cache.parmTemplateGroup() version = hou.IntParmTemplate("ver", "version", 1, default_value=(1,), min=1, max=99) ptg.insertAfter("file", version) file_cache.setParmTemplateGroup(ptg) output_driver = hou.node('/obj/ropnet1').createNode('geometry') output_driver.moveToGoodPosition() #output_driver.setName(source_node.name()) output_driver.setName(file_cache_new) output_driver.setParms({'soppath':source_node.path()}) #output_driver.setParms({'sopoutput':'`chs(\"' + file_cache.path() + '/file")`'}) output_driver.setParms({'sopoutput':cachepath}) output_driver.setColor(cacheout_color) #ADD "version" Pram2 ptg2 = output_driver.parmTemplateGroup() version = hou.IntParmTemplate("ver", "version", 1, default_value=(1,), min=1, max=99) ptg2.insertAfter("sopoutput", version) output_driver.setParmTemplateGroup(ptg2) file_loader = source_node.parent().createNode('file') file_loader.setInput(0, file_cache, 0) file_loader.moveToGoodPosition() file_loader.setInput(0, None, 0) file_loader.setName('loadback_' + file_cache.name()) #file_loader.parm('file').setExpression('chs("' + output_driver.path() + '/sopoutput")') file_loader.setParms({'file':'`chs(\"../' + file_cache.name() + '/file")`'}) source_node_out.setInput(0, file_loader, 0) source_node_out.moveToGoodPosition() ''' file_loader_time = source_node.parent().createNode('timeshift') file_loader_time.setInput(0, file_loader, 0) file_loader_time.moveToGoodPosition() file_loader_null = source_node.parent().createNode('null') file_loader_null.setInput(0, file_loader_time, 0) file_loader_null.moveToGoodPosition() #file_loader.null('OUT_' + source_node.name()) '''
No comments:
Post a Comment