Complex UV Layout in Maya
Over the last couple of years UV layout in Maya has changed for the better. In this course we're going to be taking a look at some of those changes as we UV map an entire character
# 1 27-02-2006 , 12:40 PM
skywola's Avatar
Registered User
Join Date: Jan 2004
Location: Tempe, Arizona, USA
Posts: 224

How to detect odd or even numbers

How to Detect odd or even numbers in MEL

int $num = 1;
if ($num % 2 == 0)
print($num + " even");
else
print($num + " odd");
$num++;


"The Sage as an Astronomer: If you still see the stars as something above you, you lack the eye of knowledge." Friedrich Nietzsche
# 2 27-02-2006 , 11:59 PM
MattTheMan's Avatar
Registered User
Join Date: Apr 2005
Location: Fairfield, CT
Posts: 2,436
i dont know MEL, but I know C++, so:

cant u divide a number by 2, then store the result in a char with 8 places, then scan the char, if the char has a dot in it then its odd, if not its even.


Live the life you love, love the life you live
# 3 28-02-2006 , 05:06 AM
skywola's Avatar
Registered User
Join Date: Jan 2004
Location: Tempe, Arizona, USA
Posts: 224
In MEL - no . . . . MEL is a much easier language than C++, although C++ undoubtably has more power, and more bells and whistles, so to speak.


"The Sage as an Astronomer: If you still see the stars as something above you, you lack the eye of knowledge." Friedrich Nietzsche
# 4 28-02-2006 , 09:00 AM
Alan's Avatar
Moderator
Join Date: Oct 2002
Location: London, UK
Posts: 2,800
you've done it right by using the modulus command. If you get nothing back then it's even (i think! it's a bit early in the morning for maths! user added image)

user added image
A


Technical Director - Framestore

Currently working on: Your Highness

IMDB
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