|
Hola!
First off, don;t use the listener to grab commands, here lies only fear and despair.
are you familiar with programming at all?
The best way to do this is to use something called a loop, basically an action that is performed on each object.
for example, lets say we want to print the name of each of our selected objects to the listener. (open the listener first! :)
type in the following;
clearlistener()
for i in 1 to selection.count do
(
print selection.name
)
lets step through this;
clearlistener() - this will clear the output of the listener for you, handy.
selection is what you have selected, its stored in an array which is a list of objects. the first line;
for i in 1 to selection.count do
this is telling max that it needs to go through each object in the selection array. i is the index of the object. everything in the next set of brackets is going to be run on each object.
here is what we have in those brackets;
print selection.name
this tells max to print the objects name, selection is the array and the i is the index position…
so thats basically a for loop.
now lets get to the meat of what you want to do.
here is a script that takes all of your selected objects and aligns the pivots to the world;
clearlistener()
for i in 1 to selection.count do
(
worldalignpivot selection
)
just like above, i am looping through all of the objects i have selected and running the command “WorldAlignPivot” on that object, which aligns the pivot to the world.
I encourage you to use maxscript help to look up some of these commands.
anyway, thats just a start, i could write you the script that you want but i would rather teach you to fish if you get my drift :)
good luck…
|