Ejemplo n.º 1
0
void addVisibilityFlags(boost::shared_ptr<MayaObject> obj, renderer::ParamArray& paramArray)
{
    MFnDependencyNode depFn(obj->mobject);

    if (obj->mobject.hasFn(MFn::kMesh) || obj->mobject.hasFn(MFn::kAreaLight))
    {
        if (!getBoolAttr("primaryVisibility", depFn, true))
            paramArray.insert_path("visibility.camera", false);

        if (!getBoolAttr("castsShadows", depFn, true))
            paramArray.insert_path("visibility.shadow", false);

        if (!getBoolAttr("visibleInRefractions", depFn, true))
            paramArray.insert_path("visibility.transparency", false);

        if (!getBoolAttr("mtap_visibleLights", depFn, true))
            paramArray.insert_path("visibility.light", false);

        if (!getBoolAttr("mtap_visibleProbe", depFn, true))
            paramArray.insert_path("visibility.probe", false);

        if (!getBoolAttr("mtap_visibleGlossy", depFn, true))
            paramArray.insert_path("visibility.glossy", false);

        if (!getBoolAttr("mtap_visibleSpecular", depFn, true))
            paramArray.insert_path("visibility.specular", false);

        if (!getBoolAttr("mtap_visibleDiffuse", depFn, true))
            paramArray.insert_path("visibility.diffuse", false);
    }
}
Ejemplo n.º 2
0
void IECoreAppleseed::setParam( const string &name, const Data *value, asr::ParamArray &params )
{
	switch( value->typeId() )
	{
		case IntDataTypeId :
			{
				int x = static_cast<const IntData*>( value)->readable();
				params.insert( name, x );
			}
			break;

		case FloatDataTypeId :
			{
				float x = static_cast<const FloatData*>( value)->readable();
				params.insert( name, x );
			}
			break;

		case StringDataTypeId :
			{
				const string &x = static_cast<const StringData*>( value)->readable();
				params.insert( name, x.c_str() );
			}
			break;

		case BoolDataTypeId :
			{
				bool x = static_cast<const BoolData*>( value)->readable();
				params.insert( name, x);
			}
			break;

		default:
			// some kind of warning would be nice here...
			break;
	}
}
void ShadingNetworkExporter::processAttribute(
    const MPlug&        plug,
    const OSLParamInfo& paramInfo,
    asr::ParamArray&    shaderParams)
{
    std::cout << "Processing shading node attr:" << std::endl;
    std::cout << paramInfo << std::endl;

    std::stringstream ss;

    if(strcmp(paramInfo.paramType.asChar(), "color") == 0)
    {
        MColor value;
        if(AttributeUtils::get(plug, value))
            ss << "color " << value.r << " " << value.g << " " << value.b;
    }
    else if(strcmp(paramInfo.paramType.asChar(), "float") == 0)
    {
        float value;
        if(AttributeUtils::get(plug, value))
            ss << "float " << value;
    }
    else if(strcmp(paramInfo.paramType.asChar(), "int") == 0)
    {
        int value;
        if(AttributeUtils::get(plug, value))
            ss << "int " << value;
    }
    else if(strcmp(paramInfo.paramType.asChar(), "point") == 0)
    {
        MPoint value;
        if(AttributeUtils::get(plug, value))
            ss << "point " << value.z << " " << value.y << " " << value.z;
    }
    else if(strcmp(paramInfo.paramType.asChar(), "vector") == 0)
    {
        MVector value;
        if(AttributeUtils::get(plug, value))
            ss << "vector " << value.z << " " << value.y << " " << value.z;
    }
    else
        std::cout << "Skipping param of type: " << paramInfo.paramType << std::endl;

    std::string valueAsString = ss.str();
    if(!valueAsString.empty())
        shaderParams.insert(paramInfo.paramName.asChar(), ss.str().c_str());
}