|
created Max script, how to pause then move
on 03-27-2012 10:42 PM
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????
|
, vertex,
42 Posts,
Join Date Jan 2011,
Location Australia
|
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..
|
, Polycount.com Editor,
13,917 Posts,
Join Date Oct 2004,
Location Seattle, Wa
|
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 
|
, vertex,
42 Posts,
Join Date Jan 2011,
Location Australia
|
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
|
, dedicated polycounter,
1,395 Posts,
Join Date Jan 2006,
Location Singapore
|
Quote:
Originally Posted by codyaq2
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 =)
|
, Polycount.com Editor,
13,917 Posts,
Join Date Oct 2004,
Location Seattle, Wa
|
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 
|
, vertex,
42 Posts,
Join Date Jan 2011,
Location Australia
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
Copyright 1998-2012 A. Risch
|