コード例 #1
0
        public static void DrawMaterialList(MeshSyncPlayer t, bool allowFold = true)
        {
            Action drawInExportButton = () =>
            {
                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Import List", GUILayout.Width(110.0f)))
                {
                    var path = EditorUtility.OpenFilePanel("Import material list", "Assets", "asset");
                    t.ImportMaterialList(path);
                }
                if (GUILayout.Button("Export List", GUILayout.Width(110.0f)))
                {
                    var path = EditorUtility.SaveFilePanel("Export material list", "Assets", t.name + "_MaterialList", "asset");
                    t.ExportMaterialList(path);
                }
                GUILayout.EndHorizontal();
            };

            if (allowFold)
            {
                var styleFold = EditorStyles.foldout;
                styleFold.fontStyle = FontStyle.Bold;
                t.foldMaterialList  = EditorGUILayout.Foldout(t.foldMaterialList, "Materials", true, styleFold);
                if (t.foldMaterialList)
                {
                    DrawMaterialListElements(t);
                    drawInExportButton();
                    if (GUILayout.Button("Open Material Window", GUILayout.Width(160.0f)))
                    {
                        MaterialWindow.Open(t);
                    }
                    EditorGUILayout.Space();
                }
            }
            else
            {
                GUILayout.Label("Materials", EditorStyles.boldLabel);
                DrawMaterialListElements(t);
                drawInExportButton();
            }
        }
コード例 #2
0
        public override void OnInspectorGUI()
        {
            DrawDefaultInspector();

            var t = target as MeshSyncServer;

            GUILayout.Label("Material List", EditorStyles.boldLabel);
            DrawMaterialList(t);

            EditorGUILayout.Space();

            //GUILayout.Label("Texture List", EditorStyles.boldLabel);
            //DrawTextureList(t);

            EditorGUILayout.Space();

            if (GUILayout.Button("Open Material Window"))
            {
                MaterialWindow.Open(t);
            }
            EditorGUILayout.Space();

            //if (GUILayout.Button("Generate Lightmap UV"))
            //    t.GenerateLightmapUV();
            //EditorGUILayout.Space();

            if (GUILayout.Button("Export Meshes"))
            {
                t.ExportMeshes();
            }
            EditorGUILayout.Space();

            if (GUILayout.Button("Export Materials"))
            {
                t.ExportMaterials();
            }
            EditorGUILayout.Space();

            EditorGUILayout.LabelField("Plugin Version: " + MeshSyncServer.pluginVersion);
        }