public string EvaluateLODGroupName(LODGroup lodGroup, PrefabContext prefabContext) { if (lodGroup == null) { return(null); } var lods = lodGroup.GetLODs(); if (lods.Length == 0) { return(null); } var firstMesh = lods[0].renderers.FirstOrDefault(); if (firstMesh == null) { return(null); } var folder = ExportUtils.ReplaceExtension(ExportUtils.GetRelPathFromAsset(_engine.Options.Subfolder, firstMesh), ""); if (string.IsNullOrWhiteSpace(folder)) { folder = prefabContext.TempFolder; } return(ExportUtils.Combine(folder, ExportUtils.SafeFileName(_engine.DecorateName(ExportUtils.GetName(firstMesh))) + ".With" + lods.Length.ToString(CultureInfo.InvariantCulture) + "Lods.mdl")); }
public string EvaluateMeshName(Mesh mesh, PrefabContext prefabContext) { if (mesh == null) { return(null); } var folder = ExportUtils.ReplaceExtension(ExportUtils.GetRelPathFromAsset(_engine.Options.Subfolder, mesh), ""); if (string.IsNullOrWhiteSpace(folder)) { folder = prefabContext.TempFolder; } return(ExportUtils.Combine(folder, ExportUtils.SafeFileName(_engine.DecorateName(ExportUtils.GetName(mesh))) + ".mdl")); }
public string EvaluateAnimationName(AnimationClip clip, PrefabContext prefabContext) { if (clip == null) { return(null); } var relPath = ExportUtils.GetRelPathFromAsset(_engine.Options.Subfolder, clip); if (Path.GetExtension(relPath).ToLowerInvariant() == ".anim") { return(ExportUtils.ReplaceExtension(relPath, ".ani")); } var folder = ExportUtils.ReplaceExtension(relPath, ""); if (string.IsNullOrWhiteSpace(folder)) { folder = prefabContext.TempFolder; } return(ExportUtils.Combine(folder, ExportUtils.SafeFileName(_engine.DecorateName(clip.name)) + ".ani")); }
public string EvaluateMeshName(ProBuilderMesh mesh, PrefabContext prefabContext) { if (mesh == null) { return(null); } if (_dynamicMeshNames.TryGetValue(mesh, out var name)) { return(name); } var assetUrhoAssetName = ExportUtils.GetRelPathFromAsset(_engine.Options.Subfolder, mesh); if (string.IsNullOrWhiteSpace(assetUrhoAssetName)) { name = ExportUtils.Combine(prefabContext.TempFolder, ExportUtils.SafeFileName(_engine.DecorateName(ExportUtils.GetName(mesh))) + "." + _dynamicMeshNames.Count + ".mdl"); _dynamicMeshNames.Add(mesh, name); return(name); } return(ExportUtils.ReplaceExtension(assetUrhoAssetName, "") + "/" + ExportUtils.SafeFileName(_engine.DecorateName(mesh.name)) + ".mdl"); }
public void Combine_EmptyStrings_ResultEmpty() { var result = ExportUtils.Combine("", "", ""); Assert.AreEqual("", result); }
public void Combine_TreeStringsWithSeparators_ResultSeparated() { var result = ExportUtils.Combine("A/", "B/", "C/"); Assert.AreEqual("A/B/C/", result); }
public void Combine_TwoStrings_ResultSeparated() { var result = ExportUtils.Combine("A", "B"); Assert.AreEqual("A/B", result); }
public string EvaluateMeshName(NavMeshTriangulation mesh, PrefabContext prefabContext) { return(ExportUtils.Combine(prefabContext.TempFolder, "NavMesh.mdl")); }