Retrieving Wrapped Objects (SDK)

3DS Max Plug-In SDK

Retrieving Wrapped Objects (SDK)

You can get MAX objects out of MAXScript wrapper values in several ways:

  1. Using one of the coercion virtual functions that are implemented on the appropriate wrapper classes:

virtual INode* to_node();

virtual Mtl* to_mtl();

virtual Texmap* to_texmap();

virtual Modifier* to_modifier();

virtual Control* to_controller();

For example,

INode* node = arg_list[0]->to_node();

  1. Using the general purpose MAXWrapper virtual function, get_max_object():

virtual ReferenceTarget* get_max_object();

Note that this function will retrieve the base object in a node inside a MAXNode wrapper value, rather than the INode itself. The reason for this is explained in the MAX ClassIDs and SuperclassIDs topic.

  1. Using the ReferenceMaker member function, GetReference(). All MAXWrapper objects store their MAX-side object reference as reference 0, so:

ref = arg_list[1]->GetReference(0);