Distributed at COMITIA115 (2016/01/31 at Tokyo Big Sight) ** Houdini Practical Handbook Wrangle x Python ** (Circle "Magic Distilled Water") http://majou.jp/archives/667/
This is a memo when I tried to work on a Python example sentence.
New scene → geometry node creation
Once inside (delete the original file1) Create grid Create python Connect
setPosition() The example sentence on p.10. I will write in the Python Code column in the Python node
The first two lines were written when the Python node was created, so Only the next 4 lines. (* The first two lines are described on p.6)
python
for point in geo.points():
pos = point.position()
pos += hou.Vector3(0,2,0)
point.setPosition(pos)
This is the only secret that I typed the points of geo.points ()
to the point and became "Are".
result I moved 2 in the Y direction.
I also rewrite it as follows and play
Rewrite 1
for point in geo.points():
point.setPosition( point.position()+hou.Vector3(0,2,0) )
Rewrite 2
x = 0
y = 2
z = 0
pos = hou.Vector3(x,y,z)
for point in geo.points():
point.setPosition( point.position()+pos )
hmath.buildTranslate
p.10 Second example sentence
python
for point in geo.points():
pos = point.position()
mtx = hou.hmath.buildTranslate((0,2,0))
pos = pos * mtx
point.setPosition(pos)
pos = pos * mtx
can be an assignment operator. pos * = mtx
For the time being, only the Python example sentences on p.10.
Wrangle x Python book, Toranoana seems to be orderable https://www.toranoana.jp/mailorder/article/04/0030/38/99/040030389986.html ~~ It seems to be scarce ~~ <When I confirmed it at the timing of writing [2], it was sold out!
Input completion appears in the middle of typing, such as around hou.hmath.b
When you start typing the function arguments, you will see a description of the function.
If you put print
orhelp ()
in Python Code
It will be displayed in a separate window called ** "Houdini Console" **.
Please note that if there are too many lines, it will flow.
For example, the above figure is an example when help (hou.hmath)
is done, but the beginning part flowed and could not be read. (As expected, help is in Python Shell ~)
Vector3 http://sidefx.jp/doc/hom/hou/Vector3.html
Matrix4 http://sidefx.jp/doc/hom/hou/Matrix4.html
setPosition http://sidefx.jp/doc/hom/hou/Point.html#setPosition
hmath http://sidefx.jp/doc/hom/hou/hmath.html
Since the published Japanese documents are not translated into Japanese unexpectedly, it is often quick to go to the head family quietly.
By the way, about Houdini's Python environment I also touched a little here
Python interpreter in Maya, Houdini, blender, Nuke http://qiita.com/it_ks/items/ae1d0ae01d831c2fc9ae#houdini
Recommended Posts