I made this gizmo for kinda "baking".
Have fun!
https://drive.google.com/file/d/0B77RQxzB7Z2aZlF5blFSd3lQX2M/view?usp=sharing
I updated it. 2015.01.13 17:00PM PST
2015-01-12
2014-12-16
expression in "filter" knob
TransformノードやReformatノードのfilterにexpressionを張りたいときは、
If you want to add expression at "filter" in Transform node or Reformat node,
ノード選択してコピーして、Script Editorでペーストする。
Select the node and copy and then paste in Script Editor.
ここでnameの直前に、インデントをあわせて、filter {{Transform1.filter}} を加える。
Here, you just need to add "filter {{Transform1.filter}}" avobe the "name" line. Please don't forget there should be " " means space at the top of this line, I mean it's kinda indent.
この場合、Transform1のfilterに向けてリンクがはられる。
In this case, this is the "link" to the "filter" knob of Transform1.
あとは、このScript Editorの内容をノードグラフすればTransform1のfilterにリンクしたTransformノードができる。
And then, once you copy and paste these code in Script Editor on NodeGraph, you'll get Transform node which has the expression for "Transform1" in its filter knob.
If you want to add expression at "filter" in Transform node or Reformat node,
ノード選択してコピーして、Script Editorでペーストする。
Select the node and copy and then paste in Script Editor.
ここでnameの直前に、インデントをあわせて、filter {{Transform1.filter}} を加える。
Here, you just need to add "filter {{Transform1.filter}}" avobe the "name" line. Please don't forget there should be " " means space at the top of this line, I mean it's kinda indent.
filter {{Transform1.filter}}
この場合、Transform1のfilterに向けてリンクがはられる。
In this case, this is the "link" to the "filter" knob of Transform1.
あとは、このScript Editorの内容をノードグラフすればTransform1のfilterにリンクしたTransformノードができる。
And then, once you copy and paste these code in Script Editor on NodeGraph, you'll get Transform node which has the expression for "Transform1" in its filter knob.
2014-11-03
ColorMatrix
ColorMatrixノードはピクセルのrgb値に対して指定したmatrixを掛けてくれるものだ。
たとえば、world spaceのnormalパスがあるとして、これをcamera spaceのnormalパスに変換したい場合、world spaceのnormalにカメラの回転マトリクスの逆行列をかければいい。
CameraMatrix allow us to multiply a "matrix" by the value of rgb.
For example, here is kinda normal pass which was rendered in CG as normal in world space, and then we will convert it to one in camera space. How? We can do this with multiplication the value of rgb of normal in world space and the inverse matrix which is "rotation matrix" of camera.
また、カメラの回転マトリクスは、カメラのスケールが(1,1,1)であれば、"Camera"ノードのworld matrixの((0,1,2), (4,5,6), (8,9,10)) として得ることができる。
Well, when scale of Camera node is (1, 1, 1), you can handle as the world matrix of Camera node as the "rotation matrix" of camera. Actually it should be in m[0], m[1], m[2], m[4], m[5], m[6], m[8], m[9] and m[10].
なので、これをColorMatrixノードに代入する。逆行列ってのはこのColorMatrixのinverseにチェックをいれればOKです。
And then, put them in ColorMatrix node. Because we use it as inverse matrix, just check "inverse" box.
その後、このColorMatrixノードをworld spaceのnormalパスにつなげると
After that, we connect the input of this ColorMatrix to the Read node which has normal pass in world space......
normal pass(world space) > normal pass(camera space) の変換ができる。
逆に、camera space を world space に変えたい場合は、inverseのチェックをはずせばいい。
And We can get the normal pass in camera space!
In case that camera space one would be converted to world space one, we don't need to check "inverse" box.
この方法で、normal pass の回転も可能です。
You can rotate your normal pass in this way.
たとえば、world spaceのnormalパスがあるとして、これをcamera spaceのnormalパスに変換したい場合、world spaceのnormalにカメラの回転マトリクスの逆行列をかければいい。
CameraMatrix allow us to multiply a "matrix" by the value of rgb.
For example, here is kinda normal pass which was rendered in CG as normal in world space, and then we will convert it to one in camera space. How? We can do this with multiplication the value of rgb of normal in world space and the inverse matrix which is "rotation matrix" of camera.
また、カメラの回転マトリクスは、カメラのスケールが(1,1,1)であれば、"Camera"ノードのworld matrixの((0,1,2), (4,5,6), (8,9,10)) として得ることができる。
Well, when scale of Camera node is (1, 1, 1), you can handle as the world matrix of Camera node as the "rotation matrix" of camera. Actually it should be in m[0], m[1], m[2], m[4], m[5], m[6], m[8], m[9] and m[10].
なので、これをColorMatrixノードに代入する。逆行列ってのはこのColorMatrixのinverseにチェックをいれればOKです。
And then, put them in ColorMatrix node. Because we use it as inverse matrix, just check "inverse" box.
その後、このColorMatrixノードをworld spaceのnormalパスにつなげると
After that, we connect the input of this ColorMatrix to the Read node which has normal pass in world space......
normal pass(world space) > normal pass(camera space) の変換ができる。
逆に、camera space を world space に変えたい場合は、inverseのチェックをはずせばいい。
And We can get the normal pass in camera space!
In case that camera space one would be converted to world space one, we don't need to check "inverse" box.
この方法で、normal pass の回転も可能です。
You can rotate your normal pass in this way.
pyAlembic
You can find pyAlembic for windows in the following link.
http://pyalembic.sourceforge.net/
http://sourceforge.net/projects/pyalembic/files/
Actually in my Environment,
AlembicPyIex.dll
AlembicPyImath.dll
awBoost_python-1_52.dll
alembic.pyd
iex.pyd
imath.pyd
I have these files in the folder which is contained in result of "nuke.pluginPath()"
http://pyalembic.sourceforge.net/
http://sourceforge.net/projects/pyalembic/files/
Actually in my Environment,
AlembicPyIex.dll
AlembicPyImath.dll
awBoost_python-1_52.dll
alembic.pyd
iex.pyd
imath.pyd
I have these files in the folder which is contained in result of "nuke.pluginPath()"
2014-10-22
matrix
matrixに値を入れたいとき、
node['matrix'].setValueAt(value, frame, index)
node['matrix'].getValueAt(frame)[index]
When you want to set the value into matrix,
node['matrix'].setValueAt(value, frame, index)
node['matrix'].getValueAt(frame)[index]
2014-10-15
ノードグラフ上でノードを移動するツール
あれ?これって標準であったりする?
ノードグラフ上でグリッドの値だけノードをオフセットするツール。
NodeShift.py
でmenu.pyに
menu.py
の記述を加えれば。ctrl + shift + カーソルキー(矢印キー)で選んだノードを矢印方向に1グリッドだけ動かせる。複数選択でもOK。
import nuke def shiftHP(): shiftH = nuke.toNode('preferences')['GridWidth'].value() sn = nuke.selectedNodes() for n in sn: posX = n['xpos'].value() newPosX = posX + shiftH n['xpos'].setValue(newPosX) def shiftHN(): shiftH = nuke.toNode('preferences')['GridWidth'].value() sn = nuke.selectedNodes() for n in sn: posX = n['xpos'].value() newPosX = posX - shiftH n['xpos'].setValue(newPosX) def shiftVP(): shiftV = nuke.toNode('preferences')['GridHeight'].value() sn = nuke.selectedNodes() for n in sn: posY = n['ypos'].value() newPosY = posY - shiftV n['ypos'].setValue(newPosY) def shiftVN(): shiftV = nuke.toNode('preferences')['GridHeight'].value() sn = nuke.selectedNodes() for n in sn: posY = n['ypos'].value() newPosY = posY + shiftV n['ypos'].setValue(newPosY)
でmenu.pyに
menu.py
import NodeShift m.addCommand("shiftHP", "NodeShift.shiftHP()", "ctrl+shift+Right") m.addCommand("shiftHN", "NodeShift.shiftHN()", "ctrl+shift+Left") m.addCommand("shiftVP", "NodeShift.shiftVP()", "ctrl+shift+Up") m.addCommand("shiftVN", "NodeShift.shiftVN()", "ctrl+shift+Down")
の記述を加えれば。ctrl + shift + カーソルキー(矢印キー)で選んだノードを矢印方向に1グリッドだけ動かせる。複数選択でもOK。
2014-10-09
キーフレームにアクセスする
今回も、果たして誰かの役にたっているのだろうか・・・ というかなり備忘録的なpythonに関してです。
あるattributeにアニメーションがついているとして、そのキーフレームにアクセスして値を取得したり、シフトしたりしたいとします。
たとえばその場合、Transform1ノードのtranslateにx,yについている2個目のキーフレームの値を取得したい場合。
となり、これが、xのアニメーション( animation(0) )の2個目のキーフレーム( keys()[1] )の値( y ) となります。
また、その2番目のキーフレームが何フレーム目に存在しているかってのは、
となります。実行すると、そのフレームナンバーが返ってきます。
Graph Editor上でのxとy、つまり時間軸とその値です。
また、そのキーフレームの値を変更する場合は・・・
これで、Transform1 ってノードのattribute "translate.x" ( 位置のx座標 ) をフレームナンバー的( x ) に3個目のキーフレーム ( "2" ) を10フレーム目 ( "10" ) に移動させるといったことになります。
これで、Transform1 の translate.x の3個目のキーフレームの値を( GraphEditor的にy値を )、-30 にするってことになります。
値を取得する場合は、
で、値を変更したい場合は、
となります。
後者はココが参考になるかと。
http://www.nukepedia.com/python/using-nukeanimation-without-tearing-your-hair-out
たとえばその場合、Transform1ノードのtranslateにx,yについている2個目のキーフレームの値を取得したい場合。
nuke.toNode('Transform1')['translate'].animation(0).keys()[1].y
また、その2番目のキーフレームが何フレーム目に存在しているかってのは、
nuke.toNode('Transform1')['translate'].animation(0).keys()[1].x
となります。実行すると、そのフレームナンバーが返ってきます。
Graph Editor上でのxとy、つまり時間軸とその値です。
また、そのキーフレームの値を変更する場合は・・・
nuke.animation("Transform1.translate.x" , "x", ("2", "10"))
これで、Transform1 ってノードのattribute "translate.x" ( 位置のx座標 ) をフレームナンバー的( x ) に3個目のキーフレーム ( "2" ) を10フレーム目 ( "10" ) に移動させるといったことになります。
nuke.animation("Transform1.translate.x" , "y", ("2", "-30"))
これで、Transform1 の translate.x の3個目のキーフレームの値を( GraphEditor的にy値を )、-30 にするってことになります。
値を取得する場合は、
animation(i).keys()
で、値を変更したい場合は、
nuke.animation("ノード名.アトリビュート名" , "コマンド名", (コマンドの種類に応じた引数))
となります。
後者はココが参考になるかと。
http://www.nukepedia.com/python/using-nukeanimation-without-tearing-your-hair-out
Subscribe to:
Posts (Atom)