Setting "Input Prims" in Python

   1814   2   2
User Avatar
Member
9 posts
Joined: Aug. 2015
Offline
When modifying a LOP prim in python, I'd like to be able to communicate that change to other nodes downstream, so they can use `lopinputprim('.', 0)`as their input.

Python nodes don't auto-detect changes in “input prims”.

Here's an example:
from pxr import Sdf
node = hou.pwd()
stage = node.editableStage()

prim_path = node.inputPrims(0)[0]
prim = stage.GetPrimAtPath(prim_path)
prim.CreateAttribute("primvars:__TEST", Sdf.ValueTypeNames.Int, True, Sdf.VariabilityUniform).Set(42)

a node querying the input prim downstream will have no indication it's there.

(houdini 18.0.287)
User Avatar
Staff
1448 posts
Joined: July 2005
Offline
You mean something like hou.pwd().setLastModifiedPrims()?
User Avatar
Member
9 posts
Joined: Aug. 2015
Offline
yup, definitely that

Thanks!
  • Quick Links