Jump to content

martinkrol

Members
  • Content count

    2
  • Donations

    0.00 CAD 
  • Joined

  • Last visited

Community Reputation

0 Neutral

About martinkrol

  • Rank
    Peon

Personal Information

  • Name
    martin
  • Location
    canada
  1. ( I posted this on the sidefx forum as well, posting here as well to hopefully get more eyes on this . ) Hey there guys. So in my journey to learn some scripting/python... I am having some issues ( code below ) So I am trying to create a shelf script that goes through all geo objects in the scene, creates a new specific geo node, and within it make a pointcloud that would be made from the values collected. I am hoping to build the pointAttrib dict, and as it's looping through the objects, append to the list. at the end of the script, I want to print/use the list of values but only one set of values prints. I am expecting at least 10 object names and their respective values. Anyone have the time to point me in the right direction? I'd love to know what I am doing wrong. pointAttrib ={} def selectSubChildrenOfType(node, node_type): for child in node.allSubChildren(): if child.type() == node_type: #print child.name() #print child.worldTransform() trX = str(child.worldTransform().at(3,0)) trY = str(child.worldTransform().at(3,1)) trZ = str(child.worldTransform().at(3,2)) #create dictionary from info above. keys = {'name': child.name(), 'tx': trX, 'ty': trY, 'tz': trZ} pointAttrib.update(keys) # print "obj "+ (pointAttrib["name"]) + " transX " + (pointAttrib["tx"]) # print a readable version of the values we generated. # print "translate X: " + trX # print "translate Y: " + trY # print "translate Z: " + trZ # executes the defined function above. selectSubChildrenOfType(hou.node("/obj"), hou.objNodeTypeCategory().nodeTypes()['geo']) #create a point per transform matrix that was found in the selctSUbChildrenOfType function. for key in pointAttrib: print key print pointAttrib[key] Question number 2: How would the code look for creating a node only if it doesn't exist. ( if I point to the specific node directly ). It's a bit of a chicken or an egg problem and I'm not sure how I would solve it. So far I have tried.. but yeah it's not right, but at least thats where my head is at. Any ideas? hints? tips? def createNodeIF(node, name) for child in node.allSubChildren(): if child.name() != name: hou.node("/obj").createNode("geo", "pointcloud" ) Any help would be appreciated.
  2. Hey guys. I am trying to get this working in Houdini 15. I get a few errors after pasting this code above. The node errors out and when I middle click to check info I get this. Error: python error: Traceback ( most recent call last): File "<stdin>", line 132 in <module> File "<stdin>", line 6, in createCity AttributeError: 'NoneType' object has no attribute 'EvalAsFloat' anyone know whats going wrong?
×