void SceneValidator::ValidateTexture(Texture *texture, const FilePath &texturePathname, const String &validatedObjectName, Set<String> &errorsLog) { if(!texture) return; String path = texturePathname.GetRelativePathname(pathForChecking); String textureInfo = path + " for object: " + validatedObjectName; if(texture->IsPinkPlaceholder()) { errorsLog.insert("Can't load texture: " + textureInfo); } bool pathIsCorrect = ValidatePathname(texturePathname, validatedObjectName); if(!pathIsCorrect) { errorsLog.insert("Wrong path of: " + textureInfo); } if(!IsPowerOf2(texture->GetWidth()) || !IsPowerOf2(texture->GetHeight())) { errorsLog.insert("Wrong size of " + textureInfo); } if(texture->GetWidth() > 2048 || texture->GetHeight() > 2048) { errorsLog.insert("Texture is too big. " + textureInfo); } }
void SceneValidator::ValidateLandscape(Landscape *landscape, Set<String> &errorsLog) { if(!landscape) return; if(dynamic_cast<EditorLandscape *>(landscape)) return; if(landscape->GetTiledShaderMode() == Landscape::TILED_MODE_TILE_DETAIL_MASK) { for(int32 i = 0; i < Landscape::TEXTURE_COUNT; ++i) { Landscape::eTextureLevel texLevel = (Landscape::eTextureLevel)i; if(texLevel == Landscape::TEXTURE_COLOR || texLevel == Landscape::TEXTURE_TILE_MASK || texLevel == Landscape::TEXTURE_TILE0) { ValidateLandscapeTexture(landscape, texLevel, errorsLog); } Color color = landscape->GetTileColor(texLevel); if (!ValidateColor(color)) { landscape->SetTileColor(texLevel, color); } } } else { for(int32 i = 0; i < Landscape::TEXTURE_COUNT; ++i) { Landscape::eTextureLevel texLevel = (Landscape::eTextureLevel)i; if( (Landscape::TEXTURE_DETAIL == texLevel) || (Landscape::TEXTURE_TILE_FULL == texLevel && (landscape->GetTiledShaderMode() == Landscape::TILED_MODE_TILEMASK || landscape->GetTiledShaderMode() == Landscape::TILED_MODE_TILE_DETAIL_MASK))) { continue; } ValidateLandscapeTexture(landscape, texLevel, errorsLog); } } //validate heightmap bool pathIsCorrect = ValidatePathname(landscape->GetHeightmapPathname(), String("Landscape. Heightmap.")); if(!pathIsCorrect) { String path = landscape->GetHeightmapPathname().GetRelativePathname(EditorSettings::Instance()->GetDataSourcePath()); errorsLog.insert("Wrong path of Heightmap: " + path); } }
void CDirectoriesPropertyPage::OnDropFiles(HDROP dropInfo) { // // Get the number of pathnames (files or folders) dropped // UINT nNumFilesDropped = DragQueryFile(dropInfo, 0xFFFFFFFF, NULL, 0); UINT m_dropMode = DL_ACCEPT_FOLDERS; // // Iterate through the pathnames and process each one // TCHAR szFilename[MAX_PATH + 1]; CString csPathname; CString csExpandedFilename; for (UINT nFile = 0 ; nFile < nNumFilesDropped; nFile++) { // // Get the pathname // DragQueryFile(dropInfo, nFile, szFilename, MAX_PATH + 1); // // It might be shortcut, so try and expand it // csPathname = szFilename; csExpandedFilename = ExpandShortcut(csPathname); if(!csExpandedFilename.IsEmpty()) { csPathname = csExpandedFilename; } // // Now see if its something we allow to be dropped // UINT iPathType = 0; if(ValidatePathname(csPathname, iPathType)) { // // By default, we insert the filename into the list // ourselves, but if our parent wants to do something flashy // with it (maybe get the filesize and insert that as an extra // column), they will have installed a callback for each // droppped item // if(m_dropMode & DL_USE_CALLBACK) { // // Let them know about this list control and the item // droppped onto it // //if(m_dropMode.pfnCallback) // m_dropMode.pfnCallback(this, csPathname, iPathType); } else { m_IncludeDirectoriesList.AddString(csPathname); } } } // // Free the dropped-file info that was allocated by windows // DragFinish(dropInfo); }