如何从maxscript函数和C#函数传递3dMax网格?

时间:2018-01-31 15:43:50

标签: c# maxscript method-signature

我有一个在maxscript脚本中创建的网格 我想将它传递给我的C#代码,我显然无法获得正确的函数签名...
它适用于void函数(代码被调用,我得到一个断点,字符串被传递回3dMax)

我加载我的DLL,创建我的对象,并尝试将网格传递给函数,但是我收到以下错误:

  
    

MAXScript MacroScript错误异常:      - 运行时错误:找不到匹配参数列表<<

的方法   

加载DLL的我的maxscript代码:

newMesh = mesh vertices:verts faces:faces   

dotnet.loadassembly ( dllDir )

ThisTestObject  = dotnetobject "_3dMaxExporter.Test" "test"

myText = ThisTestObject.TestFunc newMesh 

C#代码:

    public string TestFunc(Autodesk.Max.IMesh test)
    {
       return ("You can call me " + Name + "!");
    }

知道我的签名需要哪种类型?

1 个答案:

答案 0 :(得分:1)

UIntPtrIntPtrUIntPtr如果你想通过句柄(getHandleByAnim MAXScript端,GetAnimByHandle(UIntPtr handle) .NET端)传递它,IntPtr如果你想通过它的地址传递它(refs.getAddr MAXScript端,MarshalNativeToManaged .NET方法的Wrappers.CustomMarshalerMesh方法。