Notifications
Clear all

[Closed] how to use pin stack on maxScript with max9?

because on max9 ,
can not use “ ModPanel.SetPinStack() ”

4 Replies
1 Reply
(@bobo)
Joined: 11 months ago

Posts: 0

Support for the pin stack was added in Max 2010.
AFAIK, the only solution is to upgrade.

Modify Panel
Pin Stack Button

[left]modpanel.getPinStack()
[/left]
[left][color=red]NEW[/color][color=red] in [/color][color=red]3ds Max 2010[/color][color=red]:[/color]Returns true if the Pin Stack button is pressed, false if not pressed or not in Modify panel.
[/left]
[left]
[/left]
[left]modpanel.isPinStackEnabled()
[/left]
[left][color=red]NEW[/color][color=red] in [/color][color=red]3ds Max 2010[/color][color=red]:[/color][color=red][/color][size=2]Returns true if the Pin Stack button is enabled, false if not enabled or not in Modify panel.
[/size][/left]
[left]
[/left]
[left][size=2]modpanel.setPinStack <bool>
[/size][/left]
[left][size=2][color=red]NEW[/color][color=red] in [/color][color=red]3ds Max 2010[/color][color=red]:[/color][color=red][/color][size=2]Sets the Pin Stack button to the specified state as long as the Pin Stack button is enabled.[/size][/size][/left]
[size=2]
[/size][left]
[/left]


fn pressPin = if getCommandPanelTaskMode() == #modify do
(
 local toolbar, pin
 modp = for w in (windows.getChildrenHWND #max) where w[4] == "ModifyTask" do exit with w[1]
 if modp != OK do
 (
  for w in (windows.getChildrenHWND modp) where w[4] == "CustToolbar" do toolbar = w[1]
  if toolbar != undefined do
  (
   pin = UIAccessor.GetFirstChildWindow toolbar
  -- WM_LBUTTON_DOWN  = 0x0201
  -- WM_LBUTTON_UP  = 0x0202
   windows.sendMessage pin 0x0201 0 0
   windows.sendMessage pin 0x0202 0 0
  )
 )
)


it’s not perfect but better then nothing.

this function toggles the Pin Button ON/OFF

I don’t know a way to get the Pin Button state using max script only …

thanks denisT and bobo

You will need the Avguard extensions plugin (from scriptspot.com) in order to call
getChildrenHWND in Max 9 and earlier.

They weren’t bundled in until Max 2008. Once you have the plugin it toggles the pin like a charm.