Jump to content
GlennimusPrime

Creating Custom Shelf Buttons [SOLVED]

Recommended Posts

Posted (edited)

I've been working with particles a lot recently and find myself continuously needing to open the 'display options' window to switch between displaying particles as points or discs (so I can visualise the pscale in viewport).

NrC2X8i.jpg
Would these two display options be something I could add to the shelf as two buttons? Display particles as points and display particles as discs?
I have no knowledge of how to create shelf buttons.

Edited by GlennimusPrime

Share this post


Link to post
Share on other sites

"Display particles as Discs" is like copying a Primitive Circle/Sphere to Points. The Copy to Point SOP will assign pscale to primitive objects as well and should suit your visualization needs.

Share this post


Link to post
Share on other sites

Hi thanks @Fenolis I was hoping for an easy shelf button so I can quickly switch between the two ideally. I don't want to have to do the whole copy to points thing whenever I want to switch back and forth between points and discs. I know it's a quick setup to do that, but not ideal when doing this many times a day across multiple projects.

Share this post


Link to post
Share on other sites

This code should work, you can make a new shelf tool by right clicking in any empty shelf space and then choose 'New Tool...'

 

You can paste this in the 'Script' tab:

if hou.ui.curDesktop().paneTabOfType(hou.paneTabType.SceneViewer).curViewport().settings().particleDisplayType() == hou.viewportParticleDisplay.Points:
    hou.ui.curDesktop().paneTabOfType(hou.paneTabType.SceneViewer).curViewport().settings().particleDisplayType(hou.viewportParticleDisplay.Discs)
else:
    hou.ui.curDesktop().paneTabOfType(hou.paneTabType.SceneViewer).curViewport().settings().particleDisplayType(hou.viewportParticleDisplay.Points)

 

  • Like 1

Share this post


Link to post
Share on other sites

Incredible! Thank you so much @jkunz07 This has really made my day! I really do spend a lot of time jumping in and out of the preferences window all day long.

Share this post


Link to post
Share on other sites

Hey John,

Thanks for the code. I have a question, does Houdini echo your actions somewhere? I remember in Softimage, every action I did, the python would echo that action, so it was easy to create scripts as you could grab the code from there.

Does Houdini have that kind of functionality?

6 hours ago, jkunz07 said:

This code should work, you can make a new shelf tool by right clicking in any empty shelf space and then choose 'New Tool...'

 

You can paste this in the 'Script' tab:


if hou.ui.curDesktop().paneTabOfType(hou.paneTabType.SceneViewer).curViewport().settings().particleDisplayType() == hou.viewportParticleDisplay.Points:
    hou.ui.curDesktop().paneTabOfType(hou.paneTabType.SceneViewer).curViewport().settings().particleDisplayType(hou.viewportParticleDisplay.Discs)
else:
    hou.ui.curDesktop().paneTabOfType(hou.paneTabType.SceneViewer).curViewport().settings().particleDisplayType(hou.viewportParticleDisplay.Points)

 

 

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

×