ScriptSpot

Forum topic · General Scripting

why there is no switching between move and scale modes in the example?

By Any · 2018-12-10

Description

Good afternoon. Can anyone explain why there is no switching between move and scale modes in the example? Any object and Point named Point001 is present in the scene

___________________________________________________________________________________________

 

try (DestroyDialog  Test) catch()

rollout Test "Test" 

(

pickbutton pbtn_Select_Object "Select Object" 

on pbtn_Select_Object picked obj do

(

select obj

max scale

toolMode.coordsys $Point001

toolMode.transformCenter() 

)

)

createDialog Test pos:[100,100] style:#(#style_titlebar, #style_border, #style_sysmenu, #style_minimizebox)

_____________________________________________________________________________________________

 

I'm using Max 2015. After executing the script, the main Toolbar is set to Move, not to Scale.

Comments (5)

Any · 2018-12-12

Oh how difficult... But thank you for your attention to my problem

.

miauu · 2018-12-12

If you find another solution, please share it here. :)

.

miauu · 2018-12-10

Switch to Select and Scale mode, execute this and pick an object in the scene:


try (DestroyDialog  Test) catch()
rollout Test "Test" 
(

	pickbutton pbtn_Select_Object "Select Object" 

	on pbtn_Select_Object picked obj do
	(

	)

)
createDialog Test pos:[100,100] style:#(#style_titlebar, #style_border, #style_sysmenu, #style_minimizebox)

As you can see right after the object is picked the Select and Move mode will be turned on.

I do not understand the answer.

Any · 2018-12-11

Hello miauu!!! I do not understand the answer. How is my code different from yours? I even improved it. But the result is the same. Switching to SCALE mode does not occur.

________________________________________________________________________________________

try (DestroyDialog  Test) catch()

rollout Test "Test" 

(

 

pickbutton pbtn_Select_Object "Select Object" 

 

on pbtn_Select_Object picked obj do

(

select obj

    max move

max scale

toolMode.coordsys $Point001

toolMode.transformCenter() 

)

 

)

createDialog Test pos:[100,100] style:#(#style_titlebar, #style_border, #style_sysmenu, #style_minimizebox)

 

_________________________________________________________________________________________

.

miauu · 2018-12-11

As you can see in my code there is no need to have any code in the

on pbtn_Select_Object picked obj do

It seems that no matter of the code in the picked obj event at the end the 3ds Max automatically turns on the Select and move.

This will do what you need:


try (DestroyDialog  Test) catch()
rollout Test "Test" 
(
	local pickedObj = undefined

	pickbutton pbtn_Select_Object "Select Object" 
	timer timer_01 "" interval:10 active:false

	on pbtn_Select_Object picked obj do
	(
		timer_01.active = true
		pickedObj = obj
	)
	
	on timer_01 tick do
	(
		if pickedObj != undefined do
		(
			max scale
			toolMode.coordsys $Point001
			toolMode.transformCenter()
			timer_01.active = false
		)	
	)
)

createDialog Test pos:[100,100] style:#(#style_titlebar, #style_border, #style_sysmenu, #style_minimizebox)