A .NET API for Maya
Cyrille Fauvel from the Autodesk Developer Network gave the first public sneak peek of a .NET API for Maya back in December on his blog. I'm pleased to announce that it is now a reality for our subscription customers with the release of the Extension 2 Maya 2013 on the subscription site.
For fun here is a sample Hello World plug-in for Maya written in C#:
using System; using Autodesk.Maya.Runtime; using Autodesk.Maya.OpenMaya; [assembly: MPxCommandClass(typeof(MayaNetPlugin.helloWorldCmd), "helloWorldCmd")] [assembly: ExtensionPlugin(typeof(MayaNetPlugin.helloWorldPlugin), "Autodesk", "1.0", "Any")] namespace MayaNetPlugin { public class helloWorldPlugin : IExtensionPlugin { bool IExtensionPlugin.InitializePlugin() { return true; } bool IExtensionPlugin.UninitializePlugin() { return true; } String IExtensionPlugin.GetMayaDotNetSdkBuildVersion() { return ""; } } public class helloWorldCmd : MPxCommand,IMPxCommand { public override void doIt(MArgList argl) { MGlobal.displayInfo("Hello World\n"); } } }
Of course it gets much more interesting than that since there is support for docking WPF windows in Maya, and for using LINQ. Here is an example of how LINQ can be used to query the dependency graph for all selected objects with a mesh:
var meshes = from p in new MSelectionList() where p.hasFn(MFn.Type.kMesh) select new MFnMesh(p);
In the Maya devkit/dotnet folder though you can find over 60 sample .NET plug-ins ported from the C++ API. For more information on the Maya .NET API you should check out the documentation.
Also note that the Autodesk Developer Network has made a C# plug-in wizard available on the Maya developer center page.
SDK Documentation Improvements
There has also been a number of improvements to the SDK documentation:
- The Writing a Deformer Node chapter has been updated.
- The Manipulators chapter has been updated.
For detailed information on the changes in the SDK and SDK documentation see the What's New in Extension 2 for Maya 2013 topic. There is also some information about other improvements to the Maya 2013 Extension 2 in the Maya user documentation.
SDK Documentation Translator Widget
Finally is a special treat for Maya users who don't speak English as a first language: the addition of a Microsoft Translation widget to the SDK documentation. This is a pilot project, that we first tried on Gameware customers and that we are now rolling to the larger audience of Maya SDK users.
I'd appreciate hearing your feedback regarding any or all of these improvements.