Creative COW SIGN IN :: SPONSORS :: ABOUT US :: CONTACT US
MAYA: MAYA ForumMAYA TutorialsMAYA

Re: new to Mel - array question?

Cow Forums : MAYA
VIEW POSTS   •   ADD A NEW POST   •   SEARCH   •   CHANGE FORUM
Respond to this post   •   Return to posts index   •   Read entire thread


Re: new to Mel - array question?
by Sean Fennell on Sep 18, 2007 at 4:08:06 pm

An array is just a variable that holds a list of values. For your purposes it sounds like you want a loop, in addition to an array.

Use the array to store the names of the copied objects. Use the for loop to copy them at regular intervals. Lets say the interval is every frame for 15 frames. Here's an example:


string $copiedObjects[];
int $currentTime = `currentTime -query`;
int $maxTime = $currentTime + 15;
// store this so its easy to get the original selection back
string $selection[] = `ls -sl`;

for(int $i = $currentTime; $i <= $maxTime; $i++)
{
// select the original selection
// (this way we dont duplicate the duplicates)
select -r $selection;
// step one frame forward in time every time the loop runs
currentTime -edit $i;
// duplicate the object
string $copy[] = `duplicate -rr`;
// the duplicate command returns an array of the duplicate objects
// assuming we only have one object selected, assign the first
// value of the $copy array to the index of the $copiedObjects
// array that matches this loop (the value $i is the index for this
// loop
$copiedObjects[i] = $copy[0];
}



Respond to this post   •   Return to posts index   •   Read entire thread


Current Message Thread:
  • new to Mel - array question? by raina-bab on Sep 16, 2007 at 12:16:37 pm
    • Re: new to Mel - array question? by Sean Fennell on Sep 18, 2007 at 4:08:06 pm


Related Threads:
maya mograph/array



Note: If you are a registered user please click here to login before posting.

Your post will not be accepted if your name and email address are not registered in our database. Click here if you do not have an account.

Name
E-Mail Address
Subject
E-Mail me when someone responds
Just This Message   Entire Thread   None  

Message:



Note: The following are HTML characters and may cause parts of your post to disappear if not used correctly: < > &
To include any portion of the post in your response, highlight the desired text and hit the "Q" key. Read more...



Add your message signature


 


Note: By clicking "Post Direct" button above, you are agreeing to the Creative Cow's Code of Conduct.



FORUMSTUTORIALSMAGAZINETRAININGVIDEOS - REELSPODCASTSEVENTSSERVICESNEWSLETTERNEWSBLOGS

© CreativeCOW.net All rights are reserved.

[Top]