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

  1. VEX and HOM in external editor

    Hi, Just thought in ask if anyone knows of an external editor with vex and HOM libraries in them. You know to lazily have autofill and nice colors in an external editor (visual studio maybe??) Just kind of hoping that more advanced programmers here will have a better set up than mine
  2. Hi i want to assign a global variable as path for a rop node with python - but the thing is that python translates $F to the current frame, and every other parameter... node_rop.parm('sopoutput').set("$JOB/render/$HIPNAME.$F.bgeo.sc") gets translatet to /Users/xxxx/Project/render/path.12.bgeo.sc in the rop network so how can i assign a $F to a textinput field with python thank you for help!
  3. Hi All, Can a node store the sub-component selection of it but the node is not shown at the scene viewer ( but for example selected at the network editor ). And how can I get it ? G
  4. Hi, How can i get the actual parameter name ( or the parameter object ) from a parameter when using python expression on it. I mean something like this: hou.parm('.').name() but not works. In an object hou.pwd() but i need It on a parameter. THX! G
  5. Hello ! I'm trying to do some tests using rpyc to control Houdini over the network (currently only on the same computer) I managed to get it to work (creating some nodes, getting the frame range, setting the frame) But, strangely, I can't get the correct current frame number It will return 1.0, but if I use hou.setFrame(XX) it will then return that value (whatever XX was) even after manually changing the frame in Houdini I tried using hou.frame(), hou.expandString("$F") They both had the same problem My steps to get it to work were copying the rpyc folder at C:\Program Files\Side Effects Software\Houdini 17.0.XXX\python27\lib\site-packages to C:\Program Files\Autodesk\Maya2017\Python\Lib\site-packages In Houdini, open a Python Shell and write/execute import hrpyc hrpyc.start_server() In Maya, open a Python Shell and write/execute import rpyc connection = rpyc.classic.connect("localhost", 18811) hou = connection.modules.hou print hou.frame() # Returns 1.0 hou.setFrame(52) # Sets the frame to 52 print hou.frame() # Returns 52.0 print hou.expandString("$F") # Returns 52 But if you manually change the frame in Houdini and only execute the print hou.frame() line, the problem will be apparent Even in another Houdini instance the problem is present. import hrpyc connection, hou = hrpyc.import_remote_module() print hou.frame() Is there something I did wrong, missed or anything ? Thanks !
  6. Hey ODFORCE, Does PyCharm integrate with Houdini well? (Auto-completion, external debugging, unit testing?) Just curious. I did find some blog posts on VS Code set up, but I was curious about Houdini and PyCharm specifically. There was an issue with PySide from an earlier post..? (I'm fairly new to IDE set up, so forgive me if it's obvious) There are plugins for Nuke and Maya for PyCharm. Nothing for Houdini though.
  7. mapToWorld for non-single viewer layout

    How to use hou.GeometryViewport.mapToWorld() if the scene viewer is set to non-single layout. I can get mouse position with Qt, but can't calculate offset for different layouts. Works well in single persp mode
  8. detecting keyframes with pyton

    Hi Guys I have a very specific request from an animator working in houdini. He wants to have all his animation curves on the objects being animated, he doesn't want to be worrying on parenting or constraints. Right now I have a working tool which it is looking at the values of a source object and keying them to the same parameters on a target object. No problem. But if I wanted to minimize the amount of key frames being created, how would I do that? I can't seem to find a python function for "if key frame present, then..." So my question is, is there a way in Python to detect key frames and execute a function only when one is detected? Any help would be appreciated.
  9. Hi, I need to replace the interface of the houdini rop network with my own panel. I use it for sending renders to farm etc. I use the 'oppresetload' to load my property page to the node itself. The issues come when i want to change a few thing on the interface by a python script ( parameter labels and script callback of buttons -> see script bellow ). The issues are: folder conditional strings are cleared, some parameter type changes ( button strip ). My question is: What is the proper way of replacing a node's interface without Digital Asset ? THX! G Label change: ptg = parm_obj.parmTemplateGroup() parmname = 'active' pt = ptg.find( parmname) if is_sim == '1': rop.parm('issimtoggle').set(1) # pt.setLabel('Active / [ SIM ] / '+self.version) elif is_sim == '0': rop.parm('issimtoggle').set(0) # pt.setLabel('Active / [ RENDER ] / '+self.version) ptg.replace( parmname, pt) parm_obj.setParmTemplateGroup(ptg) button Callback change Script : parm_obj = rop ptg = parm_obj.parmTemplateGroup() pt = ptg.find( parm) pt.setScriptCallback( script) pt.setScriptCallbackLanguage(hou.scriptLanguage.Python) ptg.replace( parm, pt) parm_obj.setParmTemplateGroup(ptg)
  10. Getting view 2d rect from 3d geometry

    Can I get somehow 2d rect from SOP geometry using viewport transformation matrix?
  11. Hello! I am creating a python script that search for all the textures used in the project and copies them in a folder $HIP/textures. After that, it converts the path to $HIP/textures/[texture_name]. It works fine until there isn't a variable like $F in the string. If this is the case, it copies just the first frame and not the full sequence. What I am using to collect all the textures path is a line from a code I've found: files = glob.glob(hou.expandString(re.sub(r'\$F\d', "*", parm.unexpandedString()))) Being a python newbie, I am not really sure to correctly understand what it does in order to fix this issue. I got more or less that re.sub replace the first argument (\$F\d) with the second argument ("*") inside the text of the third argument. Is all the expandString and unexpandedString that confuses me. Seems like that this function just returns the string value at the current frame? What if I want to get all the textures/files? Thanks in advance for any help/suggestions
  12. Hi, How can I set conditional string ( hide when ) on folder parameter by python ? Thanks G
  13. I have a parameter in my node that I want to convert to use python, usually we can right click> expression >change language to python but for some reason is gray out =( and reading documentation I could do parm.setExpression("2+2". language=Something) but I thought using hou.lenguage.Python as argument but wants a value? do we have something like parm.setScriptLenguage? or an easy way to switch all the node to use python, or just that parameter?
  14. Hi, Can it be available to check a node is dragged to render view and then specify which node is rendered on it ? THX G
  15. Hi, I would use mantra Pre-Render Script on farm render too. But on farm the Pre-Render Script does not find the same module which one in the scene is correctly working. Is it the farm or houdini problem ? Any idea ? Thanks. G
  16. This is an example for building landscapes from irregular points using SciPy. import numpy as np from scipy.interpolate import griddata # FIRST INPUT: REGULAR GRID node = hou.pwd() geo1 = node.geometry() grid_x = np.array(geo1.pointFloatAttribValues("px")) grid_y = np.array(geo1.pointFloatAttribValues("py")) grid_z = np.array(geo1.pointFloatAttribValues("pz")) # SECOND INPUT: RANDOM POINTS inputs = node.inputs() geo2 = inputs[1].geometry() val_x = np.array(geo2.pointFloatAttribValues("px")) val_y = np.array(geo2.pointFloatAttribValues("py")) val_z = np.array(geo2.pointFloatAttribValues("pz")) # MULTIVARIATE INTERPOLATION grid_y = griddata( (val_x, val_z), val_y, (grid_x, grid_z), fill_value=0.0, method='cubic' ) # methods: nearest, cubic, linear # NEW HEIGHT POSITIONS ON GRID geo1.setPointFloatAttribValuesFromString("py",grid_y.astype(np.float32)) scipy_grid_to_points.hiplc
  17. Hi everyone ! As says the title, I want to export scalar values attached to voxels (VDB) into a 3D matrix because I want to access to voxel data into another software (matlab) does someone know how to do that ? thanks ! Alex
  18. Python: Loop delete geometry

    I want to export single tiles of a grid by their id attribute with Python. Because saveToFile() is lacking any filter options, I am trying to use a loop for deleting all redundant primitives before each export. Unfortunately once primitives have been deleted for the first time, they are gone for all subsequent loops, too. node = hou.pwd() geo = node.geometry() dir_exp = node.evalParm('dir_export') id_values = geo.primIntAttribValues("id") id_count = len(set(id_values)) # is there a more hou way to count unique attribute values? for iteration in range(id_count): geo_change = geo path_export = dir_exp + 'segment' + str(iteration) + '.obj' prims = [p for p in geo_change.prims() if p.attribValue('id') != iteration] geo_change.deletePrims(prims) # how can I keep the full geo data for the remaining loops? geo_change.saveToFile(path_export) How can I keep the full geometry for each loop? And are there any better ways to export geometry parts based on attributes with Python? landscape_slice_export.hiplc
  19. Hey Peeps. Not sure which category this questions belongs to so I threw it into the general question forum. I am currently building an HDA with one of the functions of this HDA is to draw curves. In order for me to be able to draw the curve on the top level of the HDA with the drawcurve tool I have to set the default state of the HDA to 'Stroke'. This is all working fine. My issue is now that because the HDA is holding more than one "Mode" I only want the default state to be 'Stroke' when the mode is set to utilize the draw curve function. In other words, I only want the interactive draw tool in the viewport to be active when a certain parameter is active. I hope I explained this well enough, if not let me know and I will try to be more visual with a simple example file (at work currently so cannot share anyting). Thank you in advance. Cheers
  20. Hello all, I have a question regarding to how I can use Sublime Text as an external scripting editor for VEX / Python on macOS. I have tried editing houdini.env as follows but Sublime didn't open when I clicked the button "External Editor" on scripting window. EDITOR = "/Applications/Sublime\ Text.app/Contents/MacOS/Sublime\ Text" I suspected it's because of the space in directory's name but if I change the name of the application then it screws up the Sublime Text app itself so I cannot do that. I've also tried following but nothing worked. EDITOR = "/Applications/Sublime Text.app/Contents/MacOS/Sublime Text" The reason why I think it is due to the spacing on directory's name is because when I tried to set the external editor to Atom which has no space on any directory to it's bin file, it launched ok when I pressed External Editor button on scripting window in Houdini. EDITOR = "/Applications/Atom.app/Contents/MacOS/Atom" But I would really like to use Sublime Text for editing the script instead of Atom, so my question is... how can I escape the space for the file path on houdini.env on macOS? I'm using Houdini Indie 17.0.352 macOS Mojave 10.14.1 Thank you
  21. How to add a new path to environment variable? For example, trying to add a new path to the "PATH" (i need HOUDINI_PATH indeed): import os print os.environ['PATH'] os.environ['PATH'] = 'C:/TEMP;&' print os.environ['PATH'] >> C:\Program Files\Microsoft MPI\Bin\;C:\Program Files\Java\jdk-10.0.1\bin; ... >> C:/TEMP;& So, os.environ['PATH'] = 'C:/TEMP;&' overwrites existing "PATH" variable. This way os.environ['PATH'] += os.pathsep + 'C:/TEMP;' is working. I was thinking "&" should do the trick (append a string to the variable instead of replacing it), but it does not work. So I wonder if I misunderstood something with "&" and "+=" is the only solution.
  22. I'm learning command-line rendering through Python, but I can't get RopNode to work. When I use hou.RopNode.render() I get "unbound method render() must be called with RopNode instance as first argument (got nothing instead)". When I try to add "mantra1" in the parentheses (the file I want to render is the one open) I get the same error except "got str instance instead" in the parentheses. For all my Googling I haven't found any examples of how to successfully use this. What am I missing?
  23. hou.Geometry.point() not working..?

    Simple problem: I have a foreach loop running over points on a curve each with an attribute that is randomized for which variety of geometry it needs to use. The varieties are coming from 1 input, but where each variety has a different primitive attribute for which variety it is (I get the geometry in from Unity). I got the geometry getting piped in to a copy to points node, in the foreach, but before that I need to delete, per loop, what is not used. Or I need to pick it, I don't know. I just need the loop to select a variety based on the randomly generated attribute. So the way I did it was with a delete node, with an expression with the following python code: curVal = hou.pwd().curPrim().attribValue("namechoice") compareVal = hou.node("../foreach_plank_start").geometry().point(0).attribValue("nameselect") if curVal != compareVal: return 0 else: return 1 Comparing the primitive attribute (int) with the point attribute (int). But.. I get this error: Error: Unable to evaluate expression ( Traceback (most recent call last): File "<stdin>", line 3, in expression AttributeError: 'Geometry' object has no attribute 'point' (/obj/worknode/fence_maker/delete2/filter)). Explanations to why hou.Geometry.point() is not "valid", suggestions for other ways to code it or suggestions for other way to do the network are most welcome!
  24. Hi, Is there a chance for example to get a picked position of a connection item ( where the pointer is picked its line ) ? I would place a node where it's picked.. I think the paste tool does similar when you pick a position at the Network Editor before paste. THX! G
  25. Here are two simple clipping tools using python SOP verbs: Bricker and Radial. Unlike the divide SOP it´s cutting always right through the center. python_cutting.hip
×