Tanoda
pb_ImportAssetButton.cs
Go to the documentation of this file.
1using UnityEngine;
2using System.Collections;
3using System.Collections.Generic;
4using B83.Win32;
5using GILES.Interface;
6
7namespace GILES
8{
13 {
15
16 public override string tooltip { get { return "Import Asset"; } }
17
21 public void OpenLoadPanel()
22 {
23 pb_FileDialog dlog = GameObject.Instantiate(dialogPrefab);
24 dlog.SetDirectory(System.IO.Directory.GetCurrentDirectory());
25 dlog.isFileBrowser = true;
26 dlog.filePattern =
27 "*.3d|*.3ds|*.3mf|*.ac|*.ac3d|*.acc|*.amf|*.amj|*.ase|*.ask|*.b3d|*.blend|*.bvh|*.cob" +
28 "|*.dae|*.dxf|*.enff|*.fbx|*.gltf|*.|*.glb|*.ifc|*.irr|*.irrmesh|*.lwo|*.lws|*.lxo|*.md2" +
29 "|*.md3|*.md5|*.mdc|*.mdl|*.mesh|*.xml|*.mot|*.ms3d|*.ndo|*.nff|*.obj|*.off|*.ogex|*.ply" +
30 "|*.pmx|*.prj|*.q3o|*.q3s|*.raw|*.scn|*.sib|*.smd|*.stl|*.ter|*.uc|*.vta|*.x|*.x3d|*.xgl|*.zgl|*.zip" +
31 "|*.hlp|*.png|*.jpg|*.jpeg|*.bmp|*.mp4|*.mp3|*.wav";
32 dlog.AddOnSaveListener(OnOpen);
33
34 pb_ModalWindow.SetContent(dlog.gameObject);
35 pb_ModalWindow.SetTitle("Import Asset");
37 }
38
39 private void OnOpen(string path)
40 {
41 Open(path);
42 }
43
44 public void Open(string path)
45 {
46 string san = pb_FileUtility.SanitizePath(path);
47
48 if(!pb_FileUtility.IsValidPath(san))
49 {
50 Debug.LogWarning(san + " not found, or cannot access its location.");
51 return;
52 }
53
54 var fdad = FindObjectOfType<FileDragAndDrop>();
55 fdad.OnFiles(new List<string>() {san}, new POINT(0, 1));
56
58 }
59 }
60}
UnityEngine.Debug Debug
Definition: TanodaServer.cs:19
string filePattern
If isFileBrowser is true, this string my be used to filter file results (see https://msdn....
void AddOnSaveListener(Callback< string > listener)
void SetDirectory(string directory)
static void SetTitle(string title)
static void SetContent(GameObject prefab)
Definition: B83.Win32.cs:38