Protecting Newly Created Values from the Collector (SDK)

3DS Max Plug-In SDK

Protecting Newly Created Values from the Collector (SDK)

Value family instances created in running C++ code are immediately visible to the collector. The collector cannot see references in plain C++ local or global variables, so to prevent them from being collected while just in C++ variables, you can use the following macros to ensure the collector leaves them alone. You also need to do this if you take a value out of some structure such that nothing else is referencing it and still want to keep hold of it in a C++ variable.

An important convention is that values you get in arguments passed to you are guaranteed to be protected by someone up the call chain. You must ensure this convention holds yourself for any function you call.

See Also:

Collector-Safe Value Local Macros