ranxerox Posted December 18, 2009 Share Posted December 18, 2009 I want to setup a bunch of points as parameters to a popnet, using an addsop. These points have a custom attribute which I want to assign values to (depending upon their point index $PT). I am not sure what the easiest way to do this is. I have an add sop, followed by an attribCreate sop, and in the initialization of the value I have an expression, but this gets really messy really fast. For instance .. if($pt==0,1,3) .. this works for 2 values of PT, but how would I go about doing more ? I though I could use python to do this with a dictionary myDict = {0:1,1:3,2:5}, then index this dictionary with the $PT .. this would work but it seems python expressions only work in channel expressions (is this true ?..). sorry for the confusion, just frustrated because it seems like this should be really simple but .. maybe there is a better way altogether ? thanks -ranx Quote Link to comment Share on other sites More sharing options...
ranxerox Posted December 18, 2009 Author Share Posted December 18, 2009 ok, so I solved my problem using a VOP SOP, but I am curious as to the other elements of the question .. how would you use python in an attribCreate Sop to solve the same problem ? Is there a better way to do this ? thanks -ranx Quote Link to comment Share on other sites More sharing options...
edward Posted December 22, 2009 Share Posted December 22, 2009 Since this is a fairly simple task, I wonder if a custom Python SOP (embedded in the .hip file) might be the way to go. Quote Link to comment Share on other sites More sharing options...
ranxerox Posted December 22, 2009 Author Share Posted December 22, 2009 yes, in retrospect this would have been the way to go. thanks -ranxx Since this is a fairly simple task, I wonder if a custom Python SOP (embedded in the .hip file) might be the way to go. Quote Link to comment Share on other sites More sharing options...
antoinedurr Posted December 25, 2009 Share Posted December 25, 2009 Unless you're positioning the points with the add SOP as well, I always use a grid SOP, and just do a 1xN grid where N is the quantity of points I want. Then the attribcreate SOP. In there, add a custom float parameter (with the gear menu), set the attribute value to chf("newfloatparam", $PT). Now I just add keyframes on whatever point numbers I want to set. Another approach is to make your points, add the attribute (but don't set any values), lock the attribcreate SOP, and then pull up the geometry spreadsheet, and enter values there (yes, you can edit all the attribute values in the spreadsheet). 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.