CGTalk > Software > Autodesk Maya > Maya Programming
Login register
Thread Closed share thread « Previous Thread | Next Thread »
 
Thread Tools Search this Thread Display Modes
Old 11-15-2012, 12:05 AM   #1
EdtheHobbit
File read in 0 seconds
portfolio
Ed Whetstone
Lighting Artist
Richardson, USA
 
Join Date: Oct 2007
Posts: 664
Send a message via AIM to EdtheHobbit
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.
 
Old 11-15-2012, 08:52 AM   #2
ldunham1
Character TD
portfolio
Lee Dunham
Character Rigger
Surrey, United Kingdom
 
Join Date: Feb 2008
Posts: 179
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
 
Old 11-15-2012, 09:25 AM   #3
Mark-J
Expert
 
Mark-J's Avatar
portfolio
Mark Jackson
CEO & Founder
Red9 Consultancy
United Kingdom
 
Join Date: Feb 2005
Posts: 409
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.
 
Old 11-15-2012, 05:22 PM   #4
EdtheHobbit
File read in 0 seconds
portfolio
Ed Whetstone
Lighting Artist
Richardson, USA
 
Join Date: Oct 2007
Posts: 664
Send a message via AIM to EdtheHobbit
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.
 
Old 11-15-2012, 05:24 PM   #5
EdtheHobbit
File read in 0 seconds
portfolio
Ed Whetstone
Lighting Artist
Richardson, USA
 
Join Date: Oct 2007
Posts: 664
Send a message via AIM to EdtheHobbit
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.
 
Old 11-15-2012, 05:29 PM   #6
katisss
lllllllllllhexhex
 
katisss's Avatar
portfolio
Katrin Schmid
www.lo-motion.de
Sydney, Germany
 
Join Date: May 2005
Posts: 619
Mel is only good for shelves and AETemplates now.
+1 for python
__________________
www.lo-motion.de
Realflow forum: http://www.realflowforum.com

 
Old 11-15-2012, 05:35 PM   #7
giordi
Lord of the posts
 
giordi's Avatar
portfolio
Marco Giordano
Creature TD
Double Negative
London, United Kingdom
 
Join Date: Aug 2008
Posts: 618
Quote:
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
 
Old 11-15-2012, 06:23 PM   #8
EdtheHobbit
File read in 0 seconds
portfolio
Ed Whetstone
Lighting Artist
Richardson, USA
 
Join Date: Oct 2007
Posts: 664
Send a message via AIM to EdtheHobbit
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!
 
Old 11-15-2012, 06:55 PM   #9
katisss
lllllllllllhexhex
 
katisss's Avatar
portfolio
Katrin Schmid
www.lo-motion.de
Sydney, Germany
 
Join Date: May 2005
Posts: 619
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

 
Old 11-15-2012, 08:26 PM   #10
Stoehr
Expert
 
Stoehr's Avatar
portfolio
Matthew L Stoehr
Professor & Dept. Chair
American River College, Art New Media
Sacramento, USA
 
Join Date: May 2003
Posts: 924
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
 
Old 11-15-2012, 10:52 PM   #11
EdtheHobbit
File read in 0 seconds
portfolio
Ed Whetstone
Lighting Artist
Richardson, USA
 
Join Date: Oct 2007
Posts: 664
Send a message via AIM to 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.

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.

Code:
<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-15-2012 at 10:54 PM. Reason: typos
 
Old 11-16-2012, 08:00 AM   #12
RedNine
Veteran
 
RedNine's Avatar
portfolio
Andy
Red9 Consultancy
London, United Kingdom
 
Join Date: Oct 2009
Posts: 65
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
 
Old 11-17-2012, 01:13 PM   #13
CaptainSam
Frequenter
 
CaptainSam's Avatar
portfolio
jo jurgens
Senior TD
Qvisten Animation
Norway
 
Join Date: Jul 2002
Posts: 245
Quote:
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
 
Old 11-17-2012, 05:04 PM   #14
EdtheHobbit
File read in 0 seconds
portfolio
Ed Whetstone
Lighting Artist
Richardson, USA
 
Join Date: Oct 2007
Posts: 664
Send a message via AIM to EdtheHobbit
Quote:
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.

Quote:
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.
 
Old 11-17-2012, 05:11 PM   #15
EdtheHobbit
File read in 0 seconds
portfolio
Ed Whetstone
Lighting Artist
Richardson, USA
 
Join Date: Oct 2007
Posts: 664
Send a message via AIM to EdtheHobbit
Quote:
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.


Quote:
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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:44 AM.


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