Jump to content

Search the Community

Showing results for tags 'hom'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Lounge/General chat
    • Education
    • Jobs
  • Houdini
    • General Houdini Questions
    • Effects
    • Modeling
    • Animation & Rigging
    • Lighting & Rendering
    • Compositing
    • Games
  • 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

Found 8 results

  1. Hi everyone, I'm trying to have my Python Module in my HDA place another node right below my asset on creation. So my OnCreation script runs my python module from disk, which has the following code: pos = first_node.position() second_pos = (pos[0], pos[1] - 2) second_node.setPosition(second_pos) This does nothing. The second node is always created near (0, 0) in the network editor. But if i run those lines in the Python shell in Houdini, it works just fine. So that tells me that the OnCreated scripts don't wait for the HDA to actually be placed into the scene before running, despite what the docs say (a problem I've run into before). My solution to this was to use hdefereval to wait to run the code until the event loop was idle. This shows promises of working, but I'm running into issues now. The code I'm trying is: pos = first_node.position() second_pos = (pos[0], pos[1] - 2) hdefereval.executeDeferred("second_node.setPosition(second_pos)") but the problem here is that when it goes to execute the code, the variables no longer exist, and the code fails because "Name 'second_node' is not defined". But I use a custom 123.py script every day that has the exact line hdefereval.executeDeferred("hou.hscript(code)") where "code" is a pre-defined variable, and hdefereval has no problem using that variable when it goes to execute. So I'm not really sure what the problem is here. What is the best way to move a node using Python? (and if you know how to get my hdefereval call to work, that'd be even better!) Thanks, ~Chris
  2. Weird Behavior - createOutputNode

    I'm developing a setup using a Python SOP and came across some behavior that I cannot account for. In my example scene, you'll see that I just have a cube appended with a Python SOP. Enable the Python SOP to see what happens. Inside the Python SOP I'm just getting the parent node (the cube), then trying two different things: 1) append a transform node to the Python SOP, and 2) append a transform node to the cube. The first succeeds, the second fails due to "invalid node type name", and it spawns multiple transform nodes. Here's the code: node = hou.pwd() parent = node.parent() # This works just fine: node.createOutputNode("xform") # This fails due to "Invalid Node Type": parent.createOutputNode("xform") So the first issue is why does createOutputNode from a parent node fail? The error raised is "Invalid node type name", but that doesn't make sense because the same node type name is valid when using createOutputNode from the current node. The second issue is why do multiple transform nodes get spawned from a single createOutputNode? EDIT: Only a single transform node spawns when the parent.createOutputNode line is removed, so I believe the second issue is due to the Python SOP re-evaluating the failing code multiple times, each time spawning another successful transform node from the Python SOP. createOutputNode_example.hip
  3. Has anyone else encountered an issue with an hda python module where the OnInputChanged evaluates twice? I'm not sure what's causing it... Even simple code in the module triggers it -- eg: node = kwargs['node'] print node ^ I get two printouts of the node each time i change the input connection. I originally noticed this when I was trying to query the connected input. When I did node = kwargs['node'] input = node.inputs()[0] print input I would get an error saying the index was out of the tuple range, followed by a correct printout of the first input connection. The first eval seems to trigger before the connection is actually made, hence why it errors the first time through. Then the second eval triggers once it's connected. This is bizarre, and I haven't yet figured out what's causing it. Surely this isn't standard behavior. Anyone else seen this or have ideas as to what's causing it? Thanks, Chris
  4. Blend Node Mask Parameter

    Since I keep forgetting how to do this.... Blend nodes have a weird parameter on them called Mask - it lets you specify what combination of Tx Ty Tz Rx Ry Rz Sx Ry Rz to take from each input. this is called a "Bit Mask" and here is how to figure then out: with a default blend object in your scene (blend1) and something wired into it...anything, a null open a python shell and type: >>> bmask = (then click on the Mask 1 parameter of blend1 and drag it here) you should have this: >>> bmask = hou.parm('/obj/blend1') hit enter now type >>> bmask.eval() hit enter >>> 511 what the hell? here's how to decrypt this number if you turn OFF all the TRS of blend1/Mask1 and type the above again you'l get: >>> 0 turn ON TX >>> 1 turn OFF TX and turn ON TY >>> 2 turn OFF TY and turn ON TZ >>> 4 and so on....each one is double the one before. so how did we get 511? we ADD each one to get a total > 1 (tx) + 2 (ty) + 4 (tz) + 8 (rx) + 16 (ry) + 32 (rz) + 64 (sx) + 128 (sy) + 256 (sz) = 511 so to manipulate this parameter with HOM we can set this parameter to the TOTAL that we want. if we want TX RY and SZ we'd use: ( 1 + 16 + 256 = 273 ) bmask.set(273)
  5. Hi, I'm currently working on an asset browser implemented as a python panel using PySide. The main part of it is a QListWidget containing one items per asset. I'm trying to implement drag and drop functionality to place items directly in viewport at drop position. For dragging I'm using the itemPressed signal, which is sent by QListWidget when holding the mouse button over an item. Then I want to check if a drop is allowed on mouseMoveEvent() by traversing all viewports and checking if the mouse cursor is located inside. But can't find a way to check if the mouse cursor is over the viewport. Also I need the exact drop position when releasing the mouse button. I found this related topic http://forums.odforce.net/topic/20382-geometry-point-under-the-mouse/ and tried to adopt the first block to get the drop position in world space. For testing I just created a default Mouse CHOP and called hou.evalParm('/obj/chopnet/mouse") from withi mouseReleaseEvent(), but it always fails (the path is definetely correct) with hou.OperationFailed exception. Also calling hou.GeometryViewport.mapFromMouseChop() always fails for me, even if I just pass (0.0, 0.0). Here is some code: class AssetListWidget(QtGui.QListWidget): def __init__(self, parent=None): QtGui.QListWidget.__init__(self, parent) # doing some initialization here self.itemPressed.connect(self.onItemPressed) def onItemPressed(self, item): self.draggedItem = item # cache sceneviewers for paneTab in hou.ui.curDesktop().paneTabs(): if paneTab.type() == hou.paneTabType.SceneViewer: self.sceneViewers.append(paneTab) def mouseMoveEvent(self, ev): allowDrag = False for sceneViewer in self.sceneViewers: for viewport in sceneViewer.viewports(): try: mx, my = hou.evalParmTuple("/obj/chopnet/mouse") # always fails vx, vy = v.mapFromMouseChop(mx, my) # screen to view direction, position =v.mapToWorld(vx,vy) # view to world except hou.OperationFailed as err: print err """ try: print viewport.mapFromMouseChop(0.0, 0.0) # always fails except hou.OperationFailed as err: print err """ def mouseReleaseEvent(self, ev): # will be similiar to above QtGui.QListWidget.mouseReleaseEvent(self, ev) What am I doing wrong? How do I have to set up the Mouse CHOP properly? Does someone have a better advice for implementing this feature (if it is even possible using hom)? Thanks for any help! Best, Satara
  6. Hello, Does anybody know how to get the button parmeter's name itself using python, when the button is pressed? Thanks.
  7. Hi there, has python more or less replaced hscript? I know some things are easier to do with one or the other, So I guess I'm just asking where people are mostly using what? In the docs, it states "HOM replaces the functionality of Houdini's previous scripting solutions, the expression language and HScript." is this true? I mostly find hscript in sample scenes I download from odforce. Sorry if this is a silly question, but I'm still green to all this Thanks!
  8. Pyton Optimization

    Hi All, I was just writing a bit of python code that goes through an object and creates a dictionary of attributes and vertex indices. It works fine for small meshes(under 100k Points, but as you get bigger it inevitably gets slower. I've tracked the majority of the slowness to a couple of lines that is run many times (per vertex) attribStack[name].append(v.point().attribValue(attr)) indexStack[name].append(v.point().number()) I think this is because of how HOM is accessing the info (or better, how I am accessing the info through HOM) here is the code block : attribStack = {} indexStack = {} for attr in myGeo.pointAttribs(): if attr is not None: name = attr.name() attribStack[name] = [] indexStack[name] = [] attribStack[name].append(str(attr.dataType())+str(attr.size())) indexStack[name].append(str(attr.dataType())+str(attr.size())) for prim in myGeo.iterPrims(): for vid in xrange(prim.numVertices()): # get vertex v = prim.vertex(vid) attribStack[name].append(v.point().attribValue(attr)) indexStack[name].append(v.point().number())[/CODE] The basic things that I need to happen are : Create a list of values for each attrib Create a point index on the vertices (for shared data) Any thoughts on other ways to optimize this bit of code. perhaps I'm missing the obvious answer.
×