Selection Lock Status?

Selection Lock Status?

Anonymous
Not applicable
820 Views
12 Replies
Message 1 of 13

Selection Lock Status?

Anonymous
Not applicable
Is there a way to get the status of the Selection Lock Toggle ? I have found a similar question but without the answer EVEN though it says that there is 1 reply ?

So ... how to read the status of the Selection Lock Toggle button through script ?

cheers
0 Likes
821 Views
12 Replies
Replies (12)
Message 2 of 13

Steve_Curley
Mentor
Mentor
With difficulty, by the looks of things.

"max spacebar" will toggle it, but always returns "OK"
"actionMan.executeAction 0 "59231"" will also toggle it, but always returns "true"

I don't see any easy way to interrogate the status, though it may be possible through the "UIAccessor" and "dialogMonitorOps" interfaces. Might get real messy real quick - a lot of coding just to get at a status.

Max 2016 (SP1/EXT1)
Win7Pro x64 (SP1). i5-3570K @ 4.4GHz, 8Gb Ram, DX11.
nVidia GTX760 (2GB) (Driver 430.86).

0 Likes
Message 3 of 13

Anonymous
Not applicable
Yup same conclusion here... still .. I would really like to know if there IS a way since its pretty vital for my script.

The script is an export script that works with a selection that is put together before exporting.

If the lock button is on - it totally corrupts whats getting exported (selected).

.. and then the user needs to figure it out and release the lock button... this quite often results in somebody writing to me saying "the exporter doesnt work!" and then I have to go and check whether the lock button is on / off.... making me go "aargh" when returning to my seat ... :/.

Other suggestions ?
0 Likes
Message 4 of 13

Anonymous
Not applicable
Then force Selection Lock OFF in your export script.
Opss, sorry... the status is a problem here 😕
0 Likes
Message 5 of 13

Steve_Curley
Mentor
Mentor
That is indeed the problem. You can't force it one way or the other, only toggle it, and with no (easy) way to check the status that's about as much use as a chocolate fireguard.

Max 2016 (SP1/EXT1)
Win7Pro x64 (SP1). i5-3570K @ 4.4GHz, 8Gb Ram, DX11.
nVidia GTX760 (2GB) (Driver 430.86).

0 Likes
Message 6 of 13

Anonymous
Not applicable
Ok, here's what occurred to me:
oldSel = getCurrentSelection() -- backup selection
deselect selection -- testing deselect
newSel = getCurrentSelection() -- get new selection
test = (oldSel as string == newSel as string) -- boolean test
if test then -- ie if toggle is ON
(
max spacebar -- toggle OFF
/* TO DO export code here ... */
)
else
(
select oldSel
/* TO DO export code here ... */
)

Of course, this must be inside the selection check content like
if selection.count > 0 do ...
, else the "deselect" trick will fail. I hope this help :)
0 Likes
Message 7 of 13

Steve_Curley
Mentor
Mentor
LOL - you just beat me to it. I was trying by creating a dummy, selectMore then testing if the dummy was selected, then deleting the dummy so as not to affect the current selection.

Max 2016 (SP1/EXT1)
Win7Pro x64 (SP1). i5-3570K @ 4.4GHz, 8Gb Ram, DX11.
nVidia GTX760 (2GB) (Driver 430.86).

0 Likes
Message 8 of 13

Steve_Curley
Mentor
Mentor
Here you go - the "slightly shorter" version :)


fn unlockSelection =
(
d = dummy()
selectmore d
if (d.isSelected == false) then -- selection lock is active
max spacebar -- not now it isn't
delete d
)

unlockSelection()

Max 2016 (SP1/EXT1)
Win7Pro x64 (SP1). i5-3570K @ 4.4GHz, 8Gb Ram, DX11.
nVidia GTX760 (2GB) (Driver 430.86).

0 Likes
Message 9 of 13

Anonymous
Not applicable
Damn winter, my network was out...
I polish a little bit my version:
if selection.count == 0 then
(
messageBox "Nothing selected to export!"
)
else
(
oldSel = getCurrentSelection()
deselect selection
newSel = getCurrentSelection()
test = (oldSel as string == newSel as string)
if test then (max spacebar) else (select oldSel)
/* TO DO export code here ... */
)

but yours is also Ok, packed as function, and not need "selection.count" check :)
0 Likes
Message 10 of 13

Steve_Curley
Mentor
Mentor
I like functions... :)

Max 2016 (SP1/EXT1)
Win7Pro x64 (SP1). i5-3570K @ 4.4GHz, 8Gb Ram, DX11.
nVidia GTX760 (2GB) (Driver 430.86).

0 Likes
Message 11 of 13

Anonymous
Not applicable
Hey guys,

It sure is a bit clunky to do it like this ... but hey ... it should work... thanks alot!

cheers
0 Likes
Message 12 of 13

Anonymous
Not applicable
HEY!... I might have found an even shorter route to the treasure!

"max select all" actually unlocks selection lock !!!

that means that I just have to store the current selection and the do a "max select all" and then restore the selection and hey presto..... I should think.


a = getCurrentselection()
max select all
select a


Cheers
0 Likes
Message 13 of 13

Steve_Curley
Mentor
Mentor
Crafty ;)

Max 2016 (SP1/EXT1)
Win7Pro x64 (SP1). i5-3570K @ 4.4GHz, 8Gb Ram, DX11.
nVidia GTX760 (2GB) (Driver 430.86).

0 Likes