No More Retake

3DCG屋さん向けTips&Referenceサイト

メニュー

Houdini:Python memo Part04

ノードあれこれ

#選択中のノードをすべて取得(リスト取得)
oNodeS = hou.selectedNodes()
#最初の一つを取り出す
oNode = oNodes[0]
#ノードのロックがかかっているか否か確認する
oNode.isLocked()
#ノードのバイパスのON/OFFを確認する
oNode.isBypassed()
#ノードの入力を取得する(タプル取得)
oNode.inputs()
#子供のノードを取得します(リスト取得)
oNode.children()

 

ノード検索(glob)

obj = hou.node("/obj")
def names(nodes):
   return [node.name() for node in nodes]

oNodes = obj.glob("geo*")
print names(oNodes)

名前でノード検索。よく使う。

ノード検索(recursiveGlob)

obj = hou.node("/obj")
def names(nodes):
    return [node.name() for node in nodes]

oNodes=obj.recursiveGlob('*', hou.nodeTypeFilter.ObjCamera)
print names(oNodes)

名前とタイプでノード検索。再帰的に子ノードも検索。
上記サンプルは、任意の名前のカメラを検出する。
hou.nodeTypeFilterは指定しなくともOK。
よくよくつかう。

フレームレンジを設定する

range =[1, 99]

hou.playbar.setFrameRange(range[0], range[1])
hou.playbar.setPlaybackRange(range[0], range[1])

 

グローバル変数を取得する

frame = hou.expandString('$F')
print frame

$Fとか$HIPとかの値を取得。

カメラをビューポートに設定

myCam = hou.node('/obj').createNode('cam', 'myCam')
hou.hscript('viewcamera -c ' + myCam.name() + ' *.*.world.persp1')

これはhscriptの方が簡単なんだってさ。

以上!

関連記事

コメントをお待ちしております

このサイトについて

3DCG Tipsサイト。Houdiniの記事が多めです。

RSS

follow us in feedly

Archives

  • 2024 (1)
  • 2023 (2)
  • 2022 (9)
  • 2021 (14)
  • 2020 (46)
  • 2019 (17)
  • 2018 (33)
  • 2017 (29)
  • 2016 (36)
  • 2015 (64)
  • 2014 (54)
  • 2013 (60)
  • 2012 (55)

スポンサードリンク

言語切り替え

  • English (United States)
  • 日本語

スポンサードリンク

言語切り替え

  • English (United States)
  • 日本語

Houdiniを使えるようになる本


Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /usr/home/nomorere/nomoreretake.net/wordpress/wp-content/themes/n1-custom/functions/social.php on line 132

Warning: file_get_contents(): Failed to enable crypto in /usr/home/nomorere/nomoreretake.net/wordpress/wp-content/themes/n1-custom/functions/social.php on line 132

Warning: file_get_contents(http://api.facebook.com/restserver.php?method=links.getStats&urls=http%3A%2F%2Fnomoreretake.net%2F2018%2F09%2F14%2Fhoudinipython-memo-part04%2F): failed to open stream: operation failed in /usr/home/nomorere/nomoreretake.net/wordpress/wp-content/themes/n1-custom/functions/social.php on line 132

Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /usr/home/nomorere/nomoreretake.net/wordpress/wp-content/themes/n1-custom/functions/social.php on line 132

Warning: file_get_contents(): Failed to enable crypto in /usr/home/nomorere/nomoreretake.net/wordpress/wp-content/themes/n1-custom/functions/social.php on line 132

Warning: file_get_contents(http://api.b.st-hatena.com/entry.count?url=http%3A%2F%2Fnomoreretake.net%2F2018%2F09%2F14%2Fhoudinipython-memo-part04%2F): failed to open stream: operation failed in /usr/home/nomorere/nomoreretake.net/wordpress/wp-content/themes/n1-custom/functions/social.php on line 132