how to execute a python command inside a compiled for-loop?

   1872   3   1
User Avatar
Member
900 posts
Joined: Feb. 2016
Offline
In a compiled for-loop I have a pointVop that I need to force-compile on each iteration.

I would use a python node at the beginning of the for-loop, to .pressButton() on the force compile button of attribVop. Unfortunately the python node cannot be used inside a compiled block.

What could I do?

UPDATE: Oh, I see I could register an event callback. Will give this a try. Hopefully it will work for a parm change inside a compiled for-loop
hou.nodeEventType.ParmTupleChanged
UPDATE2: not it doesn't work with compiled blocks.


I also tried this workaround:
create a node with an integer parameter linked to the iteration number of the meta import.
Then set a callback script for the parm, but the callback would only be triggered on manual changes made by the user, not by the meta import node.


thanks!
Edited by Andr - July 12, 2019 04:21:35

Attachments:
forceCompileLoop.JPG (146.1 KB)

User Avatar
Member
900 posts
Joined: Feb. 2016
Offline
and while we are talking about PointVop and Python, I have a bonus question:
Do you know how to evaluate/read with a python expression the result data of a Vop Node output?
'result' output is not a parm, so I can't really do parm.eval() on it
Edited by Andr - July 12, 2019 03:09:29

Attachments:
outputvop.jpg (54.5 KB)

User Avatar
Member
8555 posts
Joined: July 2007
Offline
Too much hackery going on in here
What is the real goal? None of this is common, why would you want to force compile VEX code that'd be insanely inefficient

And no, you can't get a result of VOP using Python as there is no such thing, VOPs are just a blueprint for VEX code, and then that gets compiled and the only outputs are those that you export from VOPs, everything else will be just temporary internal variable that is inaccessible from outside
Edited by tamte - July 12, 2019 04:26:45
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
900 posts
Joined: Feb. 2016
Offline
Hey, thanks for checking in.
I just realized I was missing an important piece of information: the difference between Unified Noise Static and Unified Noise (Dynamic). I learned it the hard way.

I was trying to hack my way into changing the basis parm of the static version on each iteration.
That's why I needed to force compile the vopnet. To update the noise type.
(I even duplicated the HDA of the Static version, to expose the basis input a feed it a string attribute, basis input parm is already exposed in the non-static version lol)

Apparently I should use the Dynamic for such workflow.


Thanks for the explanation, very appreciated

Attachments:
staticVsDynamic.JPG (154.0 KB)

  • Quick Links