chiess Posted November 20, 2013 Share Posted November 20, 2013 Hi, At the moment, I have a simple NURBS line with 2 control points. This setup is stored in a subnet. The position of these 2 points can be modified via parameters on the subnet (basically each of them is linked to a transform node). But, to make it better, I want to choose the number of control points my line could have. In that case, I need more position-parameters on the subnet to control each of these points. Is there a way to dynamically create new parameters on a node? For example, I give the "Number of control points"-parameter the number 4, which means, I want to have 4 control points on my line. How can I dynamically add 4 additional parameters to the subnet, each controlling another point. Maybe via python? Examples would always be helpful, but an advice towards the right direction would also help a lot. (I was thinking of adding transform nodes with a foreach node. In that case each of them has its own transform node. I then need to feed in the control point number and link it to the correct parameters on the subnet-node) Thanks, Chris Quote Link to comment Share on other sites More sharing options...
magneto Posted November 20, 2013 Share Posted November 20, 2013 You have to use a multi parm interface. I don't remember which nodes in Houdini already use that, that you can inspect, but you can check out Add SOP, AttribCreate SOP to see some examples. These are compiled so you can't replicate them easily. I am sure there are HDAs that use this feature around Or depending on your needs, you can also allow people to type values the way the Curve SOP does, and/or wrangle the data yourself using python before passing it to Curve SOP. Quote Link to comment Share on other sites More sharing options...
chiess Posted November 20, 2013 Author Share Posted November 20, 2013 (edited) HA!, thanks a lot magneto... perfect advice You just need to create a folder and set it to "Multiparm Block (list)". Then simply add the parameter input fields you need as sub-tree. Thanks! EDIT: it makes me sad that I couldn't figure that out by myself and had to create a topic for it Edited November 20, 2013 by chiess Quote Link to comment Share on other sites More sharing options...
magneto Posted November 20, 2013 Share Posted November 20, 2013 lol don't worry about it. This website is populated by helpful individuals who are humble 1 Quote Link to comment Share on other sites More sharing options...
chiess Posted November 20, 2013 Author Share Posted November 20, 2013 (edited) Thanks magneto! I have another question which you (or anyone really) probably know the answer. What is the syntax for dynamic channel referencing? I couldn't find a real answer online so far. For example: I have a parameter field which is called cpt1x, another one which is called cpt2x, etc. I know have a constant in a vopsop which references those parameters, like ch("../cpt1x"). The problem I have now, is that the 1 in the ch() should by dynamic, such as ch("../cpt" + attribute + "x") I don't really know what the correct syntax could be in Houdini to achieve that? Thanks, Chris Edited November 20, 2013 by chiess Quote Link to comment Share on other sites More sharing options...
magneto Posted November 20, 2013 Share Posted November 20, 2013 I am not sure how to appropriately generate the multi-parm parameter names, but once you have them it's easy to access them in VEX. Just build strings in VEX using the sprintf function and then pass it to ch, chv, etc. That should work. Quote Link to comment Share on other sites More sharing options...
chiess Posted November 20, 2013 Author Share Posted November 20, 2013 (edited) Do you mean like this as expression in a constant inputfield ? ch(sprintf("../../cpt%dx", randomAttrib)) Not working, so I guess not Can you show me a quick example please, that would be great. Thanks magneto EDIT: Hmm, it looks like I have to use a VEX node and write a short line of code somehow in there. (never used the VEX node before, no idea how it works yet, but very curious). It seems to give me a lot more power overall, or is that wrong? Edited November 21, 2013 by chiess Quote Link to comment Share on other sites More sharing options...
magneto Posted November 21, 2013 Share Posted November 21, 2013 No you have to do it all in VEX. You can also use expressions but this is more direct and probably faster. So create an AttribWrangle and paste this: string name = sprintf("p%s", 1);vector v = chv(name);printf("%s\n", v);[/CODE]It should print the value of the parameter whose name you built using sprintf. In my case it's p1. If you want the parameter one level up, then use "../p%s". Quote Link to comment Share on other sites More sharing options...
chiess Posted November 21, 2013 Author Share Posted November 21, 2013 I would love to try it, but unfortunately attribWrangle is only available in 12.5, and I am still using 12.1 Quote Link to comment Share on other sites More sharing options...
anim Posted November 21, 2013 Share Posted November 21, 2013 (edited) forums.odforce.net/index.php?/topic/13829-parameter-interface-expression-entry/#entry86059 Edited November 21, 2013 by anim Quote Link to comment Share on other sites More sharing options...
chiess Posted November 21, 2013 Author Share Posted November 21, 2013 Thanks anim! It worked nicely. It is weird though that it only takes strings as possibility to connect them with each other. A quick function ala str(xxx) would have helped a lot in such cases. But I guess, that is why you have the option to use VEX like magneto said. 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.