예제 #1
0
파일: AbcExport.cpp 프로젝트: alfkr/alembic
ALEMBIC_MAYA_PLUGIN_EXPORT  MStatus initializePlugin(MObject obj)
{
    MStatus status;
    MFnPlugin plugin(obj, "Alembic", ABCEXPORT_VERSION, "Any");

    status = plugin.registerCommand(
        "AbcExport", AbcExport::creator,
        AbcExport::createSyntax );

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

    MString info = "AbcExport v";
    info += ABCEXPORT_VERSION;
    info += " using ";
    info += Alembic::Abc::GetLibraryVersion().c_str();
    MGlobal::displayInfo(info);

    return status;
}
	bool  PhysicalsunNodeVisitor::regist(MFnPlugin &plugin)
	{
		//CM_TRACE_FUNC("PhysicalsunNodeVisitor::regist()");

		MStatus status;

		status = plugin.registerNode( 
			renderman::PhysicalsunNode::getTypeName(), 
			renderman::PhysicalsunNode::getTypeId(), 
			renderman::PhysicalsunNode::creator, renderman::PhysicalsunNode::initialize, MPxNode::kDependNode,
			&renderman::light_classification);
		IfMErrorMsgReturnIt( status, "Can't register "+renderman::PhysicalsunNode::getTypeName()+" node" );
		status.clear();
		status = MSwatchRenderRegister::registerSwatchRender( renderman::PhysicalsunNode::getTypeName()+"Swatch", liqNodeSwatch::creator );
		IfMErrorMsgReturnIt( status, "Can't register "+renderman::PhysicalsunNode::getTypeName()+"Swatch" );

		RNodeVisitorMgr::getInstancePtr()->regist(
			PhysicalsunNode::getTypeName().asChar(),
			PhysicalsunNodeVisitor::getInstancePtr()
			);
		return true;
	}
    //
    // Description:
    //  this method is called when the plug-in is unloaded from Maya. It
    //  deregisters all of the services that it was providing.
    //
    // Arguments:
    //  obj - a handle to the plug-in object (use MFnPlugin to access it)
    //
    MStatus MLL_EXPORT uninitializePlugin ( MObject obj )
    {
        MStatus   status;
        MFnPlugin plugin ( obj );

        // Add plug-in feature de-registration here

        // Export plug-in
        status = plugin.deregisterFileTranslator ( COLLADAMaya::COLLADA_EXPORTER );
        if ( !status )
        {
            status.perror ( "deregisterFileTranslator" );
            MGlobal::displayWarning ( MString ( "Unable to unregister OpenCOLLADA exporter: " ) + status );
            return status;
        }

        // Import plug-in
        status = plugin.deregisterFileTranslator ( COLLADAMaya::COLLADA_IMPORTER );
        if ( !status )
        {
            status.perror ( "deregisterFileTranslator" );
            MGlobal::displayWarning ( MString ( "Unable to unregister OpenCOLLADA importer: " ) + status );
            return status;
        }

#if MAYA_API_VERSION >= 800
        // Disable the shared-reference node options.
        MGlobal::executeCommand ( "optionVar -iv \"referenceOptionsSharedReference\" 0;" );
        MGlobal::executeCommand ( "optionVar -iv \"referenceOptionsShareDisplayLayers\" 0;" );
        MGlobal::executeCommand ( "optionVar -iv \"referenceOptionsShareShaders\" 0;" );
#endif // MAYA 8.0 and 8.5

#ifdef _DEBUG
        // Stop the error logging
        MGlobal::stopErrorLogging();
#endif

        return status;
    }
	bool  Checker2NodeVisitor::regist(MFnPlugin &plugin)
	{
		//CM_TRACE_FUNC("Checker2NodeVisitor::regist()");

		MStatus status;

		status = plugin.registerNode( 
			elvishray::Checker2Node::getTypeName(), 
			elvishray::Checker2Node::getTypeId(), 
			elvishray::Checker2Node::creator, elvishray::Checker2Node::initialize, MPxNode::kDependNode,
			&elvishray::texture2d_classification);
		IfMErrorMsgReturnIt( status, "Can't register "+elvishray::Checker2Node::getTypeName()+" node" );
		status.clear();
		status = MSwatchRenderRegister::registerSwatchRender( elvishray::Checker2Node::getTypeName()+"Swatch", liqNodeSwatch::creator );
		IfMErrorMsgReturnIt( status, "Can't register "+elvishray::Checker2Node::getTypeName()+"Swatch" );
		
		RNodeVisitorMgr::getInstancePtr()->regist(
			Checker2Node::getTypeName().asChar(),
			Checker2NodeVisitor::getInstancePtr()
			);
		return true;
	}
