magneto Posted February 29, 2012 Share Posted February 29, 2012 It's hard to word this but basically I am trying to assign weights to points based on their index. So point 0 will have a value of 0, and point N will have a value of 1. I did this no problem but when a group is specified, I want the values to be adjusted accordingly. So if you have 100 points, and then created a group for point 25-50, then I want the range to be 0-1 based on 25-50, as if 25 was 0, and 50 was 100. Basically I need something like: group.startIndex group.endIndex Can I do this purely using nodes? I am using AttribCreate so if anyone has any solutions for this, I would appreciate it. Thanks Quote Link to comment Share on other sites More sharing options...
anim Posted February 29, 2012 Share Posted February 29, 2012 here is the example using attributecreate and a little python as a value expression groupName = ch("group") geo = hou.pwd().inputs()[0].geometry() group = geo.findPointGroup(groupName) points = group.points() start = points[0].number() end = points[-1].number() return hou.hmath.fit( lvar("PT"), start, end, 0, 1 ) look in file how it's used weight_group.hipnc 1 Quote Link to comment Share on other sites More sharing options...
sadhu Posted February 29, 2012 Share Posted February 29, 2012 Is this is what you want? Quote Link to comment Share on other sites More sharing options...
sadhu Posted February 29, 2012 Share Posted February 29, 2012 (edited) Sorry. Forgot to attach the file. weights_based_on_index.hipnc Edited February 29, 2012 by sorry 1 Quote Link to comment Share on other sites More sharing options...
magneto Posted February 29, 2012 Author Share Posted February 29, 2012 Thanks guys, exactly what I needed Quote Link to comment Share on other sites More sharing options...
magneto Posted February 29, 2012 Author Share Posted February 29, 2012 @anim: I just tried using the same expression in a very similar case but it says "extra token in the expression". I don't understand. Can you please take a look at it? att.hipnc Quote Link to comment Share on other sites More sharing options...
anim Posted March 1, 2012 Share Posted March 1, 2012 change expression language of that parameter to python right-click/Expression/Change Language to Python 1 Quote Link to comment Share on other sites More sharing options...
magneto Posted March 1, 2012 Author Share Posted March 1, 2012 Wow I thought the global icon at the top corner changes all fields for the selected node. So Houdini allows both languages in the same node instance? I just did it and it worked. Thanks man, didn't know this. Quote Link to comment Share on other sites More sharing options...
anim Posted March 1, 2012 Share Posted March 1, 2012 global icon is just for new expressions, otherwise you can always choose, expressions that are in different language than set by that icon are red, not green so you can tell straight away 1 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.