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

  1. Hi there,I'm trying to change the colour of a primitive once a particle collides with it….but i don't want to use an attribute transfer because that gives me a gradient of colour on the primitive and i want to change the colour back after it's been hit and have it be a solid colour. So hit == green (0,1,0)not hit == red(1,0,0)Another problem i'm having is when i don't use an attribute transfer and write it in a python sop(code below) i change all the primitives colours in one go rather than individually where the the particle collides with each primitive.Not sure how to go about this, but here is the file attached.Any help would be much appreciated.CODE FOR HIT COUNTER AND PRIMITIVE CHANGE COLOUR node = hou.pwd() geo = node.geometry() from hou.session import * inputs = node.inputs() # bring in city searcher data pointcolliders = inputs.geometry().points() ship = geo.prims() if hou.frame() == 1: hitCount = 0 for p in pointcolliders: store = p.attribValue(“hittotal”) # get hittotal attribute from the pop solver hitCount += store # hitcount += store (to add number of hits to hou.session) hits = store green = (0.0,1.0,0.0) red = (1.0,0.0,0.0) #change colour of second input so object for s in ship: if hits == 1: s.setAttribValue('Cd', green) else: s.setAttribValue('Cd', red) particles hit each prim.hipnc
  2. 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!
  3. Hey guys! On opening or saving any scene file, i want houdini to shift to frame $FSTART and turn to manual cook mode. So i know houdini needs a 456.py file in its home directory but i need help with the code. I've manged to find some help from other forums and ended up with this, which obviously doesn't work Badum Tss! hou.setFrame(1) hou.setUpdateMode(hou.updateMode.Manual) hou.updateModeSetting() hou.updateMode.Manual
  4. Anyone scripted anything for Houdini Engine in Maya? Just want to be able to import an HDA. Any pointers appreciated.
  5. Hi guys Can you set global variables using python within an HDA? I have an ordered menu that is being populated by a python menu script. Is it possible to set a global variable from in there? Thanks!
  6. hi there, I have a global attribute that i've made in a python node: citySearcherDistanceTrav = geo.addAttrib(hou.attribType.Global, 'citySearcherDistanceTrav', '') i've then set the attribute with some floats totalDistance = self.stepSize * hou.frame() #speed * time = distance travelled dt = str(totalDistance) geo.setGlobalAttribValue('citySearcherDistanceTrav',dt) #see image 1 But i can't seem to access the values in the next node directly below. I tried find global attrib not sure how to access the data in a python node again. A
  7. Hey guys I have an HDA with 2 python SOPs inside. I need a button on the HDA that would trigger a function in one of the python SOPs. I looked at how callback scripts work but it was too confusing. Appreciate it if someone could help me out. Thanks! Cheers defc0n1
  8. Hey, so I have a situation where i have exported a load of rbd simulations to alembic and i now, after re-importing them back in as alembic archives, I want to export them out from Houdini as FBX. Now, i can do this fine on an individual level, but it takes a while to export each one and then I have to come back and export the next one when thats finished, usually an hour later or something. What i I would prefer to do is to create a python script to automatically export the next one so i can leave them all going over night or something but I dont have any idea how to do this. Can someone please help me out or point me in the right direction? Thanks
  9. Hey everyone I have an ordered menu in my HDA that gets populated by a python script based on an attribute. The name of the menu is data_source: if (geo.attribValue('nHDU') > 1): return ("0", "Primary", "1", "Extension") else: return ("0", "Primary") I'm trying to access this token value from an internal python node using this: value = hou.evalParm("../data_source") Now I know for sure that the nHDU value is >1 and the two menu items are being populated. Problem is, no matter what I select on the menu, I always get a value 0. It works if I add it directly to the ordered menu without using a script. But that defeats the purpose because it should depend on the attribute nHDU. Could someone tell me what's happening here? Thanks.
  10. Hi there, I'm trying to flip the vector once it reaches the boundary of the square and then it carries on moving randomly within the boundary, but i can't seem to get it to do this. I;ve made mirror functions to flip vectors and plus and minus functions but it doesn't seem to work, not sure what i'm doing wrong. A boundaryavoider.hipnc
  11. Hi there, i'm trying to animate multiple points that move randomly within a boundary. So far i have the random movement done, but i want to be able to get the points to collide with the boundary and carry on moving. Any help would be great. A walker.hipnc
  12. In my attempt at solving a pull focus issue I sourced the following script here on odforce. I then paste into a Python Script digital asset node. But how to get it to run/compile? Should it run automatically? #!/usr/bin/env hython _version = 0.11 ''' Inital Author: "SYmek" from od[force] community. Edited by: Farsheed Ashouri Thanks to everyone who have helped. For more information: http://forums.odforce.net/index.php?/topic/9725-creating-a-new-python-script-for-automating-camera-dof-setup-solved/ ''' import hou def computeFocus(): if hou.selectedNodes(): for node in hou.selectedNodes(): # print node.path() if node.type().name() == "cam": camera = node # else: target = node target = hou.node("/obj").createNode("null","DOF_Controler") theExp='vlength(vtorigin("%s", "%s"))' try: camera.parm("focus").setExpression(theExp % (camera.path(),target.path())) # cT = camera.worldTransform().extractTranslates() # tT = target.worldTransform().extractTranslates() # try: camera.parm("focus").set(cT.distanceTo(tT)) print "Done." except: print "Did you actually select any camera?" else: print "Please select a camera and a target." #if __name__ == "__main__": computeFocus()
  13. Hi there, i'm trying to animate multiple points that move randomly within a boundary. So far i have the random movement done, but i want to be able to get the points to collide with the boundary and carry on moving. Any help would be great. A walker.hipnc
  14. Hi, could someone show an example of the use of the "hou.Geometry.boundingBox()" class? I want to query the of bbox objects from the Python Shell. I've written scripts in maya-mel, and I'm getting my head around python in Houdini. Any syntax examples would be appreciated Brian Samuels
  15. Hi guys Here's my problem - I need to work with openVDB volumes and I need to code using a python node. The problem is, even after successfully installing openVDB, I am not able to import the pyopenvdb module in Houdini. I can access it from the shell in my Mac, and can create/manipulate volumes etc., but not from Houdini. When I try import pyopenvdb as vdb in the python node or shell, it just says that it cannot find the module. Please help. Thanks.
  16. Hi, I would like to convert an rgb color value of an attribute at points to temperature (kelvin). I am wondering if anyone is aware of any algorithm related to that. cheers, C
  17. Hi guys! Just want to share with you some of my experiments. huilib - is a simple python wrapper around houdini .ui language. It was written "just for fun", so no warranty if it works for you. But i think it's pretty usable for simple ui, in situation, when PyQt is not an option Maybe someday we'll see something similar from sesi Feel free to use it. https://bitbucket.org/alexxbb/huilib/overview
  18. When I start Houdini I recently get this error message in the Python console. Python 2.7.6 (default, Oct 26 2016, 20:33:43) [GCC 4.8.4] on linux2 Houdini 16.0.557 hou module imported. Type "help", "copyright", "credits" or "license" for more information. >>> ---------------------------------------- Exception happened during processing of request from ('127.0.0.1', 40274) Traceback (most recent call last): File "/usr/lib/python2.7/SocketServer.py", line 593, in process_request_thread self.finish_request(request, client_address) File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request self.RequestHandlerClass(request, client_address, self) File "/usr/lib/python2.7/SocketServer.py", line 651, in __init__ self.finish() File "/usr/lib/python2.7/SocketServer.py", line 710, in finish self.wfile.close() File "/usr/lib/python2.7/socket.py", line 279, in close self.flush() File "/usr/lib/python2.7/socket.py", line 303, in flush self._sock.sendall(view[write_offset:write_offset+buffer_size]) error: [Errno 32] Broken pipe ---------------------------------------- How can this be fixed?
  19. Hi, I am a very beginner of coding and looking for a custom save shell by python. This time, especially I'd like to ask for how to replace ".comment." part. Example file is "fx_dest_vocity_v051.04.comment.hip" and a procedure is : 1 - click shelf dock 2 - show a popUpWindow and type a comment 3 - click the popUpWindow, close it, and a script replaces "comment" part and new file name is saved, for example, "fx_dest_vocity_v051.04.vel2xfaster.hip" my best guess is; fileName = hou.hipFile.basename() ## for instance, file name is "fx_dest_vocity_v051.04.comment.hip" hou.ui.displayMessage("type comments", variable ) ## save comment hou.ui.displayMessage.close result = re.search( "([0-9]{2})\.???????\.hip", fileName ) ## get comment part newFileName = fileName.replace( result.group(1), variable ) hou.hipFile.save(newFileName) ## new file name "fx_dest_vocity_v051.04.vel2xfaster.hip" I know it's so many broken lines, so if someone helps to rewrite it, it would be great, thanks!
  20. 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
  21. Heya, I've written a little python expression to scale geo dependent on through which camera is being viewed. It works but does not recognise when the viewport has changed - is there an event trigger I can use to get it to recognise this change? import hou desktop = hou.ui.curDesktop() scene_viewer = desktop.paneTabOfType(hou.paneTabType.SceneViewer) viewport = scene_viewer.curViewport() camera = hou.GeometryViewport.camera(viewport) if 'preview' in str(camera): return 0.01 print 'preview cam' else: return 1
  22. Hello, one question please: What expression can I write to use the @ptnum attribute to drive the @P.y attribute using VEX or Python expressions. What if I want to drive @P.y with @P.x ?? thanks in advance.......
  23. Hi! I'm trying to find a way to read a config when a button is pressed, and update the available items in a menu parameter. I've tried a couple of methods, but haven't managed to get anything to work yet. First Attempt: target_menu_items = ["a", "b", "c"] menu_parm = node.parm("menu_parm") template = menu_parm.parmTemplate() template.setMenuItems(target_menu_items) The interface remains unchanged. Reading the docs that is understandable: So I tried what the docs recommended without any luck: ptg = node.parmTemplateGroup() menu_parm = node.parm("menu_parm") template = menu_parm.parmTemplate() template.setMenuItems(target_menu_items) ptg.replace("menu_parm", template) node.setParmTemplateGroup(ptg) I had some success by adding a line, but this isn't really a solution. template.setName("bahhumbug") I assume it's failing to replace the template if the name of the replacement template matches that of the existing one. I don't understand why that would be a problem though. I've had a thorough Google and can't find any examples of this... so I'm worried I'm approaching it the wrong way. Can anyone explain where I'm going wrong? Many many thanks in advance, Dan
  24. In the current tool I'm building for H16, I have a UI in which I would like to have different options available to the user depending on their selection. It would be ideal if these options can change without the user having to close and relaunch the UI every time. In short, I need a way to capture a signal emitted when the user selects node(s). I looked around the HOM and didn't see anything that looks like it gets called whenever a node is selected, just queries for currently selected nodes. Does anyone know how I could trigger something in my UI whenever the user selects different nodes? Thanks! Chris
  25. Hey guys, I'm very interested in anything with crypto currencies like Bitcoin. I've coded something together that grabs the current Bitcoin price from the web and throws it into Houdini as a 3d text. I've also managed to get the Bitcoin price history and graph it inside Houdini. Don't know tho whom it may be useful but look around or maybe even improve it. Maybe it might create new ideas. Python code and example available in the attachment or at github. The Batchman Bitcoin.hipnc