Skip to main content

A post dedicated to Autodesk Maya and the Maya API

I wanted to write this post for a long time now. In my free time I also do 3D stuff like models and various other things. While doing these I came across Autodesk Maya and from a developer's perspective I like it a lot.

It's one remarkable piece of software. Over the years it just kept growing and getting better. Today it has a huge variety of features and amazing support for developing various new components for it.

I will start with the basics. Surprisingly for a program it has it's own dedicated scripting and programming language called Maya Embedded Language or MEL. In reality the entire application is just one interpreter that reads these MEL scripts to generate the user interface. As you have guessed by now, the entire user interface is written in MEL.

It looks a lot like php and it has some special functions called commands which interact with Maya. With these commands we can add new menus or even edit 3D objects inside it.

The partial script bellow is written by me to add a new menu entry with some new functionalities:


And bellow is the menu that it creates:



It even has a built-in editor for these scripts. Additionally if you don't like it you can choose to write these scripts in python too. It even has another editor for python scripts.

Another amazing thing about this software is how it handles the relationship between the data or how it shows and updates the data to the user. In this case the data is formed of complex 3D objects.

Nowadays there is a trend in user interface programming to use some sort of framework that listens for changes in the data and updates the user interface for you. This is exactly the same idea that Maya uses but it takes it to the next level. All the 3D objects and other types that are shown to the user have properties. These properties determine the shape, color and in general how the object looks.

The amazing thing is that we can establish dependencies between these properties. So for example when we change a property on an object, it will notify all the dependent entities that have another property linked to the changed property. These dependent entities can have other properties which can change. This can trigger a cascade of updates. These are actually like dependency properties in Windows Presentation Foundation.

All these dependencies make a graph, a directed acyclic graph which we can even partially visualize in Maya like bellow:



In UI frameworks, especially in javascript ones, we can establish dependencies on two layers, between the user interface and another object. Here we can have multiple layers, as many as we want. So most modern UI frameworks just implement a subset of the principle and functionality mentioned above.

In the end, Maya is built around this base skeleton of objects with dependencies, each of these object type having some specific functionality built inside, triggered when some properties are changed on it.

For all these objects that exist, there is a C++ API to edit them. There are various function sets which can be used in C++ to perform changes on objects. Not every object support a given function set. For example the most basic function set supported by almost every object is the MFnDependencyNode function set. It allows us to get and set properties of the object that it is attached to. Another function set is MFnTransform that can pe applied to objects that have a position in space.

We can even create new relationships and dependencies between various properties of objects from this API.

There are also custom built-in types for strings, files, networking and even threading.

Finally, if you don't want C++, you can use the Maya .Net API and code in C#. You can even create new windows or extend existing ones in Windows Presentation Foundation or Windows Forms.

The software engineers which developed this program integrated seamlessly several huge technologies. The base user interface is actually written in QT and OpenGL. On top of these they managed to integrate Windows Presentation Foundation and Windows Forms. They even added a python interpreter to access and alter data.

Finally the way you interact with it is amazing and makes a good case study for user interface and user interaction. Just defining the behavior of the operation that a user can do to edit some objects inside it requires a lot of work. The use cases and steps they involve must be huge.

Bellow you can see the pie menu near the top, a context menu in which items are displayed radially to make better use of space:


Some of those items in the menu can open up a new radial menu themselves. And so on.


Overall it's an amazing program both for a developer's and a 3D artist's perspectives.


Comments

Popular posts from this blog

Some software development common sense ideas

 I haven't really written here in a long time so it's time to write some new things. These are just some random common sense things that seemed to short to write about individually but seem really interesting and useful to me or other people 1. There is nothing fixed in software development, all things vary by circumstances and time Remember the documentation that didn't seem that important when you started the project, well after a couple of years one the application has grown and become really complicated, no one actually knows everything about the application anymore. So now you really need that documentation. What happens if you suddenly need much more people to develop the application because of some explosive growth? Without documentation, new developers will just look at the application like they look at a painting. This actually happened to me. Maybe in the beginning of a project, a technology really helped you a lot but as the project grew, it started making things

My thoughts as an experienced developer in this field.

To be honest, I would have never guessed that      I would end up saying these these things, especially jn the beginning of my career. As you become more experienced, you kind of get to see everything and you become less impressed by new things. Honestly there is some sort of repetitiveness in this field and we kind of like to reinvent the wheel quite often, because well, we become a bit too easily bored. Take for example how the web looks now, a lot of it has been borrowed from other places, mostly desktop development, especially the parts about making custom reusable components.  Or from older frameworks, like state management in the UI which actually was first properly implemented in Asp .Net Webforms, as far as I know, something like 20 years ago, where you used to have the dreaded view state.  But most likely something similar existed before that too. I was not that surprised when React adopted initially this idea. Or even less surprised when hooks where introduced that seemed a b

Some things which are often blindly applied and followed by developers which are not always good

This is probably one of the most controversial things that I have written so far but I am just tired of hearing about these things and discussing these things. Other developers that I know share part of my feelings. I would rather hear more about how people built things, overcame challenges or what new interesting ideas and concepts they implemented. Those things are really interesting and innovative, not hearing about the same theoretical things over and over again. I can just read and learn those things from 100 sources on the internet. Firstly, one of the most discussed and promoted things is agile/scrum development. I think I have been through 5-8 workshops about agile development methodology. And each time, some things differed. There is no 100% standard approach to this. Everyone uses their own version of this development methodology and seem to argue a lot that their approach is right and everyone else is doing it wrong. You go to an interview, this will be one of the first 10 t