Sunday, March 27, 2011

Maya - Numeric expressions in the Channel Box

This tip is fairly simple, but is quite useful to know; I use this almost on a daily basis for various tasks.

Within the Channel Box, you're able to use simple math expressions, for example by selecting an attribute and multiplying it by 5. This also works on multiple selections of attributes, and in the Attribute Spread Sheet. Let's take a look.

As an example, let's say you want to scale an object up to twice its size, for each X Y and Z component, essentially doing a uniform scale. Aside from manually using a calculator (calc.exe in Windows), you might think of doing "Edit > Freeze Transformations", then selecting all the scale channels and entering "2". However, there's a more proper method, so let's try the math operators instead. Select all the scale channels and enter *=2 as shown below.




Now your object will double in size, uniformly multiplying each selected attribute by 2. From the Maya help file on attribute entry, here's the syntax and available options:


To enter a value relative to the current one:
  • Type +=n to add n to the current value.
  • Type -=n to subtract n from the current value.
  • Type *=n to multiply n by the current value.
  • Type /=n to divide the current value by n.
  • % as a suffix indicates a percentage-based operation (For example, +=10% adds 10% of the current value to each selected value).


Though the Status Line includes an option for "Relative Transform" entry, I find this method to be more flexible, as it allows you to operate on any attributes shown in the Channel Box, Component Editor, and Attribute Spread Sheet. Another example of how useful it is: Halving the intensity of a selection of lights that all have different intensities with *=.5

You'll use this more than you might think.

7 comments:

  1. Awesome, will use this for sure. Thanks!

    ReplyDelete
  2. Cheers!
    Such a shame you cant use something like *=n * rand(100)

    ReplyDelete
  3. It's interesting that many of the bloggers to helped clarify a few things for me as well as giving.Most of ideas can be nice content.The people to give them a good shake to get your point and across the command .

    digital marketing company in india

    ReplyDelete
  4. Superb. I really enjoyed very much with this article here. Really it is an amazing article I had ever read. I hope it will help a lot for all. Thank you so much for this amazing posts and please keep update like this excellent article.thank you for sharing such a great blog with us. expecting for your..
    SEO Company in India

    ReplyDelete
  5. Great Article… I love to read your articles because your writing style is too good, its is very very helpful for all of us and I never get bored while reading your article because, they are becomes a more and more interesting from the starting lines until the end.

    AWS Training in Channai

    ReplyDelete
  6. I have definitely picked up anything new from right here. I did however expertise a few technical points using this site, since I experienced to reload the web site a lot of times previous to I could get it to load correctly.
    Office Interiors in Chennai
    Home Interior Decorators in Chennai

    ReplyDelete