Esempio n. 1
0
        private void OnGUI()
        {
            gt_logo = AssetDatabase.LoadAssetAtPath <Texture2D>("Assets/GT_Toolkit/Editor/resources/gt_toolkit_logo.png");
            GUILayout.Space(20);
            GUILayout.Label(gt_logo);

            // TOOLKIT
            GUILayout.Space(20);
            GUILayout.Label("Import Material", EditorStyles.boldLabel);

            // Create Material
            GUILayout.BeginHorizontal();
            GUILayout.Label("Pipeline:");
            this.pipeline_index = (EditorGUILayout.Popup(this.pipeline_index, pipeline_toggle_array, GUILayout.MaxWidth(250)));
            GUILayout.EndHorizontal();
            GUILayout.Space(10);

            GUILayout.BeginHorizontal();
            GUILayout.Label("Workflow:");
            this.mat_index = (EditorGUILayout.Popup(this.mat_index, mat_toggle_array, GUILayout.MaxWidth(250)));
            GUILayout.EndHorizontal();
            GUILayout.Space(10);

            GUILayout.BeginHorizontal();
            this.create_mat = EditorGUILayout.Toggle("Create Material", this.create_mat);
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            GUILayout.Space(10);
            GUILayout.BeginVertical();
            GUILayout.BeginHorizontal();
            // Import Button
            if (GUILayout.Button("Import Material", GUILayout.MaxWidth(300), GUILayout.MinHeight(30)))
            {
                if (mat_index == 0)
                {
                    is_metallic = true;
                    is_specular = false;
                }
                else if (mat_index == 1)
                {
                    is_metallic = false;
                    is_specular = true;
                }
                else if (mat_index == 2)
                {
                    is_metallic = true;
                    is_specular = true;
                }
                else
                {
                    is_metallic = false;
                    is_specular = false;
                }
                Debug.Log(create_mat);
                this.StartCoroutine(Toolkit.CreateMaterialAsync(Toolkit.GetFilePath("Import GameTextures Material", "gtex"), GetPipeline(this.pipeline_index), is_metallic, is_specular, create_mat));
            }
            GUILayout.EndHorizontal();
            GUILayout.Space(5);
            GUILayout.BeginHorizontal();
            // Import Button
            if (GUILayout.Button("Batch Import Materials", GUILayout.MaxWidth(300), GUILayout.MinHeight(30)))
            {
                if (mat_index == 0)
                {
                    is_metallic = true;
                    is_specular = false;
                }
                else if (mat_index == 1)
                {
                    is_metallic = false;
                    is_specular = true;
                }
                else if (mat_index == 2)
                {
                    is_metallic = true;
                    is_specular = true;
                }
                else
                {
                    is_metallic = false;
                    is_specular = false;
                }
                this.StartCoroutine(Toolkit.BatchCreateMaterialAsync(Toolkit.GetFolderPath("Import GameTextures Material - BATCH"), GetPipeline(this.pipeline_index), is_metallic, is_specular, create_mat));
            }
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();
        }