This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pymel.core import * | |
# 確実にエッジを取得したいのでfilterExpandを使用。 | |
e = filterExpand(sm=32)[0] | |
# 更にfilterExpandを使用するとls -flをした時と同様に要素が1つずつ確実に返ってくる。 | |
# edgeの両端のvertexの場合、頂点番号がつながっているとそのまま1まとまりで返されたりする。 | |
# なので念のため再度filterExpandに渡してデータにエラーがないようにしている。 | |
# filterExpandでは文字列を返してくるため最後にPyNodeを使ってpymelオブジェクトに変換。 | |
v = [PyNode(v) for v in filterExpand(polyListComponentConversion(e, fromEdge=True, toVertex=True), sm=31)] | |
space = 'world' | |
# normal()はnormalizeされたデータのコピーを返す。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ReadのfileでTcl書式のExpressionが使われていた場合に | |
# パスを展開して取り出す方法 改良版 | |
# ※この方法だと%04dとかも一緒に展開される模様 | |
import nuke | |
for o in nuke.selectedNodes('Read'): | |
filepath = o['file'].evaluate() | |
print(filepath) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Mayaで大量のシーンのplayblastを一斉に取りたい時用のスクリプト。 | |
# 事前に取得したシーンファイル名をムービー保存ディレクトリと一緒に渡すとプレイブラスト開始。 | |
# このスクリプトではフォーカスしたいオブジェクトを記述すればそれにフォーカスしてプレイブラストをするものの、 | |
# カメラの固定やジョイントの表示をOFFにしたいなどあれこれやりたいことはあると思うので、 | |
# その場合はviewport settingsの下辺りに追加してやればOKのはず。 | |
from pymel.core import * | |
import os | |
import os.path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Alembicを全体で1ファイルではなく各フレームごとに出力したい場合に使用 | |
# 以下では1-100Fまでを出力 | |
# start, endの値を書き換えてデータを出力しているので、ファイル名に$Fなどが入っていないとだめ | |
abc = hou.node('/obj/obj_name/rop_alembic1') | |
for i in range(100): | |
f = i + 1 | |
abc.parm('f1').set(f) | |
abc.parm('f2').set(f) | |
abc.parm('execute').pressButton() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root = hou.node('/') | |
rop = hou.node('/out/any_rop') | |
root.recursiveGlob(rop.evalParm('forceobject'), hou.nodeTypeFilter.Obj) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from maya import OpenMaya | |
from pymel.core import * | |
def mdagpath_from_name(name, extend_to_shape=False): | |
if not objExists(name): | |
raise MayaNodeError, name | |
slist = OpenMaya.MSelectionList() | |
slist.add(name) | |
dagpath = OpenMaya.MDagPath() | |
slist.getDagPath(0, dagpath) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 超簡易Backburner Submitterスクリプト | |
# IFDを所定のフォルダに出力した後に、backburnerに投げたいROP(mantraのみ)を選んでこのツールを実行 | |
# 各ROPのIFDの場所を読んでコマンドを生成してジョブを投げる | |
# 生成したコマンドやタスクファイルは、$HIP/dispatch以下に格納され、それが実行されるという流れ | |
# 基本的にはShelfに登録して使う想定 | |
# priorityやserversなどはROP側に新規でparm追加して読むなどすればROP側での調整も可能だが未対応 | |
import hou | |
import os | |
import os.path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// curveの先端を接線(というか隣のポイントとの差分)を使って伸ばす | |
vector p0 = point(0, "P", 0); | |
vector p1 = point(0, "P", 1); | |
vector np0 = point(0, "P", i@numpt-1); | |
vector np1 = point(0, "P", i@numpt-2); | |
vector tan_in = normalize(p0-p1); | |
vector tan_out = normalize(np0 - np1); | |
float ext = ch("ext"); | |
addpoint(0, p0+tan_in*ext); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Houdiniにカメラを持っていく用に、値をbakeしてシンプルなデータにするための処理を自動化。 | |
# 一応複数対応してる感じで書いてるけど、あんまり想定してないしテストもしていないw | |
# filmoffsetに関して、アニメーションの再接続をしているもののこれもそのままは持っていけないので一応やってるだけ。 | |
# bakeするレンジはtime sliderに準拠する。 | |
from pymel.core import * | |
cams = [] | |
for o in selected(): | |
new_cam = duplicate(o, rr=True)[0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from maya import OpenMaya | |
import pymel.core as pm | |
def mdagpath_from_name(name): | |
if not pm.objExists(name): | |
raise MayaNodeError, name | |
slist = OpenMaya.MSelectionList() | |
slist.add(name) | |
dagpath = OpenMaya.MDagPath() | |
slist.getDagPath(0, dagpath) |