[Closed] 3ds max sdk .NET
Well, at least I’ve solved saving modified parameters values with the scene:
In the ScriptCustomAttrib class:
-NumRefs must return 1 (not 0)
Need help (again).
I’ve done a custom attribute plugin with SDK.NET
Now I’m trying to find its dependents through a “DependentEnumProc” class.
All works fine but…
… when the ReferenceMaker is a CustAttribContainer (the one I’m interested in), I can’t cast it to IICustAttribContainer.
That is:
IReferenceMaker: Autodesk.Max.Wrappers.ReferenceTarget
IReferenceMaker.ClassName: CustAttribContainer
IReferenceMaker.SuperClassID: RefMaker
IReferenceMaker.GetType: Autodesk.Max.Wrappers.ReferenceTarget
Then I want to get its ‘owner’ through: (thanks DenisT)
((IICustAttribContainer)rmaker).Owner;
But I get the typical error “Unable to cast object of type ‘Autodesk.Max.Wrappers.ReferenceTarget’ to type ‘Autodesk.Max.IICustAttribContainer’.
at P3D.CountDependents.Proc(IReferenceMaker rmaker) in D:_000-ANDRES\PROGRAMACION\VISUAL C#\CustomAttrib\P3D_UTILS-01.cs:line 264
at Autodesk.Max.Wrappers.ManagedWrapperDependentEnumProc.proc(ManagedWrapperDependentEnumProc* , ReferenceMaker* rmaker)”.
Can anyone think about another way to do this? Marshaling? A workaround?
NOTE: if I return from this method an array with all the Reference Makers, in Maxscript I get a ‘dotNetObject:Autodesk.Max.Wrappers.ICustAttribContainer’ object from wich I can get its owner (with the good result). Seems that the cast to dotnet works automatically!!??
I have been looking at your problem. And there seems to be no easy answer. The simple cast should do it (as per maxscript result), but that is not true. But I’m still investigating.
Very true :). Mostly because they never finished everything in Autodesk.Max, they add what was needed to run the .NET UI (WPF and WinForms), and to run the StateSets, remember the true origin of the .NET SDK was from Ephere.
The new MaxPlus should had supersede the Autodesk.Max, using swig to automate most of the C++ SDK to .NET bindinds, but that is also not true, since we can’t create a SDK Plugin in MaxPlus, and again it was used to drive the first Python iteration and MCG.
It’s very unusual to see a good independent project get any better after been acquired by a major corporation. And when it does, it takes years.