Notifications
Clear all
[Closed] Recast IViewExp to IViewExp13in C#
Mar 18, 2014 11:03 pm
Like the topic says, I want to get the active viewport as an IViewExp13 to make use of its extended methods in C#.
Standard (IViewExp13)IViewExp crashes Max.
Thanks!
1 Reply
Mar 18, 2014 11:03 pm
you can’t cast an interface like that you have to go through max’s extending process in c++ it would be (from the sdk docs)
[ViewExp]( http://docs.autodesk.com/3DSMAX/15/ENU/3ds-Max-SDK-Programmer-Guide/cpp_ref/class_view_exp.html)& vp = ip->GetViewExp(hWnd);
[ViewExp13]( http://docs.autodesk.com/3DSMAX/15/ENU/3ds-Max-SDK-Programmer-Guide/cpp_ref/class_view_exp13.html)* vp13 = NULL;
if (vp.[IsAlive]( http://docs.autodesk.com/3DSMAX/15/ENU/3ds-Max-SDK-Programmer-Guide/cpp_ref/class_view_exp.html#a4c85cb21ae0d4101526b9545f9051e95)())
vp13 = reinterpret_cast<ViewExp13*>(vp.[Execute]( http://docs.autodesk.com/3DSMAX/15/ENU/3ds-Max-SDK-Programmer-Guide/cpp_ref/class_view_exp.html#a7d989d2670d3668a408f8c970986af4f)( [ViewExp::kEXECUTE_GET_VIEWEXP_13]( http://docs.autodesk.com/3DSMAX/15/ENU/3ds-Max-SDK-Programmer-Guide/cpp_ref/class_view_exp.html#a5bea799269f02f5b3395d6b2c068b618a2946a61b6e0f61bb3a4b4295889896b1)));
so you’ll have to duplicate that process in c#