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
metaprogramming MEL: metaMel!

I've started working on a metaprogramming system for MEL, as part of a larger "open pipeline" project. I figured I'd document my progress here.

The first goal is to build an on-the-fly script / UI generator in MEL (and possibly Python for some tasks)

I'm leaning towards XML as my initial model, so my first task will be to write MEL scripts for reading, writing, and manipulating XML.

I'm going to combine this with Maya-centric methods for getting variables from the user or maya environment -- so even the base templates can be automated to some degree.

The whole shebang is going to be recursive as well, so you can have an xml document that triggers calls to other documents to supply content.

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.
 
  11 November 2012
just curious, any reason your not using python handsdown for it?
For starters I've found python for xml handling far easier and more effiecient than using mel.
__________________
ldunham.blogspot.com
 
  11 November 2012
Have to ask the same thing, why mel? For pure metaData programming you really need Python and class structures to make the most of data. Mel is good, I've got nothing against it, but once you switch to Python you'll never look back.
__________________
Founder & CEO : Red9Consultancy
Red9 StudioPack : Red9 StudioPack GitHub
Author: Autodesk Masterclass 2011 - 'Live Animation Binding'
 
  11 November 2012
I wholeheartedly agree, actually. Python would be the logical choice, and a lot less painful on the whole. Python probably should be the meta-language. But... for whatever reason, the idea of using a meta-language that is the same as the destination language is wonderfully endearing to me. So, for the MEL portions of the code, I'm going to use MEL meta-code. I'll probably end up doing a python interpreter as well, for the python portions of the code.
 
  11 November 2012
And, I should probably add, this is a personal project -- if I was on a deadline or handing this to a supervisor, I'd use Python in a heartbeat.
 
  11 November 2012
Mel is only good for shelves and AETemplates now.
+1 for python
__________________
www.lo-motion.de
Realflow forum: http://www.realflowforum.com

 
  11 November 2012
Originally Posted by katisss: Mel is only good for shelves and AETemplates now.
+1 for python


exactly , i don't use mel since like 3 years now for a pipeline python is the way to go , regardles the easier use and so on with python you can trigger so many libraries to help your work .
Example even the XML is obsolete if you use python you can easly use JSON or PICKLE and avoid all the pain coming from XML
__________________
My website/blog , with a lot of tips&tricks about maya API,python,and pyqt , and tutorials
www.marcogiordanotd.com
llinkedin
 
  11 November 2012
Why MEL?

Python is great. Won't argue about that.

I'm starting with MEL for a very good reason. This is a learning exercise and will ultimately be a teaching tool, and as much as I appreciate the input, I'm well aware that I'm going in the less-than-optimal direction starting out. If I don't struggle through the MEL first, I won't fully understand (and can't teach) the differences between the procedural and object-oriented approaches to this kind of problem.

So, settle down, I hear ya!
 
  11 November 2012
Teaching loves the past. I remember my Pascal lecture as quite useless.
But so great for teaching...
__________________
www.lo-motion.de
Realflow forum: http://www.realflowforum.com

 
  11 November 2012
Ed,

I hear ya. As a fellow educator, I'm also learning MEL and Python, so I can knowledgeably explain the nuances and differences. So, students understand where and when to use MEL or Python. It is very important to the history of Maya and 3D in general. Many of the developments in neighboring programs are born from solving problems in Maya. I'd love to hear your experiences, and trade info with you.

I'm currently stuck on the same idea, how to implement meta-data in MEL. Specifically following this technical artist from Bungie. Interestingly, this was presented in 2009, so only 3 years ago, and is entirely in MEL.

Love to hear your thoughts.
__________________
maya and zbrush training
creating CG3D since 2001

3D Models
@ Turbosquid

my Scripts
 
  11 November 2012
So here's the initial challenge that I'm setting myself. I want to interpret this xml into a fully-functioning mel file that creates a floating, resizeable window with two buttons. The buttons' colors will be set with a modal window described in a mel file. The get'...' method will set the variable, and the use'...' method will re-use it.

