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 'scripting'.



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 19 results

  1. Hey guys I have a python library that does not work well in the Houdini python environment. However, it works fine in my system environment. Is there a way to run a .py file from disk from a python node? If yes, can it be made to use the system environment? Thanks!
  2. Hi Everyone, Hope you are all well. We have not been using houdini long. We are long time soft users and we are testing out software to move too and see the strengths of them. Houdini is our first choice for the sheer scope of it, so we have started looking at this first. Anyways, explaination of the problem below. I am trying to script a "simple" saving function through a HDA via Python (I dont know if this is a correct way of doing it, so please If I am going in the wrong direction, shout) it will create a few folders based on some parameters in the HDA interface and save the file with the name specified. I am setting environment variables through this and using that to generate the path for the file save and also will hopefully re-use the Environment variables later for ROP output ETC for the scene. I am running into an error with what I believe is to do with the hou.hipFile.save function. I have not been coding for very long either so please bare with me if my Termanology is off also. I have attached some code snippets. I am basically trying to save the files to a structured job folder system. something like below. $JOB/scene/[WORKCATAGORY]/[SHOTFOLDER]/SHOTNAME.hipnc I have defined some functions in the Python Module in the HDA, and these are being called by the callback script on each parameter. It is really weird, It has worked once or twice. But then I try to save again and it does not work again. I did some debugging and the Error that houdini generates, it definately works when I take out the SHOTFOLDER in the string for the path to save to. If my file path is just saved in the WORKCATAGORY section it saves. My defined functions (sorry code is messy) def shotName(parm): hou.putenv("SHOTNAME", parm) test = parm print test def folderName(parm): fname = "NN_" + parm hou.putenv("FOLDERNAME", fname) test = fname print test def workCatagory(node, parm): a = hou.parm(parm.path()).eval() labelName = hou.parm(parm.path()).menuLabels()[a] testA = parm hou.putenv("WORKCATAGORY", labelName) print labelName def customSave(): #Pull in Enviroment Variables work = hou.getenv("WORKCATAGORY") shot = hou.getenv("SHOTNAME") folder = hou.getenv("FOLDERNAME") # Houdini save path FULL savePath = "$JOB/scene/" + work + "/" + folder + "/" + shot + ".hipnc" # Houdini save path with a job catagory but not job name folder #savePath = "$JOB/scene/" + work + "/" + shot + ".hipnc" exSavePath = hou.expandString(savePath) exSavePath = exSavePath.replace('//', '/') #hou.putenv("SAVEPATH", exSavePath ) hou.hipFile.save(exSavePath, False) print exSavePath the error it generates is Traceback (most recent call last): File "<stdin>", line 1, in <module> File "opdef:/Object/Northforge3_testa?PythonModule", line 40, in customSave File "C:/PROGRA~1/SIDEEF~1/HOUDIN~1.600/houdini/python2.7libs\houpythonportion.py", line 1287, in decorator return func(*args, **kwargs) File "C:/PROGRA~1/SIDEEF~1/HOUDIN~1.600/houdini/python2.7libs\hou.py", line 28330, in save return _hou.hipFile_save(*args, **kwargs) OperationFailed: The attempted operation failed. Error creating file: W:/Work/Development/D00026_Houdini_test/3.3d/D00026_Houdini_test_HOUDINI/scene/rend/NN_test/test.hipnc working enviroment is. Windows 10 Houdini Apprentice 16.0 saving to a NAS drive I hope some of that makes sense. Cheers
  3. 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
  4. Hey all, The team at Psyop just open sourced their ID matte toolset called cryptomatte. I started working there a couple months ago. we are looking from some contributors for Mantra implementation for the project! anybody interest? https://github.com/Psyop/Cryptomatte Have look and if your interest hit up the team, we are eager to make this apart of mantra Cheers!
  5. Hi I'm new to this wrangle node programming, I've been busting my head over why this doesn't work for three days, it's so simple therefor i must be missing out on some general vex concepts. If anyone can please point me in the right direction that would be greatly appritiated. I have a bunch of points on a grid and their moving up and down via noise. I am trying to set up a point attribute that has a value of 1 when a point if moving up (positivly in the Y axis) and a value of 0 when a point is moving down (negativly in the Y axis). This attribute is called Direction, I'm computing the logic on temporary VEX variables and then writing them out to the attributes. Here's how it looks like : // 0 is going down, 1 is going up, -1 means the point has no direction // on the first frame they have no direction so the points just take their current heights so they can use them for comparison on the second and every other frame int temporary_Direction; float temporary_Previous_Frame_Height; if(@Frame == 1) { temporary_Direction = -1; temporary_Previous_Frame_Height = @P.y; } else { temporary_Direction = @Direction; // ------------> this is where the problem is (this is here so that the temporary variable get's the value of the currently proccesing point every frame) temporary_Previous_Frame_Height = @P.y; if(temporary_Direction == -1) // If the point has no direction { if(temporary_Previous_Frame_Height < v@P.y) // If it's going up { temporary_Direction = 1; temporary_Previous_Frame_Height = v@P.y; } if(temporary_Previous_Frame_Height > v@P.y) // If it's going down { temporary_Direction = 0; temporary_Previous_Frame_Height = v@P.y; } } } // Out_Values i@Direction = temporary_Direction; f@Previous_Frame_Height = temporary_Previous_Frame_Height; // Out_Values The problem here seems to be when I declare "temporary_Direction = @Direction", for some reason on the second frame when I read @Direction the value wich is given to temporary_Direction is 0 instead of -1 wich was given to every @Direction on the first frame. Temporary_Previous_Frame_Height updates just fine but temporary_Direction doesnt. Also writing "if(temporary_Direction == -1)" doesnt seem to work either. Is my thought process even slightly right here, what am i doing wrong, are temporary variables created in vex something that exist globally and in order to use them per point we need to read each point's values or are temporary variables something that exist for every point. Also why do i have to give values to all attributes every single frame or else they will reset to 0 (hense the Out_Values section). //////////////////////////// Update Thank you everyone for replying. I've tried out the time shift sop and it work's fine now( I dont even need the Previous_Frame_Height attribute anymore). I've updated the main post with the original hip file and the one with the time shift sop. Learning about the time shift sop is great, but i would still like to improve my thought process on writing code. It would be greatly appritiated if someone can take a look at the original hip file and possibly shed some light on the problem. I've added notes inside the original hip file for clarity. Any help would be appritiated Thanks in advance Original.hip Time-Shift SOP.hip
  6. Hello I want to ask one quick question. How to store all primitive number in array using VEX. I am writing int nearpts[] = nearpoints(@OpInput1, point(1,"P",0), 20); to store points in array. Now i want to store prim num. I connected grid on 1st input and one centre point on 2nd input to use this one. If you have other way to store points tell me that also. Thank you
  7. Hello guys, I know how for loop works in c++ but i am not able to write in vex .Can anyone explain me how to write for loop with simple point and color example . Thank you
  8. Hi guys, I need to ask one quick question. How to use nearpoint expression in vex . Thanks in advance
  9. Hello dear community, I am currently trying to setup a city generator as part of my bachelors thesis. For a basic street layout, I am using a voronoi sop on a plane and fuse these points. It would be a big ease to be able to find the neighbors of a point (not vertices) and get their position. I did some workaround by creating a dictionary with position vectors and counting the positions that match, so I can at least count the neighbors. Does anybody know a trick or a function to do this in pythin? I know there is a VEX function that does that, however I don't know VEX pretty much and I am having trouble understanding their usage, although I read the docs. Any kind of help would be much appreciated. Best regards, Nicolas
  10. Hello dear community, I am just writing a little Python sop that can Unwrap a polycurve like a uvtexture node does on a nurbs curve with [Arc Length Spline] setup. My question is, what is the attribute name of the uv coordinate? I tried uv and uv[1] as its shown on the spreadsheet. Does anybody know the answer? Best wishes, Nicolas
  11. Hi! Cant find information about how to create empty folder with python inside digital asset parameters. I have a python callback script and at the end i'd like to create folder named, for example, Animation. Just it right now, no parameters inside, only empty folder inside asset. Did anyone know how to make it? That's what i am talkig about.
  12. Hi guys, This has boggled my mind for a while now. I have a OTL that has a tool script attached to it (Type Properties > Tool section), that evokes a PySide interface. The problem is that when I run the tool a few times, every single time a new instance of the interface is being opened, while the old one is still alive. So I'm ending up with lots of open windows of the same tool after a while which is super annoying. How can I prevent this from happening? I want to have only one single instance running at a time, basically close the old window if the tool is run again. Here's a really simple example that we could use as a test case. (Same problem if I run it as a shelf tool) from PySide import QtGui, QtCore class Window(QtGui.QWidget): """Simple Test""" def __init__(self): super(Window, self).__init__() self.setGeometry(50, 50, 500, 300) self.setWindowTitle("test") self.home() def home(self): btn = QtGui.QPushButton("Test Button") a_label = QtGui.QLabel("Test Label") qvbox = QtGui.QVBoxLayout() qvbox.addWidget(btn) qvbox.addWidget(a_label) qvbox.insertStretch(2) self.setLayout(qvbox) def run(self): self.show() main = Window() main.run() Some where I read that using the QEventLoop might help to detect running instances with hou.ui.eventLoopCallbacks(), but after trying some stuff for a few hours, I'm at my wits end. Help here would be much appreciated Thanks!!!
  13. Hey guys, I searched around for this and can't seem to find a solution, maybe you guys know. To simplify what I'm doing (its quite more complicated than this, but, ya know), lets just say I have this set up- string A = "91+"; string B = @ptnum; string C = A+B; C == "91+1", "91+2", "91+3" . . . Is there an eval I can do in VEX to get a result like this per point? 91 92 93 94 95 I've tried doing things like - float( C ) == errors out or atof( C ) == "91" But it doesn't seem to work for me. Is there any sort of - eval( C ) Or another way to evaluate the string variables as an expression/math? I'm considering just adding new parameters to evalutate the math through python and to read the parameters into the vex, but is there an easier way to do this?
  14. Edit parameters and snippets with your favorite editor – quickly! Includes automatic configuration by looking for popular editors in your computer. Installation - Download - Add the following files to your preference folder or .hip file location: PARMmenu.xml and MainMenuCommon.xml For the complete guide and more information: https://github.com/ArthurYidi/Houdini-External-Editor
  15. Hi all: I am trying to integrated H14 with my company's render pipeline, I imported my old customized Mantra and Rop output Nodes from H13 which were python script HDA module in type property and modified from H13 original nodes, so we could send the geometry cache and renders to the farm with one click. Rop Output Driver: After imported the otls, it will automatically create a new vex type digital asset, and my old one gone. So I tried to modify the H14's built-in Rop Output node in type property, adding the HDA module, after I pasted my script and click accept, same shit happened again, H14 create a new vex type digital asset. It seems H14 forbids user from modifying its built-in nodes in type property. Mantra: I can't even edit anything in type property not without destroying the layouts, so I created a new output driver digital asset, but new render nodes can not be seen in the IPR render view. Do you guys have some ideas how to work around the situations? Orz.................... Thanks
  16. Is it possible to have a standalone window dialog that does more than just read input or multi-input using python? For instance, can I have a dialog that reads multi input, has a node selection tree, and uses the button as a function call rather than closing the window? Or have a checkbox option within the GUI?
  17. Hi guys, I recently (few days ago) started learning python and while I hit many walls I managed to find enough info on this forum and sidefx.com to help me overcome the issues. However there's one (for now) that I can't manage to solve and it's a bit hard to explain in writing so I hope you'll have patience with me, thanks Passing tokens using callback script. I need to call a function with using the token variable from the drop down menu. For example if the user selects the first option the function get's called with a variable, if the user selects the second option the same function is called but with a different variable. From Houdini help looks like it's done using callback script to pass the token of the menu but I can't seem to make it work. This is the python callback I have on the menu: hou.pwd().parent().parent().hdaModule().DisplayPaintMode(hou.pwd().parm('paintDisplay').eval()) paintDisplay is the drop-down menu parameter where the callback script is with the 1st token: result and the 2n one: paint And this is the function on the HDA python module: #Display Paint Node def DisplayPaintMode(node): HDA = hou.pwd().parent().parent() import toolutils if node == 'paint': print 'display paint' paintNode = HDA.node('ObjectToDestroy/PaintFractureDensity') paintNode.setDisplayFlag(True) paintNode.setRenderFlag(True) else: print 'display result' sopnode = HDA.node('ObjectToDestroy/OUT_display') sopnode.setDisplayFlag(True) sopnode.setRenderFlag(True) But this always prints 'display result' regardless of what option is selected from the menu. However if I change the callback to: hou.pwd().parent().parent().hdaModule().DisplayPaintMode('paint') then it prints paint - the way it should. So I can't find how to pass the menu tokens with the callback script. Thanks a bunch, -Adrian
  18. I'm trying to learn houdini, and one thing which I'm getting really stuck at is the syntax and (apparent) inconsistency of expressions / snippets of code - or at least there's so many little idiosyncrasies that it's driving me nuts. I've looked around as much as I can in various documentations, but couldn't find a single piece of text which describes an overview of all of these things, instead the info is scattered all over the place, probably because some of these are legacy and dates back decades while others are quite new. As far as I understand: $ is for global variables (in HSCRIPT ? and python too? are there substitutes for VEX?) @ is for attributes in VEX (is it possible to access attributes in HSCRIPT?) ch is for referencing a channel (i.e. a parameter of something from the GUI?) (is this HSCRIPT? or PYTHON?) I'm still not sure what op or ` (backtick) are for or when to use them. What I'm after is a very short (hopefully not more than a few sentences per item) summary of what each of these things are, and in what context we are supposed to use them. Also, what is the context of what we enter into textfields? E.g. when I write sin($T) into the position of an object. Is this HSCRIPT? or Python? Or is that a Houdini Expression which is a whole other context separate to HSCRIPT? cheers,
  19. Hi, a scripting question: On SOP level, object-merging an obj level object(say a camera).. then in another node want to refer to the camera's aperture.. What is the way to do that? (Indirectly refer to a parameter in hscript) something like this: (but this doesnt work `ch("../object_merge3/objpath1")/aperture` thanks! Alex (below works with detail params in attribcreate, but is there a more streamlined way?) attribcreate1: aperturePath = `chs("../object_merge3/objpath1")`/aperture attribcreate2: aperture = $APERTUREPATH