PDA

View Full Version : problem regarding baking


MarXIndia
04-27-2009, 08:12 AM
HI all does any body know why its showing an error when iam trying to assign a variable to the time unit flag for the bake command..

here is the command
bakeResults
-simulation true -t "0:10"
-sampleBy 1
-disableImplicitControl true
-preserveOutsideKeys true
-sparseAnimCurveBake false
-controlPoints true -shape true {"Box"};



and here is what i was trying to do

int $start = 1;
int $end = 25;

bakeResults
-simulation true -t "$start:$end"
-sampleBy 1
-disableImplicitControl true
-preserveOutsideKeys true
-sparseAnimCurveBake false
-controlPoints true -shape true {"Box"};

but its showing the following error


// Error: line 10: Invalid time unit: $start:$end //

can anybody help me

thanx

MolemanSD7
04-27-2009, 07:52 PM
Okay, here's the code that works:

int $start = 1;
int $end = 25;

bakeResults
-simulation true -t -t ($start + ":" + $end)

-sampleBy 1
-disableImplicitControl true
-preserveOutsideKeys true
-sparseAnimCurveBake false
-controlPoints true -shape true {"Box"};

When you use quotes, you need to understand the way maya handles strings. By putting "$start:$end", maya sees you trying to use $start:$end as a single integer. Which, it obviously isn't. So, you need to tell maya to construct the string properly. So, the brackets after the '-t' flag tell maya to figure out what's in there first. When you're adding any previously defined variables ($start and $end in this case) to a string, they must be outside of any quotation marks. Where as the : has to be inside quotes. So, you say make a string $start + ":" + $end, which will look like: 0:25 Make sense?

MarXIndia
04-30-2009, 12:24 PM
Thank Moleman script worked yet it had a mistake you wrote -t flag twice but that`s ok..thanx alot...well this thing never came in my mind while using those variables i`ll take care of those frm next times.....

CGTalk Moderation
04-30-2009, 12:24 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.