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


Forums

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

  1. Hey All, I'm trying to customize a python settings.json file with int, float, bool, and sting values set up on a Null control with parameter sliders. I've read in the initial file I want to modify with a Json file, and have matched all the tags with the slider controls. I'm then collecting the tags into an array called query and trying to replace the original values in the .json with the slider control values. This is what I have so far (python novice), but I feel like there is a more solid way to do this. I know I'm not actually storing any files or values, I'm just printing to console for now import hou parentstr = '/obj/geo1/null1' query = work_item.stringAttribArray("query") vars = {} for q in query: parmstr = parentstr + "/" + q transval = hou.parm(parmstr).eval() vars[q] = transval if isinstance(vars[q], str): strv ='"'+q+'"'+':'+'"'+vars[q]+'"' print(strv) else: strv = '"'+q+'"'+":"+str(vars[q]) print(strv) There's also one section "animation_prompts" that goes one level deeper and would need some sort of formatting love where I need to indent and put in a few other lines. Thanks in advance! -Dana
  2. I have a custom pyqt ui with a list widget in it. I'd like that list widget to update if the user changes context in the network view. e.g. from object to SOP to ROP (Driver) etc. I believe I can utilise the ContextEvent handler but I don't know how to initiate it. Can anyone help me out or point me to a script I can dissect? https://www.sidefx.com/docs/houdini/hom/network.html I briefly flirted with the pypanel nodepath hook but ideally I'd like to run this from a toolshelf too. https://www.sidefx.com/docs/houdini/examples/python_panels/nodepath.html
  3. I am trying to get createModuleFromSection() in the Python module in an HDA I am developing. It can't find the module. I am less than a python noob thus struggling. I have a modified nodegraphvellumutils.py (which works perfectly) renamed as PythonSubmod.py and I want to attach it to the HDA then call it from the PythonModule. import toolutils submod = toolutils.createModuleFromSection("submod", kwargs["type"], "PythonSubmod.py") # Add network editor hooks if hou.isUIAvailable(): from submod import setSelectPosContextData, isPassThroughConnection, createEventHandler def isVellumNode(): return True test_PythonModule.hda
  4. Hi Masters of Houdini ! Is there a solution of checking of all node parameters change made in HIP file from the very begining like a log of changes ? Is there a chance to see the undo data ? Thanks in Advance ! Szabolcs
  5. Hi Masters of Houdini ! Is there a solution of checking of node parameters change made in HIP file from the very begining like a log of changes ? Thanks in Advance ! Szabolcs
  6. Python - custom ui popup window

    i making a shelf tool and i'd like to have a popup window with a custom interface appear. is this possible? i'd like to have a node selector, a directory selector and a dropdown can't seem to find any info on custom ui from SideFX documentation
  7. Hi !! Is there a way to replace 'Geometry' text at the Network Editor ? Cheers, Szabolcs
  8. Houdini.School | Attributes

    New Houdini class on Attributes. Enroll now: https://bit.ly/houdiniattributesclass Teaser: https://vimeo.com/714350608 Attributes are the heart and soul of Houdini. So many beginners and even intermediate users stumble over the importance of knowing the in and outs of Attributes. Understanding this topic is vital to getting the most out of Houdini itself. My goal is to give you a much deeper understanding of Attributes, so I have broken down this class into smaller topics. This way I can take you step by step from the core geometry component foundations, to common workflows, as well as reading & writing attributes from scratch. I'll also take you through examples of actual attribute implementations relating to RBD, FLIP, VELLUM, Crowd sim, and show some Viewport GL attributes. In session 1 you will be shown the core geometry components and how they relate to attributes. You'll also be given some clarity on confusing terminology, plus learn what attribute classes, and types you have available. Also covered will be a full explanation of the Geometry Spreadsheet, plus some tips on how you can sort through all of the data that it presents. I'll run you through what intrinisics are, how they can be accessed, and also explain what attributes are NOT, which is just as important as knowing what they are. In session 2 I will teach you the many different ways that attributes can be created, plus the the ways you can read those attributes back into your node streams. I will also take you through the world of Attributes versus variables, global versus local, and explain the reasoning and history of dollar sign versus the at symbol. In session 3, I'll focus solely on attribute usage in a variety of simulation setups. Showing you some implementation methods for simulation attributes. Houdini comes packed with a lot of native attributes already built in. I've gone ahead and collected together a massive list of well over 8,000 of them for you in PDF form. This course is aimed at getting beginners up and running with Attributes, but I will be taking you into intermediate territory fairly quickly as it's required to get a full understanding of Attributes. There WILL be discussions of VOPs, VEX, HScript, and Python in the second session. Don't worry though, because I will also be showing you many of the native SOP attribute nodes which simplify many common tasks for non-coders. I've packed a lot of information into this class, so even if you are an intermediate user to begin with, there is still plenty of good info for you as well. For more info and to enroll, head over to Houdini.School today.
  9. Hi, I'd need to customize the behaviour of the default buttons of some nodes, e.g. - display a custom message when I press "Save to Disk" on a rop_alembic. Also, I want the script to run for all the users in my studio. Maybe should I create a preset from this and save it in the shared HOUDINI_PATH? Beyond the fact I'm not sure how to do it on a custom buttom I may create in the parameter interface, all the default parameters are locked. Can someone help me? thanks
  10. Do I need to Learn Python?

    Hi All, Do I need to learn Python to become a Houdini developer? If yes, what are some resources from which I can learn python programming?
  11. Hey Everyone has anyone used hou.hotkeys ? I've made a tool and would like to have a shortcut assigned to it when its loaded. I can create a shelf and add tools to it through python with the hou.shelves library. But assigning a shortcut to the tool is . I tried to understand how the shortcut was assigned to the tool by doing it manually. For example Ctrl + Alt + Shift + T to the tool called My Custom Tool Then I was curious to find what the hotkey symbol the tool was using hou.hotkeys.hotkeySymbol. The examples of the documentation show a strict dot notation but running this command will return something along these lines with a colon ? >>> hou.hotkeys.hotkeySymbol("Houdini/My Custom Tool") h.tools:my_custom_tool Regardless, with that info, trying to assign this through python seemed to work. The edit tool window will register and show the assignment, as well as the HotKey Manager. However pressing the shortcut doesn't work and doesn't trigger the tool code hou.hotkeys.addCommand("h.tool:my_custom_tool","My Custom Tool", "This is a custom tool") hou.hotkeys.addAssignment("h.tool:my_custom_tool","Alt+Ctrl+Shift+T") Weird behaviour is deleting the shortcut in the Hotkey manager and reassigning it doesn't work either. I need to manually run hou.hotkeys.removeHotkeySymbol("h.tool:my_custom_tool") for it to work again when setting it through the Hotkey Editor manually. It seems the hou.hotkeys.addCommand is missing something ? its not linking to the command to the tool correctly to the shortcut even though visually in the Hotkey editor and the edit tool window hotkeys tab shows properly. Did anyone face this issue ? Is this how we assign hotkeys to a tool through python ?
  12. Launch gplay using on linux

    I'm not able to launch gplay from python script with QtCore.QProcess() agent = QtCore.QProcess() agent.start("gplay", [name]) initial Qt widget is working fine but when i try to load the selected geometry file in gplay nothing happens. I'm not sure what went wrong. note:I'm working on a linux machine and using python 2.7. Thanks in advance.
  13. Set quickmarks via python

    Hey everyone! Like the title suggests I am trying to find a way to set quickmarks in Houdini via python (or if it is considerably easier to do via hscript I am totally open to doing it there as well). So far I've come across the "nodegraphview" module with it's "Quickmark", "createQuickMark" and "setQuickMark" functions but that's about as far as I have gotten. The documentation I've been able to find here is a little bit too sparse for my skill level. Mostly I am unsure of/confused about what the function wants as its inputs, as it is only listed by variable names with no further description. What does 'net' mean? Or 'bounds', or 'items'? This is what I have tried so far just to test and see what error messages I got which I hoped could lead me towards what to google for (Yeah the empty string are there just because I have no idea what to put there): import nodegraphview as view net = hou.ui.currentPaneTabs()[0] qmark = view.QuickMark(net, '', '', hou.node('/obj')) view.setQuickMark(8, qmark) And this is the error I got: AttributeError: 'NetworkEditor' object has no attribute 'isSelected' Has anyone out there done this before and could give me some tips or know of any more in depth documentations about how to use this module and these functions? Thank you so much for your time!
  14. Python Performance Issues

    So I am working on a project which is requiring me to extract the point numbers from an arbitrary polygonal object. The most pythonic way to do what I am trying to do is this: geo = hou.Geometry() geo.loadFromFile(path/to/my/file.bgeo.sc) primPoints = [[pt.number() for pt in pr.points()] for pr in geo.prims()] I need to maintain the winding order and get it down to just the ints for the point numbers. I have profiled every function in this, and hou.Prim.points() is god awful slow, taking up 16 of 22 seconds on a 1.5M poly, 800k point file. I am trying to find a way to circumvent hou.Prim.points() but nothing is jumping out to me. I have even moved everything into Pandas, which does make working with the data and doing further transformations easier, but I have not gotten any performance increases as it still relies on calling hou.Prim.points() for every primitive. I have contemplated trying to use hou.Geometry.points() and calling hou.Point.prims() to go at it from the other direction, thinking that it might save me some time since the list of points is always shorter than the list of prims, but it loses the winding order, which I need for my use case. Said use case is parsing cached geometry into a custom format for optimized use elsewhere. I have been able to get the performance up to snuff on just about everything else, and will save even more time on later steps thanks to Pandas data management, but this singular step is so sluggish that it just about tanks the whole project. Literally everything else in the pipeline that I am developing is under 4-5 seconds/frame for huge geometry volumes in the pre-process step (which this is part of) and the final end of the process is so fast I'm not even going to talk about it. Literally just this is bogging things down in an untenable way. Pandas code for reference: import pandas as pd geo = hou.Geometry() geo.loadFromFile(path/to/my/file.bgeo.sc) primsSeries = pd.Series(data=geo.prims()) primsSeries = primsSeries.apply(hou.Prim.points) primsSeries = primsSeries.apply(lambda x: list(map(hou.Point.number, x))) The two take virtually identical amounts of time with the pure pythonic one being a couple seconds faster because it is doing the hou.Point.number in the same step as the list generation, whereas the Pandas code currently does it as a secondary step. I'm sure I could include it in the hou.Prim.points apply, but this was mostly separated for profiling to see where all of my speed was going. Does anyone out there have any idea how to bypass hou.Prim.points in this process in favor of something faster or am I 100% stuck?
  15. I have an HDA with a parameter that allows users to return a selection from the viewport (same type of parameter used on blast nodes etc.). I have a callback script that I want to run whenever the artist makes a selection, however, the script only seems to execute when the string portion of the parameter is edited. For example if I manually type the name of an object into the parameter the callback script executes as expected, but if I use the arrow button to select the objects in the viewport and hit enter to confirm my selection the callback script is not executed. This obviously isn't very useful or intuitive for artists. Does anyone have any workarounds or suggestions on how to get this functioning the way one would expect it to?
  16. PDG index sorting

    Hello; I'm just getting into PDG and have an interesting problem I'm trying to solve. I have a list of files that I'm trying to sort using PDG. The files are labelled x0y0,x0y1,x0y2.....x7y7. When I load them with the "filepattern" TOP, it sorts them as x0y0, x0y1, x0y2, x0y3 etc. Instead, I would like to re-sort them as x0y0,x1y0,x2y0,x3y0,x4y0 ..... x0y1,x1y1,x2y1,x3y1,x4y1 etc. What would be the best approach for this? Any python algorithm that may be suitable for this that can be executed in TOPS? Maybe a feedback loop?
  17. Return Item name of ordered Menu

    Hi, I have been struggling with this for the past 2 days. I need help in returning the name of the selected item in an ordered menu. What I am trying to achieve is to dynamically populate the ordered menu with the list of projects via menu scrip (python) import os path="k:/Projects/" dirList = os.listdir(path) dirs = [] for dirName in dirList: fullPath = os.path.normpath(os.path.join(path, dirName)) if os.path.isdir(fullPath): #dirs += [fullPath, dirName] dirs += [dirName, dirName] return dirs This code scans for folders in directory(k:/Projects/) and lists them in the menu. All works fine till here. Now I need to return the name value of the selected menu item from another parameter. So I have tried this listItemName = hou.pwd().parm("parmList_Projects").eval() and this listItemName = hou.pwd().parm("parmList_Projects").evalAsString() but it returns only integer values from (0,1,2,...) How can I get the name or label value ?
  18. Hi all, Is there a way I can use a shelf tool python script to select a joint in the rig tree window pane when I have a rig pose SOP selected?
  19. So it seems the only way to procedurally expand all the variants is using the explore variants LOP. The problem I get when using this is that the file I am exploring variants on which Is brought in using a reference LOP gets an error of not having a save path and it defaults to creating a new usd file for the layer instead of reading the one from the reference LOP. I tried to look inside the network and noticed the reference lop there is what was causing the problems, but it was too complicated for me to fix. I tried just bypassing the reference LOP inside the network which worked but then I get the default prim name "/__variants" set in the python script and I was not able to make any changes to the primName variable without getting invalid null prim error. Please help! Edit: I realize after messing around a bit more that the reference LOP causes the separate USD file to be written out whereas other methods like extracting the variants manually or using a stage manager use write out the same data but inside the final usd layer from the usd rop. So basically I am just wondering how to procedurally get all variant prims to use for point instancing since the explore variants method that is often shown does not appear ideal.
  20. Hi, I have found how to set the template flag ( setGenericFlag( hou.nodeFlag.Termplate ) but how the shaded template could be set ( click on the flag with CTRL ) ? I see all the flags but I could not figure out what that is .. Thx, G
  21. Hi, I have found how to set the template flag ( setGenericFlag( hou.nodeFlag.Termplate ) but how the shaded template could be set ( click on the flag with CTRL ) ? I see all the flags but I could not figure out what that is .. Thx, G
  22. Hi There, I'm trying to grab all attributes on the current work item in TOP and assign them to points in SOP. I wrote a python script and it works fine in SOP lively but I'm getting an error or crush when I kick off ROP Geometry Output TOP. I used python approach because I have several attributes to transfer and the attributes can be changed in the future so I'd like to avoid using @xxxx with hardcoded attribute names in SOP. It would be great to have some suggestions. Thanks you ~
  23. Hello, When I copy and run the following code in a python sop node, editor = hou.ui.paneTabOfType(hou.paneTabType.NetworkEditor) image = hou.NetworkImage() image.setPath('$HFS/houdini/pic/Mandril.pic') image.setRect(hou.BoundingRect(0, 0, 5, 5)) editor.setBackgroundImages([image]) (which can be found here in the sideFX documentation: https://www.sidefx.com/docs/houdini/hom/hou/NetworkImage.html ) it does indeed create the background image in the network editor. However, should you change context and then go back to the sop context where you created the background image (example: /obj/geo/python >>> /out >>> /obj/geo/python), it will have disappeared. This doesn't happen when creating the background image through the network editor's dedicated button, but I need to be able to do it with python, because I'm setting up a shelf tool template that would need to do this. Any idea why the image is disappearing with the python script? Thanks Attached is a simple scene with the python node set up. Just activate the python node, see the background image pop in place, change context, go back, and see that the background image has disappeared. background_image.hip
  24. Object Selection Button

    Hi all! I had a bit of a question re scripting selections. Ive been using the excellent soputils.selectGroupParm() in a few of my tools but Ive recently needed the ability to select objects in a similar way. Ive done some looking into it and there doesn't seem to be a simple way to get an object selection state in a viewport after clicking an action button. Does anyone know how one would go about implementing like this or is it going to be a case of learning how the python state system works (I wouldnt know where to start with it right now). The image demonstrates what Im trying to achieve. You click the little arrow and the viewer enters an object/geo selection mode (similar to selectGroupParm) and on completion it returns a list of object node paths. Thanks!
  25. root = hou.node("/obj/") netbox = root.findNetworkBox("Mynetworkbox") nodes = netbox.nodes() print(nodes) i am trying to get all nodes inside a specific network box but print(netbox) returns None
×