Jump to content

Search the Community

Showing results for tags 'python'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


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

Found 433 results

  1. Hi All, I am creating a flipbook using below python code and calling those image seq. in nuke but while importing it's colorspace is set to paintspace if I change this to sRGB then things look fine but the issue is I don't have any controls on NUKE function as it's implemented in database and works simply if i pass a image seq in it. Is there any other way I can fix issue while exporting from houdini itself. There are 2 things I came to know about it but don't know this are the actual cause of issue. Houdini Menu > Edit > ColorSetting > Colorcorrection MPlay > Colorcorrection Bar If above are the solution to fix this issue then what exactly has to be done in python way ? If above are not the solution then how to fix this issue ? flip_book_seq_path = '/u/{}/Desktop/flip.$F4.exr'.format(USER) cur_desktop = hou.ui.curDesktop() scene = cur_desktop.paneTabOfType(hou.paneTabType.SceneViewer) flip_book_options = scene.flipbookSettings().stash() flip_book_options.output(flip_book_seq_path) start_f = 1001 end_f = 1002 flip_book_options.frameRange((start_f, end_f)) flip_book_options.outputZoom(100) flip_book_options.useResolution(1) x = 1980 y = 1020 flip_book_options.resolution((x, y)) flip_book_options.cropOutMaskOverlay(1) scene.flipbook(scene.curViewport(), flip_book_options)
  2. Python Viewport NDC Transform

    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 all, I have a hard time understanding how to programmatically add values to a multiparm folder. I want to add new items to a multiparm I added on my HDA. I can see all sorts of code for multiparm template groups and how to construct and add them to a node, but hardly any code that actually adds data to the multiparm. Any pointers are greatly appreciated! Thanks, -Johan
  4. Hello, I got two specific questions in simulation right now, as they were described in title. First, I want to use python node to program a few lines of statement that could add color points on the ramp of my color nodes, since I need to add 200 points in order to give my geometry layers of different colors. (I only know the syntax of how to set node's attribute values with Python, but I did not find out the syntax that can tell the node automatically add points) Also, as my first screenshot shows, I want to know how to set values to color vector, since color parameter's name is “rampcr#rampgr#rampbr#”, I don't know how to syntax that with values and expressions. The second question is about generating a bounding box in order to delete exactly half of my volume, but I want the effect operated in the end of my network, because I want the color be set well(i.e. color changes from shell to shell of my spherical volume), and then cut it half, make the cross section of my spherical volume be seen, so that the rings of different colors could be seen more obviously~ I used a delete node as the second screenshot shows, but it did not work, it seems all my volume was disappeared, the whole volume was ghosted in the scene so that you can see what I constructed. I don't know if I set something wrong or I should use another node to achieve my final effect? It is ok if you can only solve one of my questions, I would be grateful. Thanks a lot in advance!
  5. Hey guys! Once again, I have to seek out your precious help ^.^ I am currently creating my own asset browser and I am working on feeding assets from Houdini into the library. So far, everything was going pretty smoothly up until I got stuck with something that seems so simple: the frameSelected() function of the hou.GeometryViewport class. When I use the Python shell inside Houdini and do this, it is working correctly: import toolutils viewer = toolutils.sceneViewer() view = viewer.curViewport() node = hou.node('/obj/geo1/DZK_Asset_Export') node.setCurrent(True,True) view.frameSelected() My section in the HDA is not. Broken down to the essential part (with hard coded selection of node as above for the sake of the example): import toolutils viewer = toolutils.sceneViewer() view = viewer.curViewport() [...] cam = obj_level.createNode('cam', 'asset_cam') node = hou.node('/obj/geo1/DZK_Asset_Export') node.setCurrent(True,True) view.frameSelected() view.saveViewToCamera(cam) view.setCamera(cam) All the other functions work as expected (lockCameraToView, saveViewToCamera, setCamera all work fine). I only have trouble with frameSelected(), even when adding the code from the shell to my script, basically hard coding selecting the correct node. After running my export process which does not frame the view, I can go to the shell and call frameSelected() and from there it works again :/ I also have sections where I first set the camera, lock the view, then try framing but it is the same result: all working, except the framing. I wonder what I am doing wrong in my code and hope you can help me out. Any pointers, comments are greatly appreciated!
  6. Heyya, I'm currently developing our project-internal filecache node with a couple of fancy features for usability / productivity. The current workflow is starting a seperate Houdini instance with Juraj Tomori's Tool here: Background Render Now I also wrote a couple of scripts that update the progress of the currently ongoing cache by analyzing the output directory and showing the progress. (as well as some info on the output like time per frame and size). [This was primarily developed for the use within a TOPs-Render network, however, the background process variant turned out to be much superior for a variety of reasons.] Now what I built was a script in a seperate TOP-Network which is supposed to execute this analysis every couple of seconds for a given amount of time using the time.sleep(t) function. Now usually this does exactly what I want, keeping this process/sleeping in the BG and execute the analysis function while Houdini stays functional. However, the problem is that sometimes (quite unpredictably, but mostly when aborting/refreshing this TOP-network) this sleeping switches to the foreground, causing Houdini to freeze for however long the ticker was set. And this is game-breaking when you sometimes have to wait for five minutes. You get the point. Here is the (admittedly clumsy) bulk of code: import time import hou import os PARENT = hou.node("../../..") ticker_s = PARENT.parmTuple("ticker_s").eval() break_at_end = 0 node = hou.node("../../../mnp_cacher") fstart = node.parm("f1").eval() fend = node.parm("f2").eval() totalframes = int(fend - fstart) dir = PARENT.parm("outputfile").eval() dir = os.path.dirname(dir) def outputchecker(dur=20, tick=1, confirm=1): iterations = dur / tick warning_message = "Starting updateticker for {} seconds.".format(dur) if hou.ui.displayConfirmation( warning_message ): i=0 while i < iterations: i += 1 #print "Iteration: " + str(i) #SCAN OUTDIR LOCAL CODE ---------------------------- counter = 0; duration_list = [0] folder_size = 0 for (path, dirs, files) in os.walk(dir): for file in files: if ".hip" in file: #exception for backup #print str(counter) + ": SKIPPING" continue filename = os.path.join(path, file) folder_size += os.path.getsize(filename) # --- GET FOLDER SIZE mytime = os.path.getmtime(filename) # --- GET CACHE TIME counter += 1 if counter==1: counter #print str(counter) + ": EXCEPT" else: prevtime = os.path.getmtime(filename_prev) myduration = mytime - prevtime #print str(counter) + " - " + str(mydur) if myduration > 0: duration_list.append(myduration) filename_prev = filename #------------------------------------------------------------- scan end frame = fstart + (counter-1) allframes = fend-fstart curframes = frame-fstart progress = curframes/allframes percent = "{:.0%}".format(progress) # ----- SCAN OUTDIR AND UPDATE COMMENT scan = PARENT.hdaModule().scan_outdir(dir, 1) #print message running_message = "" running_message = "CACHING: {} (Fr.: {} / {})\n".format(percent, int(frame), int(fend)) running_message += scan running_message += " [Update Ticker: {} / {}]\n".format(i, iterations) PARENT.setComment(running_message) time.sleep(tick) outputchecker(ticker_s[0], ticker_s[1]) This looks something like this if executed properly, and I've fallen in love with the info I get from this: Now what I don't get is why this sleeping switches to the FG-process of Houdini. The python-script-TOP is set to evaluate In-Process, but when executing cleanly, it works in the BG nicely. I'm grateful for any clue or alternative approach. Thanks, Martin
  7. In order to write code in SOP python node, do I need to have a python software in my local computer? Because I tried to write some code in python node to import my data files, it seemed not working. What I have coded is attached. Thanks!!
  8. Get polygon and normals in Python

    Hey all- I have a simulation running that is controlling the position and orientation of a grid that comprises just a single square polygon. Trying to use python to output the normal and center point of that grid. I can access the first hou.Prim, but I can't figure out how to get the polygon to get the normal. How do I do that? Thanks! Dave
  9. Un-hide Nodes

    Hey guys! Sharing a simple tool to reveal hidden/deprecated houdini nodes, incase you need them or just miss them. It's free, hope you find it useful. cheers! Use with caution, some nodes might make your scene unstable! https://gitlab.com/kishenpj/unhide_nodes
  10. Hi folks, i have a Python Processor with 5 work items and i would like to create a dependencies based on a attribute WorkItemID that increase for each work item. How can i create dependency to cook those work items exactly in the order that i want and not in parallel ? Thanks in advance
  11. Hey guys (and gals)! I'm working on a small project to simulate max style auto backups for Houdini wrapped up in an HDA. For this HDA I have a few functions in the python module that need to be able to read the values of the parameters of the HDA, like a string field where the user can say where to place the auto backups, determine the auto save intervals etc. However I am having some issues reading the parm values. So far I've been trying the normal method of first getting a referance to the node itself and then running: node = hou.node('.') node.parm('parmname').eval() However this is proving to be very unreliable, whenever I save and match definition the hda this approach no longer seems to work and I immediately get errors indicating that the first line trying to get a reference to the node returns none/NoneType. I have even tried to define it with a full path to the node like such: node = hou.node('/obj/autosaver1') But it still seems to encounter the same issue. I have seen some mentions of other methods but I am not really sure I fully get how they work. Any advice on the best and most reliable approach to getting the values from the different parameters of an HDA from within the python module? Thanks for the read! Stay safe out there!
  12. Python - Select Folder?

    Hi! I'm writing a shelf tool that allows users on Linux to search a directory and its sub-directories for a certain file-type / keyword. To do this I've used a readMultiInput like below - start_popup = hou.ui.readMultiInput(start_message, ("Path to Search", "File to Look For"), initial_contents=(home_dir, ".exr"), title="File Finder", buttons=('OK', 'Cancel'), default_choice=0, close_choice=1) In this version of the script, users need to manually type in / paste the directory they want to search, but I'd like for there to be a pop-up dialog allowing users to select a folder, the same way hou.ui.selectFile() allows you to select a file. Is there a way to do this?
  13. hotkey combined with ctrl

    hi - while writing a python script i run into a problem: with kwargs['shiftclick'] I can recognize if a shelf tool was activated by clicking in combination with the ctrl key - so by clicking on it in the shelf tool but is there a way to recognize if the script was activated by ctrl and its HOTKEY? thank you for any information about that!
  14. Hi guys, I'm currently experimenting with packages for setting up Houdini's environment variables. Is there a way to update the HOUDINI_PACKAGE_DIR while Houdini is already open or do the packages only get scanned during startup? It looks like the packages don't get processed if I just change the HOUDINI_PACKAGE_DIR from inside Houdini via hou.putenv() or hou.hscript('setenv …'). What I'm practically trying to do: I'd like to switch project specific packages with the corresponding env variables being updated when the user opens a file that's located in another project. I also actually don't want to relaunch Houdini. I guess another more basic way would be to just set all the variables being inside the package manually in the 456.py?! Thanks for your help! Michael
  15. Hi everyone, I'm very new to hscript and python, I just started learning it very recently. I'm trying to add a Pre-Render Script in a rop geometry output in Python. I could do it with hscript with: opparm -C /obj/geo1/ray1 method project I'm trying to find a command that would do the same thing with opparm -C in Python. So far, i only found .pressButton(), which isn't exactly what I need. Please help and thank you very much in advance. Phiphat
  16. Hi folks, I am actually coding some basic operators like divergence, gradient in vex and python to demistify them and wanted to share the file with you. Feel free to update or correct the file since i might not be sure of some operators. it contains : - Divergence (voxel and points) - Gradient (voxel and points) - Curl (voxel) : the curl seems to not have the same order as vdb curl so still in wip - Laplacian (voxel) : The computed laplacian is somehow less precise than vdb laplacian - Covariance matrix and eigen vectors (points) : It works but the scale is normalize - Laplacian matrix of a mesh (python) - Bernstein polynomials basic_operators_001.hiplc
  17. Python 3

    Is there any way to use python 3 in Houdini. I tried to use different packages in Houdini, for example, the discord API. All my python scrips work fine on their own. But if I try to use them in Houdini, I get a lot of errors. I assume it happens because of oft pyhon2.7. But I'm not 100% sure cause I'm quite new to python in Houdini. Hope anybody can give me some advice
  18. Hi, Is it possible to set up the normals of these points procedurally using vex or python? I just set point attribute to every point with vex, but could I make it more procedural if I had more or less points, for example?
  19. Hi people, I had some code which I was running to find the rendered image in the "Render View" pane and save it to file. _desktop = hou.ui.curDesktop() _ipr = _desktop.paneTabOfType(hou.paneTabType.IPRViewer) _ipr.saveFrame(_file) This was running fine in Houdini 17. However, since updating to Houdini 18 (I'm using 18.0.440), the desktop object seems like it can't find the IPR pane, the paneTabOfType method is returning None. Anyone have any ideas what I can do to get this working? Thanks, Henry
  20. Hi all; I seem to be having a strange issue where I create a button on a null that is suppose to be a control system for a paint node; however, the button does not select the paint node. I have tried to use callback scripts by using a function like hou.cd("../path to the node") however I'm not getting any results and the button is not activating I'm not sure what is happening?. I appreciate all help anyone has to offer & I'm going to link the file that is isolating the issue underneath if anyone would like to take a look at it thanks. Kind Regards Rusty.M A simplified HIP file version of the same issue: cd_Button.hipnc
  21. Hi. I want to select all the parent nodes of the selected node. For example, if you select null3 and click the Python shelf, the parent node null2 is selected, and if you press the Python shelf again, the parent node above it is selected, and all the parent nodes are selected. Please refer to the image. Please check my script. Thank you. node = hou.selectedNodes()[0] b= node.inputs()[0] b.setSelected(True)
  22. Hi. Is there any python code to move the node with the arrow keys? Or have you seen it? I am wordering if i can move the node with the arrow keys. Please share any way you know. Thank you.
  23. Hi, Can a viewport (presp) transformation be stored and later restored back again. I was searching for the memory toolbars in python but I could not find. Thanks G
  24. Modeler 2020

    Product link: https://gum.co/KYCgR What's new: 1. The Modeler core has been completely rewritten. Performance, stability and UX are improved. 2. A hotkey system has been created. Hotkeys are now configured in a separate editor (Hotkeys shelf tool). The editor allows you to quickly configure keyboard and mouse shortcuts. Unlike other modeling programs, you can now associate any tool with any combination of keys or mouse actions. In a similar way, the mouse and keyboard are configured in Nevercenter Silo, but unlike Silo, there are no restrictions here. That is, you can assign absolutely any tool to the mouse. On the other hand, mouse tools such as interactive selection can also be assigned to keyboard shortcuts. Also, unlike the standard Houdini behavior in Modeler, you can use the additional two mouse keys X1 and X2 (Ctrl+X1, Shift+Ctrl+X2 etc). The Hotkeys editor has two default mouse layouts: 1. Standard - that works just like DM and the previous Modeler version - LMB to select items and MMB to drag them 2. Pro - which allows us to select geometry components with RMB and drag with LMB. MMB used to select invisible items too. 3. The interactive state system (add-on for Python States) has been rewritten from scratch. Many tools have become more interactive and have the ability to customize the node in the viewport. In addition, you can quickly create custom interactive python tools for your own HDAs. The mouse wheel now works more universally. In many nodes, the wheel allows you to change the Uniform Scale parameter. List of nodes that now use state tools: Soft Boolean, Insert Mesh, QPrimitive, Array, Hose, Bevel, Extrude, Bridge, Set Flow, Smooth Points, Thickness, View Deform. 4. Retopology tools (Topo category) have been redesigned. TopoDraw tool (Alt+A) allows you to quickly draw poly patches on the reference geometry. It has an ability to snap to existing geometry. Topo mode (Alt+T) now packs the reference model. This speeds up the entire process of retopology with millions of faces. The Push tool now works in the Topo mode, which allows you to get the desired result even faster. In addition, the Push tool has improved performance and stability. 5. The Insert Mesh SOP was redone from scratch. It has interactive tuning, better performance, and more accurate results thanks to improved normals. 6. The Deform menu was merged with the Align menu and renamed to Transform Menu (Z). 7. The Relax tool renamed to Smooth. The tool is completely redesigned and takes advantage of Python States. Using the Smooth tool, you can smooth points or polygons in a standard way. On the other hand, the edges are smoothed as separate curves. Combined with interactive enhancements, the tool allows you to quickly fix messy areas. 8. Tools that create modeling nodes were removed from the Modeler shelf. Only general tools are now on the shelf. Direct modeling tools are now called from the Modeler mode. Added shelf tools: Delete Node, Merge Nodes, Stash History, Pack History, Clean History и Delete Attribs 9. Added a new tool Repeat Node Parms that allows you to apply settings from previously created nodes of the current tree 10. ToolsPanel (spacebar) renamed to Launcher. Launcher tools have been re-sorted and have a new Mouse section for interactive tools like selection or dragging 11. For Bevel, Bridge, Extrude and Smooth tools separate nodes were created 12. Bevel, Extrude, Inset, Smooth, Thickness hotkeys can work as sticky keys. That is, the call of a hotkey, for example, of the Extrude tool, leads to an instant change of the extrusion value before releasing the key. 13. Added Inset tool that uses Extrude SOP. In contrast to the Extrude tool, the first time you start Inset, you can change the inset with LMB. 14. The Lattice tool removed. It is now replaced by improved View 4 and View 9 (View Deform) from the Transform menu (Z) 15. Tools for a quick preview of the subdivided geometry were created: Preview Subdivide (Alt+1) и Preview Subdivide Wire (Alt+2). Standard viewport subdivision and instance subdivision (Symmetrize Tool) ar assigned to Alt+3 и Alt+4 respectivelly. 16. Select By Normals mode (6) allows you to select components based on normals 17. Local transformation tools have been added to the Transform menu: Local Move, Local Rotate и Local Scale 18. An Extend (Y) tool. This add-on to the Extrude tool allows you to quickly extrude edges and polygons using handles. 19. The Bridge Connected tool returned from the DM package 20. Slice, Clip and Mirror tools have the ability to set the initial origin based on points selection center 21. On the next call, the Delete tool changes the node so that it deletes unselected geometry. 22. The KitBash tool now offers to automatically create a KitBash panel if it is not created 23. Shift+Double Click can now replace the geometry of the current Insert Mesh SOP with the geometry from the KitBash panel 24. Combine and Boolean now offer to select nodes at the object level if the tool was launched inside the SOP container 25. Set Flow creates more accurate geometry in unusual situations. 26. Added a Point Weld tool (Alt+W) for interactive point stitching 27. The Soft Boolean SOP can be configured interactively. It also has a slightly improved performance. 28. Collapse History (Left) renamed to Pack History 29. Many tools are assigned to new hotkeys. The ToggleCompass tool is now called with the Backspace key. 30. The Edit Mesh shelf tool now renamed to Modeler 31. Modeler now moved to the package Houdini system instead of using houdini.env
  25. Hi, I'm new here and new to Houdini so my question may be dumb. I'm building my digital assets using some python scripts and so far everything is going pretty well. However, I can't find a way to specify the "Maximum Outputs" number of my (LOP) digital asset, using the API. In fact, I'd like to see no output at all, similar to a rop_geometry SOP or a usd_rop LOP. The minimum and maximum number of inputs are easily customizable, but not the maximum number of outputs, which however is accessible in the "Basic" tab of the "Operator type properties" window. I also did some research on the HDASection and HDAOptions side, without success. Maybe I missed something. Any ideas? Thanks