Jump to content
Sign in to follow this  

Name based colouring shelf tool

Recommended Posts

A few weeks ago i started working on a shelf tool for my self, to learn PyQt and make my own live a bit easier.
It allows uses to create a list of node names and assign colours to each name.

When applied all nodes in the project matching to any of the given names is given a colour linked to that name.

This can be used for example if you want to give all Null nodes the same colour without havin to look for every node in your project.

I'ts almost finished and would like some feedback on possible improvements.


attached is a file with the code.

Simply create a new shelf tool and  add the code in script tab.



node coloring tool.txt

Share this post

Link to post
Share on other sites

Ooooh PySide in Houdini, nice! I really like the idea of offering a workflow to improve scene cleanup, as I usually like to just focus on creating.. the cleaning up of scenes will almost always happen afterwards for me.


I'm only just in the process of learning Houdini, but I am certainly familiar with Python tool development in Maya including PyQt/Pyside. So I will try to give at least some advice.



- Houdini ( apprentice) crashes when closing the main form if a subform (color window) is open.

(Perhaps also try to see if an instance of your window is already open, so you can close that old instance and THEN give the user the new 'fresh' window. Otherwise you can get 4 open which makes reproducing the bug above more likely.)


Few other, perhaps less relevant thoughts from my side:


- Make the widget with the lineEdit, checkbox etc. scale horizontally, or set the mainwindow's horizontal sizepolicy to QtGui.QSizePolicy.Fixed . Right now the headers mis-allign and making the window bigger horizontally imho doesn't seem usefull in this case. (#ocd  :ph34r:)

The same goes for the color picking window ofcourse. If it doesn't have to scale, then I like to make it unable to scale. You can do this directly in the code, but the QtDesigner has the functionality as well ofcourse. 


- If possible, I'd split the UI code into a different file and import that into your main script (for clarity). Does Houdini have a default scripts folder? 


- Are you familiar with the new style stringformatting in python? Personally I find that way more readable and you can repeat arguments with that.



#old style

colourName = "comboBox_%d" % size

#new style

colourName = "comboBox_{0}".format(size)

nice read: http://stackoverflow.com/questions/5082452/python-string-formatting-vs-format

Then finally, I have a question for you!:
-Would you care to elaborate on the workflow of creating the GUI? You compiled through the commandline I presume?


P.s.: You might already know, but there's also a way to have certain types of nodes colored automatically. Eg; create a null and it will be colored black by default. Not sure how to make that work myself, but I got some user preference files from a colleague and that got me set up quite easily with that.


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this