Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Custom callback .Net

Custom callback .Net

elpie89
Advocate Advocate
686 Views
1 Reply
Message 1 of 2

Custom callback .Net

elpie89
Advocate
Advocate

Hello all,

I'm trying to make communication between two plugin .NET
I managed to raise a callback from the first plugin and register the second plugin to that callback

GlobalInterface.Instance.BroadcastNotification(SystemNotificationCode.PreExport, filePaths);

in the second plugin, I grab the callback with

IGlobal global = Autodesk.Max.GlobalInterface.Instance;
IInterface18 ip = global.COREInterface18;
if (!callbackRegistered)
{
     this.fileSaveHandler = new GlobalDelegates.Delegate5(this.Global_PreFileSave);
     GlobalInterface.Instance.RegisterNotification(this.fileSaveHandler, null,SystemNotificationCode.PreExport);
     callbackRegistered = true;
 }

Now the problem is that I need to retrieve an object between these two plugins

In this case an array of string is passed to GlobalInterface.Instance.BroadcastNotification

public void Global_PreFileSave(IntPtr obj, INotifyInfo _param1)
        {
            object listFiles = _param1.CallParam;
string[] files = ((IEnumerable)listFiles).Cast<object>().Select(x => x.ToString()).ToArray(); // here I'm stacked }

 Any idea on how to retrieve this object?

Thanks 

0 Likes
Accepted solutions (1)
687 Views
1 Reply
Reply (1)
Message 2 of 2

elpie89
Advocate
Advocate
Accepted solution

I actually found a way.

IUTF8Str file = Autodesk.Max.GlobalInterface.Instance.UTF8Str.Create(filePath);
Loader.Global.BroadcastNotification(SystemNotificationCode.PreExport, file);

I found that I cannot pass simple C# type,  like string int etc.

So the parameter must be a native 3dsmax type.

Let me say that is not coding, this is guessing stuff.

Of course, I found this on the wonderful documentation of 3DS max Smiley Mad