Houdini Advent Calendar 2016 Day 19 article.
The content is as the title ... At this point, those who say "Ah, high" may be asked to close it. If you know any other better way, I would be grateful if you could tell me secretly.
Let's take a look inside the hou module. Of the list returned by dir, if "NodeType" is included, it seems like that, so I will investigate it like that.
for i in dir(hou):
if 'NodeType' in i:
print( i )
Then
It has returned quite a bit. It seems that the first half and _swigregister are different. It's interesting that there are "Node Type" and "Node Type Category". I feel that the latter is more like that.
inspect.getmembers
Now let's take a look using the inspect module getmembers.
import inspect
for i in inspect.getmembers(hou):
if 'NodeType' in i[0]:
print i
The NodeTypeCategory system seems to be ** built-in function ** across the board. These functions return a "NodeTypeCategory" type.
type( hou.sopNodeTypeCategory() )
<class 'hou.NodeTypeCategory'>
NodeTypeCategory
It's a NodeTypeCategory type, and I typed n to see if I could see it by name, and then "nodeTypes" was also suggested.
sopCategory.name()
'Sop'
sopCategory.nodeTypes()
The name is as expected, but The nodeTypes I found by the way looks like this!
I was a little scared, but now I can check the nodes in each node category.
import inspect
for i in inspect.getmembers(hou):
if 'NodeType' in i[0]:
if inspect.isbuiltin(i[1]):
try:
nodetypecategory= i[1]()
except:
continue
nts = nodetypecategory.nodeTypes()
print( nodetypecategory.name(),len( nts ) )
The try-except in the middle is provided by the swigregister people to cause an error. The second line from the bottom received the dictionary that was the result of nodeTypes, and printed the length of the dictionary along with the category name.
result…… ~ ~ I understand that each Net system has only one node, Is there so much SOP, DOP, VOP, etc.? ?? ?? Is that so.
I will post the result for the time being. It is H15.5.632.
('ChopNet', 1)
('Chop', 103)
('CopNet', 1)
('Cop2', 145)
('Dop', 435)
('Object', 146)
('Particle', 1)
('Pop', 68)
('Driver', 42)
('Shop', 205)
('Sop', 430)
('VopNet', 18)
('Vop', 816)
I decided to compare ** CHOP **, which seems to be relatively easy to count. The result of the script is "103" as above.
chopNodes = hou.chopNodeTypeCategory().nodeTypes()
sorted( chopNodes.keys() )
On the Houdini UI ...
4 columns, 25 rows. ** You can even multiply **
I can't find 3 nodes " for
"," popnet
" and " vop phop type
"on the UI.
However, if you look at the online document as of H12, there is for
CHOP, so
http://sidefx.jp/doc/nodes/chop/for.html
It can be inferred that these are left behind to maintain compatibility with past scene data.
Is it so that the amount of VOP is so great?
So how to filter only that node in a script? It seems that this will be my next homework.
I was helped by the suggestion. Convenient! !!
Next is Yone80 @ github's "Transform to fit a square polygon".