Jump to content

Search the Community

Showing results for tags 'hom'.

  • 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 13 results

  1. According to https://www.sidefx.com/docs/houdini/hom/tool_script.html: Ok, so stateutils is the more high-level API, unlike toolutils/soputils/doputils, right? So where is the documents for stateutils?
  2. Hey, I am currently building an HDA with python viewer states and I want to display an image/grid in the upper left corner of the viewport. This is what I currently use to move the grid to the current viewport postion. viewport = hou.ui.curDesktop().paneTabOfType(hou.paneTabType.SceneViewer).curViewport() cam = viewport.viewTransform() hou.parmTuple('/obj/geo1/transform1/t').set(cam.extractTranslates()) hou.parmTuple('/obj/geo1/transform1/r').set(cam.extractRotates()) I also transform the grid in the negative z direction afterwards. This results in the image beeing in the center of the viewport. But I'm not sure how I can move the image to the corner of the viewport and keep it in the correct postion when the viewport is beeing resized. Maybe with the viewport.viewportToNDCTransform() or viewport.mapToWorld() methods. But I couldnt figure out how. I found a promising vex based result here:https://youtu.be/7UuVhbTRcew?t=1890 string cam = chs("camera"); vector bb = relbbox(0,@P); vector4 crop = chp("crop"); bb.x = fit(bb.x, 0, 1, crop.x, crop.y); bb.y = fit(bb.y, 0, 1, crop.z, crop.w); bb.z = chf("zoffset"); @P = fromNDC(cam,bb); But this one requires a camera node and I'd rather have this logic in the python states if possible. Thanks
  3. Hi there, Has anyone had any success with importing the hou module from python in a shell on macOS? I am currently running Mojave 10.14.1 with stock python 2.7.10 (fresh OS install) on my laptop, and have not been able to get it up and running. I found a couple of threads related to it from a few years ago suggesting it's not possible, but I sort of figured it would be mentioned in the docs that it's incompatible on macOS. So maybe I'm missing something? Python 2.7.10 (default, Aug 17 2018, 17:41:52) [GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.0.42)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import hou dyld: warning, LC_RPATH $ORIGIN/. in /Applications/Houdini/Houdini17.0.352/Frameworks/Houdini.framework/Versions/Current/Libraries/libopenvdb_sesi.dylib being ignored in restricted program because it is a relative path dyld: warning, LC_RPATH $ORIGIN/. in /Applications/Houdini/Houdini17.0.352/Frameworks/Houdini.framework/Versions/Current/Libraries/libopenvdb_sesi.dylib being ignored in restricted program because it is a relative path dyld: warning, LC_RPATH $ORIGIN/. in /Applications/Houdini/Houdini17.0.352/Frameworks/Houdini.framework/Versions/Current/Libraries/libopenvdb_sesi.dylib being ignored in restricted program because it is a relative path dyld: warning, LC_RPATH $ORIGIN/. in /Applications/Houdini/Houdini17.0.352/Frameworks/Houdini.framework/Versions/Current/Libraries/libopenvdb_sesi.dylib being ignored in restricted program because it is a relative path dyld: warning, LC_RPATH $ORIGIN/. in /Applications/Houdini/Houdini17.0.352/Frameworks/Houdini.framework/Versions/Current/Libraries/libopenvdb_sesi.dylib being ignored in restricted program because it is a relative path dyld: warning, LC_RPATH $ORIGIN in /Applications/Houdini/Houdini17.0.352/Frameworks/Houdini.framework/Versions/Current/Libraries/./libblosc.1.dylib being ignored in restricted program because it is a relative path dyld: warning, LC_RPATH $ORIGIN in /Applications/Houdini/Houdini17.0.352/Frameworks/Houdini.framework/Versions/Current/Libraries/libblosc.dylib being ignored in restricted program because it is a relative path Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Applications/Houdini/Current/Frameworks/Houdini.framework/Versions/Current/Resources/houdini/python2.7libs/hou.py", line 19, in <module> import _hou ImportError: dlopen(/Applications/Houdini/Current/Frameworks/Houdini.framework/Versions/Current/Resources/houdini/python2.7libs/_hou.so, 2): Library not loaded: /Users/prisms/builder-new/WeeklyDevToolsHEAD/dev_tools/local/lib/libz.1.dylib Referenced from: /Applications/Houdini/Houdini17.0.352/Frameworks/Houdini.framework/Versions/Current/Libraries/libAlembic_sidefx.1.7.9.dylib Reason: image not found According to the docs, you need to import DLFCN sys.setdlopenflags(old_dlopen_flags | DLFCN.RTLD_GLOBAL) But there is no DLFCN module for macOS. Python docs suggest generating DLFCN if it's not available, though /usr/include does not exist. I'm not really familiar with these dl related commands. I found this link and tried to just manually replace DLFCN.RTLD_GLOBAL to -1, which got rid of a lot of errors except Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Applications/Houdini/Current/Frameworks/Houdini.framework/Versions/Current/Resources/houdini/python2.7libs/hou.py", line 19, in <module> import _hou ImportError: image not already loaded I also tried the otool steps here which did not seem to change anything. Not really sure where to go from here. Thanks!!
  4. in hython I don't know what are scriptargs. I found reference to kwargs, but scriptags remain enigma
  5. 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
  6. Hey guys, I was wondering if anybody is familiar with using the hou.node.setDeleteScript() method. In the docs, the language arg is set to Python: setDeleteScript(script_text, language=hou.scriptLanguage.Python) But when running the following code, I get an error n = hou.node('/obj/geo1') cmd = 'x = 5; print x' n.setDeleteScript(cmd) OperationFailed: The attempted operation failed. Python is not yet supported in deletion scripts. Just passing an empty string gives the same error. When trying to set the language flag to Hscript with n.setDeleteScript('setenv x = "hello"', language=hou.scriptLanguage.Hscript) It raises another error TypeError: setDeleteScript() got an unexpected keyword argument 'language' Is there something I'm missing? I would normally create an HDA and use the built in 'On Deleted' call and run my code there, but for this particular case I'm unable to use an HDA. I was able to find this function all the way back in the Houdini 12 docs. Is it still not usable? Thanks!
  7. 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
  8. 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
  9. 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)
  10. 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
  11. Hello, Does anybody know how to get the button parmeter's name itself using python, when the button is pressed? Thanks.
  12. 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!
  13. 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.
×
×
  • Create New...