IIKeyControl not properlu exposed?

 
 
 
Posted by:zarusz
Data created:28 November 2010

Hello,

I am trying to port my max export plugin from C++ to C#.

I have encoutered a problem with the MAX.NET wrapper.

Having IIKeyControl interface how to obtain a key value ?

Consider the following C# pseudocode:

IILinPoint3Key key;

IControl icontrol = ...;

IIKeyControl keys = (IIKeyControl)icontrol.GetInterface(InterfaceID.Keycontrol);

//keys.GetKey(i, ??); - how to get the key value of type IILinPoint3Key ?


The variable icontrol is of Class_ID(LININTERP_POSITION_CLASS_ID, 0) and contains keys of type ILinPoint3Key in my C++ code.

In my opinion the wrapper method signature is wrong:
void GetKey(int i, Autodesk.Max.IIKey key)

It should be something like this:

void GetKey(int i, out Autodesk.Max.IIKey key)

By the way...
Many thanks to EPHERE for the wonderful MAX.NET :)

Hello again,

My mistake, now I see how it should look like.

Using IGlobal interface one must first create the IILinPoint3Key implementation and pass it to GetKey. Then it gets filled with the key value.

The following sample might be usefull:

IGlobal global = ...
IILinPoint3Key key = global.ILinPoint3Key.Create(); // obtain ILingPoint3Key implementation
var keys = (IIKeyControl)icontrol.GetInterface(InterfaceID.Keycontrol);
for (var i = 0; i < keys.NumKeys; i++)
{
  keys.GetKey(i, key);
  // the key value is now in "key"
}

 

Thanks for the sample Tomasz, it takes some getting used to going from C++ to .NET-alternatives.

Marsel Khadiyev (Software Developer, EPHERE Inc.)