Introduction to Maya - Modeling Fundamentals Vol 1
This course will look at the fundamentals of modeling in Maya with an emphasis on creating good topology. We'll look at what makes a good model in Maya and why objects are modeled in the way they are.
# 1 17-08-2008 , 02:49 AM
Falott's Avatar
Registered User
Join Date: Jan 2005
Location: vienna
Posts: 1,095

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.
# 2 17-08-2008 , 02:53 AM
Falott's Avatar
Registered User
Join Date: Jan 2005
Location: vienna
Posts: 1,095
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.
# 3 17-08-2008 , 03:24 AM
Falott's Avatar
Registered User
Join Date: Jan 2005
Location: vienna
Posts: 1,095
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.
# 4 17-08-2008 , 07:16 PM
LauriePriest's Avatar
Moderator
Join Date: May 2003
Location: London
Posts: 1,001
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 user added image, reminds me of my scripts.

# 5 17-08-2008 , 07:24 PM
Falott's Avatar
Registered User
Join Date: Jan 2005
Location: vienna
Posts: 1,095
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 user added image

but it´s working. that´s what matters ^^


everything starts and ends in the right place at the right time.
# 6 17-09-2008 , 02:08 AM
alexanderH's Avatar
Subscriber
Join Date: Sep 2007
Location: Mississauga, Ontario, Canada
Posts: 450

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 user added image

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.”
# 7 17-09-2008 , 04:03 AM
gster123's Avatar
Moderator
Join Date: May 2005
Location: Manchester Uk
Posts: 6,300
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
# 8 17-09-2008 , 10:33 AM
alexanderH's Avatar
Subscriber
Join Date: Sep 2007
Location: Mississauga, Ontario, Canada
Posts: 450
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.”
Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads