ScriptSpot

Script

Blender Scale

By obaida · Credited author: Obaida · 2021-10-28

Version
1.4
Votes
1
External download
External download
Description

3dsMax Script for Appling Scale on Sub Levels Similar to Blender ,

  • Works with Editable Spline, Editable Mesh, Editable Poly Objects .
  • Depends on Current Coordinate Systems , (Coordinate Center not Used) .

UPDATE 1 :

  • Add "Middle" as Center of Scale .

  • Add Support for Edge and Face/Poly 

UPDATE 2 :

    • Remove "Get Selected Vertices" Button , Thanks to Miauu .

    • Fix Scaling on Y and Z Axis not Working in Pervious Update .

UPDATE 3 :

  • Restoring "Get Selected Vertices" Button (Previous Update not Working Properly) .

NOTS :

  • Better to not use RightClick On spinners while dragging (You can use 0.0 value anytime) .

  • When selecting more than 500 vertices its better to not Drag the spinners  .

  • Pressing any of Center Buttons (Min,Mid,Max) will also Get Selected Vertices .

UPDATE 4 :

  • Add Auto Sublevel Selection Detection .

Videos
Comments (11)

obaida · 2022-05-02

Ok

UI position

temirgalin · 2021-10-29

Can UI window remember its position after restart of the max

obaida · 2021-10-29

I didn't make it save to External file because this sometimes Make the Script UI disappear when using 2 monitors .

JokerMartini · 2021-10-28

Cool idea for a script. You do not need the 'get Vertices button'. You can be clever about it and remove the need for that button. It would make the tool easier to use.

Thanks

obaida · 2021-10-28

idk any other idea rather than using Callbacks , I don't like to use it , cuz I disable it long time ago in my max preferences .

.

miauu · 2021-10-28

Use this. No need to press the [Get Selected Vertices] button.



on sp_scaleX buttonDown do
	(
		Check_Axis() 
		Check_Class()
		do_Hold #start
		
	)
	on sp_scaleX changed value do BScale #X rad_center.state
	on sp_scaleX entered inSpin inCancel do 
	(
		if not inCancel then do_Hold #accept Str:"Scale X" else
		(
			Check_Axis() 
			Check_Class()
			do_Hold #cancel
		)
	)

By the way, why do you name your controls this way:

button 'btn_getsel'

When you can use this:

button btn_getsel

Thanks

obaida · 2021-10-28

I use ' ' in names just for fun :) ,
about your idea I separated the calculation function from the spinners cuz I thought it'll lead to delay while changing the values and it needs to be calculated once ! , so I Kept it out .
I add "middle" as center for the scale ,
About the Get Button , I tried to get rid of it but I couldn't , maybe with mousemove event on the dialog but also couldn't stop it (it should work 1 time !) .
I think I'll make it imgTag , so by hovering it'll do the job .

.

miauu · 2021-10-28

OK, try this then:



on sp_scaleX buttonDown do
	(
		print "sp_scaleX buttonDown"
		Check_Axis() 
		Check_Class()
		do_Hold #start
 
	)
	on sp_scaleX changed value do 
	(
		print "sp_scaleX changed value"
		BScale #X rad_center.state
	)
	on sp_scaleX entered inSpin inCancel do 
	(
		if not inCancel then do_Hold #accept Str:"Scale X" else
		(
			print "sp_scaleX entered inSpin inCancel"
			Check_Axis() 
			Check_Class()
			do_Hold #cancel
		)
	)

and check what will be printed in the maxscirpt listener.

The

on sp_scaleX buttonDown do 

is executed only once, when the user press any of the spinner's buttons. So, when this happen the script will do the same as when the Get Sel Vert button is pressed, and will do it only once. Then, while the lmb is down and the value of the spinner is changed the script will execute only this:

BScale #X rad_center.state

If I am not right, in the maxscript listener you should see this, while the spinner's button is pressed:
"sp_scaleX buttonDown"
"sp_scaleX changed value"
"sp_scaleX buttonDown"
"sp_scaleX changed value"
"sp_scaleX buttonDown"
"sp_scaleX changed value"
...
but what you will see is this:
"sp_scaleX buttonDown"
"sp_scaleX changed value"
"sp_scaleX changed value"
"sp_scaleX changed value"
"sp_scaleX changed value"

obaida · 2021-10-28

I tried your code and its printing "sp_scaleX buttonDown" each time I click the spinner
so it looks like the spinner doing the function on every click (not dragging the spinner)
with dragging the spinner its ok .

.

miauu · 2021-10-28

Yes, every time when you click the spinner the code inside "on lbutton down do" will be executed, but why this should be a problem?
The script is yours and you will make it as you want. Here is how I see the things.
1) if you use what I posted the benefits are:
- you will get rid of the Get Vert Sel button and will simplify the workflow
- the script will work only with the currently selected object

The script creates an Undo record each time when the user click the spinner, so with or without the Get Vert Sel button, the user will have to press the UNDO as many times as he needs.

obaida · 2021-10-28

yes you right . I'll see , but its very annoying why imgTag has event mouseout and the dialog doesn't have !!!! , mouseout event will solve all this problems .