bool mrShaderFilter::ValidateReturnType(ClassDesc& classDesc) { SClass_ID superClassID = classDesc.SuperClassID(); if(superClassID == MATERIAL_CLASS_ID) { // Validate if we want a TYPE_MTL return type //return ValidType(TYPE_MTL); // Do not validate types for materials. Only use the apply type for validatoin. return true; } else if(superClassID == TEXMAP_CLASS_ID) { imrShaderClassDesc* shaderClassDesc = Get_mrShaderClassDesc(&classDesc); if(shaderClassDesc == NULL) { // Assume that the texture returns a color return ValidType(static_cast<ParamType2>(TYPE_RGBA)); } else { // Go through the results structure ParamBlockDesc2* pbDesc = shaderClassDesc->GetResultPBDesc(); if((pbDesc != NULL) && ValidateReturnType(*pbDesc)) { return true; } // Go through the sub-structures, is allowed if(m_acceptStructs) { Tab<ParamBlockDesc2*>& resultDescs = shaderClassDesc->GetResultPBDescs(); int count = resultDescs.Count(); for(int i = 0; i < count; ++i) { ParamBlockDesc2* pbDesc = resultDescs[i]; if((pbDesc != NULL) && ValidateReturnType(*pbDesc)) { return true; } } } return false; } } else { // Shouldn't occur DbgAssert(false); return false; } }
bool mrShaderFilter::Include(ClassDesc& classDesc, DWORD flags) { // [dl | 20may2003] Disregard the 'mr extensions active' flag. /* // If this is a mental ray shader, then never include it if the mental ray // custom attributes are not active. imrShaderClassDesc* shaderClassDesc = Get_mrShaderClassDesc(&classDesc); imrShaderTranslation_ClassInfo* customClassInfo = Get_imrShaderTranslation_ClassInfo(classDesc); if((shaderClassDesc != NULL) || (customClassInfo != NULL)) { imrPreferences* prefs = GetMRPreferences(); if((prefs != NULL) && !prefs->GetMRExtensionsActive()) { return false; } } */ return (ValidateApplyType(classDesc) && ValidateReturnType(classDesc)); }
bool mrShaderFilter::Include(ClassDesc& classDesc, DWORD flags) { return (ValidateApplyType(classDesc) && ValidateReturnType(classDesc)); }