Skip to content

Instantly share code, notes, and snippets.

@taikomatsu
Last active January 10, 2017 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taikomatsu/8eaf256cae687d2b58326358821d42c6 to your computer and use it in GitHub Desktop.
Save taikomatsu/8eaf256cae687d2b58326358821d42c6 to your computer and use it in GitHub Desktop.
Create dummy render objects and delayed load shaders with links.
# render用のdelayed loadオブジェクトとシェーダを作成する
# 当然それらにはリンクが設定してある状態になる
# SOPで任意のノード(rop_alembic, rop_geometry, filecache)を選んでshelfボタンをポチで完了
import hou
type_pairs = {'rop_alembic': 'filename',
'rop_geometry': 'sopoutput',
'filecache': 'file'}
for o in hou.selectedNodes():
# get parm link
nodetype = o.type().name()
if nodetype not in type_pairs:
print('[WARNING] No expected node type: {}'.format(nodetype))
continue
parm = type_pairs[nodetype]
# create render obj
obj = hou.node('/obj')
rnd_name = 'render_{}'.format(o.name())
rnd = obj.createNode('geo', node_name=rnd_name)
rnd.parm('shop_geometrypath').set('/shop/$OS')
# create delayed load
shop = hou.node('/shop')
dl = shop.createNode('vm_geo_file', node_name=rnd_name)
dl.parm('file').set('`chs("{}/{}")`'.format(dl.relativePathTo(o), parm))
print('# Done')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment