Jordan Walsh Posted November 30, 2015 Share Posted November 30, 2015 Hi, Is there a Python way to grab a nodes icon directly from houdini to use as an icon in a PyQt4 QTreeWidget or similar? Would be nice to add them for when I'm displaying a tree of nodes. Cheers! Quote Link to comment Share on other sites More sharing options...
graham Posted November 30, 2015 Share Posted November 30, 2015 hou.NodeType.icon() will return the icon name/path which can then be used with hou.ui.createQtIcon() Quote Link to comment Share on other sites More sharing options...
Jordan Walsh Posted December 1, 2015 Author Share Posted December 1, 2015 Thanks Graham, Looks like that works for 14+, any solution for Houdini 13? Quote Link to comment Share on other sites More sharing options...
graham Posted December 1, 2015 Share Posted December 1, 2015 There is not an ideal solution, no. The hou.NodeType.name() function still returns the same so you'd be forced to write additional supporting functions that can parse that and handle various possibilities: Regular Houdini icon aka "SOP_box" which you'd then have to expand out to the full path located inside the HFS (or custom locations, also possibly dealing with icon mappings) Icons embedded inside operator definitions "opdef:...." Regular icons pathed on disk. Nothing that's overly hard, but not super easy without some understanding of where Houdini likes to keep things and whatnot. Quote Link to comment Share on other sites More sharing options...
Jordan Walsh Posted December 1, 2015 Author Share Posted December 1, 2015 hmmm... i thought as much... perhaps i can go with out pretty icons for now Quote Link to comment Share on other sites More sharing options...
Jordan Walsh Posted December 1, 2015 Author Share Posted December 1, 2015 Arrg.. I couldn't resist... I can all of them apart from the opdef ones. I can use readFile(node.type().icon()) but I'm not sure if I can pass this to a QIcon object. Quote Link to comment Share on other sites More sharing options...
graham Posted December 1, 2015 Share Posted December 1, 2015 For embedded icons you could grab the contents from the icon section of the asset definition and write it to disk and then read that back in. Though you'd want to have some sort of method to know if the icon for a node type was already written out so it wasn't doing it every time the ui updated. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.