Jump to content

Search the Community

Showing results for tags 'dict'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Lounge/General chat
    • Education
    • Jobs
    • Marketplace
  • Houdini
    • General Houdini Questions
    • Effects
    • Modeling
    • Animation & Rigging
    • Lighting & Rendering + Solaris!
    • Compositing
    • Games
    • Tools (HDA's etc.)
  • Coders Corner
    • HDK : Houdini Development Kit
    • Scripting
    • Shaders
  • Art and Challenges
    • Finished Work
    • Work in Progress
    • VFX Challenge
    • Effects Challenge Archive
  • Systems and Other Applications
    • Other 3d Packages
    • Operating Systems
    • Hardware
    • Pipeline
  • od|force
    • Feedback, Suggestions, Bugs

Product Groups

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Skype


Name


Location


Interests

Found 1 result

  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.
×
×
  • Create New...