Jump to content

gweiss

Members
  • Content count

    6
  • Donations

    0.00 CAD 
  • Joined

  • Last visited

Everything posted by gweiss

  1. In a test scene I have a sphere node inside a geo node inside a subnet node I want to promote the sphere node parameters to the subnet node with this code I'm getting an error: The attempted operation failed. Invalid indices/name/parm template import hou #get pTGroup on node node = hou.node('obj/subnet1') ptg = node.parmTemplateGroup() #create new folder in group sphereFolder = houFolderParmTemplate('sphr', 'sphere', folder_type=hou.folderType.Simple) ptg.addParmTemplate(sphereFolder) node.setParmTemplateGroup(ptg) #find inner sphere node sph = hou.node('obj/subnet1/sphere_object1/sphere1') #get pTGroup on sphere node sphG = sph.parmTemplateGroup() #promote the parameters of sphere node to upper node (subnet1) sphere_folder = ptg.findFolder("sphere") for i in sphG.entriesWithoutFolders(): ptg.appendToFolder(sphere_folder, i) node.setParmTemplateGroup(ptg) what am I doing wrong?
  2. Hi, how can I select all nodes of specific type, for example I want to select all the bone nodes and put them inside a network box or just store them in a variable I tried using hou.objNodeTypeCategory().nodeTypes()['bone'], but couldn't find the way to use the result. also is there a clean way to add items to a network box, size it around the nodes and layout the nodes inside it? Thanks G
  3. Thank you so much! that is exactly what I was looking for G
  4. learning python I'm trying to write a script that will place a bone between two locators. I managed to read the locators position and place the bone in the first locator's position I got the distance between the two locators using hou.distanceTO() and passed it to the bone's length channel. the only thing I'm missing and can't find the way to do it is find the angles for the rotation of the bone to aim at the second locator. how can I do that? this is my code: import objecttoolutils #store selected objects sl = hou.selectedNodes() sla = sl[0] slb = sl[1] #evaluate position of selected objects n1 = sla.worldTransform().extractTranslates() n2 = slb.worldTransform().extractTranslates() #create bone and position to first selected object my_bone = hou.node("/obj").createNode('bone') px = my_bone.parm("tx").set(n1[0]) py = my_bone.parm("ty").set(n1[1]) pz = my_bone.parm("tz").set(n1[2]) pt1 = hou.Vector3(n1) pt2 = hou.Vector3(n2) b1 = pt1.distanceTo(pt2) bl = my_bone.parm('length') bl.set(b1) Thanks gweiss
  5. Hi, learning python, I'm trying to do a simple test of creating a custom shelf tool that calls a function from a file to create a sphere I copy the create sphere shelf button script: import toolutils import soptoolutils rad = 0.5 kwargs['bbox'] = hou.BoundingBox(-rad, -rad, -rad, rad, rad, rad) sphere = soptoolutils.genericTool(kwargs, 'sphere') sphere.parm("type").set("polymesh") sphere.parm("radx").set(rad) sphere.parm("rady").set(rad) sphere.parm("radz").set(rad) I save a .py file with a new function and paste the script with a small change of - rad = 1 so I have a saved file called spherebig.py that looks like that import hou import toolutils import soptoolutils def createBigSphere(): rad = 1 kwargs['bbox'] = hou.BoundingBox(-rad, -rad, -rad, rad, rad, rad) sphere = soptoolutils.genericTool(kwargs, 'sphere') sphere.parm("type").set("polymesh") sphere.parm("radx").set(rad) sphere.parm("rady").set(rad) sphere.parm("radz").set(rad) in my new shelf tool I enter this on the script tab: import spherebig spherebig.createBigSphere() and when I press the button I get this error: NameError: global name 'kwargs' is not defined am I doing something wrong or is there a different way to create objects this way? Thanks gweiss
  6. Thanks so much Atom and f1480187
×