void SceneValidator::ValidateTextureAndShowErrors(Texture *texture, const FilePath &textureName, const String &validatedObjectName) { errorMessages.clear(); ValidateTexture(texture, textureName, validatedObjectName, errorMessages); ShowErrorDialog(errorMessages); }
void SceneValidator::ValidateLandscapeTexture(Landscape *landscape, Landscape::eTextureLevel texLevel, Set<String> &errorsLog) { DAVA::FilePath landTexName = landscape->GetTextureName(texLevel); if(!IsTextureDescriptorPath(landTexName) && landTexName.GetAbsolutePathname().size() > 0) { landscape->SetTextureName(texLevel, TextureDescriptor::GetDescriptorPathname(landTexName)); } ValidateTexture(landscape->GetTexture(texLevel), landscape->GetTextureName(texLevel), Format("Landscape. TextureLevel %d", texLevel), errorsLog); }
void SceneValidator::ValidateMaterial(Material *material, Set<String> &errorsLog) { for(int32 iTex = 0; iTex < Material::TEXTURE_COUNT; ++iTex) { Texture *texture = material->GetTexture((Material::eTextureLevel)iTex); if(texture) { ValidateTexture(texture, material->GetTextureName((Material::eTextureLevel)iTex), Format("Material: %s. TextureLevel %d.", material->GetName().c_str(), iTex), errorsLog); FilePath matTexName = material->GetTextureName((Material::eTextureLevel)iTex); if(!matTexName.IsEmpty() && !IsTextureDescriptorPath(matTexName)) { material->SetTexture((Material::eTextureLevel)iTex, TextureDescriptor::GetDescriptorPathname(matTexName)); } } } }
void SceneValidator::ValidateInstanceMaterialState(InstanceMaterialState *materialState, Set<String> &errorsLog) { if(materialState->GetLightmap()) { ValidateTexture(materialState->GetLightmap(), materialState->GetLightmapName(), "InstanceMaterialState, lightmap", errorsLog); } FilePath lightmapName = materialState->GetLightmapName(); if(!IsTextureDescriptorPath(lightmapName)) { Texture *lightmap = SafeRetain(materialState->GetLightmap()); if(lightmapName.IsEmpty()) { materialState->SetLightmap(lightmap, FilePath()); } else { materialState->SetLightmap(lightmap, TextureDescriptor::GetDescriptorPathname(lightmapName)); } SafeRelease(lightmap); } }
FMaterial * FMaterial::ValidateTexture(FTextureID no, bool expand, bool translate) { return ValidateTexture(translate? TexMan(no) : TexMan[no], expand); }