Jump to content

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.

Link to comment
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
Link to comment
Share on other sites

  • 3 years later...

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 2
Link to comment
Share on other sites

  • 1 year later...

Hi, 

I Was trying to control width/height of a grid from another module where to do some calculations, and I need to code it, so, where to do it?  Wrangle isn't the solution?

// I was trying with expressions, but I need more power and versatility there... 

 

Thks!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...