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.


  • Content count

  • Joined

  • Last visited

  • Days Won


Community Reputation

25 Excellent

1 Follower

About asnowcappedromance

  • Rank

Personal Information

  • Name Manuel
  • Location Vancouver, B.C.
  1. Hey what's up community? In order to keep this thread alive, although I'm hardly ever posting, here's my latest and greatest Python project! Would be awesome to get some feedback on this, cheers!
  2. Hi guys, I'm trying to assign a hotkey to the tool section of a script OTL and can't get it to work. Script is located in 'Type properties > Tools'. parameters on the Options Tab are defaults: Name - $HDA_DEFAULT_TOOL LABEL - $HDA_LABEL Then I go to the Hotkeys tab, hit 'Edit' (Global), then the Hotkey Manager pops up and the 'Action' column is selecting 'HDA_LABEL' by default. Now when I assing a hotkey to this, I'm getting the following error pop-up on execution of the hotkey: 'Cannot find the tool $HDA_DEFAULT_TOOL.' Does anybody know how to fix this / what's going on? Thanks a lot, Manu
  3. No Of course Linux does have copy/paste What I wanted to do is store strings that are created by Python into the clipboard, that's not possible without using modules in Python. Using PySide/PyQt, not only can you store strings, you can also store images as well as Mime data, which can be quite helpful!
  4. Here's an interesting snippet I came up with the other day. If you want to copy/paste stuff with Python, but you're working on Linux and 'xsel' is not installed on your system, you can abuse PySide to access the clipboard. Following code takes the path of a selected node and copies it into the clipboard, so you can paste it with ctrl-v: if hou.selectedNodes(): import PySide.QtGui as qtg app = qtg.QApplication.instance() clipboard = app.clipboard() string = hou.selectedNodes()[0].path() clipboard.setText(string)
  5. To answer my own question: for entry in QtGui.qApp.allWidgets(): if type(entry).__name__ == 'Window': entry.close()
  6. 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!!!
  7. You can look up the incoming geometry the following way: hou.node('/obj/geo1/null1').inputs()[0].geometry()
  8. No problem. Go to a houdini shelf, right click and click "new tool". Give your new tool a name, i.e. colorLab. Paste the following code in the script section: import os #Add dynamic path to houdini home folder BASE_PATH = hou.hscriptExpression("$HOME").replace("/", "\\") PY_PATH = "".join([BASE_PATH,"\houdini14.0", "\scripts\ColorLab_v1.0.py"]) execfile(PY_PATH) If you're using Houdini 15, change the 14 to 15 in the above code. Then go to your Documents/houdini folder and create a 'scripts' folder. Place the following files in that scripts folder: color_config.json ColorLab_v1.0.py OnCreated.py That's it You can add an icon too if you want. (Options tab of the shelf tool)
  9. >>> n = hou.node('/obj/geo2/null2') >>> ptg = n.parmTemplateGroup() >>> for i in ptg.entries(): ... print i ... <hou.ToggleParmTemplate name='copyinput' label='Copy Input' default_value=True> <hou.ToggleParmTemplate name='cacheinput' label='Cache Input' default_value=False> <hou.FolderParmTemplate name='folder0' label='Folder Name' folder_type=MultiparmBlock> >>> ptg.find("folder0") <hou.FolderParmTemplate name='folder0' label='Folder Name' folder_type=MultiparmBlock> >>> f = ptg.find("folder0") >>> f.parmTemplates()[0] <hou.FloatParmTemplate name='parm#' label='Label' length=1 naming_scheme=Base1 look=Regular default_value=(0,)> >>> me = f.parmTemplates()[0] >>> me.setName("newTest#") >>> me <hou.FloatParmTemplate name='newTest#' label='Label' length=1 naming_scheme=Base1 look=Regular default_value=(0,)> >>> f.setParmTemplates((me,)) >>> ptg.replace("folder0", f) >>> n.setParmTemplateGroup(ptg) >>> In order to change the name of the parm using Python, you'll have to use parmTemplates. This is a way to do it. For some reason, a Multiparmblock can't be found via parmTemplateGroup().findFolder(), but you can access it with just find().
  10. All you have to do is open the Edit Parameter Interface, select the parameter inside your Multiparm Block and rename the label with a '#' suffix, which will result in appending a number starting from 1 to your parm labels. Cheers, Manu
  11. Hi Alexey, Thanks for the reply. The problem is that I think by default QWidgets in PySide Houdini already use the hou.ui.qtStyleSheet() because when I apply this in Houdini 15 to my QWidget, the look doesn't change either, there is no difference at all to the jpg that I posted before. Is your GUI look changing when you set the Style Sheet like that? Setting it to something like 'setStyleSheet("background-color: #00FF00; color: #FFFFFF")' makes a big difference on the other hand. Cheers!
  12. so I ran into another PySide problem ... Maybe one of you can enlighten me on what I'm doing wrong with this one? I'm trying to use the QtGui.setStyle() function in order to change the style of my GUI. Turns out, no matter what preset I use, it all looks the same. (Using Windows7). (Attached a screenshot) Here's the code I'm running in a shelf tool: from PySide import QtGui, QtCore class Window(QtGui.QWidget): """A setStyle() test""" def __init__(self): super(Window, self).__init__() self.setGeometry(50, 50, 500, 300) self.setWindowTitle("PyQT tuts!") self.home() def customHandler(self, ErrorType, ErrorContext ): #print "Type:", ErrorType #print "error:", type(ErrorContext) pass def home(self): btn = QtGui.QPushButton("Test Button") styleChoice = QtGui.QLabel("Windows Vista") comboBox = QtGui.QComboBox() comboBox.addItem("motif") comboBox.addItem("Windows") comboBox.addItem("cde") comboBox.addItem("Plastique") comboBox.addItem("Cleanlooks") comboBox.addItem("windowsvista") comboBox.activated.connect(lambda: self.style_choice(comboBox, styleChoice)) QtCore.qInstallMsgHandler(self.customHandler) qvbox = QtGui.QVBoxLayout() qvbox.addWidget(btn) qvbox.addWidget(comboBox) qvbox.addWidget(styleChoice) self.setLayout(qvbox) def style_choice(self, comboBox, widget): cur_str = comboBox.currentText() widget.setText(cur_str) QtGui.QApplication.setStyle(QtGui.QStyleFactory.create(cur_str)) def run(self): self.show() main = Window() main.run() Thanks a bunch! Cheers!
  13. Have you had a look at Hython? Comes installed with Houdini. Example: in the shell: hython script.py script.py contents: import shutil #copy hip template into another directory newfile = ‘/path/to/my/hip/file/newhipfile.hip’ shutil.copy('/dir/file.hip', newfile) hou.hipFile.load(newfile) hou.node("/path/to/driver").pressButton()
  14. Hi guys, Thanks for the feedback and glad you like it. I didn't use qtdesigner on purpose since I wanted to learn Pyside from scratch, as it helped me a lot to understand how it works. It's awesome that the tool works on Mac, too. As for linux, I tested the tool at work yesterday and it turns out I had to change the following: #Add dynamic path to houdini home folder BASE_PATH = hou.hscriptExpression("$HOME").replace("/", "\\") JSON_PATH = os.path.normpath("".join([BASE_PATH,"\houdini14.0", "\scripts\color_config.json"])) #Add dynamic path to houdini home folder BASE_PATH = hou.hscriptExpression("$HOME") JSON_PATH = os.path.normpath("".join([BASE_PATH,"/houdini14.0", "/scripts/color_config.json"])) One major issue that I ran into (and I'd be interested if somebody found a fix for this) is that the drag & drop ONLY works if I have a python panel open (not to be confused with the Python shell) and if I drag the node over this panel and then onto my tool. That's quite strange and I haven't found a foolproof way to do this yet. Suggestions are most welcome! Paul - See you soon in Vancouver!
  15. I wanted to share my new project with the community, it's called the 'Node Color Laboratory'. Intended to be used as a shelf tool, this tool has been written in Python and PySide. I've seen a bunch of people using various ways to enforce color coding, however none of the approaches was using an interface, so I decided to build one to make organizing colors most intuitive. Here's the link to the vimeo file: Attached are the files you're going to need to run the tool, to be placed in the $HOME/houdini14.0/scripts folder. You will have to create a new shelf tool and paste the script found in the 'ColorLab_v1.0.py' file in there. This tool has been developed in Windows, I haven't had a chance yet to check if the same directory structures work in Linux/Max. Feedback always appreciated, cheers! colorLab.rar