Welcome to od|forum

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

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

  1. Hi everyone, Are you a big fan of the Houdini Tricks website? We are - that's why we invited the man behind Houdini Tricks, motion designer and developer Erwin Santacruz, to be our featured Houdini Artist. He's not only a tireless contributor to the Houdini community, he is also a great teacher. Here, he walks us through building Python shelf tools in Houdini. We hope you enjoy his tutorial as much as we did, Patricia and the GridMarkets team
  2. Hi, I´m trying to create a custom panel editor. Still in the early stages, but I would like to have my QToolBox has the same size of his parent widget the QScrollArea. I was thinking about implement resizeEvent() to resize the QToolBox (horizontally) when the QScrollArea changes size. But I´m always getting the wrong sizes from QScrollArea, even changing the size of the panel I´m receiving the (1,1,638,478) size from the viewport().geometry() or sizeHint(). I´m puzzled!! Thanks for helping!
  3. Currently I wanted to change some rops´s image path parameters with python. I have the problem that python converts my strings with e.g. "$F4" or "$JOB" expressions in it to absolute paths. Can I avoid that? e.g. : c.parm("vm_picture").set("//testDirectory/teststring_$F4.v001.exr") turns to: //testDirectory/teststring_0079.v001.exr How can I set this up with keeping the $JOB or $F expressions in it? is this possible?
  4. Hi all, I have a small question about the best behavior when one wants to keep the track of the source scenes for a specific task/asset. Let's say you want to cache a sim. Usually you will make several versions of it. I think it is important to have the source file for each sim/cache version that is saved at the caching time (maybe in the sim/cache folder). Houdini has a 'post-render script' capabilities but my knowledge of hscript or python is very limited. Any ideas how to do that? Thank you! Cheers, Cristian
  5. Hey everyone, I recently set up a website and a stream for Houdini people or everyone else who is interested in Houdini. I am going to start streaming Houdini every day, starting today. After each stream I will upload results and depending on time a timelapse, a tutorial, a .hip(nc) file or documentation of sorts for everybody to view and examine. Where can you find all this? Website: http://shadesoforange.de/ Stream: https://www.twitch.tv/shadesoforange Who am I? I am studying Animation & Game in Darmstadt, Germany and am 23 years old. I recently finished my internship at RISE FX and am crazy about all Houdini, procedural and CG stuff. More about me here. My first stream is going to start at 15:00 CET. So if you want to hang out and have a chat, come by and say hello! See you!
  6. Hi Everyone, I was wondering if there is anyway in Python to run a function only when the left mouse bottom being held down? Thanks,
  7. Hi guys, I am working on a python script that bakes the hand movement of geometry with mouse in the viewport over the time and creates keys on each frame. In other word, I want to move my object with mouse in the view port and get the Transform/Rotation/Scale keyed on each frame. Currently I am using hou.selectedNode() and the hou.parm() to access the specific parameters that I want to bake. Then I use a for loop to generate keyframe on each frame. Immediately after pushing the bake button it bakes the parameters value on the first frame for entire time line. I have tried using while loop with time.sleep() to wait for a bit after setting key on each frame, but it freeze the view port and I cant move my geometry. Is there anyway to make my code somehow that constantly check the new values of object parameters on each frame and allow me to work on the view port while it does its job in the background? Is this related to multi threading? Here is my for loop for f in timeline: setKey = hou.Keyframe() setKey.setFrame(f) setKey.setValue( keyValue[f] ) ParmList.setKeyframe(setKey) hou.setFrame(f) Thanks,
  8. There are various event handlers you can use with HDA's (like onCreated, onInputChanged etc.) but I can't seem to find one that can be used as a callback for when the output connection of the HDA changes.. Basically i'm trying to create a custom version of the gas disturbance, part of which has the option to visualise the block size of the disturbance (just with coloured points on a grid). So I was thinking I would use an event handler on the HDA to know when it was connected and then in python traverse down the children to find the solver then traverse back up to find the smoke object so I can get the size and center to position the grid correctly. Is this possible? Is this a stupid idea?
  9. Hello I'm trying to make a little script that would check which frame was the last one rendered and then would continue the rendering process if necessary. It's a Windows machine The easiest way I could think of doing it was simply using the subprocess module to call the hrender script with the proper arguments, but I having some trouble The relevant code is def main(): last_known_frame = get_last_frame(RENDER_DIR) if last_known_frame is not None: hrender_command = "hrender -e -f {} {} -d {} {}.hip".format(last_known_frame, END_FRAME, OUTPUT_DRIVER, PROJECT_NAME) os.chdir("V:\Programs\Side Effects Software\Houdini 15.5.607\\bin") subprocess.call([hrender_command], shell=True) However, I get a "hrender -e -f... is not a recognized as an internet command..." I tried using subprocess.call(["hrender", hrender_command], shell=True), with the proper path to the HIP file, but then it calls it like they were two different arguments, which isn't the case So three questions Is what I'm doing possible? What am I doing wrong? Is there a better way? Regarding the second question, I superficially searched how to use HOM on a generic script but apparently you need to assign PATH variables and such on Windows, it looks like a mess I would prefer to avoid if possible Thank you
  10. Hello, I am struggling with adding all deep render properties inside a mantra node with python. To do so manually via interface is quite simple, I go to node - edit render properties - filter *deep* - add them all. However I am modifying mantra nodes with python and it would be great if I could do the same thing automatically. So far it seems rather tedious - I need to create all ParmTemplates, match their signatures and append to a FolderParmTemplate and set this to the node. Another thing worrying me is menu parameters - I do not need to create interface with menus, can I only set the desired value? Is it equivalent to creating a string parameter and setting it's value to menu item's name (not label)? Thanks, Juraj
  11. Hi, I'd like to access the 'Hide When' parameter field in 'Edit Parameter Interface' via python. The idea is to access this field and store a string such as "{ showmoreinfo == 1 }". Is there a way to easily do this? I searched and found workarounds which involve calling the hide method i.e. hou.parm('/out/mantra1/vm_lightexport_scope21').hide(1) but this result in an inefficient system requiring hoops to achieve what I want. Any ideas? Thanks Luca
  12. 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
  13. Hey Guys! I have a pretty newbie question about some Python and HDA interaction. So in a nutshell I'm trying to create an HDA with implemented Python script which does the following: 1. I have an Original Geo, which is object merged in my HDA. 2. I select some primitives on my original geo (or on the HDA). 3. After I selected my primitives, with a press of a button on my HDA, the selected primitives will be added to a group's pattern parameter inside my HDA. 4. And of course it would be great if this could work with a relative reference, so if I copy my HDA multiple times it'll update the groups within the correct HDA. I have this code so far: import toolutils viewer = toolutils.sceneViewer() geo = viewer.selectGeometry() s = geo.mergedSelectionString() # How can I make THIS PATH relative reference? n = hou.parm('/obj/Colorzied_Geo_Asset_1/Colorized_GEO/group1/pattern') n.set(s) I put together a pretty simple example file and the hda, which will hopefully help you guys understand what I'm trying to achieve. In case my explanation is a little confusing. selectedPrims_python_problem_v001.hip colorzied_geo_asset.hda Any help or nudge in the right direction would be greatly appreciated! Thanks in advance! Best, Laszlo
  14. Hi all, I'm attempting to write a particle cache exporter and I'm having trouble getting the Python module to use functions that are stored in a different section. My instinct was to create a new output driver type as the category made sense, but there were a few challenges which I'll mention here for others facing the same issues: The 'Render to Disk' button's Callback Script section is greyed out. To run code when this button is pushed you need to Create a file parameter called 'soho_program' and change it's default channel value to 'opdef:.?PythonModule' Create a file parameter called 'soho_outputmode' and change it's default to 2 This just runs the code in PythonModule. I have another module in which I store the functions that need to be run in PythonModule, but I cannot import these fucntions. The docs about asset modules state that you need to write the following to import another section as a module: import toolutils foo = toolutils.createModuleFromSection('bar', kwargs['type'], 'PFX_Exporter_Functions') However, because this is an output driver, there appears to be no kwargs argument, so I cannot get the kwargs['type'] value. I've tried other methods such as hou.nodeTypeCategories()['Driver']. Strangely the 'Driver' type is not available directly like all the others are as listed here. Does anyone know how to import modules from the other sections when using the Driver type?
  15. Hi, when creating channel defaults inside digital asset I can set it as a value or hscript expression. Is it possible to set it to python expression? A way would be to create OnCreated script which will assign expression to a channel, or use some hscript for executing python command. But I am curious if there is another - better way Juraj
  16. 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
  17. After a bit of light testing it seems that if I import a Python module when loading Houdini, using pythonrc.py, I cannot later use it directly in a parameter expression. Instead I have to import it into the expression again, which could make the expression string more complicated and error-prone (multiple lines or semicolons). Is this really the case? I feel like I must not be doing something correctly.
  18. Hi, there. I have some HDAs that use an external python module. I'd like to package the module into the HDAs so that external files are not necessary to use them. Currently I am embedding the python module using the “Custom Script” event handler, and I want to read file from “Extra Files” Tab. I want to write & read files from HDA's Extra Files Tab. Because I don't want to write & read files from External Directory. If I changed computer, I should move not only HDA asset but related External Files. I want to embed all files related to HDA. The Extra File is just txt file or json file. I already ask same question to sidefx forum. But, I receive some useful tips. I try HDADefinition Module but I cannot find to write in HDA. I spend about two weeks.. otl OTL Is there any way to write in the HDA's Extra Files? Link I asked same question
  19. Hi, When I select points from the viewport, how do I get a value of point attribute in python? I wrote a beginning like this: 1 import toolutils 2 viewer = toolutils.sceneViewer() 3 selection = viewer.selectGeometry('Get Ids From Select Points',geometry_types = [hou.geometryType.Points]) but I don't know how to continue this. thanks Shawn
  20. Hey guys, I saw there is a hscript command ‘openport’, but I didn't find example on how to communicate with houdini via python. Here's what I need to do: 1-Open a port, from localHost, within houdini session. 2-From an external python interpreter, execute houdini python commands, using local port. IE: hou.node('/obj').createNode('geo') Here's how I can do this in maya: 1-cmds.commandPort(name='localhost:7555') 2- client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) client.connect(('127.0.0.1', 7555)) c = ‘python(“cmds.polySphere()”);’ client.send(c) Does anyone know if it's possible to this in houdini? Anyone has some examples? Thanks Jonathan
  21. Similar to the H14 workflow of hitting X on the currently selected node in any vop context to create a visualizer node, I want to do the same but connect the currently selected node to the compute lighting Ce output (or a bind export node set ot Ce but that can throw errors) to quickly visualize the color data of the map I am working on without having to do expensive shader calculations. The visualize node is great when working with Cd in SOPS but does not return the same functionality in shaders This is a default hotkey in arnold for C4D, its like alt+w+v or something. I'm sure there is a way to do this with a python script attached to a hotkey. Any ideas?
  22. Hi there, I was looking for a way to launch an Houdini' RPC server directly from a terminal window, without interacting with GUI at all. The documentation says I need to run Houdini and then from its python shell I have to start the server with the following commands: import hrpyc hrpyc.start_server() After that I can establish a connection to it from my terminal and start running my python scripts. Is it possible to start the server directly from the terminal? For my needs I'm trying to avoid interacting with the GUI and automate the whole process with python scripts. thanks in advance
  23. Hi, I'm writing a few shelf tools with hotkey links to allow quick creation of some common nodes (Null (N), Wrangle (W) etc) Here is the simple script if(len(hou.selectedNodes()) > 0): node = hou.selectedNodes()[0] if(node.type().category() == hou.sopNodeTypeCategory()): parent = node.parent() null = parent.createNode("null") null.setNextInput(node) null.moveToGoodPosition(True, False, True, True) null.setSelected(True, True, False) null.setCurrent(True) null.setDisplayFlag(True) Although the new Null is selected and display-flagged correctly, the parameter pane remains on the previously selected node. The outline colour of the null is also yellow rather than orange. Is the a way to fix this?
  24. Hi! Is there way to call "Render to Disk in Background" form Python? Houdini use one thread for generating ifd, so I want spawn rendering in background without H freeze like "Render to Disk in Background", but don't see any information in help or inside node how this works. I implement this in naive way using multiple hrender subprocesses works perfectly fine but subprocesses don't terminates automatically. Any one knows proper way to this?
  25. hello,I would like to use python to move a parameter to a folder. What functions do I need to use? please help me,thanks.