Created
July 25, 2012 23:47
-
-
Save crydalch/3179399 to your computer and use it in GitHub Desktop.
Fracture Points SOP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# A companion SOP to the Points to Fracture shelf tool. Generates points, | |
# and applies the instance attribute to them. | |
# | |
node = hou.pwd() | |
geo = node.geometry() | |
# Add code to modify the contents of geo. | |
if node.parm("pointlist").eval(): | |
plist = node.parm("pointlist").eval() | |
plist = plist.split(" ") | |
if node.parm("attrlist").eval(): | |
ilist = node.parm("attrlist").eval() | |
ilist = ilist.split(" ") | |
inst_attr = geo.addAttrib(hou.attribType.Point, "instance", "") | |
coords = [] | |
for x in plist: | |
c = [ float(c) for c in x.split(',') ] | |
coords.append(c) | |
i=0 | |
while i < len(coords): | |
pt = geo.createPoint() | |
pt.setPosition(coords[i]) | |
if node.parm("attrlist").eval(): | |
pt.setAttribValue(inst_attr, ilist[i]) | |
i+=1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment