Jump to content

Name based colouring shelf tool


Maurits

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

Link to comment
Share on other sites

  • 2 weeks later...

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.

 

Bug:

- Houdini (15.0.244.16 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.

 

Example:

#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.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...