Is setprimattrib() a deferred function?

   1882   1   2
User Avatar
Member
10 posts
Joined: 12月 2006
Offline
Hello,

I'm trying to set a primitive attribute in a detail wrangle, using
setprimattrib()
.
For whatever reason the function is not executed at runtime, but after the whole wrangle.

Saying:
prim(0, "primvariable", i);
setprimattrib(0, "primvariable", i, primvalue, "set");
prim(0, "primvariable", i);

returns the same value for both
prim()
calls, instead of returning the new value on the second call.

Is this expected? I'm quite sure it's at least not desired.

I also include an example file. This is from a more complex thing I'm trying to solve, where I write a value onto different prims if they meet certain criteria. Therefor I can't do it in two wrangles or in a primitive wrangle.

Thanks for any help or pointers!

PS: I tried in h16.5 and h17. I'm running on linux so the
printf()
calls just output something to the terminal.

Attachments:
setprimattrib_issue.hip (112.0 KB)

User Avatar
Member
384 posts
Joined: 4月 2017
Offline
IIRC, reading and setting of attributes in a wrangle are done at specific times during execution in order to avoid racing conditions and other problems that arise in parallel processing. You can't reliably set an attribute's value and then get it in the same wrangle. You'll need to change your logic, or break the operation up into multiple wrangles.
MOPs (Motion Operators for Houdini): http://www.motionoperators.com [www.motionoperators.com]
  • Quick Links