Пример #1
0
        public override void OnGUI(MaterialEditor editor, MaterialProperty[] properties)
        {
            if (EditorHelper.isInitialized == false)
            {
                EditorHelper.Init();
            }

            targetMat   = editor.target as Material;
            editorTab   = targetMat.GetInt("_EditorTab");
            displayMode = EditorHelper.GetRenderDisplayMode(targetMat, displayMode);
            string envString = "Environment";

            if (EditorGUIUtility.currentViewWidth < 460)
            {
                envString = "Env";
            }
            editorTab = GUILayout.Toolbar(editorTab, new string[] { "Surface", "Detail", "Lighting", envString, "About" }, GUILayout.Width(EditorGUIUtility.currentViewWidth - 40));

            GUILayout.Space(10);

            if (editorTab == 0)
            {
                ShowTextureArea();
            }
            if (editorTab == 1)
            {
                ShowDetailArea();
            }
            if (editorTab == 2)
            {
                ShowLightingArea();
            }
            if (editorTab == 3)
            {
                ShowEnvironmentalArea();
            }
            if (editorTab == 4)
            {
                EditorHelper.About();
            }
            targetMat.SetInt("_EditorTab", editorTab);
        }
Пример #2
0
        public static RenderDisplayModes GetRenderDisplayMode(Material targetMat, EditorHelper.RenderDisplayModes displayMode)
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label("Rendering", EditorHelper.TextHeading);
            EditorHelper.HelpButton("rendering");
            GUILayout.EndHorizontal();
            GUILayout.Space(5);
            displayMode = (EditorHelper.RenderDisplayModes)targetMat.GetInt("_DisplayMode");
            int newDisplayMode = EditorHelper.GUIDropDown((int)displayMode, "Display Mode", 120, EditorHelper.renderModeStrings);

            if (newDisplayMode >= 0)
            {
                displayMode = (EditorHelper.RenderDisplayModes)newDisplayMode;
                targetMat.SetInt("_DisplayMode", (int)displayMode);
            }

            EditorHelper.HelpItem("rendering", "<b>Rendering Display Mode</b><color=silver>\n\n<b>Material FX: </b>Has All Features enabled\n<b>Unity Standard:</b> Used to A / B results\n<b>Normal:</b> Previews the Normal channel\n<b>Metallic:</b> Previews the Metallic channel\n<b>Smoothness:</b> Previews the Smoothness channel\n<b>Thickness:</b> Previews the Thickness channel (MaterialFX)\n<b>Curvature:</b> Previews the Curvature channel (MaterialFX)\n<b>Emission:</b> Previews the Emission channel \nSubsurface Scattering: Previews the Light influence channel \n<b>Environment FX Map:</b> Previews the FX channel used for environemtal effects (snow / growth /wetness). \n<b>Iridescence:</b> Previews the Iridescence channel\n<b>Reflection Probe Boost: </b>Previews the Reflection Boost channel\n<b>Additional Cubemap: </b>Previews the Cubemap Reflection channel\n<b>Checker Pattern: </b>Used to preview texel density on models & uvs.</color>");

            GUILayout.Space(10);
            return(displayMode);
        }