예제 #1
0
void RenderManShader::loadShader( const std::string &shaderName, bool keepExistingValues )
{
	IECore::ConstShaderPtr shader = runTimeCast<const IECore::Shader>( shaderLoader()->read( shaderName + ".sdl" ) );
	loadShaderParameters( shader, parametersPlug(), keepExistingValues );
	namePlug()->setValue( shaderName );
	typePlug()->setValue( "ri:" + shader->getType() );
}
예제 #2
0
const IECore::ConstCompoundDataPtr RenderManShader::annotations() const
{
	std::string shaderName = namePlug()->getValue();
	if( !shaderName.size() )
	{
		return NULL;
	}
	
	IECore::ConstShaderPtr shader = NULL;
	try
	{
		shader = runTimeCast<const IECore::Shader>( shaderLoader()->read( shaderName + ".sdl" ) );
	}
	catch( const std::exception &e )
	{
		IECore::msg( IECore::Msg::Error, "RenderManShader::annotations", e.what() );
		return NULL;
	}
	
	return shader->blindData()->member<CompoundData>( "ri:annotations" );
}
예제 #3
0
void RenderManShader::loadShader( const std::string &shaderName, bool keepExistingValues )
{
	IECore::ConstShaderPtr shader = runTimeCast<const IECore::Shader>( shaderLoader()->read( shaderName + ".sdl" ) );
	loadShaderParameters( shader.get(), parametersPlug(), keepExistingValues );
	namePlug()->setValue( shaderName );

	string type = "ri:" + shader->getType();
	bool oldAndNewTypesCompatible = false;
	if( type == "ri:volume" )
	{
		// "ri:volume" is the type of the shader, but it's not a valid assignment
		// type. Valid assignment types are "ri:atmosphere", "ri:interior" and "ri:exterior".
		type = "ri:atmosphere";
		const string oldType = typePlug()->getValue();
		oldAndNewTypesCompatible = oldType == "ri:atmosphere" || oldType == "ri:interior" || oldType == "ri:exterior";
	}

	if( !keepExistingValues || !oldAndNewTypesCompatible )
	{
		typePlug()->setValue( type );
	}
}
예제 #4
0
void RenderManLight::loadShader( const std::string &shaderName )
{
	IECore::ConstShaderPtr shader = IECore::runTimeCast<const IECore::Shader>( RenderManShader::shaderLoader()->read( shaderName + ".sdl" ) );
	RenderManShader::loadShaderParameters( shader.get(), parametersPlug() );
	getChild<StringPlug>( "__shaderName" )->setValue( shaderName );
}