localstarlight Posted September 22, 2016 Share Posted September 22, 2016 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. Quote Link to comment Share on other sites More sharing options...
adrianr Posted September 22, 2016 Share Posted September 22, 2016 https://www.sidefx.com/docs/houdini15.0/vex/functions/detail Is this what you mean? If you had a float detail attribute "foo", and made a float parameter node in a Point vop for example, you could type the following to access it, detail("../surface_node_name", "foo", 0) Quote Link to comment Share on other sites More sharing options...
Atom Posted September 22, 2016 Share Posted September 22, 2016 (edited) 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 September 22, 2016 by Atom 1 Quote Link to comment Share on other sites More sharing options...
localstarlight Posted September 22, 2016 Author Share Posted September 22, 2016 Both answers work, thanks guys! Quote Link to comment Share on other sites More sharing options...
SteveNi Posted September 24, 2016 Share Posted September 24, 2016 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. Quote Link to comment Share on other sites More sharing options...
trebz7 Posted October 16, 2019 Share Posted October 16, 2019 Is there any update on this? I'm trying to change parameter value in VEX wrangle. Quote Link to comment Share on other sites More sharing options...
StepbyStepVFX Posted October 16, 2019 Share Posted October 16, 2019 (edited) 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 October 16, 2019 by StepbyStepVFX 2 Quote Link to comment Share on other sites More sharing options...
dimavj Posted July 14, 2021 Share Posted July 14, 2021 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! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.