Reply
Reply
 
Thread Tools Display Modes
codyaq2's Avatar
Old (#1)
Hey all

So currently I have this;
Quote:
max select all
max group group
(
ResetPivot $
CenterPivot $
for i in selection do
(
i.pivot = [0, 0, 0]
)
)
max tti
max group ungroup
I want to select all, group, move the pivot to 0,0,0, then be able to move the group to a new area, then ungroup the objects.
Question is, how do i pause the script when the move transform type in box comes up, so i can enter a new values, then continue the script once i close the box????
Offline , vertex, 42 Posts, Join Date Jan 2011, Location Australia  
   Reply With Quote

Mark Dygert's Avatar
Old (#2)
I don't think there is a way to wait until the TTI is closed then carry on. I don't think its exposed in maxscript. What I guess you could do, is use a querrybox that would trigger the rest of the script when you clicked yes?

Code:
max group group
(
    ResetPivot $
    CenterPivot $
    for i in selection do    (
        i.pivot = [0, 0, 0]
    )
)
max tti
if queryBox "Do you want to ungroup?" beep:false then (
    max group ungroup 
)
else ()
Alternatively I guess you could come up with your own UI that mimics the TTI but triggers the rest of the script when values are changed or a button is pressed.

Last edited by Mark Dygert; 03-28-2012 at 11:26 AM..
(AKA Vig) Portfolio | Lab | Brawl | Decker |
Offline , Polycount.com Editor, 13,917 Posts, Join Date Oct 2004, Location Seattle, Wa Send a message via MSN to Mark Dygert  
   Reply With Quote

codyaq2's Avatar
Old (#3)
Hey man, thanks for the reply
Unfortunately i have tried that already before, and the issue why i didn't continue to use that is because the querybox locks out max, so you have to press yes or no before you can edit the TTI
Offline , vertex, 42 Posts, Join Date Jan 2011, Location Australia  
   Reply With Quote

LoTekK's Avatar
Old (#4)
Dialogs and rollouts are your friends :p

Code:
(
	local objs
	local spinnerRange = 1000	--
	local spinnerScale = 0.5	--adjust as appropriate

	rollout repositionRollout "Reposition" (
		spinner posX "Position X" range: [-spinnerRange, spinnerRange, 0] scale: spinnerScale
		spinner posY "Position Y" range: [-spinnerRange, spinnerRange, 0] scale: spinnerScale
		spinner posZ "Position Z" range: [-spinnerRange, spinnerRange, 0] scale: spinnerScale
		button applyTransform "Apply" width: 100
		on repositionRollout open do (
			objs = group $*
			centerPivot objs
			for o in objs do (
				o.pivot = [0,0,0]
			)
		)
		on posX changed n do (
			objs.position.x = n
		)
		on posY changed n do (
			objs.position.y = n
		)
		on posZ changed n do (
			objs.position.z = n
		)
		on applyTransform pressed do (
			ungroup objs
			for o in $* do (
				resetPivot o
			)
			destroyDialog repositionRollout
		)
	)
	
	createDialog repositionRollout-- modal: true
)
edit:
the script should probably record the original pivots of each object so it can restore them if necessary. For now the script above just does a resetPivot for each object after ungrouping.

Last edited by LoTekK; 03-29-2012 at 05:49 AM.. Reason: forgot to add the pivot repositioning bits
FlowMap Painter v0.9.2

teckArtist.com
LoTekK.com

"Has anyone really been far even as decided to use even go want to do look more like?" -DKK
Offline , dedicated polycounter, 1,395 Posts, Join Date Jan 2006, Location Singapore Send a message via MSN to LoTekK Send a message via Skype™ to LoTekK  
   Reply With Quote

Mark Dygert's Avatar
Old (#5)
Quote:
Originally Posted by codyaq2 View Post
Hey man, thanks for the reply
Unfortunately i have tried that already before, and the issue why i didn't continue to use that is because the querybox locks out max, so you have to press yes or no before you can edit the TTI
Oh right, in that case I guess you would use a standard rollout with a button that acts like a querybox but won't lock up max, it will just pop up.


LotekK seems to be onto something too. I would probably roll with that =)
(AKA Vig) Portfolio | Lab | Brawl | Decker |
Offline , Polycount.com Editor, 13,917 Posts, Join Date Oct 2004, Location Seattle, Wa Send a message via MSN to Mark Dygert  
   Reply With Quote

codyaq2's Avatar
Old (#6)
Cheers heaps for the replies

So i just went with this.....

Quote:
rollout mover_script "Input Move" width:159 height:62
(
button btn1 "Group" pos:[9,7] width:66 height:19
button btn2 "Move" pos:[9,30] width:66 height:19
button btn3 "Ungroup" pos:[100,9] width:66 height:19
on btn1 pressed do
(
select $*
max group group
$Group001.pivot = [0,0,0]
)
on btn2 pressed do
(
max tti
messagebox "Remember to copy and paste these values down"
)
on btn3 pressed do
(
max select all
max group ungroup
)
)
floater= newrolloutfloater "xxx" 200 100
addrollout mover_script floater
$Group001.pivot = [0,0,0] only moves the group pos, not the objects inside, so thats what i wanted.


I may implement yours though LoTekK
Offline , vertex, 42 Posts, Join Date Jan 2011, Location Australia  
   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Copyright 1998-2012 A. Risch