예제 #1
0
MStatus initializePlugin( MObject obj )
{ 
	MStatus   status;
	MFnPlugin plugin( obj, PLUGIN_COMPANY, "3.0", "Any");

	status = MEventMessage::getEventNames(eventNames);
	if (!status)
	{
		return status;
	}

	// Search for and remove idle and idleHigh events since they will
	// completely swamp the output.  They are tested by the idleTest
	// plug-in
	//

	int i;

	for (i = 0; i < (int)eventNames.length(); ++i)
	{
		if (eventNames[i] == "idle" ||
			eventNames[i] == "idleHigh")
		{
			eventNames.remove(i);
			--i;
		}
	}
	
	cout<<"eventTest: "<<eventNames.length()<<" events are defined"<<endl;

	callbackId = new MCallbackId [eventNames.length()];

	if (!callbackId)
	{
		return MStatus(MS::kInsufficientMemory);
	}

	for (i = 0; i < (int)eventNames.length(); ++i)
	{
		callbackId[i] = 0;
	}

	// Register the command so we can actually do some work
	//
	status = plugin.registerCommand("eventTest",
									eventTest::creator,
									eventTest::newSyntax);

	if (!status)
	{
		status.perror("registerCommand");
	}

	return status;
}