Initial commit: Hermes-Houdini Bridge
- Shelf tool to open/close command port in Houdini - hhb client script (eval, script, get-selected, set-param, etc.) - Hermes skill with standard hou module workflows - Example: create pyro setup - hou module quick reference
This commit is contained in:
@@ -0,0 +1,111 @@
|
||||
# hou Module Quick Reference
|
||||
|
||||
Common patterns for the Hermes Bridge.
|
||||
|
||||
## Selection & Navigation
|
||||
|
||||
```python
|
||||
# Selected nodes
|
||||
hou.selectedNodes() # → list[hou.Node]
|
||||
hou.selectedNodes()[0].path() # → '/obj/geo1/box1'
|
||||
hou.selectedNodes()[0].type().name() # → 'box'
|
||||
|
||||
# Find nodes
|
||||
hou.node('/obj/geo1') # Get by path
|
||||
hou.node('/obj').children() # All children
|
||||
hou.node('/obj').recursiveGlob('*box*')# Glob search
|
||||
|
||||
# Parent/child
|
||||
node.parent() # Parent node
|
||||
node.node('childname') # Named child
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
```python
|
||||
n = hou.selectedNodes()[0]
|
||||
|
||||
# Get/Set
|
||||
n.parm('tx').eval() # Evaluate value
|
||||
n.parm('tx').set(5.0) # Set value
|
||||
n.parm('file').set('/path/to/file') # Set string param
|
||||
|
||||
# All non-default parms
|
||||
[(p.name(), p.eval()) for p in n.parms() if not p.isAtDefault()]
|
||||
|
||||
# Existence check
|
||||
if n.parm('snippet') is not None:
|
||||
n.parm('snippet').set('@P.y += 1;')
|
||||
```
|
||||
|
||||
## Connections
|
||||
|
||||
```python
|
||||
# Inputs
|
||||
n.inputConnections() # → tuple of (input_node, output_idx, input_idx)
|
||||
n.inputConnectors() # Input connector names
|
||||
n.setInput(0, other_node) # Connect
|
||||
|
||||
# Outputs
|
||||
n.outputConnections() # What connects FROM this node
|
||||
|
||||
# Disconnect all inputs
|
||||
for i in range(len(n.inputConnectors())):
|
||||
n.setInput(i, None)
|
||||
```
|
||||
|
||||
## Node Creation
|
||||
|
||||
```python
|
||||
parent = hou.node('/obj/geo1')
|
||||
|
||||
# Single nodes
|
||||
box = parent.createNode('box')
|
||||
null = parent.createNode('null', 'OUT')
|
||||
|
||||
# Common types
|
||||
'geo' # Geometry container
|
||||
'null' # Null
|
||||
'attribwrangle' # Attribute Wrangle
|
||||
'attribvop' # Attribute VOP
|
||||
'file' # File read (SOP)
|
||||
'rop_geometry' # Geometry ROP
|
||||
'switch' # Switch
|
||||
'merge' # Merge
|
||||
'transform' # Transform (xform)
|
||||
'sphere' # Sphere
|
||||
'grid' # Grid
|
||||
'scatter' # Scatter
|
||||
'boolean' # Boolean
|
||||
'remesh' # Remesh
|
||||
'polyextrude' # Poly Extrude
|
||||
'principledshader::2.0' # Material
|
||||
```
|
||||
|
||||
## VEX
|
||||
|
||||
```python
|
||||
wrangle = hou.selectedNodes()[0]
|
||||
wrangle.parm('snippet').set('''
|
||||
// Your VEX code here
|
||||
@P.y += sin(@Frame * 0.1) * 0.5;
|
||||
@Cd = rand(@ptnum);
|
||||
''')
|
||||
```
|
||||
|
||||
## Layout
|
||||
|
||||
```python
|
||||
node.moveToGoodPosition() # Auto-layout one node
|
||||
for n in parent.children():
|
||||
n.moveToGoodPosition() # Layout all children
|
||||
```
|
||||
|
||||
## Scene Info
|
||||
|
||||
```python
|
||||
hou.hipFile.name() # Current .hip path
|
||||
hou.hipFile.basename() # Just filename
|
||||
hou.expandString('$HIP') # Scene directory
|
||||
hou.hscript('ls /obj') # Raw hscript
|
||||
```
|
||||
Reference in New Issue
Block a user