Tuesday, February 15, 2011

Comprehensive Renamer: Maya Rename Script

Comprehensive Renamer: Maya Rename Script


Download Here (CreativeCrash)


One more rename script for Maya, written in mel, I'am trying to make it as feature rich as possible, so all requests are welcome.


Copyright (C) 2011 Dushyant Kumar Kashyap
MEL script for MAYA 8.0+
File: comprehensiveRenamer.mel
Desc: This is a simple mel script that allows the user to rename multiple Objects.
With lots-n-lots of options.
Author: Dushyant Kumar Kashyap (dushyantk@gmail.com)


Usages:  Just Source Script, it will call the required procedure automatically.



   

Tuesday, February 8, 2011

Save Incremental Version



Here's a small code to save an Incremental version of your maya file, so basically, no need to go to Save-As-> type the Name Again, just Copy the code in a MEL Shelf button: and every-time you need make an Incremental save, hit that Button.
  1. global proc incrementalSave()
  2. {
  3. string $f=`file -q -sn`; // get file name
  4. string $ft[]=`file -q -typ`; // file type (mayaAscii, etc.)

  5. if ($f!="")
  6. {

  7. // * extracting base filename (path/basename) and version number *

  8. string $n[],$ext="";

  9. if (tokenize($f,".",$n)) $ext=$n[size($n)-1];
  10. if (size($n)>1) $f=substring($f,1, size($f)-size($ext)-1 );
  11. if ($ext!="") $ext=("."+$ext);

  12. int $x=0, $m=1, $v=0, $d=0, $w=1;

  13. while($x==0)
  14. {
  15. string $e=substring($f,size($f),size($f)); // last character (as string)

  16. if (gmatch($e,"[0-9]")) // last character was a number?
  17. {
  18. $v+=($m*(int)$e);
  19. $m*=10;
  20. $d++; // (count number of digits)
  21. $f=substring($f,1,size($f)-1); // chop last character
  22. }
  23. else $x=1;
  24. }

  25. // * renaming current file (with incremented version number) *

  26. $v++; // increment version number
  27. string $vs=("000000000"+(string)$v);

  28. if ($d<1) $d=2; if ($d>8) $d=8;

  29. $vs=substring($vs,size($vs)-$d+1,size($vs));

  30. $f=($f+$vs+$ext);

  31. if (`confirmDialog -t "Save [+]" -m ("Save Scene As '"+$f+"' ?") -b "Ok" -b "Cancel" -cb "Cancel" -ds "Cancel"`!="Cancel")
  32. {
  33. file -rename $f;

  34. if (`file -q -ex $f`)
  35. {
  36. if (`confirmDialog -t "File Already Exists" -m ("Overwrite already existing file '"+$f+"'?") -b "Yes" -b "No" -cb "No" -ds "No"`!="Yes")
  37. $w=0;
  38. }

  39. if ($w)
  40. {
  41. //FileMenu_SaveItem;
  42. warning("projMan: Saving File...");
  43. evalEcho("file -save");
  44. addRecentFile($f,$ft[0]); // add to the recent files list
  45. }
  46. }
  47. }
  48. else projectViewer SaveAs;
  49. }
  50. incrementalSave;

Thursday, February 3, 2011

Learn to Code: The Full Beginner's Guide

Learn to Code: The Full Beginner's Guide is 4.5-part intro series on Javascript from LifeHacker. It might be useful for using expressions in After Effects. And it doesn't leave you hanging since the epilogue shares some best pactices and additional resources.

Here's a sample movie: