Beispiel #1
0
void RenderGlobals::getImageName()
{
	double fn = getFrameNumber();
	MCommonRenderSettingsData data;
	MRenderUtil::getCommonRenderSettings(data);
	MObject renderLayer = MFnRenderLayer::currentLayer();		
	MString ext = this->imageFormatString.toLowerCase();
	ext = pystring::lower(ext.asChar()).c_str();
	this->imageOutputFile = data.getImageName(data.kFullPathImage, fn, this->imageName, MString(""), ext, renderLayer);
}
Beispiel #2
0
bool RenderGlobals::getDefaultGlobals()
{
	MSelectionList defaultGlobals;
	defaultGlobals.add("defaultRenderGlobals");

	if( defaultGlobals.length() == 0 )
	{
		Logging::debug("defaultRenderGlobals not found. Stopping.");
		return false;
	}
	MCommonRenderSettingsData data;
	MRenderUtil::getCommonRenderSettings(data);

	MObject node;
	defaultGlobals.getDependNode(0, node);
	MFnDependencyNode fnRenderGlobals(node);

	MTime tv = MAnimControl::currentTime();
	this->currentFrameNumber = (float)(tv.value());
	tv = data.frameStart;
	this->startFrame = (float)(tv.value());
	tv = data.frameEnd;
	this->endFrame = (float)(tv.value());
	tv = data.frameBy;
	this->byFrame = (float)(tv.value());

	// check if we are in a batch render mode or if we are rendering from UI
	if( MGlobal::mayaState() == MGlobal::kBatch )
	{
		this->inBatch = true;
		if( data.isAnimated() )
		{
			Logging::debug(MString("animation on, rendering frame sequence from ") + this->startFrame + " to " + this->endFrame);
			// these are the frames that are supposed to be rendered in batch mode
			this->doAnimation = true;
			for( double frame = this->startFrame; frame <= this->endFrame; frame += this->byFrame)
				this->frameList.push_back((float)frame);
		}else{
			Logging::debug(MString("animation off, rendering current frame"));
			this->frameList.push_back(this->currentFrameNumber );
			this->doAnimation = false;
		}
	}else{
		// we are rendering from the UI so only render the current frame
		this->inBatch = false;
		this->frameList.push_back(this->currentFrameNumber );
		this->doAnimation = false; // at the moment, if rendering comes from UI dont do animation
	}

	this->imgHeight = data.height;
	this->imgWidth = data.width;
	this->pixelAspect = data.pixelAspectRatio;
	
	this->regionLeft = 0;
	this->regionRight = this->imgWidth;
	this->regionBottom = 0;
	this->regionTop = this->imgHeight;

	regionLeft = getIntAttr("left", fnRenderGlobals, 0);
	regionRight = getIntAttr("rght", fnRenderGlobals, imgWidth);
	regionBottom = getIntAttr("bot", fnRenderGlobals, 0);
	regionTop = getIntAttr("top", fnRenderGlobals, imgHeight);

	getBool(MString("enableDefaultLight"), fnRenderGlobals, this->createDefaultLight);

	getString(MString("preRenderMel"), fnRenderGlobals, this->preFrameScript);
	getString(MString("postRenderMel"), fnRenderGlobals, this->postFrameScript);
	getString(MString("preRenderLayerMel"), fnRenderGlobals, this->preRenderLayerScript);
	getString(MString("postRenderLayerMel"), fnRenderGlobals, this->postRenderLayerScript);

	MFnDependencyNode depFn(getRenderGlobalsNode());
	this->maxTraceDepth = getIntAttr("maxTraceDepth", depFn, 4);
	this->doMb = getBoolAttr("doMotionBlur", depFn, false);
	this->doDof = getBoolAttr("doDof", depFn, false);
	this->motionBlurRange = getFloatAttr("motionBlurRange", depFn, 0.4f);
	this->motionBlurType = 0; // center
	this->xftimesamples = getIntAttr("xftimesamples", depFn, 2);
	this->geotimesamples = getIntAttr("geotimesamples", depFn, 2);
	this->createDefaultLight = false;
	this->renderType = RenderType::FINAL;
	this->exportSceneFile = getBoolAttr("exportSceneFile", depFn, false);
	this->adaptiveSampling = getBoolAttr("adaptiveSampling", depFn, false);
	this->imageName = getStringAttr("imageName", depFn, "");
	this->basePath = getStringAttr("basePath", depFn, "");
	this->exportSceneFileName = getStringAttr("exportSceneFileName", depFn, "");
	this->imagePath = getStringAttr("imagePath", depFn, "");
	this->threads = getIntAttr("threads", depFn, 4);
	this->translatorVerbosity = getEnumInt("translatorVerbosity", depFn);
	this->rendererVerbosity = getEnumInt("rendererVerbosity", depFn);
	this->useSunLightConnection = getBoolAttr("useSunLightConnection", depFn, false);
	this->tilesize = getIntAttr("tileSize", depFn, 64);
	this->sceneScale = getFloatAttr("sceneScale", depFn, 1.0f);
	this->filterSize = getFloatAttr("filterSize", depFn, 3.0f);
	this->good = true;
	return true;
}
Beispiel #3
0
bool RenderGlobals::getDefaultGlobals()
{
	MSelectionList defaultGlobals;
	defaultGlobals.add("defaultRenderGlobals");

	if( defaultGlobals.length() == 0 )
	{
		logger.debug("defaultRenderGlobals not found. Stopping.");
		return false;
	}
	MCommonRenderSettingsData data;
	MRenderUtil::getCommonRenderSettings(data);

	MObject node;
	defaultGlobals.getDependNode(0, node);
	MFnDependencyNode fnRenderGlobals(node);

	MTime tv = MAnimControl::currentTime();
	this->currentFrameNumber = (float)(tv.value());
	tv = data.frameStart;
	this->startFrame = (float)(tv.value());
	tv = data.frameEnd;
	this->endFrame = (float)(tv.value());
	tv = data.frameBy;
	this->byFrame = (float)(tv.value());

	// check if we are in a batch render mode or if we are rendering from UI
	if( MGlobal::mayaState() == MGlobal::kBatch )
	{
		this->inBatch = true;
		if( data.isAnimated() )
		{
			logger.debug(MString("animation on, rendering frame sequence from ") + this->startFrame + " to " + this->endFrame);
			// these are the frames that are supposed to be rendered in batch mode
			this->doAnimation = true;
			for( double frame = this->startFrame; frame <= this->endFrame; frame += this->byFrame)
				this->frameList.push_back((float)frame);
		}else{
			logger.debug(MString("animation off, rendering current frame"));
			this->frameList.push_back(this->currentFrameNumber );
			this->doAnimation = false;
		}
	}else{
		// we are rendering from the UI so only render the current frame
		this->inBatch = false;
		this->frameList.push_back(this->currentFrameNumber );
		this->doAnimation = false; // at the moment, if rendering comes from UI dont do animation
	}
	this->imgHeight = data.height;
	this->imgWidth = data.width;
	this->pixelAspect = data.pixelAspectRatio;

	getBool(MString("enableDefaultLight"), fnRenderGlobals, this->createDefaultLight);

	this->useRenderRegion = false;
	getBool(MString("useRenderRegion"), fnRenderGlobals, useRenderRegion); 
	
	this->regionLeft = 0;
	this->regionRight = this->imgWidth;
	this->regionBottom = 0;
	this->regionTop = this->imgHeight;

	getInt(MString("left"), fnRenderGlobals, regionLeft);
	getInt(MString("rght"), fnRenderGlobals, regionRight);
	getInt(MString("bot"), fnRenderGlobals, regionBottom);
	getInt(MString("top"), fnRenderGlobals, regionTop);

	getString(MString("preRenderMel"), fnRenderGlobals, this->preFrameScript);
	getString(MString("postRenderMel"), fnRenderGlobals, this->postFrameScript);
	getString(MString("preRenderLayerMel"), fnRenderGlobals, this->preRenderLayerScript);
	getString(MString("postRenderLayerMel"), fnRenderGlobals, this->postRenderLayerScript);

	this->good = true;
	return true;
}