Author Topic: 3DS Max script help  (Read 3162 times)

2021-02-04, 11:10:56

aaouviz

  • Active Users
  • **
  • Posts: 453
    • View Profile
    • Another Angle 3D
Off topic, I know. But this is my fav forum and I know you lot are super smart, away from the Corona world too...

I'm wondering if anyone knows how I can script an action to toggle OFF snaps when I provide a hotkey.

I can TOGGLE snaps easily enough with a script, but I want to disable (aka turn off) snaps even if it's already off. The problem with the toggle is that if I press my hotkey it might turn it on when I actually want it off.

The purpose of this is that I want to combine an "Unhide all" with Toggling snaps OFF so my heavy scenes don't freeze up when I unhide a lot of geometry.

I hope this is clear! Thanks for any tips.

2021-02-04, 13:48:08
Reply #1

Frood

  • Active Users
  • **
  • Posts: 1664
    • View Profile
    • Rakete GmbH
but I want to disable (aka turn off) snaps even if it's already off.

Seems like you need just "snapmode.active=false"?


Good Luck



Never underestimate the power of a well placed level one spell.

2021-02-04, 15:37:14
Reply #2

aaouviz

  • Active Users
  • **
  • Posts: 453
    • View Profile
    • Another Angle 3D
Right you are sir! Big thank you!

(Though, I swear I did try this... must have got some combination of it wrong somewhere.)

Thanks again.

2021-09-09, 09:34:10
Reply #3

aaouviz

  • Active Users
  • **
  • Posts: 453
    • View Profile
    • Another Angle 3D
Hi hi,

Another maxscript related question seeing as you answered the last so well :)

I want to turn off a specific layer (the layer is called 100_SS) with a simple little MaxScript

I know this must be possible, but my maxscript skills are not quite up-to-scratch...

Thanks in advance!

2021-09-09, 10:55:10
Reply #4

clemens_at

  • Active Users
  • **
  • Posts: 88
    • View Profile
try this:

Code: [Select]
((layerManager.getLayerFromName "100_SS")).ishidden = true

2021-09-09, 13:15:16
Reply #5

aaouviz

  • Active Users
  • **
  • Posts: 453
    • View Profile
    • Another Angle 3D
Seems to work!

Thanks mate, appreciate it :D

2021-09-09, 14:16:47
Reply #6

aaouviz

  • Active Users
  • **
  • Posts: 453
    • View Profile
    • Another Angle 3D
Ok, now I'm here to bother you smart folk once again...

I have this following script:

Code: [Select]
((LayerManager.getLayerFromName "100_SS")).current = true

macros.run "Layers" "SceneExplorerSetActiveLayerAsParentLayer"

((LayerManager.getLayerFromName "0")).current = true

It's intended to set my "100_SS" layer as current, move the selected objects to that layer and then set default layer back as current. It works perfect :D

However, I also want to make this more useful by turning it into either a button or keyboard shortcut. I've done this previously with other snippets of code with the following:
Code: [Select]
macroScript AACollapseLayers
category:"1AAScripts"
toolTip:""
(CODE GOES HERE

This doesn't work. ā€ˇParenthesis "( )" in the wrong place, or something, but no matter what I try, I can't get this to work. Any tips?

Much appreciated!

2021-09-09, 14:31:58
Reply #7

clemens_at

  • Active Users
  • **
  • Posts: 88
    • View Profile
Code: [Select]
macroScript AACollapseLayers category:"1AAScripts" -- buttonText:"insert here"
(
((LayerManager.getLayerFromName "100_SS")).current = true
macros.run "Layers" "SceneExplorerSetActiveLayerAsParentLayer"
((LayerManager.getLayerFromName "0")).current = true
)

2021-09-09, 15:12:16
Reply #8

aaouviz

  • Active Users
  • **
  • Posts: 453
    • View Profile
    • Another Angle 3D
Amazing, thank you again mate.

Super helpful stuff, my workflow is buzzing now thanks to your help