Monday, December 13, 2010

LUA: Operator Precedence

Operator precedence in Lua follows the table below, from the higher to the lower priority:



      ^
             not  - (unary)
             *   /
             +   -
             ..
             <   >   <=  >=  ~=  ==
             and
             or


All binary operators are left associative, except for `^´ (exponentiation) and `..´ (concatenation), which are right associative. Therefore, the following expressions on the left are equivalent to those on the right:



    a+i < b/2+1      <-->   (a+i) < ((b/2)+1)
    5+x^2*8          <-->   5+((x^2)*8)
    a < y and y <= z <-->   (a < y) and (y <= z)
    -x^2             <-->   -(x^2)
    x^y^z            <-->   x^(y^z)

When in doubt, always use explicit parentheses. It is easier than looking up in the manual and probably you will have the same doubt when you read the code again.

  
  
  

Thursday, December 2, 2010

Arrow Code

Thanks Nihal for your first contribution on Limbeshwar's blog, and here's an abstract example ;)

if (ui->exDirChkBox->isChecked()){
    for (int j = 0; j < dirExclLst.count(); j++){
            for(int k = 0; k < dirList.count(); k++){
                QString strDrv = dirList[k].fileName();
                QString exlLstName = dirExclLst[j];
                if (strDrv == exlLstName){
                    dirList.removeAt(k);
                }else{
                //Do Nothing
                }
            }
    }
}

Arrow Code

Welcome to the world of arrows.

Nihal Kenkre: Arrow code

Friday, October 29, 2010

Inspiration of this Blog...

I was really-really lost in the code I was developing for some pipeline stuff and at a point stumbled upon this image: From http://linuxlove.amazingdev.com/post/1327091605/programmers-limbo-i-hate-it-when-this-happens
The Limbo...You can click the Image if you want to read properly...

...

Wednesday, October 27, 2010

Saturday, October 16, 2010

YouTube Blog: Now in 3D: Join the Experiment With Us!

YouTube Blog: Now in 3D: Join the Experiment With Us!: "First there was 1953's 3D thriller 'House of Wax,' then there was the Michael Jackson adventure 'Captain EO,' and this summerthere are at lea..."

WOW! But why place right eye on the left and the left eye on the right. We can code it...right?

Or is it a Limbo in-self...

...

Monday, October 11, 2010

MEL: Time Kill


So, you are sitting in the studio, and nothing-as-such is assigned to you, or may be you just do not wish to move that stupid mouse for some time and take a break, but want to look like working darn hard:

Here's a small script for you...

  1. int $amount = 0;

  2. progressWindow
  3. -title "Initializing..."
  4. -progress $amount
  5. -status "Preview: 0%"
  6. -isInterruptable true;

  7. while (true) {

  8. // Check if the dialog has been cancelled
  9. if ( `progressWindow -query -isCancelled` ) break;

  10. // Check if end condition has been reached
  11. if ( `progressWindow -query -progress` >= 100 ) break;

  12. $amount += 1;

  13. progressWindow -edit
  14. -progress $amount
  15. -status ("Preview: "+$amount+"%");

  16. pause -seconds 3;
  17. }

  18. progressWindow -endProgress;

Put it in a shelf button. When executed, it'll create a DUMB progress windw, which does nothing but wait for time specified to complete it's function and go off. You can change "strings" in line number 4, 6, 21 according your needs. To play with time: change variable $amount increment and `pause` at line number 17 and 23 respectively.

P.S. Hope my employers don't go through this ;)

Saturday, October 9, 2010

MEL: Select Similar Objects

So here 's small script which will select similar Polygon objects in a maya Scene: Just select the base object and execute the script, and viola, all similar objects are selected for you. This is specially useful for large scenes.
  1. int $c = 1;
  2. global proc SelSimObj(string $every)
  3. {
  4. int $c = 1;
  5. string $every = $every;
  6. int $sel[3] = `polyEvaluate -v -e -f $every`;
  7. string $b[] = `ls -typ mesh`;
  8. for ($each in $b)
  9. {
  10. int $counter[3] = `polyEvaluate -v -e -f $each`;
  11. if ($counter[0] == $sel[0] && $counter[1] == $sel[1] && $counter[2] == $sel[2]){
  12. select -add $each;
  13. clear $counter;
  14. };

  15. };
  16. clear $sel;
  17. clear $b;

  18. }

  19. string $SelList[] = `ls -dag -typ "mesh" -sl`;
  20. for($every in $SelList)
  21. SelSimObj ($every);
  22. clear $SelList;

Thursday, October 7, 2010

LUA

Is it worth delving in-to it? LUA. I mean, why the hell Eyeon guys chose it for Fusion? Why not python.

And, to summaries:
Lua uses less memory and has faster interpreter and JIT compiler. Lua C integration is cleaner.

Python has a larger standard library and a much larger ecosystem built around it.

Wednesday, October 6, 2010

Operator Precedence in MEL:


This Image shows order of operator precedence in MEL. Operator in same row has equal precedence. Left most operator is evaluated first, if a statement has more then one operators of equal precedence. Something we generally don't care of, then can't figure out why things are messing up.

Who Am I

PROGRAMMER: Someone who fixes a problem you didn’t know you had in a way you don’t understand.

Tuesday, October 5, 2010

Google Profile

Found this today: http://www.google.com/profiles/108548859666328462105 Never Knew it exists ;)

The |Code Project

Trying to find the source-code of this Life, it's my own version of The Code Project.
And I Hope it's open Source!

First Limbo (on the blog):

So can we get out of a loop (through a user Input-in the same app. or program) while it's still running. It's a Limbo in itself.