ScriptSpot

Forum topic · General Scripting

Forced "Select object" mode

By scripture · 2017-12-22

Description

Hi!

Is there a way to switch by a script such a state when, for example, while being in "Select and move" mode with selected object, next I pick another object and the mode is automatically changing to just "Select object"?

It is extremely usefull to have such a state switcher because often when you are in "Select and move" with a selected object and pick another object it also by default in "Select and move" mode and as a result some accidental undesirable shifts of object may happen.

Comments (10)

capture

scripture · 2017-12-24

Jahman, yes I understand how to install and use a script ))
But maybe I donot understand something.

Anyway please see yourself the script in action:
https://yadi.sk/i/EU-jEYhW3QuShd

scripture · 2017-12-24

.

it's called q..

vusta · 2017-12-24

yes...press q before you start clicking...

q

scripture · 2017-12-24

Such a news! thank you!!! ))) Queen Ann is dead....

But I work so fast that I need automatic mode
Even shortcut is not good in my situation.

.

jahman · 2017-12-24



macroScript autoSelectObjectModeON
category:"Jahman"
tooltip:"Auto select object mode ON"
(
	
	on execute do (
		
		global handleSelectCallback = undefined
		gc light:true

		fn handleSelect ev nd = (
			
			if selection.count > 1 do execute "max select"
			
		)


		global handleSelectCallback = NodeEventCallback selectionChanged:handleSelect
	)
	
)

macroScript autoSelectObjectModeOFF
category:"Jahman"
tooltip:"Auto select object mode OFF"
(
	
	on execute do (
		
		global handleSelectCallback = undefined
		gc light:true
		
	)
	
)

Nothing happens

scripture · 2017-12-24

Jahman Thankyou very much!
But it appears that it does not work - nothing happens.

Applied your code as *.ms or *.mcr by dropping it to viewport
3D max 2018 64x

.

jahman · 2017-12-24

Yes, nothing but two new macro in category 'Jahman' to turn On and Off
Did you try them?

I think having one macro to toggle this mode will be even more convenient.



macroScript autoSelectObjectModeToggle
category:"Jahman"
tooltip:"Auto select object mode toggle"
(

	on isChecked do (::handleSelectCallback != undefined)
		
	
	on execute do (
 
		if ::handleSelectCallback != undefined then (
			
			global handleSelectCallback = undefined
			gc light:true			
			
		) else (
			
			fn handleSelect ev nd = (
 
				if selection.count > 1 do execute "max select"
	 
			) 
 
			global handleSelectCallback = NodeEventCallback selectionChanged:handleSelect
						
		)
		
	)
 
)
 

capture

scripture · 2017-12-24

Jahman, yes I understand how to install and use a script ))
But maybe I donot understand something.

Anyway please see yourself the script in action:
https://yadi.sk/i/EU-jEYhW3QuShd

.

jahman · 2017-12-24

Oh, so you need to set this state on any selection change? I didn't understand the task at first
Change selection.count > 1 to selection.count > 0 and run it again to update macros.

Thank you, thank you. thank you!

scripture · 2017-12-24

Thank you Jahman!!!!
After this simple correction your script works exactly as wanted!!! This is the best script in my huge collection of scripts!!!(I am not joking)
Thank you Jahman again and again!!!!!!