コード例 #1
0
ファイル: pluginMain.cpp プロジェクト: timmwagener/OpenMaya
MStatus initializePlugin( MObject obj )
{
	const MString	UserClassify( "shader/surface" );

	MGlobal::displayInfo(MString("Loading plugin MayaToCorona version: ") + MString(VERSION));
	MStatus   status;
	MFnPlugin plugin( obj, VENDOR, VERSION, "Any");

#ifdef HAS_OVERRIDE
	CHECK_MSTATUS( MHWRender::MDrawRegistry::registerSurfaceShadingNodeOverrideCreator( CoronaSurfacesDrawDBClassification, CoronaSurfacesRegistrantId,CoronaSurfaceOverride::creator));
#endif
	CHECK_MSTATUS( plugin.registerNode( "CoronaSurface", CoronaSurface::id, CoronaSurface::creator, CoronaSurface::initialize, MPxNode::kDependNode, &CoronaSurfacesFullClassification ));
	CHECK_MSTATUS( plugin.registerNode( "CoronaOSL", OSLNode::id, OSLNode::creator, OSLNode::initialize, MPxNode::kDependNode, &CoronaOSLFullClassification ));


	status = plugin.registerCommand(MAYATOCMDNAME, MayaToCorona::creator, MayaToCorona::newSyntax );
	if (!status) {
		status.perror("cannot register command: mayatoCorona");
		return status;
	}

	MString command( "if( `window -exists createRenderNodeWindow` ) {refreshCreateRenderNodeWindow(\"" );
	command += UserClassify;
	command += "\");}\n";
	MGlobal::executeCommand( command );

	status = plugin.registerNode(MayaToCoronaGlobalsName, MayaToCoronaGlobals::id, MayaToCoronaGlobals::creator, MayaToCoronaGlobals::initialize );
	if (!status) {
		status.perror("cannot register node: MayaToCoronaGlobals");
		return status;
	}

	setRendererName("Corona");
	setRendererShortCutName("mtCorona");
	setRendererHome(getenv("MTCorona_HOME"));

	MString cmd = MString("import mtco_initialize as minit; minit.initRenderer()");
	MGlobal::displayInfo("try to register...");
	status = MGlobal::executePythonCommand(cmd, true, false);
	if(!status)
	{
		status.perror("Problem executing cmd: mtco_initialize.initRenderer()");
		return status;
	}

	Corona::ICore::initLib(false);


	return status;
}
コード例 #2
0
ファイル: pluginMain.cpp プロジェクト: MassW/OpenMaya
MStatus initializePlugin( MObject obj )
{
	const MString	UserClassify( "shader/surface" );

	MGlobal::displayInfo(MString("Loading plugin MayaTo@ version: ") + MString(VERSION));
	MStatus   status;
	MFnPlugin plugin( obj, VENDOR, VERSION, "Any");

	status = plugin.registerCommand(MAYATOCMDNAME, MayaTo@::creator, MayaTo@::newSyntax );
	if (!status) {
		status.perror("cannot register command: mayato@");
		return status;
	}

	MString command( "if( `window -exists createRenderNodeWindow` ) {refreshCreateRenderNodeWindow(\"" );
	command += UserClassify;
	command += "\");}\n";
	MGlobal::executeCommand( command );

	status = plugin.registerNode(MayaTo@GlobalsName, MayaTo@Globals::id, MayaTo@Globals::creator, MayaTo@Globals::initialize );
	if (!status) {
		status.perror("cannot register node: MayaTo@Globals");
		return status;
	}

	setRendererName("@");
	setRendererShortCutName("mt@");
	setRendererHome(getenv("MT@_HOME"));

	MString cmd = MString("import mt@_initialize as minit; minit.initRenderer()");
	MGlobal::displayInfo("try to register...");
	status = MGlobal::executePythonCommand(cmd, true, false);
	if(!status)
	{
		status.perror("Problem executing cmd: mt@_initialize.initRenderer()");
		return status;
	}

	return status;
}
コード例 #3
0
ファイル: pluginMain.cpp プロジェクト: MassW/OpenMaya
MStatus initializePlugin( MObject obj )
{
	const MString	UserClassify( "shader/surface" );

	MGlobal::displayInfo(MString("Loading plugin MayaToThea version: ") + MString(VERSION));
	MStatus   status;
	MFnPlugin plugin( obj, VENDOR, VERSION, "Any");


#ifdef HAS_OVERRIDE
	CHECK_MSTATUS( MHWRender::MDrawRegistry::registerSurfaceShadingNodeOverrideCreator( BssdfBSDFsDrawDBClassification, BssdfBSDFsRegistrantId,BssdfBSDFOverride::creator));
	CHECK_MSTATUS( MHWRender::MDrawRegistry::registerSurfaceShadingNodeOverrideCreator( GlossyBSDFsDrawDBClassification, GlossyBSDFsRegistrantId,GlossyBSDFOverride::creator));
	CHECK_MSTATUS( MHWRender::MDrawRegistry::registerSurfaceShadingNodeOverrideCreator( CoatingBSDFsDrawDBClassification, CoatingBSDFsRegistrantId,CoatingBSDFOverride::creator));
	CHECK_MSTATUS( MHWRender::MDrawRegistry::registerSurfaceShadingNodeOverrideCreator( BasicBSDFsDrawDBClassification, BasicBSDFsRegistrantId,BasicBSDFOverride::creator));
	CHECK_MSTATUS( MHWRender::MDrawRegistry::registerSurfaceShadingNodeOverrideCreator( ThinFilmBSDFsDrawDBClassification, ThinFilmBSDFsRegistrantId,ThinFilmBSDFOverride::creator));
	CHECK_MSTATUS( MHWRender::MDrawRegistry::registerSurfaceShadingNodeOverrideCreator( TheaMaterialsDrawDBClassification, TheaMaterialsRegistrantId,TheaMaterialOverride::creator));
#endif

	CHECK_MSTATUS( plugin.registerNode( "BssdfBSDF", BssdfBSDF::id, BssdfBSDF::creator, BssdfBSDF::initialize, MPxNode::kDependNode, &BssdfBSDFsFullClassification ));
	CHECK_MSTATUS( plugin.registerNode( "GlossyBSDF", GlossyBSDF::id, GlossyBSDF::creator, GlossyBSDF::initialize, MPxNode::kDependNode, &GlossyBSDFsFullClassification ));
	CHECK_MSTATUS( plugin.registerNode( "CoatingBSDF", CoatingBSDF::id, CoatingBSDF::creator, CoatingBSDF::initialize, MPxNode::kDependNode, &CoatingBSDFsFullClassification ));
	CHECK_MSTATUS( plugin.registerNode( "BasicBSDF", BasicBSDF::id, BasicBSDF::creator, BasicBSDF::initialize, MPxNode::kDependNode, &BasicBSDFsFullClassification ));
	CHECK_MSTATUS( plugin.registerNode( "ThinFilmBSDF", ThinFilmBSDF::id, ThinFilmBSDF::creator, ThinFilmBSDF::initialize, MPxNode::kDependNode, &ThinFilmBSDFsFullClassification ));
	CHECK_MSTATUS( plugin.registerNode( "TheaMaterial", TheaMaterial::id, TheaMaterial::creator, TheaMaterial::initialize, MPxNode::kDependNode, &TheaMaterialsFullClassification ));
	CHECK_MSTATUS( plugin.registerNode( "DiffuseLight", DiffuseLight::id, DiffuseLight::creator, DiffuseLight::initialize, MPxNode::kDependNode, &DiffuseLightsFullClassification ));

	CHECK_MSTATUS(plugin.registerNode("TheaChecker", Checker::id, Checker::creator, Checker::initialize, MPxNode::kDependNode, &CheckerClassification));
	CHECK_MSTATUS(plugin.registerNode("TheaConcentric", Concentric::id, Concentric::creator, Concentric::initialize, MPxNode::kDependNode, &ConcentricClassification));
	CHECK_MSTATUS(plugin.registerNode("TheaCurl", Curl::id, Curl::creator, Curl::initialize, MPxNode::kDependNode, &CurlClassification));
	CHECK_MSTATUS(plugin.registerNode("TheaMarble", Marble::id, Marble::creator, Marble::initialize, MPxNode::kDependNode, &MarbleClassification));
	CHECK_MSTATUS(plugin.registerNode("TheaGradient", Gradient::id, Gradient::creator, Gradient::initialize, MPxNode::kDependNode, &GradientClassification));
	CHECK_MSTATUS(plugin.registerNode("TheaPerlin", Perlin::id, Perlin::creator, Perlin::initialize, MPxNode::kDependNode, &PerlinClassification));
	CHECK_MSTATUS(plugin.registerNode("TheaVoronoi", Voronoi::id, Voronoi::creator, Voronoi::initialize, MPxNode::kDependNode, &VoronoiClassification));
	CHECK_MSTATUS(plugin.registerNode("TheaWindy", Windy::id, Windy::creator, Windy::initialize, MPxNode::kDependNode, &WindyClassification));
	CHECK_MSTATUS(plugin.registerNode("TheaWireframe", Wireframe::id, Wireframe::creator, Wireframe::initialize, MPxNode::kDependNode, &WireframeClassification));
	CHECK_MSTATUS(plugin.registerNode("TheaWood", Wood::id, Wood::creator, Wood::initialize, MPxNode::kDependNode, &WoodClassification));
	CHECK_MSTATUS(plugin.registerNode("TheaWeight", Weight::id, Weight::creator, Weight::initialize, MPxNode::kDependNode, &WeightClassification));
	CHECK_MSTATUS(plugin.registerNode("TheaCombine", Combine::id, Combine::creator, Combine::initialize, MPxNode::kDependNode, &CombineClassification));
	CHECK_MSTATUS(plugin.registerNode("TheaSynthesis", Synthesis::id, Synthesis::creator, Synthesis::initialize, MPxNode::kDependNode, &SynthesisClassification));
	CHECK_MSTATUS(plugin.registerNode("TheaBlackbody", Blackbody::id, Blackbody::creator, Blackbody::initialize, MPxNode::kDependNode, &BlackbodyClassification));


	status = plugin.registerCommand(MAYATOCMDNAME, MayaToThea::creator, MayaToThea::newSyntax );
	if (!status) {
		status.perror("cannot register command: mayatoThea");
		return status;
	}

	MString command( "if( `window -exists createRenderNodeWindow` ) {refreshCreateRenderNodeWindow(\"" );
	command += UserClassify;
	command += "\");}\n";
	MGlobal::executeCommand( command );

	status = plugin.registerNode(MayaToTheaGlobalsName, MayaToTheaGlobals::id, MayaToTheaGlobals::creator, MayaToTheaGlobals::initialize );
	if (!status) {
		status.perror("cannot register node: MayaToTheaGlobals");
		return status;
	}

	setRendererName("Thea");
	setRendererShortCutName("mtThea");
	setRendererHome(getenv("MTThea_HOME"));

	MString cmd = MString("import mtth_initialize as minit; minit.initRenderer()");
	MGlobal::displayInfo("try to register...");
	status = MGlobal::executePythonCommand(cmd, true, false);
	if(!status)
	{
		status.perror("Problem executing cmd: mtth_initialize.initRenderer()");
		return status;
	}

	return status;
}
コード例 #4
0
ファイル: pluginMain.cpp プロジェクト: haggi/OpenMaya
MStatus initializePlugin( MObject obj )
{
	const MString	UserClassify( "shader/surface" );

	for (auto versionElement : getFullVersionString())
		MGlobal::displayInfo(versionElement.c_str());

	MStatus   status;
	MFnPlugin plugin( obj, VENDOR, getFullVersionString()[0].c_str(), "Any");

	status = plugin.registerCommand(MAYATOCMDNAME, MayaToAppleseed::creator, MayaToAppleseed::newSyntax );
	if (!status) {
		status.perror("cannot register command: mayatoappleseed");
		return status;
	}

	//status = plugin.registerNode( STANDIN_LOCATOR_NODE_NAME, mtap_StandinLocator::id, mtap_StandinLocator::creator, mtap_StandinLocator::initialize, MPxNode::kLocatorNode);
	//if (!status) {
	//	status.perror("cannot register node: mtap_StandinLocator");
	//	return status;
	//}

	//status = plugin.registerNode( STANDIN_MESH_NODE_NAME, mtap_standinMeshNode::id, mtap_standinMeshNode::creator, mtap_standinMeshNode::initialize);
	//if (!status) {
	//	status.perror("cannot register node: mtap_standinMeshNode");
	//	return status;
	//}

	status = plugin.registerNode(MayaToAppleseedGlobalsName, MayaToAppleseedGlobals::id, MayaToAppleseedGlobals::creator, MayaToAppleseedGlobals::initialize );
	if (!status) {
		status.perror("cannot register node: MayaToAppleseedGlobals");
		return status;
	}

	CHECK_MSTATUS(MHWRender::MDrawRegistry::registerSurfaceShadingNodeOverrideCreator(asDisneyMaterialIdDrawDBClassification, asDisneyMaterialId, asDisneyMaterialOverride::creator));
	status = plugin.registerNode("asDisneyMaterial", asDisneyMaterial::id, asDisneyMaterial::creator, asDisneyMaterial::initialize, MPxNode::kDependNode, &asDisneyMaterialIdFullClassification);
	CHECK_MSTATUS(status);
	status = plugin.registerNode("asLayeredShader", asLayeredShader::id, asLayeredShader::creator, asLayeredShader::initialize, MPxNode::kDependNode, &asLayeredIdFullClassification);
	CHECK_MSTATUS(status);

	MString command( "if( `window -exists createRenderNodeWindow` ) {refreshCreateRenderNodeWindow(\"" );
	command += UserClassify;
	command += "\");}\n";
	MGlobal::executeCommand( command );

	setRendererName("Appleseed");
	setRendererShortCutName("mtap");
	setRendererHome(getenv("MTAP_HOME"));

	MString cmd = MString("import mtap_initialize as minit; minit.initRenderer()");
	MGlobal::displayInfo("try to register...");
	status = MGlobal::executePythonCommand(cmd, true, false);
	if(!status)
	{
		status.perror("Problem executing cmd: mtap_initialize.initRenderer()");
		return status;
	}

	MayaTo::defineWorld();
	MString loadPath = plugin.loadPath();
	MayaTo::getWorldPtr()->shaderSearchPath.append(loadPath);

	if (MGlobal::mayaState() != MGlobal::kBatch)
	{
		MSwatchRenderRegister::registerSwatchRender(swatchName, NewSwatchRenderer::creator);
	}

#if MAYA_API_VERSION >= 201600
	status = plugin.registerRenderer("Appleseed", mtap_MayaRenderer::creator);
	if (!status) {
		status.perror("cannot register node: Appleseed Maya renderer");
		return status;
	}
#endif

	return status;
}