This reference page is linked to from the following overview topics: Implementing Advanced Material and Texture Map Plug-ins with Nitrous, Creating and Changing References, Creating a Patch, Patch Interpolator Example, Patch Code Example, Manual Parameter Translation, Incremental Improvements, Ring Array Slave and Master Controllers, Hardware Shader UI Feature, Ring Array Creation Process, Release Builds Have Asserts Turned Off, Editing Material and Texture Parameters, Creating the Parameter Block and Referencing It, Selection Modifiers, Topology Modifiers, MNMesh Edges, Getting the Nodes that Reference an Object, Modifier Stack Branching, About SmartHandle, Handling Mouse Procedures.
The following macros can be used in 3ds Max plug-ins to assert assumptions made by the plug-in's code.
Asserts are always enabled in Debug and Hybrid builds, and by default are disabled in release builds. They can be enabled in release builds of a plug-in by defining the MAX_ASSERTS_ACTIVE_IN_RELEASE_BUILD pre-processor symbol. One way to do this is: set CL=/DMAX_ASSERTS_ACTIVE_IN_RELEASE_BUILD
All assert macros below are equivalent. The 32 and 64 bit versions of these macros are also equivalent. The reason why several macros exist are historical... Plug-ins are encouraged to use the DbgAssert macro.
Code that needs to be compiled only when asserts are active (enabled) can be conditionaly defined using MAX_ASSERT_ACTIVE. One example when this can be useful is when certain variables are used for debugging purposes only. In this case they can be conditionally declared and updated based on the MAX_ASSERT_ACTIVE symbol, and can be part of expressions that are evaluated in asserts.
#ifdef MAX_ASSERT_ACTIVE int counter = 0; // update counter #endif DbgAssert(counter != 0);
Defines |
|
#define | assert(expr) ( (expr) || assert1( __LINE__, _M(__FILE__), _3DSMAX_CURRENT_FUNCTION_, (_M(#expr)) ) ) |
#define | DbgAssert(expr) ( (expr) || assert1( __LINE__, _M(__FILE__), _3DSMAX_CURRENT_FUNCTION_, (_M(#expr)) ) ) |
#define | DbgVerify(expr) ( (expr) || assert1( __LINE__, _M(__FILE__), _3DSMAX_CURRENT_FUNCTION_, (_M(#expr)) ) ) |
#define assert | ( | expr | ) | ( (expr) || assert1( __LINE__, _M(__FILE__), _3DSMAX_CURRENT_FUNCTION_, (_M(#expr)) ) ) |
#define DbgAssert | ( | expr | ) | ( (expr) || assert1( __LINE__, _M(__FILE__), _3DSMAX_CURRENT_FUNCTION_, (_M(#expr)) ) ) |
#define DbgVerify | ( | expr | ) | ( (expr) || assert1( __LINE__, _M(__FILE__), _3DSMAX_CURRENT_FUNCTION_, (_M(#expr)) ) ) |