Jump to content
Sign in to follow this  
localstarlight

Putting wrangle results into parameters?

Recommended Posts

How can I put the results of a wrangle into a parameter?

As a very simple example, imagine I have a subnet containing an attribute wrangle. On the wrangle I do something like:

float x = 2 * 2;

Now say I have a parameter on the subnet called 'Result', how can I put the output of 'x' into the 'Result' parameter? (Let's assume I do the attribute wrangle on Detail mode so it only runs once.)

Is this possible?

I have tried outputting the answer onto the Detail of the incoming object, eg.

f@output = x;

But then cannot figure out how a parameter can read from the detail of the object to show the result.

Share this post


Link to post
Share on other sites

VEX can't write to channel parameters at this time (Houdini 15.5). But Python can, just use a Python node instead of an Attribute Wrangle.

result_node = hou.node("/obj/some_node_with_result_parm")
x = 2
y = 3
result = x * y
result_node.parm("result").set(result)

 

Edited by Atom
  • Like 1

Share this post


Link to post
Share on other sites
Quote

VEX can't write to channel parameters at this time (Houdini 15.5). But Python can, just use a Python node instead of an Attribute Wrangle.

I hope they add this functionality...cant see the logic of not giving VEX this feature.

Share this post


Link to post
Share on other sites

Is there any update on this?
I'm trying to change parameter value in VEX wrangle.

Share this post


Link to post
Share on other sites

I don’t believe this will ever happen...

VEX is used inside nodes and is designed to be run fast : it takes an input, process the code, and generate the output of a Wrangle or other snippet.

Python is mainly used for scripting in Houdini, and depending on where you run it (from the terminal or from inside a Python node), you don’t have the same freedom of doing things. But basically, at first it was used to « automatize » what a user could do manually, like creating nodes and setting up some parameters (... scripting !).

Now, if VEX could change parameters, in other nodes, that would break the « dependency graph » : nodes are connected and are cooked sequentially. So if you start allowing VEX to change parameters upstream for example, that will really breaks how Houdini works. You could potentially generate unstable situation with infinite loops / circular references and so on. And it wouldn’t be easy to know when to recook part of the network and when to stop...

I believe that’s why VEX is run « inside » a node (a closed system in a way), while Python is more open on that, but therefore probably slower to execute because it may recook everything everytime it is run.

Maybe you would love to write VEX inside a terminal (like the Python terminal), with functions that allows to create nodes and change parameters everywhere, a kind of new API in VEX, but that would be a huge change because VEX is not Object Oriented (while Python is, which is great because nodes are ... objects). It would become a VEX++ !

Of course, insight from SideFX on that could be better than these guesses :-)

 

 

 

Edited by StepbyStepVFX
  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×