Scott Peters

speters

About Me

Connect

LOCATION
Not Specified
ウェブサイト

Houdini Skills

Availability

Not Specified

Recent Forum Posts

Getting only user-defined parms 2021年7月26日13:18

Hey all,

I've been looking into getting a list of user-defined parms, however, I get many more attributes than I should be.

In the following example, I've simply created a "file" SOP, and added a single spare parm. "my_float".

When I run the following, I get a huge list of other parameters, most of which I didn't add:

spares = []
for parm in node.parms():
    if parm.isSpare():
        spares.append(parm)



output ( saved to yaml ):
/obj/file1:
  inputs: []
  node_type: Object/geo
  parms:
    native:
      bank:
        type: bank
        value: 0.0
      caching:
        type: caching
        value: 1
      childcomp:
        type: childcomp
        value: 0
      constraints_on:
        type: constraints_on
        value: 0
      constraints_path:
        type: constraints_path
        value: ''
      dcolorb:
        type: dcolor
        value: 1.0
      dcolorg:
        type: dcolor
        value: 1.0
      dcolorr:
        type: dcolor
        value: 1.0
      display:
        type: display
        value: 1
      keeppos:
        type: keeppos
        value: 0
      lookatpath:
        type: lookatpath
        value: ''
      lookup:
        type: lookup
        value: 'on'
      lookupobjpath:
        type: lookupobjpath
        value: ''
      pathobjpath:
        type: pathobjpath
        value: ''
      pathorient:
        type: pathorient
        value: 1
      picking:
        type: picking
        value: 1
      pickscript:
        type: pickscript
        value: ''
      pos:
        type: pos
        value: 0.0
      pre_xform:
        type: pre_xform
        value: 0
      prx:
        type: pr
        value: 0.0
      pry:
        type: pr
        value: 0.0
      prz:
        type: pr
        value: 0.0
      px:
        type: p
        value: 0.0
      py:
        type: p
        value: 0.0
      pz:
        type: p
        value: 0.0
      rOrd:
        type: rOrd
        value: 0
      roll:
        type: roll
        value: 0.0
      rx:
        type: r
        value: 0.0
      ry:
        type: r
        value: 0.0
      rz:
        type: r
        value: 0.0
      scale:
        type: scale
        value: 1.0
      shop_materialopts:
        type: shop_materialopts
        value: 0
      shop_materialpath:
        type: shop_materialpath
        value: ''
      stdswitcher1:
        type: stdswitcher
        value: 0
      sx:
        type: s
        value: 1.0
      sy:
        type: s
        value: 1.0
      sz:
        type: s
        value: 1.0
      tdisplay:
        type: tdisplay
        value: 0
      tx:
        type: t
        value: 0.0
      ty:
        type: t
        value: 0.0
      tz:
        type: t
        value: 0.0
      uparmtype:
        type: uparmtype
        value: 1
      upx:
        type: up
        value: 0.0
      upy:
        type: up
        value: 1.0
      upz:
        type: up
        value: 0.0
      use_dcolor:
        type: use_dcolor
        value: 0
      vport_displayassubdiv:
        type: vport_displayassubdiv
        value: 0
      vport_onionskin:
        type: vport_onionskin
        value: 0
      vport_shadeopen:
        type: vport_shadeopen
        value: 0
      xOrd:
        type: xOrd
        value: 0
    user_defined:
      categories:
        type: categories
        value: ''
      folder01:
        type: folder0
        value: 0
      geo_accelattribute:
        type: geo_accelattribute
        value: accel
      geo_velocityblur:
        type: geo_velocityblur
....

Any idea why isSpare()is returning these other parameters? Ideally, I am collecting ALL the parms, and simply putting them into 2 categories. nativeand user_defined, so any help in getting the proper filter would help.

Thanks
-s

Dynamic creation of Tops nodes / connections 2021年7月22日20:05

Hey all,

Playing around with PDG. One of the big concerns for our team is to be able to dynamically create / edit node networks in a declarative, text driven way. Think ansible playbooks or other CI/CD solutions. ( yaml etc )

So far, I am able to create nodes, but connecting them seems to error out.

A brief description of what I am trying to do:
iterate over nested python dictionaries to create, connect and set parms on PDG nodes

I did a brief test as follows:

  • create a topnet
  • jump inside
  • create a pythonscript node
  • set pythonscript "Evaluate Script During" to Generate


Then paste this script in the pythonscript node script section:

# Executes a Python script, either in process or as a job
#
# The following variables and functions are available in both case:
# work_item
# intData, floatData, strData,
# intDataArray, floatDataArray, strDataArray
#
# In addition to the above, in-process scripts can also access:
# self - the current PDG node
# parent_item - the parent work item, if it exists
import hou

topnet_path = '/obj/topnet1'

# Here is my node structure
data = {'my_node_1':{'type':'pythonscript'},
'my_other_node': {'type':'pythonpartitioner'}
}

# get the topnet
topnet = hou.node(topnet_path)

# store an array of output nodes
new_nodes = []

# get the root python script node ( this node )
# this will connect it's output to the input of the created nodes
root_python_script_path = '/obj/topnet1/pythonscript1'
root_python_script_node = hou.node(root_python_script_path)

# iterate over the data
for node_name, node_data in data.items():
new_node = None

node_type = node_data.get('type')

if not topnet:
raise RuntimeError('Could not find node: {}'.format(node_type))
else:
new_node = topnet.createNode(node_type, node_name, 0)


# !!!!!!!!!!!!!! here is where it fails
if new_node:
new_node.setInput(0, root_python_script_node)

new_nodes.append(new_node)



# clean up the layout
topnet.layoutChildren()


# report back
print('\n\n')

print('Created New Nodes:')
print('~'*120)
for node in new_nodes:
print('\t"<{}>: {}"'.format(new_node.type(), new_node.path()))

print('\n')
print('~'*120)

However, when I get an
hou.OperationFailed
at the
new_node.setInput()


If I move the connection out of the loop, Houdini straight up locks and closes.

Any thoughts? I assume that the graph population is happening without updating, so the inputs are not yet available when trying to connect things.


Another thing I noticed, if I get a failure... then comment out the failed line.. and run it again... houdini will create 4 nodes. 2 for each loop. Effectively, it is internally holding onto the python data between runs.


Any help is appreciated

-s