Using a Spawner

From The Foundry MODO SDK wiki
Revision as of 22:02, 19 July 2011 by Shf (Talk | contribs) (Created page with "Spawners are used to create COM objects that are not servers. Often servers will need to create sub-objects of various types. Each of these sub-objects has two aspects, the ILxUn...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Spawners are used to create COM objects that are not servers. Often servers will need to create sub-objects of various types. Each of these sub-objects has two aspects, the ILxUnknownID interface handle that represents the COM object, and the internal C++ class pointer. For example suppose you want to implement a custom item type. For each item of your type that is create you'll need to allocate an instance object with a PackageInstance interface.

class CMyInstance : public CLxImpl_PackageInstance
{
   public:
	LxResult	 pins_Initialize (ILxUnknownID item, ILxUnknownID super) LXx_OVERRIDE;
	void		 pins_Cleanup (void)					 LXx_OVERRIDE;
};

Like server, spawners for sub-objects can be declared in the initialize() function. The spawner is created with the type of the C++ class, and a name that must be unique within the plug-in.