예제 #5
0
	MStatus CVCurveFromObject(const Model::Object & object, MPointArray & array) {
		MStatus status;
		MDagPath dagPath = object.getDagPath(status);

		if (!status) {
			status.perror("Object::getDagPath");
			return status;
		}
		
		MDagPath shape = dagPath;
		unsigned int numShapes;
		
		if (!(status = dagPath.numberOfShapesDirectlyBelow(numShapes))) {
			status.perror("MDagPath::numberOfShapesDirectlyBelow");
			return status;
		}

		for(unsigned int i = 0; i < numShapes; ++i) {
			if (!(status = shape.extendToShapeDirectlyBelow(i))) {
				status.perror("MDagPath::extendToShapeDirectlyBelow");
				return status;
			}

			if (shape.hasFn(MFn::kNurbsCurve)) {
				MFnNurbsCurve nurbsCurve(shape);

				if (!(status = nurbsCurve.getCVs(array, MSpace::kWorld))) {
					status.perror("MFnNurbsCurve::getCVs");
					return status;
				}

				return MStatus::kSuccess;
			}
			else
				std::cerr << "No MFnNurbsCurve!" << std::endl;
		}

		return MStatus::kNotFound;
	}
예제 #6
0
MObject AppleseedRenderer::checkSmoothMesh(MObject& meshObject, MFnMeshData& smoothMeshData)
{
	MStatus stat;
	MObject object = MObject::kNullObj;

	MFnMesh mesh(meshObject, &stat);
	if(!stat)
	{
		logger.error(MString("checkSmoothMesh : could not get mesh: ") + stat.errorString());
		return object;
	}

	bool displaySmoothMesh = false;
	if( getBool("displaySmoothMesh", mesh, displaySmoothMesh) )
	{
		if( !displaySmoothMesh )
			return object;
	}else{
		logger.error(MString("generateSmoothMesh : could not get displaySmoothMesh attr "));
		return object;
	}
	
	MObject meshDataObj = smoothMeshData.create();
	MObject smoothMeshObj = mesh.generateSmoothMesh(meshDataObj, &stat);
	if(!stat)
	{
		logger.error(MString("generateSmoothMesh : failed"));
		return object;
	}
	
	MFnMesh smoothMeshDn(smoothMeshObj, &stat);
	if(!stat)
	{
		logger.error(MString("generateSmoothMesh : could not create smoothMeshDn: ") + stat.errorString());
		return object;
	}
		
	return smoothMeshObj;
}
예제 #7
0
MStatus sine::initialize()
{
	MFnNumericAttribute nAttr;
	MStatus				stat;

	input = nAttr.create( "input", "in", MFnNumericData::kFloat, 0.0 );
 	nAttr.setStorable(true);

	output = nAttr.create( "output", "out", MFnNumericData::kFloat, 0.0 );
	nAttr.setWritable(false);
	nAttr.setStorable(false);

	stat = addAttribute( input );
		if (!stat) { stat.perror("addAttribute"); return stat;}
	stat = addAttribute( output );
		if (!stat) { stat.perror("addAttribute"); return stat;}

	stat = attributeAffects( input, output );
		if (!stat) { stat.perror("attributeAffects"); return stat;}

	return MS::kSuccess;
}
예제 #8
0
MStatus initializePlugin( MObject obj )
{
	TRACE_API_CALLS("initializePlugin");
	MStatus   status;
	
	const MString& swatchName =	MHWShaderSwatchGenerator::initialize();
	const MString UserClassify( "shader/surface/utility/:swatch/"+swatchName );

	MFnPlugin plugin( obj, PLUGIN_COMPANY, "4.5", "Any");
	status = plugin.registerNode( "hwPhongShader", hwPhongShader::id, 
			                      hwPhongShader::creator, hwPhongShader::initialize,
								  MPxNode::kHwShaderNode, &UserClassify );
	if (!status) {
		status.perror("registerNode");
		return status;
	}

	plugin.registerDragAndDropBehavior("hwPhongShaderBehavior", 
									   hwPhongShaderBehavior::creator);

	return MS::kSuccess;
}
예제 #9
0
//////////////////////////////////////////////
// plugin initialization
//////////////////////////////////////////////
MStatus initializePlugin( MObject obj )
{
	MStatus		status;
	MFnPlugin	plugin( obj, PLUGIN_COMPANY, "3.0", "Any");

	status = plugin.registerContextCommand( "lassoToolContext",
										    lassoContextCmd::creator );

	if (!status) {
		status.perror("registerContextCommand");
		return status;
	}

	// set the mel scripts to be run when the plugin is loaded / unloaded
	status = plugin.registerUI("lassoToolCreateUI", "lassoToolDeleteUI");
	if (!status) {
		status.perror("registerUIScripts");
		return status;
	}

	return status;
}
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
MStatus CVstSelectCoincidentFacesCmd::redoIt()
{
	MStatus mStatus;

	if ( !mStatus )
	{
		setResult( MString( "Cannot parse command line" ) + mStatus.errorString() );
		return MS::kFailure;
	}

	const MArgDatabase &mArgDatabase( m_undo.ArgDatabase() );

	m_undo.SaveCurrentSelection();

	if ( mArgDatabase.isFlagSet( kOptHelp ) )
	{
		GetSyntaxHelp()->PrintHelp( GetName(), GetDesc() );
		return MS::kSuccess;
	}

	return DoSelect();
}
예제 #11
0
MStatus transCircle::compute( const MPlug& plug, MDataBlock& data )
{
    MStatus stat;
 
	bool k = ( plug == outputTranslateX ) |
	         ( plug == outputTranslateY ) |
			 ( plug == outputTranslateZ ) |
			 ( plug == outputTranslate );
	if (!k) return MS::kUnknownParameter;

	MDataHandle inputData = data.inputValue( input, &stat );
	if (!stat) { stat.perror("inputValue: input"); return stat;}

	MDataHandle scaleData = data.inputValue( scale, &stat );
	if (!stat) { stat.perror("inputValue: scale"); return stat;}

	MDataHandle framesData = data.inputValue( frames, &stat );
	if (!stat) { stat.perror("inputValue: frames"); return stat;}

	MDataHandle transData  = data.inputValue( inputTranslate, &stat ); 
	if (!stat) { stat.perror("inputValue: inputTranslate"); return stat;}

	double3& iTranslate = transData.asDouble3();
	double currentFrame = inputData.asDouble();
	double scaleFactor  = scaleData.asDouble();
	double framesPerCircle = framesData.asDouble();
	double angle = 6.2831853 * ( currentFrame/framesPerCircle );
	double3 oTranslate;
	
	oTranslate[0] = iTranslate[0] + (sin( angle ) * scaleFactor);
	oTranslate[1] = iTranslate[1] + 1.0;
	oTranslate[2] = iTranslate[2] + (cos( angle ) * scaleFactor);

	MDataHandle otHandle = data.outputValue( outputTranslate ); 
	otHandle.set( oTranslate[0], oTranslate[1], oTranslate[2] );
	data.setClean(plug);

    return MS::kSuccess;
}
예제 #12
0
int main(int /*argc*/, char **argv)
{
	MStatus	stat;

	stat = MLibrary::initialize (argv[0]);
	if (!stat) {
		stat.perror("MLibrary::initialize");
		return 1;
	}

	MString	fileName("surf1.ma");

	cout << ">>>> Attempting to load surf1.ma <<<<\n";
	stat = MFileIO::open(fileName, "mayaAscii", true);
	if ( stat )
		cout << ">>>> Load Successfull <<<<\n";
	else {
		cout << ">>>> Load Failed <<<<\n";
		stat.perror("MFileIO::open");
		return 1;
	}

	stat = twistSurf();
	if (!stat)
		return 1;

	cout << ">>>> Attempting save as surf2.ma <<<<\n";
	stat = MFileIO::exportAll("surf2.ma", "mayaAscii");
	if (stat)
		cout << ">>>> Save Successfull <<<<\n";
	else {
		cout << ">>>> Save Failed <<<<\n";
		stat.perror("MFileIO::exportAll");
	}

	MLibrary::cleanup();
	return 0;
}
예제 #13
0
MStatus nodeCreatedCB::doIt( const MArgList& args )
//
//	Description:
//		implements the MEL nodeCreatedCB command.
//
{
	MStatus stat = MS::kSuccess;

	MArgDatabase argData( syntax(), args );

	// Parse command flags.
	//
	if ( argData.isFlagSet( kRegisterFlag ) ) {
		// Register a new procedure.
		//
		MString proc;
		argData.getFlagArgument( kRegisterFlag, 0, proc );
		stat = registerMelProc( proc, argData.isFlagSet( kFullDagPathFlag ) );
	} else if ( argData.isFlagSet( kUnregisterFlag ) ) {
		// Unregister a procedure.
		//
		MString proc;
		argData.getFlagArgument( kUnregisterFlag, 0, proc );
		stat = unregisterMelProc( proc );
	} else if ( argData.isFlagSet( kFilterFlag ) ) {
		// Change the filter being applied.
		//
		MString filter;
		argData.getFlagArgument( kFilterFlag, 0, filter );
		stat = changeFilter( filter );
	}
	
	if ( stat.error() ) {
		MGlobal::displayError( stat.errorString() );
	}

	return stat;
}
예제 #14
0
MStatus uninitializePlugin( MObject obj)
{
	MStatus   status;
	MFnPlugin plugin( obj );

	const MString UserClassify( "shader/surface" );
	
	std::cout << "deregister mtap cmd\n";
	status = plugin.deregisterCommand( MAYATOCMDNAME );
	if (!status) {
		status.perror("cannot deregister command: MayaTo@Cmd");
		return status;
	}

	std::cout << "deregister mtap globals\n";
	status = plugin.deregisterNode( MayaTo@Globals::id );
	if (!status) {
		status.perror("cannot deregister node: MayaTo@Globals");
		return status;
	}
   
	std::cout << "update mt@ shader ui\n";
	MString command( "if( `window -exists createRenderNodeWindow` ) {refreshCreateRenderNodeWindow(\"" );
	command += UserClassify;
	command += "\");}\n";
	CHECK_MSTATUS( MGlobal::executeCommand( command ) );

	std::cout << "minit.unregister()\n";
	MString cmd = MString("import mt@_initialize as minit; minit.unregister()");
	status = MGlobal::executePythonCommand(cmd);
	if(!status)
	{
		status.perror("Problem executing cmd: mt@_initialize.unregister()");
		return status;
	}

	return status;
}
예제 #15
0
MStatus initializePlugin( MObject obj )
//
//	Description:
//		this method is called when the plug-in is loaded into Maya.  It 
//		registers all of the services that this plug-in provides with 
//		Maya.
//
//	Arguments:
//		obj - a handle to the plug-in object (use MFnPlugin to access it)
//
{ 
	MStatus   status;
	MFnPlugin plugin( obj, "Autodesk", "2016", "Any");

	//status = plugin.registerNode( "MayaToOculus", MayaToOculus::id, MayaToOculus::creator,
	//							  MayaToOculus::initialize );
	//if (!status) {
	//	status.perror("registerNode");
	//	return status;
	//}

    status = plugin.registerNode( "NeuronForMayaDevice", 
                                  NeuronForMayaDevice::id,
                                  NeuronForMayaDevice::creator,
                                  NeuronForMayaDevice::initialize,
                                  MPxNode::kThreadedDeviceNode );
    if( !status ) {
        status.perror("failed to registerNode NeuronForMayaDevice");
    }

	status = plugin.registerCommand( "NeuronForMayaCmd", NeuronForMayaCmd::creator );
	if (!status) {
		status.perror("registerCommand");
		return status;
	}

	return status;
}
MStatus initializePlugin( MObject obj )
{
	MFnPlugin plugin( obj, "David Gould", "1.0" );

	MStatus stat;
	stat = plugin.registerCommand( "molecule3", 
								   Molecule3Cmd::creator,
								   Molecule3Cmd::newSyntax );
	if( !stat )
	{
		MGlobal::displayError( MString( "registerCommand failed: " ) + stat.errorString() );
		return stat;
	}

	stat = plugin.registerUI( "molecule3CreateUI", "molecule3DeleteUI");
	if( !stat ) 
	{
		MGlobal::displayError( MString( "registerUI failed: " ) + stat.errorString() );
		return stat;
	}

	return stat;
}
MStatus initializePlugin( MObject obj )
//
//	Description:
//		this method is called when the plug-in is loaded into Maya.  It 
//		registers all of the services that this plug-in provides with 
//		Maya.
//
//	Arguments:
//		obj - a handle to the plug-in object (use MFnPlugin to access it)
//
{ 
	MStatus   status;
	MFnPlugin plugin( obj, "David Gould", "4.0", "Any");

	status = plugin.registerNode( "Squash", Squash::id, Squash::creator,
								  Squash::initialize );
	if (!status) {
		status.perror("registerNode");
		return status;
	}

	return status;
}
예제 #18
0
MStatus uninitializePlugin( MObject obj)
{
	MStatus   status;
	MFnPlugin plugin( obj );

	// Remove all computation class + callbacks
	for (unsigned int i=0; i<4; i++)
	{
		delete currentRefreshCompute[i];
		currentRefreshCompute[i] = 0;
	}

	// Deregister the command
	//
	status = plugin.deregisterCommand("viewCallbackTest");

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

	return status;
}
예제 #19
0
// ==========================================================================
//
//          Plugin load/unload
//
// ==========================================================================
MStatus initializePlugin(MObject plugin)
{
    MStatus     st;
    MFnPlugin   pluginFn(plugin, "Autodesk, Inc.", "1.0", "Any", &st);
    if (!st) {
        MGlobal::displayError(
            MString("helixQtCmd - could not initialize plugin: ")
            + st.errorString()
            );
        return st;
    }
    //  Register the command.
    st = pluginFn.registerCommand(HelixQtCmd::commandName, HelixQtCmd::creator);
    if (!st) {
        MGlobal::displayError(
            MString("helixQtCmd - could not register '")
            + HelixQtCmd::commandName + "' command: "
            + st.errorString()
            );
        return st;
    }
    return st;
}
예제 #20
0
MStatus uninitializePlugin(MObject obj)
{
	MStatus		status;
	MFnPlugin	plugin(obj);

	status = plugin.deregisterNode(ik2Bsolver::id);
	if (!status) {
		status.perror("deregisterNode");
		return status;
	}

	status = plugin.deregisterCommand("addIK2BsolverCallbacks");
	if (!status) {
		status.perror("deregisterCommand");
		return status;
	}
	
	// Remove callbacks when plug-in is unloaded.
	MMessage::removeCallback(addIK2BsolverCallbacks::afterNewId);
	MMessage::removeCallback(addIK2BsolverCallbacks::afterOpenId);

	return status;
}
MStatus geometrySurfaceConstraintCommand::parseArgs(const MArgList &argList)
{
	MStatus			ReturnStatus;
	MArgDatabase	argData(syntax(), argList, &ReturnStatus);

	if ( ReturnStatus.error() )
		return MS::kFailure;

	// Settings only work at creation time. Would need an
	// attribute on the node in order to push this state
	// into the node at any time.
	ConstraintType typ;
	if (argData.isFlagSet(kConstrainToLargestWeightFlag))
		typ = geometrySurfaceConstraintCommand::kLargestWeight;
	else if (argData.isFlagSet(kConstrainToSmallestWeightFlag))
		typ = geometrySurfaceConstraintCommand::kSmallestWeight;
	else
		typ = geometrySurfaceConstraintCommand::kLargestWeight;
	weightType = typ;

	// Need parent to process
	return MS::kUnknownParameter;
}
예제 #22
0
//////////////////////////////////////////////////////////////////////////////
//
// The following routines are used to register/unregister
// the command we are creating within Maya
//
//////////////////////////////////////////////////////////////////////////////
MStatus initializePlugin( MObject obj )
{ 
	MStatus	  status;
	MFnPlugin plugin( obj, PLUGIN_COMPANY, "3.0", "Any" );

	status = plugin.registerData( "blindComplexData",
						  blindComplexData::id,
						  blindComplexData::creator );
	if (!status) {
		status.perror("registerData");
		return status;
	}

	status = plugin.registerCommand(  "blindComplexData",
							 blindComplexDataCmd::creator );
	if (!status) {
		plugin.deregisterData( blindComplexData::id );
		status.perror("registerCommand");
		return status;
	}

	return status;
}
예제 #23
0
MStatus uninitializePlugin( MObject obj)
{
	MStatus   status;
	MFnPlugin plugin( obj );

	// Loop through all the ids and remove the callbacks
	//
	int i;
	int len = eventNames.length();

	for (i = 0; i < len; ++i)
	{
		if (callbackId[i] != 0)
		{
			MGlobal::displayWarning("Removing callback for " +
									eventNames[i] +
									"\n");
			MMessage::removeCallback(callbackId[i]);
			callbackId[i] = 0;
		}
	}

	eventNames.clear();

	delete [] callbackId;

	// Deregister the command
	//
	status = plugin.deregisterCommand("eventTest");

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

	return status;
}
예제 #24
0
MStatus initializePlugin( MObject obj )
//
//	Description:
//		this method is called when the plug-in is loaded into Maya.  It 
//		registers all of the services that this plug-in provides with 
//		Maya.
//
//	Arguments:
//		obj - a handle to the plug-in object (use MFnPlugin to access it)
//
{ 
	MStatus   status;
	MFnPlugin plugin( obj, PLUGIN_COMPANY, "5.0", "Any");
	const MString UserClassify( "shader/surface/utility" );

	status = plugin.registerNode( "blindDataShader",
								  blindDataShader::id, 
			                      blindDataShader::creator,
								  blindDataShader::initialize,
								  MPxNode::kHwShaderNode,
								  &UserClassify );
	if (!status) {
		status.perror("registerNode");
		return status;
	}

	status = plugin.registerNode( "blindDataMesh",
								  blindDataMesh::id,
								  blindDataMesh::creator,
								  blindDataMesh::initialize );
	if (!status) {
		status.perror("registerNode");
		return status;
	}

	return status;
}
MStatus initializePlugin( MObject obj )
{
#if defined(_WIN32) && defined(_DEBUG)
    // Disable buffering for stdout and stderr when using debug versions
    // of the C run-time library.
    setvbuf(stdout, NULL, _IONBF, 0);
    setvbuf(stderr, NULL, _IONBF, 0);
#endif

    MStatus   status;
    MFnPlugin plugin( obj, PLUGIN_COMPANY, "3.0", "Any");

    status = MHWRender::MDrawRegistry::registerDrawOverrideCreator(
        drawDbClassification,
        drawRegistrantId,
        OpenSubdivDrawOverride::Creator);
    if (!status) {
        status.perror("registerDrawOverrideCreator");
        return status;
    }

    status = plugin.registerCommand("openSubdivControl", OpenSubdivCommand::Creator);
    if (!status) {
        status.perror("registerCommand");
        return status;
    }

    glewInit();

    //XXX:cleanup  Need to register other kernel dispatchers.
    OpenSubdiv::OsdCpuKernelDispatcher::Register();
#if OPENSUBDIV_HAS_CUDA
    OpenSubdiv::OsdCudaKernelDispatcher::Register();
#endif

    return status;
}
예제 #26
0
	MStatus GetSelectedObjectsOfType(MObjectArray & objects, MTypeId & type) {
		MStatus status;
		MSelectionList selectionList;

		if (!(status = MGlobal::getActiveSelectionList(selectionList))) {
			status.perror("MGlobal::getActiveSelectionList");
			return status;
		}

		if (!(status = objects.clear())) {
			status.perror("MObjectArray::clear");
			return status;
		}

		unsigned int selectionList_length = selectionList.length(&status);

		if (!status) {
			status.perror("MSelectionList::length");
			return status;
		}

		for(unsigned int i = 0; i < selectionList_length; ++i) {
			//MDagPath dagPath;
			MObject object;

			if (!(status = selectionList.getDependNode(i, object))) {
				status.perror("MSelectionList::getDependNode");
				return status;
			}

			MObject relative = GetObjectOrParentsOfType(object, type, status);

			if (!status) {
				status.perror("GetObjectOrParentsOfType");
				return status;
			}

			if (relative != MObject::kNullObj) {
				/*
				 * Make sure it's not already added
				 */

				bool contains = false;
				for(unsigned int i = 0; i < objects.length(); ++i) {
					if (objects[i] == object) {
						contains = true;
						break;
					}
				}

				if (!contains)
					objects.append(relative);
			}
		}

		return MStatus::kSuccess;
	}
