예제 #1
0
        private void displayImportButton()
        {
            GUILayout.BeginHorizontal();
            Color old = GUI.color;

            GUI.color        = GlTFUI.SKFB_BLUE;
            GUI.contentColor = Color.white;
            GUI.enabled      = GLTFUtils.isFolderInProjectDirectory(_importDirectory) && File.Exists(_importFilePath);
            if (GUILayout.Button("IMPORT", _ui.GlTFButton))
            {
                processImportButton();
            }
            GUI.color   = old;
            GUI.enabled = true;
            GUILayout.EndHorizontal();
        }
예제 #2
0
        public void loadFromBuffer(byte[] data)
        {
            if (!GLTFUtils.isFolderInProjectDirectory(_importDirectory))
            {
                Debug.LogError("Import directory is outside of project directory. Please select path in Assets/Resources/");
                return;
            }

            if (!Directory.Exists(_importDirectory))
            {
                Directory.CreateDirectory(_importDirectory);
            }

            _gltfInput = unzipGLTFArchiveData(data);
            _importer.setupForPath(_gltfInput, _importDirectory, _currentSampleName, _addToCurrentScene, _generateLightMapUvs);
            _importer.Load();
        }
예제 #3
0
        public void configure(string importDirectory, string prefabName, bool addToScene = false, bool generateLightMapUvs = false)
        {
            if (importDirectory.Length > 0)
            {
                if (!GLTFUtils.isFolderInProjectDirectory(importDirectory))
                {
                    Debug.LogError("Import directory in not in Assets/Resources");
                }
                else
                {
                    _importDirectory = importDirectory;
                }
            }

            if (prefabName.Length > 0)
            {
                _currentSampleName = prefabName;
            }

            _addToCurrentScene   = addToScene;
            _generateLightMapUvs = generateLightMapUvs;
        }
예제 #4
0
 private void displayImportDirectory()
 {
     _ui.displaySubContent("Import into");
     GUILayout.BeginHorizontal();
     _importDirectory = GUILayout.TextField(_importDirectory, GUILayout.MinWidth(UI_SIZE.x), GUILayout.Height(UI_SIZE.y));
     GUILayout.FlexibleSpace();
     if (GUILayout.Button("Change destination", GUILayout.Height(UI_SIZE.y), GUILayout.Width(minWidthButton)))
     {
         string newImportDir = EditorUtility.OpenFolderPanel("Choose import directory", _importDirectory, "");
         if (newImportDir == "")
         {
         }
         else if (GLTFUtils.isFolderInProjectDirectory(newImportDir))
         {
             Config.SetImportPath(newImportDir);
         }
         else
         {
             EditorUtility.DisplayDialog("Error", "Please select a path within your current Unity project (with Assets/)", "Ok");
         }
     }
     GUILayout.EndHorizontal();
 }