Jump to content

bhouse

Members
  • Content count

    4
  • Donations

    0.00 CAD 
  • Joined

  • Last visited

Community Reputation

1 Neutral

About bhouse

  • Rank
    Peon

Personal Information

  • Name
    Ben House
  1. setpointattrib after addpoint in detail wrangle

    If I understand correctly, this should give you the behavior you want. (file attached) setpointattrib(0, "order", 0, 0 , "set"); setpointattrib(0, "order", 1, 10 , "set"); for(int i = 1; i < 10; i++) { int order = i; float pos = (float)i/10; int newPoint = addpoint(0, lerp(point(0,"P",0), point(0,"P",1), pos)); setpointattrib(0, "order", newPoint, order, "set"); } setpointattrib.hip
  2. Rand value in Group Expression

    The rand() function must be in backticks as well. Symek does a great job of explaining them here. Also, rand() generates a random float value between 0 and 1, so when subtracting that from nprims() you will need to fit() your value to the range you want (1 to 4 in this case) and then round the output to the nearest integer. So something like this should do what you want: @primnum==`nprims(0)-rint(fit01(rand(5),1,4))` Alternatively, you can do this in a primitivewrangle node using something like: addattrib(0, "primgroup", "RandomPrim", 0); float seed = ch("seed"); if(@primnum == @numprim-rint(fit01(rand(seed), 1, 4))){ setattrib(0, "primgroup", "RandomPrim", @primnum, -1, 1, "set"); } Example file: rand_prim_group.hip
  3. changing vert order wrap

    I'm not sure I exactly understand what you are trying to do, but you can use the Ray SOP to deform geometry based on another geometry with different point counts. ray_deform.hip
  4. Python Node Placement

    I know this is more than a year later, but if anyone is still wondering how to do this, I don't believe that it is directly possible to get a node's position OnCreated. However, you can get your cursor's position at the time of creation, which is usually close enough. # python code inside an OnCreated script # get current network pane net_editor = hou.ui.paneTabOfType(hou.paneTabType.NetworkEditor) # create your node myNode = hou.node(".").createNode("null", "my_node", 0, 0) # get cursor position position = net_editor.cursorPosition() # set position of node to cursor position myNode.setPosition(position) I use this to create nodes and connect outputs as desired. (Note that the position vector can be modified to set the node location to a position relative to your cursor location instead of directly on it.) import numpy as np # reference the created node createdNode = kwargs["node"] # get current network pane net_editor = hou.ui.paneTabOfType(hou.paneTabType.NetworkEditor) # create a child node of the created node # can just use createOutputNode if you only have 1 output and 1 input #childNode = createdNode.createOutputNode("null", "child_node") childNode = hou.node(".").createNode("null", "child_node", 0, 0) # for nodes with multiple inputs/outputs use setInputs # assign the 2nd output of the created node to the first input of the childNode childNode.setInput(0, createdNode, 1) # set position equal to cursor position minus a small amount # offset position down and to the right of cursor position position = np.subtract(net_editor.cursorPosition(), [-0.5,1]) # set childNode position childNode.setPosition(position)
×