[Closed] [C#] Get Key Type
We have different type of key for example IIBezPoint3Key,IIBezScaleKey,IIBezFloatKey,etc.
My question is if we have a controller keyframed inside max, how we can detect type of it’s keys?
I know class of controller. Every controller class needs its own type of keys. This’s all what you have.
How many variations we have in controllers and key types? Is this a good method? I’m not sure how I can handle rotation controller.
using Autodesk.Max;
using System;
namespace TestLibrary
{
public static class TestClass
{
static IGlobal globalInterface = GlobalInterface.Instance;
static IInterface coreInterface = globalInterface.COREInterface;
public static void TestMethod(UIntPtr controllerHandle)
{
IControl control = (IControl)globalInterface.Animatable.GetAnimByHandle(controllerHandle);
IClass_ID cID = control.ClassID;
SClass_ID sID = control.SuperClassID;
if (cID.PartA == (uint)BuiltInClassIDA.HYBRIDINTERP_POSITION_CLASS_ID ||
cID.PartA == (uint)BuiltInClassIDA.HYBRIDINTERP_COLOR_CLASS_ID ||
cID.PartA == (uint)BuiltInClassIDA.HYBRIDINTERP_POINT3_CLASS_ID)
{
IIBezPoint3Key key = globalInterface.IBezPoint3Key.Create();
}
else if (cID.PartA == (uint)BuiltInClassIDA.HYBRIDINTERP_SCALE_CLASS_ID)
{
IIBezScaleKey key = globalInterface.IBezScaleKey.Create();
}
else if (cID.PartA == (uint)BuiltInClassIDA.HYBRIDINTERP_FLOAT_CLASS_ID)
{
IIBezFloatKey key = globalInterface.IBezFloatKey.Create();
}
else if (cID.PartA == (uint)BuiltInClassIDA.LININTERP_POSITION_CLASS_ID)
{
IILinPoint3Key key = globalInterface.ILinPoint3Key.Create();
}
else if (cID.PartA == (uint)BuiltInClassIDA.LININTERP_SCALE_CLASS_ID)
{
IILinScaleKey key = globalInterface.ILinScaleKey.Create();
}
else if (cID.PartA == (uint)BuiltInClassIDA.LININTERP_FLOAT_CLASS_ID)
{
IILinFloatKey key = globalInterface.ILinFloatKey.Create();
}
else if (cID.PartA == (uint)BuiltInClassIDA.TCBINTERP_POSITION_CLASS_ID || cID.PartA == (uint)BuiltInClassIDA.TCBINTERP_POINT3_CLASS_ID)
{
IITCBPoint3Key key = globalInterface.ITCBPoint3Key.Create();
}
else if (cID.PartA == (uint)BuiltInClassIDA.TCBINTERP_FLOAT_CLASS_ID)
{
IITCBFloatKey key = globalInterface.ITCBFloatKey.Create();
}
else if (cID.PartA == (uint)BuiltInClassIDA.TCBINTERP_SCALE_CLASS_ID)
{
IITCBScaleKey key = globalInterface.ITCBScaleKey.Create();
}
}
}
}
All looks very complicated and “long” by coding matter, but I don’t see another way.
And anyway you have to know for sure the type of key for a specified controller to its specific values(properties).
Do we have a function like MS function “GetPropNames” inside C#-C++? Maybe by using that we can filter out keys easier based on it’s properties.
how many types of controllers? 10, 20,30? what’s the problem? make a table once – control class -> key class
the question is – how to know a key class for a custom controls? nohow… we have to know it before try to do anything with it.