Create non-time varying attribute in attribute wrangle

   1909   5   0
User Avatar
Member
21 posts
Joined: March 2021
Offline
Hello!
Is it possible in an attribute wrangle node to create an attribute on a prim that isn't time sampled? I did a usd_addattrib(0,"/Render/rendersettings","myNewString","string");
usd_setattrib(0,"/Render/rendersettings","myNewString","test");

but the new attribute is time sampled and I'd rather it not be. Thank you!
User Avatar
Staff
4565 posts
Joined: July 2005
Offline
I'm not sure there is enough information here to make any claims about what is happening. If you attach a hip file someone could take a look. I've attached a simple hip file that uses this exact code in a wrangle and the resulting attribute is not time sampled.

Attachments:
setattrib.hip (276.8 KB)

User Avatar
Member
21 posts
Joined: March 2021
Offline
Hello, sorry for the delay. But yes, it does look like the time sampling is being inherited by a render product lop from above. Adding a render product with a time dependent name seems to trigger the attribute wrangle to also be time sampled, even though the attribute is unrelated to the product. I've attached a similar hip file where one attribute wrangle is time sampled because of the render product and another where it isn't when it's attached to a render settings lop only. This is in 19.5.605 but I believe there is now a setting in H20's attribute wrangle that may set the time sampling, but I'm not sure if we'll upgrade soon. Thank you!

Attachments:
forSideFx.hip (5.1 MB)

User Avatar
Member
326 posts
Joined: Jan. 2013
Offline
Your value of the Product Name: test.$F4.exr parameter already depends on the time sample because you are using the $F4 expression.

Update: In Render Product in H19.5 you can change the FrameRange/Subframes parameter to Sample Frame Range If Input Is Not Time Dependent.
Edited by dtempcyer - Nov. 25, 2023 12:35:06
User Avatar
Member
21 posts
Joined: March 2021
Offline
Ah, thank you, setting the time sample on the render product does help but I still feel like the usd attribute shouldn't be considered time sampled if the nodes above are. If I make an attribute with a python lop:

rendersettings = stage.GetPrimAtPath("/Render/rendersettings")
rendersettings.CreateAttribute("myNewPythonAttribute",Sdf.ValueTypeNames.String)
rendersettings.GetAttribute("myNewPythonAttribute").Set("aValue")

That attribute isn't time sampled and is the functionality I was looking for in the attribute wrangle if possible.
User Avatar
Staff
4565 posts
Joined: July 2005
Offline
If the input to a wrangle is time dependent, we have to make the attributes set by that wrangle time dependent. This is because we don't have any way to know if the values being written by the Wrangle LOP are going to be the same from one cook to the next (as they may be calculated based on reading data from the input stage which may be different on each frame).

If the value written by the wrangle might be time varying, it makes no sense to write to the default value, because then you're just overwriting the one default value slot over and over again with different values. To ensure none of the data from the time varying cook result is lost, we have to author time samples to make sure we capture all the values over time.

Setting the Render Product LOP to calculate values for the full frame range is definitely the way to go here. Not only will it author the default value you want on the wrangle, but every other LOP node below the Render Product won't have to recook on each frame, resulting in much better interactive performance.
  • Quick Links