I have looked all through google, and I am not able to figure out what is going on.
I am working on a custom context maya, implemented the MPxContext and MPxContextCommand and all.
I have been using the marquee example in the devkit. Now, it compiles and all, but when I call the context
command I get a MEL error without any message (like: Error: line 1)

I am using Maya 2013 SP1. Is there anything special you have to do in MEL to activate
a custom context? afaik just running the Context command (eval "MyToolContext;") should work, no?

MPxToolCommand - a MEL command that can be invoked from within the MPxContext as a means of finalizing the result of your context - ie. what is run when the user hits enter and exits the tool).

In your case, it appears that you're expecting MPxToolCommand to be creating and setting the context. That is not correct. You should instead be invoking your MPxContextCommand. This is responsible for creating an instance of your context as well as editing parameters on your context if you need to configure settings.

By default the context command should create a new context and return you its name. In order to then activate that context you need to invoke the setToolTo command on the returned context object. For example:

// Create an instance of my context.
string $myCtxObj = `myCtxCmd`;

// Now activate the context
setToolTo $myCtxObj;

In your case, this translates to:

string $cpToolCtx = `CPToolCommand`;
setToolTo $cpToolCtx;

You should see the active tool in the left pane change to show you the new active context. If you haven't set an icon for it, it will likely be a blank icon. And that's it.

Hope this helps.

FabricPaul

11 November 2012, 09:36 PM

We got some help elsewhere - this was related to the NT_PLUGIN define missing.

Thanks for your help, apologies for not posting the resolution earlier.

CGTalk Moderation

11 November 2012, 09:36 PM

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.

Follow Us On:

The CGSociety

The CGSociety is the most respected and accessible global organization for creative digital artists. The CGS supports artists at every level by offering a range of services to connect, inform, educate and promote digital artists worldwide. More about us on TheArtSociety.com