MStatus initializePlugin( MObject obj )
{
	MStatus   status = MStatus::kFailure;

	MFnPlugin plugin( obj, PLUGIN_COMPANY, "1.0", "Any");

	// Register the renderer
	//
	g_OpenGLRenderer = new OpenGLViewportRenderer();
	if (g_OpenGLRenderer)
	{
		status = g_OpenGLRenderer->registerRenderer();
		if (status != MStatus::kSuccess)
		{
			status.perror("Failed to register OpenGL renderer properly.");
		}
	}
	g_OpenGLRendererHUD = new OpenGLViewportRendererHUD();
	if (g_OpenGLRendererHUD)
	{
		status = g_OpenGLRendererHUD->registerRenderer();
		if (status != MStatus::kSuccess)
		{
			status.perror("Failed to register OpenGL renderer properly.");
		}
	}
	g_OpenGLRendererFullUI = new OpenGLViewportRendererFullUI();
	if (g_OpenGLRendererFullUI)
	{
		status = g_OpenGLRendererFullUI->registerRenderer();
		if (status != MStatus::kSuccess)
		{
			status.perror("Failed to register OpenGL renderer properly.");
		}
	}
	return status;
}
예제 #28
0
MStatus initializePlugin( MObject obj )
{
    MStatus   status = MStatus::kSuccess;
    MFnPlugin plugin( obj, "LiuSalon", "1.0", "Any");

	// load external ui
    MGlobal::executeCommand("source \"" + plugin.loadPath() + "/ui.mel\"");
	status = plugin.registerUI("createLiuSalonUI", "deleteLiuSalonUI");

	filePath = plugin.loadPath();

	// Register Command
	status = plugin.registerCommand( "LiuSalonCmd", LiuSalonCmd::creator, LiuSalonCmd::newSyntax );
    if (!status) {
        status.perror("registerCommand");
        return status;
    }

	// Register HairModelNode
	status = plugin.registerNode("HairModelNode", HairModelNode::id,
								  HairModelNode::creator, HairModelNode::initialize);
	if (!status) {
		status.perror("registerNode");
		return status;
	}

	// Register HairShaderNode
	status = plugin.registerNode("HairShaderNode", HairShaderNode::id,
								  HairShaderNode::creator, HairShaderNode::initialize);
	if (!status) {
		status.perror("registerNode");
		return status;
	}

	return status;
}
예제 #29
0
MStatus initializePlugin(MObject obj)
//Summary:	registers the commands, tools, devices, and so on, defined by the 
//			plug-in with Maya
//Returns:	MStatus::kSuccess if the registration was successful;
//			MStatus::kFailure otherwise
{
	MStatus status;
	MFnPlugin plugin(obj, PLUGIN_COMPANY, "4.5", "Any");

	// Register the translator with the system
	//
	status =  plugin.registerFileTranslator("RawText",
											"",
											polyRawExporter::creator,
											"",
											"option1=1",
											true);
	if (!status) {
		status.perror("registerFileTranslator");
		return status;
	}

	return status;
}
예제 #30
0
//////////////////////////////////////////////////////////////////////////////////////////////
// Main plugin interface
//////////////////////////////////////////////////////////////////////////////////////////////
MStatus initializePlugin( MObject obj )
//
//	Description:
//		Initialize plugin
//
//	Arguments:
//		obj - a handle to the plug-in object (use MFnPlugin to access it)
//
{ 
	MStatus   status;

	const MString UserClassify( "shader/surface/utility" );
	
	MFnPlugin plugin( obj, PLUGIN_COMPANY, "4.5", "Any");

	status = plugin.registerNode( "pnTriangles", pnTriangles::id, pnTriangles::creator,
								  pnTriangles::initialize, MPxNode::kHwShaderNode, &UserClassify  );
	if (!status) {
		status.perror("registerNode");
		return status;
	}

	return status;
}