PDA

View Full Version : Maya API


arkady1200
12-13-2002, 02:51 PM
I'm attempting to write some maya plugins, and was wondering if there is a way to create user interface elements similar to mel interface elements using the API. Any help on this topic would be appreciated. I'm looking for maybe some simple code that will create a slider that will let me control some parameter such as the x coordinates of a sphere. Thanks.

playmesumch00ns
12-13-2002, 06:36 PM
Nope, you can't do UI through the API, only with MEL. This isn't really a problem since Maya's built almost entirely with MEL anyway. It does mean that if you want to do anything more complicated than change attributes of your nodes, you'll have to write your own commands to do it, but it's not that much trouble really.

arkady1200
12-13-2002, 06:51 PM
Well, really my concern is that I would like to be able to use a c++ library that I wrote that parses out some data and have maya use that data by making calls to my library. I didn't think you can make c++ calls from within mel. Am I wrong? Am I going about it in a totally wrong way? If anyone knows, I would really appreciate some guidence. Thanks.

Taos
12-13-2002, 11:04 PM
If you have to connect the MEL world and the C++ world, you just have to write MPxCommand derived functions and then call them from your mel script. I'm not entirely sure what you want to get out of the library, so writing a command might not be what your after. Getting data from C++ to mel isn't difficult though.

MCronin
12-14-2002, 01:41 AM
For plugins, you *may* have to look into the Win 32 API. Whatever plugin you write is going to be a new Window, that's a child of Maya's Window, but it's going to need to have a message handler and what not. It's more complicated than setting up GUI elements through MEL but it's not that bad if you can program. Take a look at Windows 2000 Programming From the Ground Up or Microsoft Windows 2000 API Superbible. These books apply to XP as well.

playmesumch00ns
12-15-2002, 01:09 AM
Maya's API is completely insulated from Win32. The plugin isn't a child window, it's just implemented as a set of DLL functions. You _can_ create your own windows if you wish, but you have to deal with lots of DLL voodoo, there's an example with MFC at www.secretlevel.com but it's not pretty.

As Taos said, the best way to execute C++ functions from inside a plug-in is to write a few MPxCommands, and then call these from you MEL UI. This stuff's all covered in the Maya docs; it's not exactly hand-holding stuff, but give it a bit of time and it's quite nice.

Good luck!:thumbsup:

CGTalk Moderation
01-14-2006, 12:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.