public TiltModels75 Upgrade() { string relativePath; try { relativePath = WidgetManager.GetModelSubpath(FilePath); } catch (ArgumentException) { relativePath = null; } // I guess keep it around, so we don't lose information. if (relativePath == null) { relativePath = FilePath; } return(new TiltModels75 { FilePath = relativePath, PinStates = new[] { true }, Transforms = new[] { TrTransform.TRS(Position, Rotation, Scale.x) } }); }
void ProcessDirectory(string sPath, Dictionary <string, Model> oldModels) { if (Directory.Exists(sPath)) { //look for .obj files string[] aFiles = Directory.GetFiles(sPath); // Models we download from Poly are called ".gltf2", but ".gltf" is more standard string[] extensions = { ".obj", ".fbx", ".gltf2", ".gltf", ".glb" }; #if (UNITY_EDITOR || EXPERIMENTAL_ENABLED) if (Config.IsExperimental) { var l = new List <string>(extensions); l.AddRange(new string[] { ".usda", ".usdc", ".usd" }); extensions = l.ToArray(); } #endif for (int i = 0; i < aFiles.Length; ++i) { string sExtension = Path.GetExtension(aFiles[i]).ToLower(); if (extensions.Contains(sExtension)) { Model rNewModel = null; // XXX Use file:/// for async www calls, otherwise it is not needed. string path = /*"file:///" + */ aFiles[i].Replace("\\", "/"); try { rNewModel = oldModels[path]; oldModels.Remove(path); } catch (KeyNotFoundException) { rNewModel = new Model(Model.Location.File(WidgetManager.GetModelSubpath(path))); } m_ModelsByRelativePath.Add(rNewModel.RelativePath, rNewModel); } } //recursion string[] aSubdirectories = Directory.GetDirectories(sPath); for (int i = 0; i < aSubdirectories.Length; ++i) { ProcessDirectory(aSubdirectories[i], oldModels); } } }