3ds Max uses a set of 'locks' that indicate when it is not okay to free memory or modify the objects. The object lock and channel lock methods are both implemented and called by the system. The plug-in developer implements methods to maintain validity intervals for the channels, create new copies of channels as needed, and free the memory associated with channels that are no longer needed. Again, the main purpose of this is to minimize the overhead of the object flowing down the pipeline.
The following methods from class Object
for object locking and unlocking are implemented and called by the system:
Object::LockObject
() - This method locks the object as a whole.Object::UnlockObject
() - This method unlocks the object as a whole.Object::IsObjectLocked
() - Returns nonzero if the object is locked; otherwise 0.If an object in the pipeline is locked, then it cannot be deleted by the system but only by whoever locked it. For example, a sphere in the pipeline will be locked. This is because it exists in the scene and must not be deleted. If a bend modifier was applied to the sphere, then the sphere would convert itself to a TriObject
. This TriObject
is flowing down the pipeline and is just a temporary object. This object will be unlocked meaning that it may be deleted. This is true unless the system decides to cache it. In this case it will become locked because the system has taken ownership of it and therefore it should not be deleted. Note that these methods are implemented and called by the system and not the plug-in object. They simply manipulate a private data member inside the Object
class.