Jump to content

Assign Detail Attribute To Channel?


Atom

Recommended Posts

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?

Untitled-1.jpg

Link to comment
Share on other sites

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 by Atom
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...