C# biped interface


#1

Is biped interface exposed in the autodesk.max.dll ? I couldn’t find it.


#2

OK I found some classes like IIBipDriver, but I’m not sure how to use it.

        IIBipDriver iBipDriver = (IIBipDriver)coreInterface.GetSelNode(0);
        MessageBox.Show(iBipDriver.NumLayers.ToString());

#3

It would probably start with something like IIBipMaster if it is, Yeah I was looking at an older sdk help (it’s much faster to navigate and far more user friendly that the latest nonsense) and IBipDriver is IBipMaster renamed. Which is the main entry point for Biped in the Sdk. There some c++ stuff in older sdk’s howto \characterstudio\TestApi that maybe of help. Though that has gone walk about in the latest versions.


#4

Thanks a lot! the TestApi,cpp is only exist in Max 2014 and below!


#5

This should work right?

    private static readonly IInterface_ID I_BIPMASTER = globalInterface.Interface_ID.Create(0x9165, 0);
    private void Button_ClassID_Click(object sender, RoutedEventArgs e)
    {
        IINode node = coreInterface.GetSelNode(0);
        IControl control = node.TMController;
        IIBipDriver iBipDriver = (IIBipDriver)control.GetInterface(I_BIPMASTER);
        MessageBox.Show(iBipDriver.NumFingers.ToString());
    }

But it will crash the Max.


#6

Maybe IIBipDriver has different interface ID?


#7

no has the same…

#define I_BIPMASTER		0x9165
#pragma deprecated("I_BIPMASTER")
#define I_BIPDRIVER		0x9165

do you need to check it’s a valid biped slave controller ?

if (control && (control->ClassID() == BIPSLAVE_CONTROL_CLASS_ID))
{ ....

I don’t know what the c# check for validity is in these cases


#8

Following code should return “BipSlave_Control” (“BipDriven_Control” in 2022), but will return biped part name, for example “L Thigh”.

using Autodesk.Max;
using System.Windows;

namespace TestLibrary
{
    public static class TestClass
    {
        private readonly static IGlobal globalInterface = GlobalInterface.Instance;
        private readonly static IInterface coreInterface = globalInterface.COREInterface;

        public static void TestFunction()
        {
            IINode node = coreInterface.GetSelNode(0);
            if (node != null)
            {
                IControl control = node.TMController;
                MessageBox.Show(control.ClassName);
            }
        }
    }
}

#9

GetInterface will return null:

using System.Windows;
using Autodesk.Max;

namespace TestLibrary
{
    public static class TestClass
    {
        private readonly static IGlobal globalInterface = GlobalInterface.Instance;
        private readonly static IInterface coreInterface = globalInterface.COREInterface;

        public static void TestFunction()
        {
            IINode node = coreInterface.GetSelNode(0);
            IIBipMaster iBipMaster = node.TMController.GetInterface((InterfaceID)0x9165) as IIBipMaster;
            if (iBipMaster == null) MessageBox.Show("null");
        }
    }
}