Maya C++ Questions


#1

Sorry for these n00b questions, there are so much less informations about C++ plugins compared to MEL and Python and most infos are somehow old or outdated.

1 - Is it possible to compile a Maya plugin which is written in C++ to Linux and Mac operating systems inside Windows ?
2 - Which way for the GUI is preferred nowodays ? MEL interaction, Qt Designer or any other ?
3 - How can I transfer a MEL codes to native C++ such as Bevel, Extrude, Scale ?
4 - Any recommendations are welcome for anything about C++ such as documentations, tips, tricks, etc.


#2

Hi, i’ll try to help a little bit :slight_smile:

The documentation for the C++ API is quite nice imo

As about the gui, gui of Maya itself is written in QT, and You can use its elements as you’d use other qt widgets, so i’d say, that it’s a good idea to learn it.

As about learning, you prob snot know Chad Vernon, if You do not, then check his blog.


#3

Thank you. :slight_smile:
Where can I view or download the latest 2017 version of documentation for C++ Api ?
I have seen Chad Vernon and this guy uses his FindMaya.cmake module to make work any version of Visual Studio or a few other IDES pretty easy.
http://blog.josephkider.com/2015/09/17/using-cmake-to-create-your-first-maya-plug-in/
I know Qt but Qt elements are pretty primitive. I couldnt figure it out right now so I decided to use MEL scripts to handle GUI with some kind of MVC workflow.


#4

I recommend to use python instead of mel, it makes handling of button commands easier.
What do you mean by transferring mel to c++? Do you simply want to execute mel commands in your plugin?


#5

Thank you. :slight_smile:
I already have well written MEL GUI for my project ToolSeq UD.
I learned how to execute mel commands in C++, that is not what I am talking about.
How to do jobs in C++ like extrude, bevel ?
I dont want it too way low level make the job myself but I also dont want to execute mel commands for that because of speed concerns. I just want to learn the native way of these command. (calling these commands for thousands of components is so slow in MEL, that is why I am trying to learn C++ Api)

One more question, how can I query GUI elements of MEL, maybe like a text in textfield ?
One more question, do I need to install Maya 2014 to compile code for Maya 2014, backward compatilibity ?


#6

C++ plugins would not directly query UI usually, and insead get the values via command attributes.

A code won’t be faster in C++ just because you wrote it there. If you’ll just reuse extrude node and loop through selection of thousand nodes, you’ll barely notice a difference. To get things really fast, you have to go lower-level - maybe you don’t need to do thousands of extracts and instead there’s a smarter idea behind it, and you build a new parametric geometry and make it an output of a node.

Compiling from Windows on all platforms is not possible because of Mac. There’s no other legal way than buying a Mac and building there (at least not in C++, some other languages like Golang can actually do that). My current build environment for 3 platforms:

  • native Windows 10 - produces windows binaries
  • Mac Mini - slow, but enough to host OSX and run build scripts
  • Centos 6.5 on VirtualBox - produces linux binaries (newer versions of Linux had issues running on some client’s environments because of the specific GLibC requirement)

For documentation - just start with whatever you can find. Learn C++ if it’s new to you, build and run examples from Devkit, clone a devkit project (e.g. custom node) and try to modify it to fit your own needs. It’s quite a steep learning curve, I must admit, I consider myself a seasoned developer and in perspective of other development work that I do, building stuff in Maya is complicated.


#7

Thank you. :slight_smile:
I want to use native nodes of MEL commands at the beginning and then starting with the slowest module, I may go one step lower level to boost them up one by one. Otherwise I can lose my way of transferring the project.
Where is the official latest version documents of Maya C++ Api ?

Command attributes, you mean flags right ?
Query GUI variables in mel and pass the parameters as flags like ?
HelloWorld -print “textField -q -text myTextField”

I think I will drop the support of Mac but I will distribute source codes for my project so Mac users can compile codes for themselves if they need my plugin.


#8

http://usa.autodesk.com/adsk/servlet/item?id=24245570&siteID=123112
Found the official adress of api help files which is also available to download for offline use.