metaprogramming MEL: metaMel!

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  11 November 2012
Ah I wouldn't take it personally, I dont think anyone's doubting abilities, I think its more to do with understanding your choices. I understand your reasoning, as - I'm sure - the others do. I think the objections to using mel, was that you intend it to eventually be used by others as something to extend their own work upon.
Quote: I'm hoping that the final, final product of all this will be a way for amateurs, students, and small studios to set up pipeline tools capable of being customized down to variable names. The user only has to set up the initial conditions, and the metaPipe will take care of the rest.
My thinking is that the final product, as fantastically useful as it might be, will - in comparison - be limited and hindered.
Either way, good luck, and I'll be interested in following this project's development
__________________
ldunham.blogspot.com
 
  11 November 2012
Originally Posted by katisss: Mel is only good for shelves and AETemplates now.
+1 for python


Even for AETemplates I only use python with pymel, its much more efficient.
__________________
www.renderwiki.com - www.openmaya.net
 
  11 November 2012
As an aside, can anyone recommend a good resource for using Python with the API? I'd like to get into some real plugin programming at some point, but I'm still reeling from my last attempt at C++. Baby steps and all that.
 
  11 November 2012
Originally Posted by EdtheHobbit: As an aside, can anyone recommend a good resource for using Python with the API? I'd like to get into some real plugin programming at some point, but I'm still reeling from my last attempt at C++. Baby steps and all that.

http://www.amazon.com/Maya-Python-G...e/dp/0123785782
__________________
My website/blog , with a lot of tips&tricks about maya API,python,and pyqt , and tutorials
www.marcogiordanotd.com
llinkedin
 
  11 November 2012
Starting off, I need a way to source in scripts that will be located in sub-directories. This script returns an array of all files with a given extension type in my "metaMel" folder:


 global proc string[] mmel.getFiles(string $fileType){
   
 	// * get the local script directory (linux)
 	
 	string $scriptLoc = `internalVar -usd`;
 	string $userLoc = ($scriptLoc + "metaMel/");
 	
 	// * initial variables
 	
 	string $dirList[];
 	string $fileList[]; // <- This will be the return
 	
 	string $files[] = (`getFileList -fld $userLoc`);
 	
 	// * test conditions for ending directory search
 	
 	int $end = 0;
 	int $whileCheck = 0;
 	
 	// * loop to find all sub-directories
 	
 	while(!$end){
 			for($file in $files){
 			  
 			  // * check for directory status
 			  
 				if(`filetest -d ($userLoc + $file + "/")`){
 					$end = 0;
 					$dirList[size($dirList)] = ($userLoc + $file + "/");
 				}
 			}
 		$userLoc = ($dirList[$whileCheck]);
 		$files = (`getFileList -fld $userLoc`);
 		if($whileCheck == (size($dirList) - 1)) $end = 1;
 		$whileCheck++;
 	}
 	
 	// * loop to get all .ext files
 	
 	for($dir in $dirList){
 		string $dirFiles[] = `getFileList -fld $dir -fs ("*." + $fileType)`;
 			for($file in $dirFiles){
 				$fileList[size($fileList)] = ($dir + $file);
 			}
 	}
 	
 	return $fileList;
 }
 


And this will run a source command for each .mel file that is returned in this way:


 //=================
 // Source all .mel files in the metaMel directory
 //=================
 
 global proc mmel.metaSource(){
 	string $melFiles[] = `mmel.getFiles "mel"`;
 		for($file in $melFiles){
 			string $sourceCommand = ("source \"" + $file + "\"");
 			evalEcho $sourceCommand;
 		}
 }
 
 
  11 November 2012
read a text file to a string array and single string


 //=================
 // Read File To Single String, given filePath
 //=================
 global proc string mmel.lib.readFileToString(string $filePath){
 	string $stringArray[] = `mmel.lib.readFileToStringArray $filePath`;
 	string $stringReturn = `stringArrayToString $stringArray "\n"`;
 	return $stringReturn;
 }
 


calls mmel.lib.readFileToStringArray:



//=================
// Read File To String Array, given filePath
//=================
global proc string[] mmel.lib.readFileToStringArray(string $filePath){
	int $fileId = `fopen $filePath "r"`;  
	string $lineArray[];
	string $nextLine = `fgetline $fileId`;  
	while (size($nextLine) > 0) {
		string $cleanLine = strip($nextLine);  
		$lineArray[size($lineArray)] = $cleanLine;  
		$nextLine = `fgetline $fileId`;
		}
	fclose $fileId;
	return $lineArray ;  
}


Next step, find and replace keywords
 
  01 January 2013
I've been working on building a new website, and I've been using a CSS compiling language called "LESS" -- it simplifies and extends CSS in some pretty cool ways, but when it reaches your site, it's plain old CSS code.

It's very similar to what I want to do with metaMel - incorporating elements like mixins and variable-variables.

I haven't had any chance to work on metaMel lately, but I'm learning more python (for Houdini, now...) I'm looking forward to leveraging python for a lot of the string parsing stuff
 
  04 April 2013
Thought I'd drop by for an update - I actually got pretty darn far with metaMel.

I was able to write a really simple json file, parse it with Python, throw it to the mel-based interpreter, and build nicely-commented procedures for tasks in Maya.

Most of the new development was for the feature film "Free Birds" at RFX, so unfortunately I won't be able to share it.

Almost all of my work right now is Python for NUKE - and I'll be moving to Houdini in a few months, so my time with MEL is pretty much at an end. If I start working on personal projects again, I'll have to break out the dollar-signs and brackets again, but not for a while!
 
  04 April 2013
Originally Posted by EdtheHobbit: Thought I'd drop by for an update - I actually got pretty darn far with metaMel.

I was able to write a really simple json file, parse it with Python, throw it to the mel-based interpreter, and build nicely-commented procedures for tasks in Maya.

Most of the new development was for the feature film "Free Birds" at RFX, so unfortunately I won't be able to share it.

Almost all of my work right now is Python for NUKE - and I'll be moving to Houdini in a few months, so my time with MEL is pretty much at an end. If I start working on personal projects again, I'll have to break out the dollar-signs and brackets again, but not for a while!


hei man just a question , if you use python for other software is still worth for you to go back to mel? I mean i jumped on houdiny latelty and i could resue all my pyqt ui and custom widget without need to blink
__________________
My website/blog , with a lot of tips&tricks about maya API,python,and pyqt , and tutorials
www.marcogiordanotd.com
llinkedin
 
  04 April 2013
cheers for keeping us in the loop!
__________________
ldunham.blogspot.com
 
  04 April 2013
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 08:48 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.