Constructing Wrappers (SDK)
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.
-
If you know its an Object*, a Control*, or Modifier*, etc., you can use a wrapper class constructor directly. The available constructors are:
MAXNode (INode* node);
MAXModifier (Modifier* mod);
MAXControl (Control* cont, ParamDimension* dim);
MAXControl (Control* cont);
MAXObject (Object* obj);
MAXKey (Control* icont, int ikey, ParamDimension* dim);
MAXKey (Control* icont, int ikey);
MAXMaterial (Mtl* imat);
MAXMultiMaterial (MultiMtl* imat);
MAXMaterialLibrary (MtlBaseLib& ilib);
MAXMaterialLibrary (MtlBaseLib* ilib);
MAXMaterialLibrary ();
MAXTexture (Texmap* imap);
MAXBitMap ();
MAXBitMap (BitmapInfo bi, Bitmap* bm);
-
If you know you have a ReferenceTarget*, you can use the static member function:
static MAXClass::make_wrapper_for(ReferenceTarget* ref);
This looks at ClassIDs and SClassIDs inside the object and chooses the appropriate wrapper class.
-
If you want to wrap a subanim inside a known ReferenceTarget*, you can use the MAXSubAnim constructor:
MAXSubAnim (ReferenceTarget* ref, int subanim_num);
Remember, these all construct new MAXScript values in the MAXScript heap, subject immediately to potential collection. You have to use one of the protection schemes mentioned in the Protecting Newly Created Values from the Collector topic to ensure the value is not collected while you are still working with it.