Notifications
Clear all

[Closed] C# biped interface

 MZ1

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

10 Replies
 MZ1

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());

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.

 MZ1

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

 MZ1

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.

 MZ1

Maybe IIBipDriver has different interface ID?

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

 MZ1

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);
            }
        }
    }
}
 MZ1

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");
        }
    }
}
 MZ1

After couple month struggling with this topic, I finally found a working solution (3dsmax 2022):

using System.Windows;
using Autodesk.Max;
using Autodesk.Max.Wrappers;

namespace TestLibrary
{
    public static class TestClass
    {
        private readonly static IGlobal globalInterface = GlobalInterface.Instance;
        private readonly static IInterface coreInterface = globalInterface.COREInterface;
        const uint I_BIPDRIVER = 0x9165;

        public static void TestFunction()
        {
            IINode node = coreInterface.GetSelNode(0);
            IControl control = node.TMController;
            NativeObject obj = control.GetInterface((InterfaceID)I_BIPDRIVER) as NativeObject;
            IIBipDriver iBipDriver = globalInterface.IBipDriver.Marshal(obj.NativePointer);
            MessageBox.Show(iBipDriver.NumFingers.ToString());
        }
    }
}
Page 1 / 2