Convert Groups to Point Attributes

Hey – As a Houdini newbie, I’m still struggling a lot with groups and attributes. Today I wanted to do a circle of objects with the copy sop and give it a gradient color by polygon island. Good. Easy – I thought. BUT, the copy SOP creates just groups of objects. Now my question was, how to convert a bundle of object in an fresh point attribute from 0-1. My Approach was to convert the groups with the assemble SOP to a primitive attribute. After this I used an attribute promote to convert the primitive attribute to a point attribute. In the final step I created a fresh attribute and did a fit function to have a nice range from zero to one. fit(@island_index,0,ch(“../copy_copy360Deg/ncy”),0,1). Accordingly I was able the use this attribute in the color sop. the result, was the picture below.

To me it feels like a to involved process – I’m sure that the same process is also doable in one node e.g. in an attribute wrangle.

Rename Group Materials


A common workflow for us is to assign materials in softimage with the help of groups. All objects in a group share the same material, which makes material assigning and overriding easy. During the last days I had to select tons of meshes, to group them and to assign a new material to it. Lazy as I am, I have written a script that renames the group material with the groups name. This saves a lot of keyboard write work. Btw, this script works also with partitions – Some people prefer sorting Materials on the top level of SI’s hierarchy.

xsi = Application
collSel = xsi.Selection
log = xsi.LogMessage
for x in range(0,len(collSel)):
	oType = str(collSel(x).Type)
	oType2 = oType.replace("#","")
	if(oType2 == "Partition") or (oType2 == "Group"):
		log("Group Name: " + str(collSel(x).FullName) + " | Material: " + str(collSel(x).Material))
		if(collSel(x).Material == "None"):
			log("sftools.debug: There is no Material applied to the group")
			oObject = collSel(x).Name
			oObjectPath = collSel(x).FullName
			oMaterial = collSel(x).Material
			oMatLib = collSel(x).Material.Library
			oMat = oMaterial.Name
			xsi.SetValue(str(oMatLib) + "." + str(oMat) + ".Name", str(collSel(x).Name) , "")