Notifications
Clear all
[Closed] SDK BaseInterface to IIUnwrapMod
Sep 21, 2015 10:22 pm
Hello,
Im trying to use IUnwrapMod to get information from my UVW Unwrap modifier, its working in C++, but it doesnt work when I use similar code in C# using the .net wrapper (Autodesk.Max.dll). (Max 2015)
INode* node = ip->GetSelNode(0);
Object* pObject = node->GetObjectRef();
IDerivedObject* pDerivedObject = (IDerivedObject*)pObject;
Modifier* modifier = pDerivedObject->GetModifier(0);
//IUnwrapMod* unwrapMod = GetIUnwrapInterface(modifier);
IUnwrapMod* unwrapMod = (IUnwrapMod *)(modifier)->GetInterface(UNWRAP_INTERFACE);
unwrapMod->fnOptions();
I commented out the macro because I dont have it in C#, just so that everything is the same.
var node = GlobalInterface.Instance.COREInterface.GetINodeByHandle(handle);
var obj = node.ObjectRef;
var derivedObject = obj as IIDerivedObject;
IModifier modifier = derivedObject.GetModifier(0);
var unwrapMod = (IIUnwrapMod)modifier.GetInterface(UNWRAP_INTERFACE);
I get the exception: Unable to cast object of type ‘Autodesk.Max.Wrappers.BaseInterface’ to type ‘Autodesk.Max.IIUnwrapMod’.
I copied the interfaceID from C++:
var UNWRAP_INTERFACE = GlobalInterface.Instance.Interface_ID.Create(0x53b3409b, 0x18ff7ab8);
Does anybody know what I need to do to cast BaseInterface to IIUnwrapMod in C#?
Thanks
1 Reply