Coercion to C++ Types (SDK)

3DS Max Plug-In SDK

Coercion to C++ Types (SDK)

The Value class defines the following virtual functions for converting selected Value instances to appropriate C++ types. Value subclasses implement the converters that make sense for them. Attempting an unsupported conversion will generate a descriptive MAXScript runtime error.

In most cases, MAXScript Value classes act as wrappers for C++ types and classes. Converters that yield pointer types all return pointers to the value being wrapped, so take care when modifying the data and be aware that the collector may invalidate the pointer underneath you (the topic Protecting Newly Created Values from the Collector shows you ways to prevent this). At the moment, the collector is synchronous and will only run if needed during an allocate.

class Value

virtual float to_float(); 

virtual char* to_string(); 

virtual int to_int(); 

virtual BOOL to_bool(); 

virtual Point3 to_point3(); 

virtual Point2 to_point2(); 

virtual AColor to_acolor(); 

virtual INode* to_node(); 

virtual Ray to_ray(); 

virtual Interval to_interval(); 

virtual Quat to_quat(); 

virtual AngAxis to_angaxis(); 

virtual Matrix3& to_matrix3(); 

virtual float* to_eulerangles(); 

virtual Mtl* to_mtl(); 

virtual Texmap* to_texmap(); 

virtual Modifier* to_modifier(); 

virtual TimeValue to_timevalue(); 

virtual Control* to_controller();