Create a SimpleMod2 Modifier in C#

Create a SimpleMod2 Modifier in C#

Anonymous
Not applicable
1,019 Views
2 Replies
Message 1 of 3

Create a SimpleMod2 Modifier in C#

Anonymous
Not applicable

I have some issues when I try to create a modifier plugin using SimpleMod2 parent class. 

Here's  the code : 

using Autodesk.Max;
using Autodesk.Max.Plugins;

public class MyPlugin : SimpleMod2 { public override int NumRefs {get { return 0; }} // i dont have any pblock...
public override RefResult NotifyRefChanged(IInterval changeInt, IReferenceTarget hTarget, ref UIntPtr partID, RefMessage message, bool propagate)
{
return RefResult.Dontcare;
} public override int Display(int t, IINode inode, IViewExp vpt, int flags, IModContext mc)
{
drawGizmos(t, inode, vpt, flags, mc); // custom method
return 0;
} public override IDeformer GetDeformer(int t, IModContext mc, IMatrix3 mat, IMatrix3 invmat)
{
return null; /* causes crash of 3dsmax*/
} } public class MyPluginClassDesc : ClassDesc2 { [...] } public class Loader { public static void AssemblyMain() { GlobalInterface.Instance.COREInterface16.AddClass(new MyPluginClassDesc()); } }

 

The problem comes from the IDeformer, i can't see any way to create my own one. Is there any way to avoid its creation ? I only need a modifier to display custom gizmos.

Thank you.

0 Likes
1,020 Views
2 Replies
Replies (2)
Message 2 of 3

kevinvandecar
Community Manager
Community Manager

Hi,

 

Unfortunately, the Autodesk.Max.dll is not formed well in terms of virtual calls in derived classes, and you are likely running into a problem with this. We suggest not deriving new plugins from the Autodesk.Max.Plugins namespace. You can see this documented here with the Autodesk.Max.dll assembly description: http://help.autodesk.com/view/3DSMAX/2018/ENU/?guid=__developer_3ds_max__net_sdk_3ds_max__net_assemb...

 

I would suggest to consider using C++ for any full-on plugin development.

 

sorry for bad news, but hope it helps.

kevin

 

 


Kevin Vandecar
Developer Technical Services
Autodesk Developer Network



0 Likes
Message 3 of 3

Anonymous
Not applicable

I would suggest to consider using C++ for any full-on plugin development.

 

sorry for bad news, but hope it helps.

kevin

 


I think the world would be a slightly better place, if you would add this statement on the top of your .net documentation (and flag the documentation as deprecated, while you're on it).

0 Likes