SimplyMaya Forums

Welcome to the forum, feel free to ask questions here.

Home / forum / Animation / Mel Scripts & Programming / quick help with "currentTime"
Register FAQ Members List Calendar Mark Forums Read

New Thread
 
Thread Tools
Old 17-08-2008, 02:49 AM   #1
Falott
Registered User
 
Falott's Avatar
 
Join Date: Jan 2005
Location: vienna
Posts: 1,095
Thanks: 3
Thanked 20 Times in 18 Posts
Default quick help with "currentTime"

hi!

I would need some actionButtons to save myself some time.
basically I just want to query the current time and asign this integer value to a variable.


this is my action:

bakeResults -simulation true -t "0:2769" -sampleBy 1 -disableImplicitControl true -preserveOutsideKeys false -sparseAnimCurveBake true -at "tx" -at "ty" -at "tz" |Hips;


and I need to replace "0:2769" with "0:$time" or something.


and I need help because



$time = currentTime -query;
print $time;

bakeResults -simulation true -t "0:$time" -sampleBy 1 -disableImplicitControl true -preserveOutsideKeys false -sparseAnimCurveBake true -at "tx" -at "ty" -at "tz" |Hips;



I am just too stupid after all

// Error: $time = currentTime -query; //
// Error: Line 1.21: Invalid use of Maya object "currentTime". //
// Error: $time = currentTime -query; //
// Error: Line 1.27: Invalid use of Maya object "query". //
__________________
everything starts and ends in the right place at the right time.
Falott is offline   Reply With Quote
Old 17-08-2008, 02:53 AM   #2
Falott
Registered User
 
Falott's Avatar
 
Join Date: Jan 2005
Location: vienna
Posts: 1,095
Thanks: 3
Thanked 20 Times in 18 Posts
Default

i have it working so far to print the number but

$time = `currentTime -query`;

bakeResults -simulation true -t "0:$time" -sampleBy 1 -disableImplicitControl true -preserveOutsideKeys false -sparseAnimCurveBake true -at "tx" -at "ty" -at "tz" |Hips;


// Error: line 3: Invalid time unit: 0:$time //
__________________
everything starts and ends in the right place at the right time.
Falott is offline   Reply With Quote
Old 17-08-2008, 03:24 AM   #3
Falott
Registered User
 
Falott's Avatar
 
Join Date: Jan 2005
Location: vienna
Posts: 1,095
Thanks: 3
Thanked 20 Times in 18 Posts
Default

as usual I managed to steal it together


int $start = 0;
int $end = `currentTime -query`;
bakeResults -simulation true -t ( $start + ":" + $end ) -sampleBy 1 ....
__________________
everything starts and ends in the right place at the right time.
Falott is offline   Reply With Quote
Old 17-08-2008, 07:16 PM   #4
LauriePriest
Moderator
 
LauriePriest's Avatar
 
Join Date: May 2003
Location: London
Posts: 1,001
Thanks: 0
Thanked 59 Times in 51 Posts
Default

what you where querying from current time wasnt being stored as an intiger hence it was an invalid time unit?

complete guess, im crap at mel

serious hashing togeather , reminds me of my scripts.
LauriePriest is offline   Reply With Quote
Old 17-08-2008, 07:24 PM   #5
Falott
Registered User
 
Falott's Avatar
 
Join Date: Jan 2005
Location: vienna
Posts: 1,095
Thanks: 3
Thanked 20 Times in 18 Posts
Default

as far as I understand is it was a integer because I could let maya print the number. it must have to do something with the syntax how i placed the variable. you know ´""§$%2´´+.. <------------ this pretty much covers my understanding of mel

but it´s working. that´s what matters ^^
__________________
everything starts and ends in the right place at the right time.
Falott is offline   Reply With Quote
Old 17-09-2008, 02:08 AM   #6
alexanderH
Subscriber
 
alexanderH's Avatar
 
Join Date: Sep 2007
Location: Mississauga, Ontario, Canada
Posts: 450
Thanks: 0
Thanked 1 Time in 1 Post
Default

Quote:
Originally posted by Falott
as far as I understand is it was a integer because I could let maya print the number. it must have to do something with the syntax how i placed the variable. you know ´""§$%2´´+.. <------------ this pretty much covers my understanding of mel

but it´s working. that´s what matters ^^
Sorry to bring this back to life, but as I think I may have a reason for your integer issue. While programming in several other languages I would say that a string of characters can contain numbers and characters. I'm not sure quite how mel works, but do you declare variables? And if not how does it differentiate between an integer and not. Maybe the time value as stored in maya is not stored or called as an integer but as a string, maybe it includes time zones?
I'm sorry if this is absolutely useless, but maybe the whole thing needs a little more research to figure it out. I guess that your works is what matters though.
__________________
Peace, love and Anarchy~~~~~~~
______________________________
Wip:
iMac
Full House Project
Arch Viz Reel

My Website is Finally Back up!

“Welcome to the Internet. Where the men are men, the women are men, and the children are FBI agents.”
alexanderH is offline   Reply With Quote
Old 17-09-2008, 04:03 AM   #7
gster123
Moderator
 
gster123's Avatar
 
Join Date: May 2005
Location: Manchester Uk
Posts: 6,300
Thanks: 1
Thanked 51 Times in 45 Posts
Default

You tell it what they are such as

string $onething = "hi" ;
int $secondthing = 1 ;
float $thirdthing = 0.1 ;


if you just add variable and dont tell maya what it is it assumes.
__________________
"No pressure, no diamonds" Thomas Carlyle
gster123 is offline   Reply With Quote
Old 17-09-2008, 10:33 AM   #8
alexanderH
Subscriber
 
alexanderH's Avatar
 
Join Date: Sep 2007
Location: Mississauga, Ontario, Canada
Posts: 450
Thanks: 0
Thanked 1 Time in 1 Post
Default

I realize I was blind while reading all the previous posts. I see "int" all over the place. And well that is kinda the default integer declaration. My bad.
__________________
Peace, love and Anarchy~~~~~~~
______________________________
Wip:
iMac
Full House Project
Arch Viz Reel

My Website is Finally Back up!

“Welcome to the Internet. Where the men are men, the women are men, and the children are FBI agents.”
alexanderH is offline   Reply With Quote
New Thread

« Previous Thread | Next Thread »

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

1 Month

$34

Month-to-month billing
$34/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
 
 

3 months

$87

Billing every 3 months
$29/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
Save $5 per month or $15 in total compared to monthly billing with this package.

12 months

$288

Billing every 12 months
$24/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
Save $10 per month or $120 in total compared to monthly billing with this package.

Your plan will automatically renew. You can cancel at any time via your PayPal account to avoid being charged again.

You can view the FAQ on our video plans here. You can contact us directly here. By clicking one of the buttons above, you agree to our Terms and Privacy Policy.