検索 - User list
Full Version: Changing context option in TOPs
Root » PDG/TOPs » Changing context option in TOPs
HypoSection
I have a multi-shot setup where I have a context option called shot. I would like to iterate through all the values of shot in a TOPs network using the wedge node as well as change it manually using the Context Options Editor. I tried using a Python Script node in TOPs and setting the context option from the wedge attribute but it didn't work.

My current solution is the following but it's a bit hacky. I create a Null node in the OBJ context and create a parameter for each context option and set the value to the context option attribute e.g. @shot. Anything that needs to use this context option references the parameter. In the TOPs Wedge node I create an attribute with the same name and values as the context option and set Target Parameter to push the value to the parameter in the Null node.

It would be nice if using an attribute in a parameter without a prefix (e.g. @shot instead of C@shot or P@shot) would work like the following: if a PDG attribute exists (and you're inside a cooking TOPs work item) use that, if it doesn't, use the context option attribute. Unfortunately context option attributes always override PDG attributes. You can do it in Python but it's a bit verbose:

import hou, pdg

work_item = pdg.EvaluationContext.workItem()
if work_item is not None and work_item.state == pdg.workItemState.Scheduled:
    shot = work_item.attribValue("shot")
else:
    shot = int(hou.contextOption("shot"))

return hou.text.expandString(f"$HIP/render/shot_{shot}/$F4.exr")

How do others solve this issue?
tamte
I haven't tested this, but maybe you can try using Edit Context Options LOP, which you can set to create shot context option from your P@shot
as long as your TOP network will evaluate LOP at or below that node, everything above that node should see the correct value of the @shot context option
HypoSection
Thanks for the tip. I did try Edit Context Options LOP. It does work but has limitations. Because it only affects nodes above it in the network it doesn't affect USD Render ROPs which are below it. I also need something that works in SOPs.
tamte
HypoSection
it doesn't affect USD Render ROPs which are below it.
in that case you can use Output/Context Options tab on the USD Render ROP directly
but yes, that wouldn't affect SOP networks cooked by TOPs independently of that LOP stream
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.