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


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

  1. Embed Texture in FBX

    Hey guys, I am trying to create a workflow with which it is possible to embed texture image files in a FBX. I know that I will probably have to write a python script to do so. Maybe one of you has already done anything like that and could help me out? Regards, Emil
  2. Hi everyone! I'm starting to get into Python 2.7 for Houdini Indie (17.5) before jumping into Houdini 18 with Python 3, and I've been working in a flipbook tool until now everything is being okay but now I've found that I can't recover the camera settings/flipbook settings after generating the MPlay to maintain the user settings after applying the script. I've been trying to use the 'hou.GeometryViewportCamera.stash()' to create a copy of the settings but I'm not sure how to use it and where should I recover these settings. Also when I try to use it I get this error: 'TypeError: unbound method setDefaultCamera() must be called with GeometryViewport instance as first argument (got nothing instead)' I've created a simplified version of the script that I'll be attaching down below: If someone has any advice or idea of how would be the good approaching intro this, I'll bee really thankful. Thanks in advance to everyone.
  3. Executing hda python script every frame

    Hi there, I'm in the process of setting up a little viewport comment hda. All it does is changing the vcomment parameter on a selected camera. This works great for static text and variables but I haven't found a clean solution for time-dependent stuff such as $F. Since the hda python module doesn't execute every frame, I'm using a script SOP inside the hda which calls the phm function that updates the text every frame. The problem is, that this results in the HDA function executing last. So when doing flipbooks for instance, the image will be rendered before the hda function executes, thus the text lags behind by one frame ($F will show "1001" on frame 1002). Part of the problem is (I think) that the string is being evaluated inside the HDA. So the actual vcomment parm on the camera will already be "1001" instead of "$F" (which would probably evaluate correctly every frame). So if I could prevent the string from evaluating on the HDA, that would probably solve the issue. I'll try the same thing with a Python SOP instead of on the HDA's python module, but in the meantime, maybe someone has a better solution for this problem.
  4. Read backtick ` as string (Python)

    Hey guys, I'm writing a bunch of tools and I faced a problem : I don't know how to evaluate a backtick as a string with Python. I want to write this as the path : `opinputpath("/path/to/my/object", 0)` But I don't know how to evaluate the backticks as strings, so if anyone has an answer.. Cheers,
  5. Hi. I tried that way but got an error. error - 'NoneType' object has no attribute 'hdaModule" I created a new edit in the shelf tool and entered in, but it doesn't run. Why is that? (I want to load dop io preset. I want to change the preset when I click the shelf tool.) Thank you.
  6. As the title suggests, how do you drag and drop Qt data on to a parameter? I was able to use this example as reference. But in my case the i couldn't make the drop event register. The code i have now kinda works, but the dropped text is wierd. What's the right way to do this....could use some help! I'm attaching an example code. from PySide2.QtWidgets import * from PySide2.QtCore import * from PySide2.QtGui import * import hou class TreeWidget(QTreeView): def __init__(self): super(TreeWidget, self).__init__() self.setDragEnabled(True) # def dragEnterEvent(self, event): # print "dragEnterEvent" # event.acceptProposedAction() def mouseMoveEvent(self, event): print "MoveEvent" mimeData = QMimeData() data = (self.selectedIndexes()[0]).data() mimeData.setText(data) drag = QDrag(self) drag.setMimeData(mimeData) drag.exec_(Qt.CopyAction | Qt.MoveAction, Qt.CopyAction) # def dropEvent(self, event): # print "dropEvent" # mime_data = event.mimeData() class Example(QWidget): def __init__(self): super(Example, self).__init__() self.build_ui() def build_ui(self): self.setGeometry(300, 300, 150, 250) self.setParent(hou.qt.mainWindow(), Qt.Window) mainlayout = QVBoxLayout() self.setLayout(mainlayout) self.tree_widget = TreeWidget() self.tree_widget.setRootIsDecorated(False) self.tree_widget.setHeaderHidden(True) model = QStandardItemModel() self.tree_widget.setModel(model) mainlayout.addWidget(self.tree_widget) for i in range(10): parent_item = QStandardItem('Example_{0} \nnew_line_{0} \n '.format(i)) model.appendRow(parent_item) def dragEnterEvent(self, event): event.acceptProposedAction() # def dropEvent(self, event): # print "dropEvent 2" # str = event.mimeData().text() # event.acceptProposedAction() ex = Example() ex.show()
  7. Hey guys, I am trying to store some variables into the session source so I can easily get at it at any time. So far the tests I've been running have been working great, but I am not quiet sure how I can expand on the syntax to allow for variables to control the values set into the source. This is the syntax I've used so far: hou.setSessionModuleSource("variablename = 0") However, as far as I've been able to figure out this will only allow for hard coded values, I am looking to insert the value from a variable instead of a hard coded value, like this: mynum = 3 hou.setSessionModuleSource("variablename = mynum") When I try this in the python shell I get the error back that "name 'mynum' is not defined" (along with some more text, most notably of which I guess is that it says the operation failed). Do you guys have any tips on how I could make this work? Sorry if this is very basic, I've been trying to look around for specific syntax examples but I am having kinda a hard time finding examples of actual syntax for the Houdini specific python commands. Thanks for the read!
  8. Hi, i'm using an api whitch uses async and awake calls (i'm not that familiar with threading) - the problem is that these calls are stopping/blocking my whole houdini interface from working I'm connecting houdini with discord by import discord token = "xxxxxxxxxx" client = discord.Client() @client.event async def on_message(message): print(message.content) messages = await channel.history(limit=123).flatten() if message.content.find("hello") != -1: await message.channel.send("hi back") client.run(token) but this blocks my whole houdini application - the python script is running smoothly in the background (and works) Hope you can help me! - really desperate at the moment that this is not working if it i helps: discord api is using asyncio to work with threads
  9. Hey there, I'm trying to export point locations and prims from e geometry. I wrote a very simple Python script which is looping through points and prims, but it's quite slow. It can take up to 10s for geometries with 8/10k polygons. Is there a faster way to do it? Maybe some python methods that are optimized, which I don't know. Here's my actual code: def getGeo(): return { "vertices": getPoints(), "faces": getPrims() } def getPoints(): pointsList = [] node = hou.node('obj/geo1/OUT') geo = node.geometry() pointsLen = len(geo.points()) p = 0 for point in geo.points(): for comp in range(0, 3): pointsList.append(point.position()[comp]) p = p + 1 return pointsList def getPrims(): primsList = [] node = hou.node('obj/geo1/OUT') geo = node.geometry() primsLen = len(geo.prims()) p = 0 for prim in geo.prims(): for v_index in range(0, 3): primsList.append(prim.vertex(v_index).point().number()) p = p + 1 return primsList as you can see, I call getGeo() to return an object which contains an array of vertices and an array of faces, but it's terribly slow. Any ideas??
  10. Python - Integer to String

    In the Python SOP, I've run into a wall trying to get an integer converted to a string. In the larger picture, I'm trying to subtract 1 from a value which is currently part of a string. There are probably neater ways to write these steps, but I'm fairly new to Python so I'm writing it all out to make things easier to follow. I start with a string such as: string = "f27" Then remove the 'f' like so: string = string[1:] Convert it to an integer: integer = int(string) Subtract 1 from the value: integer -= 1 set new string string_new = "f" + str(integer) The last line returns an error on the Python SOP: TypeError: str() object is not callable. This is confusing because these same steps work just fine in the Python shell. Is there an alternative to str(), or am I using it wrong?
  11. We're a San Francisco-based startup focused on generating computer graphics for customers that build computer vision neural networks. At the moment, we have a Houdini + VRAY pipeline for specific asset niches. We are looking to expand the pipeline in terms of asset types as well as rendering engines, and ideally PDG. Remote is fine, so long as you are able to consistently work Pacific Time or Eastern Time hours. Please reach out to me, matt@synthesis.ai for more information.
  12. Hey hey there, I came across an issue and hope to find some help here once again I tried searching but didn't really know what to search for and then ended up unsuccessful. I am trying to create a Solaris/USD network with my python script but when I set the list parameters on the instancer node it only changes the choice visually but does not actually use it. As an example, when I set the "Prototype Index" to "Name Attribute" manually, the UI shows a new field to enter the name attribute. When I do this in Python: usd_instancer.parm('protoindexsrc').set("Name Attribute") usd_instancer.parm('nameattr').set("instancename") the "Prototype Index" gets set to "Name Attribute" but the extra field is not shown and the node behaves as if it's set to its default value. If I then open the list and click on "Name Attribute" myself again, it shows the new line with my correct name attribute. How would one go about solving this? Is there an extra function connected to this list choice that I have to trigger as well in Python? As always, I am very grateful for any pointers, ideas and help! Update: I noticed now that sometimes the script does not even set the list parameter. E.g. when I open a fresh scene, use my script, it creates the instancer with default values (no errors though). When I run my script again, it creates a new instancer with the list set to my values, but still having the initial issue mentioned above :/ Update2: I also posted over on the sidefx forums now and have a small screenshot to show what I mean:) I set the parameter in Python, it evaluates correctly in the shell but is neither shown in the interface nor actually used. Take care, Dziga
  13. opunhide all nodes using python

    How do you opunhide all nodes in a particular category or a bunch of specific nodes using python? I wish to add this in my startup script. a simple hou.hscriptExpression("opunhide Sop point") dosent seem to work. Nor does hou.hscript(). What am i doing wrong?
  14. import hou import pprint node = hou.node('/obj/geo1/subnet2/TestNode') number = 5 parm_tuple = node.parmTuples()[number] name = [parm.name() for parm in parm_tuple] group = node.parmTemplateGroup() parm_template = group.entriesWithoutFolders()[number] myIndex = group.containingFolderIndices(parm_template) folder = group.entryAtIndices(myIndex) ContFolder = group.containingFolder(parm_template) name = ContFolder.name() label = ContFolder.label() node = hou.node('/obj/geo1/subnet2') group = node.parmTemplateGroup() folder = hou.FolderParmTemplate(name, label) folder.addParmTemplate(parm_template) group.append(folder) node.setParmTemplateGroup(group) I am not a python guy, and I'm stuck and need some help. What I want to do is, I want to make a custom HDA that has a node(ex.Mantra) inside, and I want to copy all the parm(+folders) in the Mantra Node,and paste it in the HDA parameter. Also I want to reference it each. I tried and figured out how to copy the parm and folder,but when I do this to all the parm,it will make a lot of folder with the same name... Is there any good way to do this? I want do it with python. Thanks, Hiro
  15. Advanced UI Customization

    http://patreon.com/posts/32631275 http://gumroad.com/l/houdinisupercharged In this video I will go through the GUI customizations I did for Houdini 18. So let's get into it.
  16. Hello all, I am looking for a way to set a specific preference in Houdini with python. The preference I am looking to set is named "Auto Save Method" in the UI. I've tried to use the hou.getPreferanceNames() to get a list of all the pref name variables I can set but this does not appear in there. I have had a dig through the preference files stored inside the Houdini folder and have found a parameter inside the hcommon.pref file that would seem to match the setting I am looking to change, however, if I were to edit this text file whilst Houdini is running, would that update the setting or would it require a restart of Houdini? And is it even a good idea to be editing these .pref files whilst Houdini is running? Here is a link to the help file for the parameter I am looking to change, sorry I don't have a picture: https://www.sidefx.com/docs/houdini/ref/windows/mainprefs.html#persistence (Look for the heading "Auto Save Method", this is the setting I am looking to change) You'll have to forgive me if this is very basic stuff, I am kinda new to Python in Houdini and am trying to make tools to learn more. Thanks for the read!
  17. switch takes and render

    Hello. Im trying to run inside houdini a python script to switch takes and render after every take. It works but it only render the last take: takes_list = hou.takes.takes() for take in takes_list: # if "Main" in take.name(): continue else: print("setting to take: {}".format(take)) hou.takes.setCurrentTake(take) print(hou.takes.currentTake()) rnode = hou.node("/out/Redshift_ROP_CHAR") rnode.render() what`s the problem here? thank you.
  18. Hello guys, I'm new to Houdini and to writing python scripts for Houdini. I'm currently working on a project where I want to change the Rotation, Scale or Transformation of a geometry node by moving physical rotary encoders, which are connected to an Arduino Uno. The serial connection between Houdini and the Arduino works fine. In my script, which I save as a custom shelf tool, I change the parameters of the node by using the set() function of the Parm object. The amount of change comes from the encoders. For example: node.parm('tx').set(change) The problem for me is that while the script is running and I change, for example, the rotation of a cube, like node.parm('rx').set(25), the cube is not rotating in the viewport. The cube is only changing once the script has finished and stopped running. Basically, the viewport is only updated with the new, for example, rotation parameters once the script has finished running. The geometry node is not moving in the viewport while the script is running. My goal would have been to have the script running in the background while working on Houdini like usual, and when changing the rotation of a node via set(), the node is also rotating in the viewport. Therefore, my main question: Is there a way with the hou object to force the viewport to display all the currently new set parameters of a node (like Scale, Rotation and Transformation) while a python script from the shelf is running. Thank you for your help.
  19. https://www.sidefx.com/forum/topic/52186/ Oct. 19, 2017 4:14 P.M. Is it not possible to enable the lock view to camera button via python/hscript? experimenting w/python on this in Apprentice 16.5.634 (_old_ PC) and running into issue(s) https://www.sidefx.com/docs/houdini/hom/hou/GeometryViewport.html ... showed me several things which DO seem to work using the following syntax : import hou, toolutils myCam = hou.node('/obj/').createNode('cam', 'myCam') hou.ui.paneTabOfType(hou.paneTabType.SceneViewer).curViewport().setCamera(myCam) # hou.hscript('viewhome -s *.*.world.persp1') hou.ui.paneTabOfType(hou.paneTabType.SceneViewer).curViewport().homeAll() hou.ui.paneTabOfType(hou.paneTabType.SceneViewer).curViewport().saveViewToCamera(myCam) # ... HOWEVER, when I try something similar, I just get an Error on : >>> hou.ui.paneTabOfType(hou.paneTabType.SceneViewer).curViewport().lockCameraToView() Traceback (most recent call last): File "<console>", line 1, in <module> AttributeError: 'GeometryViewport' object has no attribute 'lockCameraToView' # ... and I have Not found any way to do this using hscript either. Anyone have advice on this?
  20. Ok, this is a simple question, but I've been out of python for so long, I've lost touch. I have a node called geo1. When I run the following script, i'd like the "Node to copy is" to give the same result of "Selected is" ( I think one is called 'getting an instance', and the other is just returning the node name). Noob question I know. if(hou.selectedNodes()): selected = hou.selectedNodes() nodeToCopy = hou.node('/obj/geo1') print "Selected is " + str(selected) print "Node to copy is " + str(nodeToCopy) Instead it returns: Selected is (<hou.ObjNode of type geo at /obj/geo1>,) Node to copy is geo1 How do I get the same return when giving an explicit node path?
  21. Hey folks, I'm executing a Windows .bat file which is written out by a pythonprocessor TOPs node to run some things on another sever. Everything works if I hardcode the filename to the batch file, but I want it to generate and execute .bat files for each work item I'm trying to access `@filename`in the pythonprocessor, but not getting anywhere. How can I access the attribute so .format fills in the path correctly? PidginCode: outFile = `@filename` filePath = "path to directory/{}".format(outFile) The sample file docs are bereft of examples so I'm wondering if I'm going about it the wrong way. Thoughts? EDIT: I made a string parameter on the node I'm querying and pointed evalParm at it. Is that the most sensible way? node = hou.node('/obj/topnet1/nodeName') parmName = str(node.evalParm('parm'))
  22. Hi All, Is there any way I can access bundle panel to find out what node is selected in the highlighted bundle? Using python, I assume? Thanks in advance for any directions F
  23. http://patreon.com/posts/33249763 http://gumroad.com/l/houdinisupercharged In this video I will show you some of the inner workings of the context-sensitive rule-based hotkey system that I implemented and one I have been using for a while to speed up my workflow inside Houdini. It's a very light-weight and flexible system that allows an arbitrary number of actions to be assigned to any key, with extensive modifier key and state support (Ctrl, Shift, Alt, Space, LMB, MMB, RMB, selection state). It's deeply integrated into the overlay network editor workflow.
  24. Modeler 1.0

    Modeler 1.0 for Houdini released! Free for all the DM 2.* users. $70 for the DM 1.* users. https://gum.co/xKBKM What's new: 1. DM now renamed to Modeler 1.0 2. new feature: the DM menu (Z hotkey) has been replaced with a new alignment menu where you can use tools for fast and accurate transformation. The menu includes the whole set of tools for working with a compass, geometry centring, quick flattening with gestures and many other transformation tools. Use the hotkeys for the tools of the old DM menu. 3. new feature: Deform Menu (N hotkey) with lots of interactive deformation tools including a new Lattice tool 4. new feature: MODELER_PICK_STYLE environment variable allows to override Modeler startup selection pick style. Add it to the houdini.env file. Use "Box", "Lasso", "Brush" or "Laser" values, then restart Houdini. 5. new feature: the hard and soft boolean tools are now combined in a new menu called Boolean (J hotkey) 6. new feature: a Fix Curves tool helps get rid of broken lines in open polygons. This helps when beveling corners of open polygons. 7. new feature: a Select Curves tool helps to select open polygons (curves) in the model 8. improvement: now some tools can create curves and process them. For example, the Extrude tool can produce lines from selected points. The Collapse tool can flatten open polygons (curves). The Connect tool can be used to cut a segment between two selected points or connect two open faces. The Push tool now properly moves points in open faces. 9. improvement: the RMB menu of the Push tool has a new item Toggle Connectivity, which allows you to move points, capturing the points of other closed pieces 10. improvement: the Push tool now works slightly faster 11. improvement: the Push tool can now slide point with Ctrl+MMB 12. improvement: the mouse and keyboard shortcuts of the Push tool have been completely redone 13. improvement: if nothing is selected, the Hose tool searches for all the curves in the current geometry 14. improvement: a Group parm added to the Hose Tool. Can be used in conjunction with a result of the Duplicate tool 15. improvement: Hose now creates straight edges tube if the Resample Curve set to zero value 16. improvement: Geometry Library renamed to KitBash and works only as the python panel 17. improvement: KitBash replace feature now doesn't update the item icon 18. improvement: Tools Panel now has a new category KitBash with tools for working with the library items. Now you can create, save, overwrite and update icons faster, without actually working in the KitBash panel 19. improvement: volatile edge sliding now does not require explicit movement of the mouse pointer to the edges 20. improvement: volatile edge sliding now can be used to slide points and faces 21. improvement: Fix Overlaps can now use face groups 22. improvement: Duplicate applied to edges now creates a curve in the current geometry object 23. improvement: the Resymmetry tool now works slightly better. The Tollerance parameter is no longer saved between nodes (). This allows you to not change the position of the seam points. 24. improvement: mouse wheel manipulation in various tools has been improved 25. improvement: new simple box type has been added to the QPrimitive HDA 26. improvement: Tools Panel now has a more logical structure for faster access to popular tools 27. improvement: the Modeler shelf was fully revisited 28. improvement: the Walk History Up and Walk History Down tools (Up and Down hotkeys) now work more interactively when traveling through nodes with more than one input or output. 29. improvement: the Select By Shells tools was replaced with a new Convert To Shells tool (Ctrl+1) 30. improvement: double-clicking with LMB in the viewport is completely revisited. Now you can jump to objects level by double-clicking LMB in an empty space. Clicking on a geometry allows you to quickly switch between objects. If you are in a certain state, double-clicking activates the selection mode. All these improvements speed up the modeling process. 31. improvement: the deformation tools (Size, Ramp, View) now have the fixed blend feature. The transition between the deformable points and the undeformable part looks more correct. 32. fix: Hose now orients rings copies correctly 33. fix: Slice, Mirror and Cut tools now set correct geometry center on tool activation 34. fix: JumpUp and JumpDown tools does not work when Compass is active 35. fix: QLight now works properly if you run it from the orthographic viewport 36. fix: sometimes camera movement with Alt did not work after a mouse click 37. Lots of tools have changed hotkeys. Look at Tools Panel for more details. 38. Python code has been revisited 39. Documentation has become more detailed 40. Overall speed improvement 41. Other improvements Works only in Houdini 18. Use build >= 18.0.346
  25. Hi, Im new to python, Im trying to use vscode as external editor but it really sucks at being intuitive for a beginner... 1) Im trying to add the hou.module so I can see the functions but It doesnt show the functions: my settings.json looks like this: { "python.pythonPath": "C:\\PROGRA~1\\SIDEEF~1\\HOUDIN~1.287\\python27\\python.exe", "python.linting.pylintEnabled": false, "python.linting.enabled": true, "python.linting.flake8Enabled": true, "[python]":{}, "python.jediEnabled": false, "python.autoComplete.extraPaths": [ "C:\\Program Files\\Side Effects Software\\Houdini 18.0.287\\houdini\\python2.7libs\\Hou.pyc" ], } (I tried without the [] brackets too) 2) Also when I edit a .py Code tells me: Linter flake8 is not installed. And when I click Install is says: There is no Pip installer available in the selected environment. Can someone help? Im using: Windows 10 Houdini 18 VS Code v 1.41.1 Python v 2.7.15 64-bit