Jason Posted February 28, 2009 Share Posted February 28, 2009 Hi there, Before rooting through the docs to find out how to do it, has anyone created Tools on the Shelves using HOM? I have a reason to want to populate a Shelf with some tools procedurally:) Anyone have example code of this? Thanks all Jason Quote Link to comment Share on other sites More sharing options...
graham Posted March 1, 2009 Share Posted March 1, 2009 (edited) I was skeptical at first but some quick investigation has proven it is indeed possible. You can access all the Shelves, Shelf Sets and tool stuff through the hou.shelves submodule. From there I was able to create a new shelf, create new tools and add them to this shelf. My current shelf set is the Technical Director one so the following code uses it. Others can be accessed from hou.shelves.shelfSets() td = hou.shelves.shelfSets()["shelf_set_td"] my_shelf = hou.shelves.newShelf("/tmp/my_shelf.shelf", "my_shelf", "My Cool Shelf") my_tool = hou.shelves.newTool("/tmp/my_tool.shelf", "my_tool", "Print kwargs", script="print kwargs") # The function to add a tool to the shelf takes a tuple/list so you are best off creating all your tools and adding them at once. If # you don't want to do that you can do something involving lists like myshelf.setTools(list(myshelf.tools()) + [tool1, tool2, etc]) my_shelf.setTools((my_tool,)) # The same must be done with hou.ShelfSet.setShelves. Another example of using lists that you could do for a loop. You can get a dictionary of every tool available in Houdini by doing hou.shelves.tools(). This allows you to use existing tools you might have already written as long as they are located in the HOUDINI_PATH. td_shelves = list(td.shelves()) td_shelves.append(my_shelf) td.setShelves(td_shelves) Voila. My Cool Shelf with a Print kwargs tool on it. Hope that helps Edited March 1, 2009 by graham Quote Link to comment Share on other sites More sharing options...
graham Posted March 1, 2009 Share Posted March 1, 2009 Another quick bit, I must thank Jason for asking the question as I think it's helped me uncover a rather annoying permission error/crash with editing shelves on the Mac build. Quote Link to comment Share on other sites More sharing options...
Jason Posted March 1, 2009 Author Share Posted March 1, 2009 Another quick bit, I must thank Jason for asking the question as I think it's helped me uncover a rather annoying permission error/crash with editing shelves on the Mac build. Any time, and I must thank YOU profusely for posting this example:) You should wiggle it into the HOM Cookbook, or something like it! Quote Link to comment Share on other sites More sharing options...
graham Posted March 1, 2009 Share Posted March 1, 2009 I'll see what I can do Quote Link to comment Share on other sites More sharing options...
sibarrick Posted April 1, 2009 Share Posted April 1, 2009 I would never even have thought of doing this. Crazy! you could have a shelf tool that creates itself on the shelf, pretty soon emergent life will evolve..... (I'll get back on my meds now) Quote Link to comment Share on other sites More sharing options...
edward Posted April 1, 2009 Share Posted April 1, 2009 So who's doing the first shelf tool that emulates an animated LED board on the shelf itself? Quote Link to comment Share on other sites More sharing options...
Jason Posted April 1, 2009 Author Share Posted April 1, 2009 So who's doing the first shelf tool that emulates an animated LED board on the shelf itself? This kinda whackness is reserved for Jens. http://forums.odforce.net/index.php?showtopic=839&hl= PS. Shield your eyes, H8 interface! 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.