This xml will build a script, but I'm thinking that I can use the same idea to build other maya objects and assets, such as scenes, characters, rigs, etc.


  <metaMel type="script">
    
    <header>
  	<title>
  	my MEL tool
  	</title>
  	<version>
  	v 1.0
  	</version>
    </header>
    
    <procComment>
    This is my tool's first procedure
    </procComment>
    
    <procedure name="myProc">
  	<floatingWindow width="400" height="200">
  	  <comment>
  	  main content
  	  </comment>
  	  <column color="darkGrey">
  		<row>
  		  <button color="get'myColor'">
  			<label>
  			button one
  			</label>
  		  </button>
  		  <button color="use'myColor'">
  			<label>
  			button two
  			</label>
  		  </button>
  		</row>
  	  </column>
  	</floatingWindow>
    </procedure>
  
  </metaMel>
  

Last edited by EdtheHobbit : 11 November 2012 at 10:54 PM. Reason: typos
 
  11 November 2012
If you want to take a look at a fully fledged Python MetaData api then it might be worth downloading my Red9 Studio Pack. I've spent a long time writing a metadata setup and api for setting up and traversing data similarly to Bungie's setup. There's examples of how to add the hooks to rigs, how to walk the metaData network and this is expanding day by day. At the moment there's no UI for this, but the code is dead easy to implement and in the example I show how to hook the Morpheus rig up.

v1.27 has had a huge update and will be released early next week

Red
 
  11 November 2012
Originally Posted by EdtheHobbit: So here's the initial challenge that I'm setting myself. I want to interpret this xml into a fully-functioning mel file that creates a floating, resizeable window with two buttons. The buttons' colors will be set with a modal window described in a mel file. The get'...' method will set the variable, and the use'...' method will re-use it.


So what you;re trying to do is basically what PyQt with Qt Designer gives you for free. Sorry to say this, but this looks like a huge waste of time. At least write this in Python (you can write Python for years and never touch object oriented programming if you insist on doing it the hard way).

Ive written tons of Mel guis over the years, including windows that build their content automatically based on lists of stuff. Ive deleted all that code by now, it only exists deep down in my Subversion history. These days, I use PySide/PyQt even for the simplest guis inside Maya and Nuke.
__________________
CaptainSam
 
  11 November 2012
Originally Posted by CaptainSam: So what you;re trying to do is basically what PyQt with Qt Designer gives you for free. Sorry to say this, but this looks like a huge waste of time. At least write this in Python (you can write Python for years and never touch object oriented programming if you insist on doing it the hard way).


Well, I guess it's a good thing that I'm the one wasting my time! You're welcome to ignore me forever if that's your choice. Not one whit or tittle of your time will be wasted. I guarantee it.

Originally Posted by CaptainSam: Ive written tons of Mel guis over the years, including windows that build their content automatically based on lists of stuff. Ive deleted all that code by now, it only exists deep down in my Subversion history. These days, I use PySide/PyQt even for the simplest guis inside Maya and Nuke.


And any person who wants to use your simple guis would have to have PySide or PyQt with QT installed, correct? So students without admin access would be out of luck. I know I have a narrow view, but that's the market I'm catering to.

Look, guys. I'm just trying to challenge myself with a task that I think would be useful and educational. I'm not a TD, I'm not even really a programmer. I don't do this kind of work professionally, so I have the luxury to look for depth instead of efficiency. I'm doing things the hard way so that I know that I CAN.
 
  11 November 2012
Originally Posted by Stoehr: I'm currently stuck on the same idea, how to implement meta-data in MEL. Specifically following this technical artist from Bungie. Interestingly, this was presented in 2009, so only 3 years ago, and is entirely in MEL.


Originally Posted by RedNine: If you want to take a look at a fully fledged Python MetaData api then it might be worth downloading my Red9 Studio Pack.


thanks, Stoehr and Red! That's definitely food for thought... I'm lacking a LOT on the theory side, though. The more I dig into this, the more I realize how much I don't know.

I'm starting simple for now with very basic text replacement, but this is definitely the kind of direction that I want to be going.
 
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 04:56 AM.


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