Atom Posted June 19, 2016 Share Posted June 19, 2016 Hi All, I have an integer detail attribute. I want to use that value down stream as the number of segments for a ReSample node. I have read you can use the detail function to accomplish this but when I place it in the segs field, I get an error "Unable To Evaluate Expression". detail(geoself(),"resample_count",0) This is probably because I am using VEX in an Hscript field. What is the correct syntax to accomplish this task? Quote Link to comment Share on other sites More sharing options...
alican Posted June 19, 2016 Share Posted June 19, 2016 Instead of using geoself(), this should work detail(opinputpath(".",0), "resample_count", 0) Quote Link to comment Share on other sites More sharing options...
f1480187 Posted June 20, 2016 Share Posted June 20, 2016 http://www.sidefx.com/docs/current/expressions/ You need to use detail expression function, since parameters accept only HScript Expression or Python expressions. The function differs from VEX alternative, due to semantic differences. Quote Link to comment Share on other sites More sharing options...
Atom Posted June 20, 2016 Author Share Posted June 20, 2016 (edited) Thanks for the info I'll give that a try. In the meantime i came up with a brute-force pythonic way to accomplish this but it takes a few more lines of code. node = hou.pwd() geo = node.geometry() def fetchIfObject (passedName): # Return a named item if it exists. try: result = hou.node(passedName) if result == 0: result = None except: result = None return result # Fetch from the node that has the number of points we are going to reshape. ob_source_points = fetchIfObject("/obj/animate_trails/group_morph_candidates") if ob_source_points: for pg in ob_source_points.geometry().pointGroups(): if pg.name() == 'morph_candidates': point_count = len(pg.points()) #print ("source node has %d points." % point_count) if point_count > 1: # Adjust the downstream resample to have this same number of points. ob_resample = fetchIfObject("/obj/animate_trails/resample_SAME_COUNT_AS_POPNET_POINTS") if ob_resample: # Assign the count value to the segs channel on the node. ob_resample.parm('segs').set(point_count-1) Edited June 20, 2016 by Atom 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.