Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Programming (https://simplymaya.com/forum/forumdisplay.php?f=32)
-   -   quick help with "currentTime" (https://simplymaya.com/forum/showthread.php?t=30706)

Falott 17-08-2008 02:49 AM

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". //

Falott 17-08-2008 02:53 AM

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 //

Falott 17-08-2008 03:24 AM

as usual I managed to steal it together


int $start = 0;
int $end = `currentTime -query`;
bakeResults -simulation true -t ( $start + ":" + $end ) -sampleBy 1 ....

LauriePriest 17-08-2008 07:16 PM

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 :D, reminds me of my scripts.

Falott 17-08-2008 07:24 PM

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 ^^

alexanderH 17-09-2008 02:08 AM

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.

gster123 17-09-2008 04:03 AM

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.

alexanderH 17-09-2008 10:33 AM

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.


All times are GMT. The time now is 02:08 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018