예제 #1
0
//----------------------------------------------------------------------------------------------------------------------
        internal static bool DrawMaterialList(BaseMeshSync t, bool allowFold = true)
        {
            //[TODO-sin: 2021-12-7] Refactor. Remove allowFold
            bool changed = false;

            if (allowFold)
            {
                var styleFold = EditorStyles.foldout;
                styleFold.fontStyle = FontStyle.Bold;
                t.foldMaterialList  = EditorGUILayout.Foldout(t.foldMaterialList, "Materials", true, styleFold);
                if (!t.foldMaterialList)
                {
                    return(false);
                }

                changed = DrawMaterialListElements(t);
                DrawMaterialImportExportButtons(t);
                if (GUILayout.Button("Open Material Window", GUILayout.Width(160.0f)))
                {
                    MaterialWindow.Open(t);
                }
                EditorGUILayout.Space();
            }
            else
            {
                GUILayout.Label("Materials", EditorStyles.boldLabel);
                changed = DrawMaterialListElements(t);
                DrawMaterialImportExportButtons(t);
            }

            return(changed);
        }
예제 #2
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();
            }
        }
//----------------------------------------------------------------------------------------------------------------------
        internal static bool DrawDefaultMaterialList(BaseMeshSync t)
        {
            GUIStyle styleFold = EditorStyles.foldout;

            styleFold.fontStyle = FontStyle.Bold;
            t.foldMaterialList  = EditorGUILayout.Foldout(t.foldMaterialList, "Materials", true, styleFold);
            if (!t.foldMaterialList)
            {
                return(false);
            }

            bool changed = DrawMaterialListElements(t);

            DrawMaterialImportExportButtons(t);
            if (GUILayout.Button("Open Material Window", GUILayout.Width(160.0f)))
            {
                MaterialWindow.Open(t);
            }
            EditorGUILayout.Space();

            return(changed);
        }
예제 #4
0
 public static void Open(BaseMeshSync server) {
     MaterialWindow window = (MaterialWindow)EditorWindow.GetWindow(typeof(MaterialWindow));
     window.titleContent        = new GUIContent("Material List");
     window.m_meshSyncComponent = server;
     window.Show();
 }