Here's a short code snippet of what I'm trying to do:
def random_primvars(self, node_path): lop_node = hou.node(node_path) stage = lop_node.stage() stage.SetEditTarget(stage.GetSessionLayer()) min_val = self.min_input.value() max_val = self.max_input.value() for prim in stage.Traverse(): primvars_api = UsdGeom.PrimvarsAPI(prim) for pv in primvars_api.GetPrimvars(): if "to_update_" in pv.GetName(): new_val = random.uniform(min_val, max_val) pv.Set(new_val)
Running this code in a shelf tool or Python panel will update the primvar values (as shown in Solaris Geometry SpreadSheet panel), but the render won't change.
However, if I implement a similar logic in a Python LOP node, the values are updated and the render shows the expected result.
The downside of this approach is that the node is cooked whenever Houdini decides it needs to, and I would like to be in control of when it's executed.
So, I guess my question is, is it possible to edit the primvars outside of a LOP node and the renderer be aware of the changes? And, if possible, is it recommended, or should I this always be done in a LOP node?