Sometimes it’s the little things….

Sometimes shortcuts in max require a little bit of scripting, there is no way without using script to turn off the viewport background for example, but it’s easy enough to write a macroscript that does exactly this then assign this to a shortcut key, toolbar button or quad menu item.

macroScript ToggleViewportBackground
 category:"DW_Tools"
 toolTip:"Toggle Viewport Background Image on and off"
(
 viewport.DispBkgImage = not viewport.DispBkgImage
)
Advertisements

About davewortley

Somewhere between an artist and a programmer, I like technical things, but being creative. I love problem solving and coming up with elaborate solutions. This blog is where I shall share ideas, tips, tutorials and anything that amuses me.
This entry was posted in 3dsmax, MaxScript. Bookmark the permalink.

6 Responses to Sometimes it’s the little things….

  1. This Is Great Dave! Very useful implementation of code. And the best part it fits in one line!

    Like

  2. Swordslayer says:

    As for ‘no way’, Alt+B > Display Background works for me; of course, this is a bit more straightforward.

    More fitting example here would be backgroundImageFilename = “” or rendOutputFilename = “” which both are ways to remove file dependencies you can’t easilly (or at all) get rid of via UI.

    Like

    • davewortley says:

      Alt+B then press Display Background and Ok is 3 user inputs, with this script you can assign it to a shortcut and toggle the display of the background back and forth with one action which is very useful sometimes when you want to compare alignments for example.

      backgroundImageFilename = “”
      is very useful and worth having on this post thanks.

      rendOutputFilename = “”
      is good too but make sure you set
      RendSaveFile = false
      Otherwise you’ll get some odd messages sometimes when doing render tests.

      Like

      • Swordslayer says:

        Yes, as I said, it is definitely more straightforward this way, no ill intent on my part 🙂

        And I agree that rendSaveFile would be needed – if it was part of a script; it just didn’t quite fit in the ‘no way to get rid of’ category as there’s a checkbox in render dialog for it. Both these commands need a render dialog to be closed to function properly, as it would override their values on close, too. But mentioning all this in a comment would be more like a self-contained blogpost instead of just hinting at two useful globals.

        Like

  3. davewortley says:

    It’s fine 🙂 I like a good ‘geek-off’ and I think it’s great that people can see the rationale behind our discussion as it shows the thought processes needed to script in max.

    A few small points 😉 once you set the RendOutputFilename to “” you cannot then untick the SaveRendFile checkbox.

    And you can use the RenderSceneDialog.commit() and RenderSceneDialog.update() to keep the RenderSceneDialog open which is good to do if using VRay so it doesn’t have to do a license check again.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s