Custom Plug-in Creation Processes
 
 
 

Two methods of the plug-in's class descriptor ClassDesc::BeginCreate() and ClassDesc::EndCreate(), allow the plug-in to customize the process of creation. When the system is about to create a plug-in object ClassDesc::BeginCreate() is called. The default implementation of this method returns 0, which tells the system to use the default process. If the plug-in does require a custom creation phase, it does so in its implementation of this method. When it is finished it returns nonzero to indicate it does not want the default process invoked.

The target camera is an example of a plug-in that must handle its own creation process. The system-managed creation procedure using BaseObject::GetCreateMouseCallBack() is not adequate to meet the needs of this plug-in. This is because it creates two nodes in the scene: the camera and the target. It also must link the camera to the target using a lookat controller that ensures the camera is always 'looking at' the target.

The creation process can be terminated by calling the method Interface::StopCreating(). This will tell the system to call ClassDesc::EndCreate().

Note that GetCreateMouseCallback() is pure virtual. Therefore plug-ins derived from BaseObject that use ClassDesc::BeginCreate() must still provide a NULL implementation of this method, for example:

CreateMouseCallBack* BaseObject::GetCreateMouseCallBack() { return NULL; }