Jump to content

gweiss

Members
  • Content count

    5
  • Joined

  • Last visited

Community Reputation

0 Neutral

About gweiss

  • Rank
    Peon

Personal Information

  • Name
    Gil Weiss
  • Location
    Londo
  1. 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
  2. Thank you so much! that is exactly what I was looking for G
  3. 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
  4. Thanks so much Atom and f1480187
  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
×