예제 #1
0
        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"));
        }
예제 #2
0
        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"));
        }
예제 #3
0
        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"));
        }
예제 #4
0
        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");
        }
예제 #5
0
        public void Combine_EmptyStrings_ResultEmpty()
        {
            var result = ExportUtils.Combine("", "", "");

            Assert.AreEqual("", result);
        }
예제 #6
0
        public void Combine_TreeStringsWithSeparators_ResultSeparated()
        {
            var result = ExportUtils.Combine("A/", "B/", "C/");

            Assert.AreEqual("A/B/C/", result);
        }
예제 #7
0
        public void Combine_TwoStrings_ResultSeparated()
        {
            var result = ExportUtils.Combine("A", "B");

            Assert.AreEqual("A/B", result);
        }
예제 #8
0
 public string EvaluateMeshName(NavMeshTriangulation mesh, PrefabContext prefabContext)
 {
     return(ExportUtils.Combine(prefabContext.TempFolder, "NavMesh.mdl"));
 }