string $fileArray[] = {"C:/_Maya/temp/file_0001.ma","C:/_Maya/temp/file_0002.ma","C:/_Maya/temp/file_0003.ma","C:/_Maya/temp/file_0004.ma","C:/_Maya/temp/file_0005.ma","C:/_Maya/temp/file_0006.ma","C:/_Maya/temp/file_0007.ma","C:/_Maya/temp/file_0008.ma","C:/_Maya/temp/file_0009.ma","C:/_Maya/temp/file_0010.ma","C:/_Maya/temp/file_0011.ma","C:/_Maya/temp/file_0012.ma","C:/_Maya/temp/file_0013.ma","C:/_Maya/temp/file_0014.ma","C:/_Maya/temp/file_0015.ma","C:/_Maya/temp/file_0016.ma","C:/_Maya/temp/file_0017.ma","C:/_Maya/temp/file_0018.ma","C:/_Maya/temp/file_0019.ma","C:/_Maya/temp/file_0020.ma"} ;
The code above shows a string array containing twenty Maya Ascii files. It's straight forward, but a little difficult to read due to it all being condensed. If you need to make edits to one of the file names or add some into the list somewhere specific it can be a bit annoying finding the right spot. Let's use white space to help us with this.
string $fileArray[] = {
"C:/_Maya/temp/file_0001.ma",
"C:/_Maya/temp/file_0002.ma",
"C:/_Maya/temp/file_0003.ma",
"C:/_Maya/temp/file_0004.ma",
"C:/_Maya/temp/file_0005.ma",
"C:/_Maya/temp/file_0006.ma",
"C:/_Maya/temp/file_0007.ma",
"C:/_Maya/temp/file_0008.ma",
"C:/_Maya/temp/file_0009.ma",
"C:/_Maya/temp/file_0010.ma",
"C:/_Maya/temp/file_0011.ma",
"C:/_Maya/temp/file_0012.ma",
"C:/_Maya/temp/file_0013.ma",
"C:/_Maya/temp/file_0014.ma",
"C:/_Maya/temp/file_0015.ma",
"C:/_Maya/temp/file_0016.ma",
"C:/_Maya/temp/file_0017.ma",
"C:/_Maya/temp/file_0018.ma",
"C:/_Maya/temp/file_0019.ma",
"C:/_Maya/temp/file_0020.ma"
} ;
Cool huh? MEL and most languages will allow you to do this and many other things with white space in your code to really space it out evenly and neatly so it's easy for you and anyone else interacting with your scripts to use and read. Practice ways of using this trick to make your code more awesome!
No comments:
Post a Comment