Exemple #1
0
    public static string ProjectFileBrowser(string title, string description, string file, string extention)
    {
        string path = file;

        EGL.BeginHorizontal();
        {
            EGL.PrefixLabel(title);
            GUILayout.Label(file, Skin.textField);

            string newPath = file;
            if (GUILayout.Button("Browse", GUILayout.Width(64f)))
            {
                newPath = EditorUtility.OpenFilePanel(description, Path.GetFullPath(UPath.GetAbsolutePath(file)), extention);
                if (newPath != string.Empty)
                {
                    newPath = UPath.GetProjectPath(newPath);
                }
                else
                {
                    newPath = file;
                }
            }
            path = newPath;
        }
        EGL.EndHorizontal();

        return(path);
    }
Exemple #2
0
    public static string ProjectFolderBrowser(string title, string description, string folder, string defaultName)
    {
        string path = folder;

        EGL.BeginHorizontal();
        {
            EGL.PrefixLabel(title);
            GUILayout.Label(folder, Skin.textField);

            string newPath = folder;
            if (GUILayout.Button("Browse", GUILayout.Width(64f)))
            {
                newPath = EditorUtility.SaveFolderPanel(description, folder, defaultName);
                if (newPath != string.Empty)
                {
                    newPath = UPath.GetProjectPath(newPath);
                }
                else
                {
                    newPath = folder;
                }
            }
            path = newPath;
        }
        EGL.EndHorizontal();

        return(path);
    }
    bool ShowLodLevel(LodLevel lod, int index)
    {
        bool removeThis = false;

        EGL.BeginVertical(GuiUtils.Skin.box);
        {
            GUILayout.Label("[" + index + "]");

            lod.Level = EGL.IntField("Lod Level", lod.Level);
            GUILayout.BeginHorizontal();
            {
                lod.FolderPath = EGL.TextField("Folder Path", lod.FolderPath);
                if (GUILayout.Button("Browse", GUILayout.Width(50f)))
                {
                    lod.FolderPath = UPath.GetProjectPath(EditorUtility.OpenFolderPanel("Browse", lod.FolderPath, Application.dataPath));
                }
            }
            GUILayout.EndHorizontal();

            lod.GridSize = EGL.IntField("Grid Size", lod.GridSize);

            lod.HeightmapResolution = EGL.IntField("Heightmap Resolution (px)", lod.HeightmapResolution);
            lod.SplatmapResolution  = EGL.IntField("Splatmap Resolution (px)", lod.SplatmapResolution);

            lod.HasDetailMap = EGL.Toggle("Use Detail Map?", lod.HasDetailMap);
            lod.HasTreeMap   = EGL.Toggle("Use Tree Map?", lod.HasTreeMap);

            if (lod.HasDetailMap)
            {
                lod.DetailmapResolution      = EGL.IntField("Detailmap Resolution (px)", lod.DetailmapResolution);
                lod.DetailResolutionPerPatch = EGL.IntField("Detailmap Patch Size (px)", lod.DetailResolutionPerPatch);
            }

            EGL.Space();

            GUILayout.Label("In-game terrain dimensions.");
            lod.TerrainWidth  = EGL.FloatField("Width & Length (m)", lod.TerrainWidth);
            lod.TerrainHeight = EGL.FloatField("Height (m)", lod.TerrainHeight);

            EGL.Space();

            GUILayout.Label("Relief Terrain Configuration");
            lod.ColormapResolution  = EGL.IntField("Colormap Resolution", lod.ColormapResolution);
            lod.NormalmapResolution = EGL.IntField("Normalmap Resolution", lod.NormalmapResolution);


            EGL.Space();

            if (GUILayout.Button("Remove", GUILayout.Width(64f), GUILayout.Height(64f)))
            {
                removeThis = true;
            }
        }
        EGL.EndVertical();

        return(removeThis);
    }
        public List <string> FilterFolder(string path, string typeTag, string extention)
        {
            string absPath = UPath.GetAbsolutePath(path);

            if (!Directory.Exists(absPath))
            {
                throw new DirectoryNotFoundException("Directory does not exist: " + path);
            }

            string pattern = "*" + typeTag + "*" + extention;

            string[]      files  = Directory.GetFiles(absPath, pattern, SearchOption.TopDirectoryOnly);
            List <string> assets = new List <string>();

            for (int i = 0; i < files.Length; i++)
            {
                string fileName = UPath.GetProjectPath(files[i]);
                assets.Add(fileName);
            }

            return(assets);
        }