Writing Pipeline Compatible Objects
The simplest way to design a new plug-in object so that it can flow through the pipeline
is to allow it to be converted to one of the commonly supported pipeline objects such
as TriObject. For more information see Converting Object Types.
Most of the methods an object must implement for pipeline compatibility relate to
minimizing processing overhead when the object is flowing through the pipeline. To
be as efficient as possible, the system avoids unnecessary copying of objects in the
pipeline and keeps track of which channels modifiers request to deep copy only those
channels and perform a shallow copy of the others. For more information see Channel Copying.
Typically all objects with geometry that flow through the pipeline should be able
to convert themselves to a triangular mesh (TriObject), but this is not a hard and fast rule. It is conceivable that an object can flow
through the pipeline and only support conversion to a NURBS object for example. However,
it makes sense to allow your objects to convert to a mesh so that they can work with
a wide number of modifiers.
Channel Copying and Allocation Methods
The following methods must be implemented by an object that is intended to flow natively
(without conversion) through the pipeline:
- Object::MakeShallowCopy() - This method creates a new shell and then creates shallow copies in the channels
that are specified. It must also copy the validity intervals of the copied channels,
and invalidate the other intervals.
- Object::ShallowCopy() - This method is passed the shell, and it copies the specified channels into it
along with the validity interval. The shallow copy just copies the pointers (for example,
the vertices pointer or the faces pointer). No new memory is typically allocated.
- Object::NewAndCopyChannels() - This method takes the channels specified and clones them, and makes them read
only (by locking them).
- Object::FreeChannels() - This method deletes the memory associated with the specified channels and set
the intervals associated with the channels to invalid (empty).
- Object::CanCacheObject() - This method is only implemented by particle systems. Particle systems bypass
a lot of how the pipeline works and so they implement this method to return FALSE
to ensure that they are never cached. Particle systems handle their own caching mechanism.
All objects other than particle system can use the default implementation which returns
TRUE.
Interval Validity Methods
The following methods must be implemented by an object that is intended to flow natively
(without conversion) through the pipeline:
- Object::ChannelValidity() - Retrieve the current validity interval for the nchan channel of the object.
- Object::SetChannelValidity() - Sets the validity interval of the specified channel.
- Object::UpdateValidity() - This is implemented by the system, but can be overridden if desired. This method
is called to combine in interval with the specified channel validity.
- Object::InvalidateChannels() - This method invalidates the intervals for the given channel mask. This just sets
the validity intervals to empty (calling SetEmpty() on the interval) .