PDA

View Full Version : Concatening problem - Random create clips


bontempos
12-10-2007, 03:55 AM
This should be very simple to solve, but it took hours without solution, sorry.

HERE IS MY GOAL:
I want to randomly create clips from character library within the duration of the time slider.
To do that, I suppose I have to know where one clip ends to place another one until the last clip reaches the last frame of the time slider. Right?
The code below, inside the proc, stands for only one clip. (I will try to build the loop later)


//get all the clips in the library
string $list[] = `clip -q -n "characterName"`;

//choose a clip;
$chooseClip = `floor (rand (size($list)))`;

//gets the array index of the clip and take its name.
//here I have one quest. When I created the clip I named it "clipTest". Why it changed to clipTestSource?
string $indexToString = ($list[$chooseClip]);

NewClip($indexToString,2);

proc NewClip(string $indexToString, float $scaleClip){

//HERE LIVES THE PROBLEM
//ALL this works when I force a string name when I call the procedure eg: NewClip("clipTest",1);
//Other than that it cant parse the values and I couldnt go further.

clipSchedule -instance ($indexToString) -sc $scaleClip -s 0 "Scheduler1";
$lastID = `clipSchedule -n $indexToString -q -ci "Scheduler1"`;
$ini = `clipSchedule -ci $lastID -q -s "Scheduler1"`;
$dur = `clipSchedule -ci $lastID -q -se "Scheduler1"`;
$scale = `clipSchedule -ci $lastID -q -sc "Scheduler1"`;
$end = ceil (($dur - $ini)*$scale);

}

I think some problems are due the wrong declaration of some variables.
Please if any one can help,

Thanks a lot,
Anderson

harmless
12-10-2007, 06:55 PM
take a look at this, I am just snipping off the "Source" from the "myClip1":

string $clipList[] = {"myClip1Source","myClip2Source"};
string $tmpClipList[] = {};
for($clip in $clipList){
$clip = `substring $clip 1 (size($clip)-6)`;
$tmpClipList[size($tmpClipList)] = $clip;
}
$clipList = $tmpClipList;
print $clipList;

CGTalk Moderation
12-10-2007, 06:55 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.