Instantiating Wrappers
 
 
 

There are three ways to make wrapper values for a MAX object you have in hand, depending on how much you know about what kind of object it is. In many cases you can use a wrapper class constructor directly.

If you only know you have a ReferenceTarget* you can use the static member function MAXClass::make_wrapper_for(). This looks at ClassIDs and SClassIDs inside the object and chooses the appropriate wrapper class.

If you want to wrap a sub-animatable object which is inside a known ReferenceTarget*, you can use the MAXSubAnim constructor:

MAXSubAnim( ReferenceTarget* ref, int subanim_num)

These all construct new MAXScript values in the MAXScript heap, subject immediately to potential collection. You have to protect the object from the collector to ensure the value is not collected while you are still working with it.