Skip to content

Commit fc7af9c

Browse files
committed
standalone file browser
1 parent d4e8911 commit fc7af9c

File tree

54 files changed

+3768
-10
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+3768
-10
lines changed

.idea/.idea.Voksel/.idea/contentModel.xml

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/.idea.Voksel/.idea/workspace.xml

Lines changed: 53 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Scripts/Serialization/SaveManager.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections;
33
using System.Collections.Generic;
44
using System.IO;
5+
using SFB;
56
using UnityEditor;
67
using UnityEngine;
78
using UnityEngine.UI;
@@ -12,6 +13,8 @@ public class SaveManager : MonoBehaviour
1213
public Transform modelHolder;
1314
public Text projectTitle;
1415
public GameObject saveLoadPrompt;
16+
17+
1518
private void Update()
1619
{
1720
if (Input.GetKeyDown(KeyCode.Escape))
@@ -26,14 +29,19 @@ private void Update()
2629

2730
public void OnSave()
2831
{
29-
string path = EditorUtility.SaveFilePanel("Save as", "", "untitled", "voksel");
32+
//string path = EditorUtility.SaveFilePanel("Save as", "", "untitled", "voksel");
33+
string path = StandaloneFileBrowser.SaveFilePanel("Save as", "", "untitled", "voksel");
34+
path = path.Replace("\\", "/");
35+
3036
SerializationManager.Save(path, saveData.current);
3137
Debug.Log("saved");
3238
}
3339

3440
public void OnLoad()
3541
{
36-
string path = EditorUtility.OpenFilePanel("Open Project", "", "voksel");
42+
//string path = EditorUtility.OpenFilePanel("Open Project", "", "voksel");
43+
string path = StandaloneFileBrowser.OpenFilePanel("Open Project", "", "voksel", false)[0];
44+
path = path.Replace("\\", "/");
3745
if (File.Exists(path))
3846
{
3947
saveData.current = (saveData) SerializationManager.Load(path);

Assets/Scripts/box.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ private void Start()
3535
cubedata.position = transform.position;
3636
cubedata.color = GetComponent<Renderer>().material.color;
3737
saveData.current.cubes.Add(cubedata);
38-
Debug.Log(saveData.current.cubes);
3938
}
4039

4140
//assign to load event

Assets/Scripts/exporter.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections;
33
using System.Collections.Generic;
44
using System.IO;
5+
using SFB;
56
using UnityEditor;
67
using UnityEngine;
78
using UnityFBXExporter;
@@ -17,7 +18,11 @@ public void ExportFbx()
1718
Debug.Log("trying to export");
1819
Debug.Log(fileName.text);
1920
Debug.Log(filePath.text);
20-
string path = EditorUtility.SaveFilePanel("Export as FBX", "", "untitled", "fbx");
21+
//string path = EditorUtility.SaveFilePanel("Export as FBX", "", "untitled", "fbx");
22+
string path = StandaloneFileBrowser.SaveFilePanel("Export as FBX", "", "untitled", "fbx");
23+
//string path = @"C:\Users\Pulkit\Desktop\untitled.fbx";
24+
path = path.Replace("\\", "/");
25+
Debug.Log(path);
2126
FBXExporter.ExportGameObjToFBX(objMeshToExport, path, true, true);
2227
Debug.Log("exported");
2328

Assets/StandaloneFileBrowser.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using System;
2+
3+
namespace SFB {
4+
public interface IStandaloneFileBrowser {
5+
string[] OpenFilePanel(string title, string directory, ExtensionFilter[] extensions, bool multiselect);
6+
string[] OpenFolderPanel(string title, string directory, bool multiselect);
7+
string SaveFilePanel(string title, string directory, string defaultName, ExtensionFilter[] extensions);
8+
9+
void OpenFilePanelAsync(string title, string directory, ExtensionFilter[] extensions, bool multiselect, Action<string[]> cb);
10+
void OpenFolderPanelAsync(string title, string directory, bool multiselect, Action<string[]> cb);
11+
void SaveFilePanelAsync(string title, string directory, string defaultName, ExtensionFilter[] extensions, Action<string> cb);
12+
}
13+
}

Assets/StandaloneFileBrowser/IStandaloneFileBrowser.cs.meta

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/StandaloneFileBrowser/Plugins.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/StandaloneFileBrowser/Plugins/Linux.meta

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)