Exemplo n.º 1
0
        void OnGUI()
        {
            GUI.DrawTexture(new Rect(0, 0, maxSize.x, maxSize.y), MSBackground, ScaleMode.StretchToFill);

            GUILayout.BeginHorizontal();

            GUILayout.Box("Bridge Plugin v" + version, MSHeadingTextStyle, GUILayout.Height(textHeadingSize.y));

            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();

            if (GUILayout.Button(MSLogo, MSLogoStyle, GUILayout.Height(logoSize.y), GUILayout.Width(logoSize.x)))
            {
                Application.OpenURL("https://quixel.com/megascans/library/latest");
            }

            if (GUILayout.Button(BridgeLogo, MSLogoStyle, GUILayout.Height(logoSize.y), GUILayout.Width(logoSize.x)))
            {
                Application.OpenURL("https://quixel.com/bridge");
            }

            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();

            tab = GUILayout.Toolbar(tab, new string[] { "Settings", "Utilities" }, MSTabsStyle, GUILayout.Height(textSize.y));

            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            Handles.color = Color.white;
            Handles.DrawLine(new Vector3(0f, lineYLoc), new Vector3(maxSize.x, lineYLoc));
            GUILayout.EndHorizontal();

            if (tab == 0)
            {
                GUILayout.BeginHorizontal();

                GUILayout.Label("Workflow", MSText, GUILayout.Height(textSize.y), GUILayout.Width(textSize.x));
                texPack = EditorGUILayout.Popup(texPack, texPacking, MSPopup, GUILayout.Height(fieldSize.y));

                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();

                GUILayout.Label("Displacement", MSText, GUILayout.Height(textSize.y), GUILayout.Width(textSize.x));
                dispType = EditorGUILayout.Popup(dispType, dispTypes, MSPopup, GUILayout.Height(fieldSize.y));

                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();

                GUILayout.Box("Shader Type", MSText, GUILayout.Height(textSize.y), GUILayout.Width(textSize.x));
                shaderType = EditorGUILayout.Popup(shaderType, shaderTypes, MSPopup, GUILayout.Height(fieldSize.y));

                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();

                GUILayout.Box("Import Resolution", MSText, GUILayout.Height(textSize.y), GUILayout.Width(textSize.x));
                importResolution = EditorGUILayout.Popup(importResolution, importResolutions, MSPopup, GUILayout.Height(fieldSize.y));

                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();

                GUILayout.Box("LOD Fade Mode", MSText, GUILayout.Height(textSize.y), GUILayout.Width(textSize.x));
                lodFadeMode = EditorGUILayout.Popup(lodFadeMode, lodFadeModeSettings, MSPopup, GUILayout.Height(fieldSize.y));

                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();

                GUILayout.Box("Import Path", MSText, GUILayout.Height(textSize.y), GUILayout.Width(textSize.x));
                path = EditorGUILayout.TextField(path, MSField, GUILayout.Height(fieldSize.y));

                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();

                setupCollision = EditorGUI.Toggle(collisionLoc, setupCollision, MSCheckBox);
                GUILayout.Box("Setup Collision", MSNormalTextStyle, GUILayout.Height(textSize.y), GUILayout.Width(textSize.x));

                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();

                applyToSelection = EditorGUI.Toggle(applyToSelectionLoc, applyToSelection, MSCheckBox);
                GUILayout.Box("Apply To Selection (2D Surfaces)", MSNormalTextStyle, GUILayout.Height(textSize.y), GUILayout.Width(textSize.x));

                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();

                addAssetToScene = EditorGUI.Toggle(addAssetToSceneLoc, addAssetToScene, MSCheckBox);
                GUILayout.Box("Add Asset to the Scene", MSNormalTextStyle, GUILayout.Height(textSize.y), GUILayout.Width(textSize.x));

                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();

                setupPrefabs = EditorGUI.Toggle(setupPrefabsLoc, setupPrefabs, MSCheckBox);
                GUILayout.Box("Create Prefabs", MSNormalTextStyle, GUILayout.Height(textSize.y), GUILayout.Width(textSize.x));

                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();

                importLODs = EditorGUI.Toggle(importLODsLoc, importLODs, MSCheckBox);
                GUILayout.Box("Import Lower LODs", MSNormalTextStyle, GUILayout.Height(textSize.y), GUILayout.Width(textSize.x));

                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();

                setupLOD = EditorGUI.Toggle(setupLODLoc, setupLOD, MSCheckBox);
                GUILayout.Box("Create LOD Groups", MSNormalTextStyle, GUILayout.Height(textSize.y), GUILayout.Width(textSize.x));

                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();

                importAllTextures = EditorGUI.Toggle(importAllTexturesLoc, importAllTextures, MSCheckBox);
                GUILayout.Box("Import All Textures", MSNormalTextStyle, GUILayout.Height(textSize.y), GUILayout.Width(textSize.x));

                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();

                connection = EditorGUI.Toggle(connectionLoc, connection, MSCheckBox);
                GUILayout.Box("Enable Plugin", MSNormalTextStyle, GUILayout.Height(textSize.y));
                if (GUILayout.Button("Help...", MSHelpStyle, GUILayout.Width(textSize.x)))
                {
                    Application.OpenURL("https://docs.google.com/document/d/1NUAh2vQ9UgK-c1J-yhVnqkTgqZxMVm77rRK-X1ukWw0/");
                }

                GUILayout.EndHorizontal();
            }
            else
            {
#if (UNITY_2018 || UNITY_2019 || UNITY_2020)
                GUILayout.BeginHorizontal();

                GUILayout.Box("Terrain Tools (Beta)", MSHeadingTextStyle, GUILayout.Height(textHeadingSize.y));

                GUILayout.EndHorizontal();

                if (MegascansUtilities.isLegacy())
                {
                    GUILayout.BeginHorizontal();

                    GUILayout.Box("Material Name", MSText, GUILayout.Height(textSize.y), GUILayout.Width(textSize.x));
                    terrainMaterialName = EditorGUILayout.TextField(terrainMaterialName, MSField, GUILayout.Height(fieldSize.y), GUILayout.Width(fieldSize.x));

                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();

                    GUILayout.Box("Material Path", MSText, GUILayout.Height(textSize.y), GUILayout.Width(textSize.x));
                    terrainMaterialPath = EditorGUILayout.TextField(terrainMaterialPath, MSField, GUILayout.Height(fieldSize.y), GUILayout.Width(fieldSize.x));

                    GUILayout.EndHorizontal();
                }

                GUILayout.BeginHorizontal();

                GUILayout.Box("Texture Tiling", MSText, GUILayout.Height(textSize.y), GUILayout.Width(textSize.x));
                tiling = EditorGUILayout.TextField(tiling, MSField, GUILayout.Height(fieldSize.y));

                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();

                if (GUILayout.Button("Setup Paint Layers", MSStrechedWidthStyle, GUILayout.Height(textSize.y)))
                {
                    MegascansTerrainTools.SetupTerrain();
                }

                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();

                string warningMsg = "Warning: This feature works properly with the metallic workflow only.";
                if (MegascansUtilities.isLegacy())
                {
                    warningMsg += "This feature requires HD Render Pipeline.";
                }

                GUI.skin.label.wordWrap = true;
                GUILayout.Label(warningMsg, MSWarningTextStyle, GUILayout.Height(textSize.y));

                GUILayout.EndHorizontal();
#endif

#if (UNITY_2018_3 || UNITY_2018_4 || UNITY_2019 || UNITY_2020)
                GUILayout.BeginHorizontal();

                GUILayout.Box("Material Tools (Beta)", MSHeadingTextStyle, GUILayout.Height(textHeadingSize.y));

                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();

                if (GUILayout.Button("Create Terrain Paint Layer", MSStrechedWidthStyle, GUILayout.Height(textSize.y)))
                {
                    MegascansTerrainTools.CreateTerrainLayerFromMat();
                }

                GUILayout.EndHorizontal();
#endif

#if HDRP && (UNITY_2018_2 || UNITY_2018_3 || UNITY_2018_4 || UNITY_2019 || UNITY_2020)
                GUILayout.BeginHorizontal();

                GUILayout.Box("Decal Setup (Beta)", MSHeadingTextStyle, GUILayout.Height(textHeadingSize.y));

                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();

                GUILayout.Box("Global Opacity (%)", MSText, GUILayout.Height(textSize.y), GUILayout.Width(textSize.x));
                decalBlend = EditorGUILayout.TextField(decalBlend, MSField, GUILayout.Height(fieldSize.y));

                GUILayout.EndHorizontal();

                if (!MegascansUtilities.isLegacy())
                {
                    GUILayout.BeginHorizontal();

                    GUILayout.Box("Scale", MSText, GUILayout.Height(textSize.y), GUILayout.Width(textSize.x));
                    decalSize = EditorGUILayout.TextField(decalSize, MSField, GUILayout.Height(fieldSize.y));

                    GUILayout.EndHorizontal();
                }

                GUILayout.BeginHorizontal();

                if (GUILayout.Button("Create Decal Projector", MSStrechedWidthStyle, GUILayout.Height(textSize.y)))
                {
                    MegascansDecalTools.SetupDecalProjector();
                }

                GUILayout.EndHorizontal();
#endif
            }

            if (!MSLogo)
            {
                InitStyle();
                Repaint();
            }
        }
Exemplo n.º 2
0
        void OnGUI()
        {
            GUI.DrawTexture(new Rect(0, 0, maxSize.x, maxSize.y), MSBackground, ScaleMode.StretchToFill);

            GUILayout.BeginHorizontal();

            if (GUILayout.Button(MSLogo, MSLogoStyle, GUILayout.Height(logoSize.y), GUILayout.Width(logoSize.x)))
            {
                Application.OpenURL("https://quixel.com/megascans/library/latest");
            }

            GUILayout.Button(BridgeLogo, MSLogoStyle, GUILayout.Height(logoSize.y), GUILayout.Width(logoSize.x));

            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();

            tab = GUILayout.Toolbar(tab, new string[] { "Importer", "Utilities" }, MSTabsStyle, GUILayout.Height(tabSize.y), GUILayout.Width(tabSize.x));

            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            Handles.color = Color.white;
            Handles.DrawLine(new Vector3(0, 105), new Vector3(maxSize.x, 105));
            GUILayout.EndHorizontal();

            if (tab == 0)
            {
                GUILayout.BeginHorizontal();

                GUILayout.Label("Workflow", MSText, GUILayout.Height(textSize.y), GUILayout.Width(textSize.x));
                texPack = EditorGUILayout.Popup(texPack, texPacking, MSPopup, GUILayout.Height(fieldSize.y));

                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();

                GUILayout.Label("Displacement", MSText, GUILayout.Height(textSize.y), GUILayout.Width(textSize.x));
                dispType = EditorGUILayout.Popup(dispType, dispTypes, MSPopup, GUILayout.Height(fieldSize.y));

                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();

                GUILayout.Box("Shader Type", MSText, GUILayout.Height(textSize.y), GUILayout.Width(textSize.x));
                shaderType = EditorGUILayout.Popup(shaderType, shaderTypes, MSPopup, GUILayout.Height(fieldSize.y));

                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();

                GUILayout.Box("Import Resolution", MSText, GUILayout.Height(textSize.y), GUILayout.Width(textSize.x));
                importResolution = EditorGUILayout.Popup(importResolution, importResolutions, MSPopup, GUILayout.Height(fieldSize.y));

                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();

                GUILayout.Box("LOD Fade Mode", MSText, GUILayout.Height(textSize.y), GUILayout.Width(textSize.x));
                lodFadeMode = EditorGUILayout.Popup(lodFadeMode, lodFadeModeSettings, MSPopup, GUILayout.Height(fieldSize.y));

                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();

                GUILayout.Box("Import Path", MSText, GUILayout.Height(textSize.y), GUILayout.Width(textSize.x));
                path = EditorGUILayout.TextField(path, MSField, GUILayout.Height(fieldSize.y));

                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();

                setupCollision = EditorGUI.Toggle(collisionLoc, setupCollision, MSCheckBox);
                GUILayout.Box("Setup Collision", MSNormalTextStyle, GUILayout.Height(textSize.y), GUILayout.Width(textSize.x));

                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();

                terrainNormal = EditorGUI.Toggle(terrainNormalLoc, terrainNormal, MSCheckBox);
                GUILayout.Box("Generate Terrain Normals", MSNormalTextStyle, GUILayout.Height(textSize.y), GUILayout.Width(textSize.x));

                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();

                applyToSelection = EditorGUI.Toggle(applyToSelectionLoc, applyToSelection, MSCheckBox);
                GUILayout.Box("Apply To Selection", MSNormalTextStyle, GUILayout.Height(textSize.y), GUILayout.Width(textSize.x));

                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();

                addAssetToScene = EditorGUI.Toggle(addAssetToSceneLoc, addAssetToScene, MSCheckBox);
                GUILayout.Box("Add Asset to the Scene", MSNormalTextStyle, GUILayout.Height(textSize.y), GUILayout.Width(textSize.x));

                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();

                connection = EditorGUI.Toggle(connectionLoc, connection, MSCheckBox);
                GUILayout.Box("Enable Live Link", MSNormalTextStyle, GUILayout.Height(textSize.y));
                if (GUILayout.Button("Help...", MSHelpStyle, GUILayout.Width(textSize.x)))
                {
                    Application.OpenURL("https://docs.google.com/document/d/17FmQzTxo63NIvGkRcfVfLtp73GSfBBvZmlq3v6C-9nY/edit?usp=sharing");
                }

                GUILayout.EndHorizontal();
            }
            else
            {
                GUILayout.BeginHorizontal();

                GUILayout.Box("Terrain Tools (Beta)", MSHeadingTextStyle, GUILayout.Height(textHeadingSize.y));

                GUILayout.EndHorizontal();

                if (MegascansUtilities.isLegacy())
                {
                    GUILayout.BeginHorizontal();

                    GUILayout.Box("Material Name", MSText, GUILayout.Height(textSize.y), GUILayout.Width(textSize.x));
                    terrainMaterialName = EditorGUILayout.TextField(terrainMaterialName, MSField, GUILayout.Height(fieldSize.y), GUILayout.Width(fieldSize.x));

                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();

                    GUILayout.Box("Material Path", MSText, GUILayout.Height(textSize.y), GUILayout.Width(textSize.x));
                    terrainMaterialPath = EditorGUILayout.TextField(terrainMaterialPath, MSField, GUILayout.Height(fieldSize.y), GUILayout.Width(fieldSize.x));

                    GUILayout.EndHorizontal();
                }

                GUILayout.BeginHorizontal();

                GUILayout.Box("Texture Tiling", MSText, GUILayout.Height(textSize.y), GUILayout.Width(textSize.x));
                tiling = EditorGUILayout.TextField(tiling, MSField, GUILayout.Height(fieldSize.y));

                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();

                if (GUILayout.Button("Setup Paint Layers", MSStrechedWidthStyle, GUILayout.Height(textSize.y)))
                {
                    MegascansTerrainTools.SetupTerrain();
                }

                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();

                GUI.skin.label.wordWrap = true;
                GUILayout.Label("Warning: This feature works properly with the metallic workflow only.", MSWarningTextStyle, GUILayout.Height(textSize.y));

                GUILayout.EndHorizontal();

                if (MegascansUtilities.isLegacy())
                {
                    GUILayout.BeginHorizontal();

                    GUILayout.Box("Warning: This feature requires HD Render Pipeline.", MSWarningTextStyle, GUILayout.Height(textSize.y), GUILayout.Width(textSize.x));

                    GUILayout.EndHorizontal();
                }

                GUILayout.BeginHorizontal();

                Handles.color = Color.white;
                Handles.DrawLine(new Vector3(0, 105), new Vector3(310, 105));

                GUILayout.EndHorizontal();

#if HDRP && (UNITY_2018_2 || UNITY_2018_3 || UNITY_2019)
                GUILayout.BeginHorizontal();

                GUILayout.Box("Decal Setup (Beta)", MSHeadingTextStyle, GUILayout.Height(textHeadingSize.y), GUILayout.Width(textHeadingSize.x));

                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();

                GUILayout.Box("Global Opacity (%)", MSText, GUILayout.Height(textSize.y), GUILayout.Width(textSize.x));
                decalBlend = EditorGUILayout.TextField(decalBlend, MSField, GUILayout.Height(fieldSize.y), GUILayout.Width(fieldSize.x));

                GUILayout.EndHorizontal();

                if (!MegascansUtilities.isLegacy())
                {
                    GUILayout.BeginHorizontal();

                    GUILayout.Box("Scale", MSText, GUILayout.Height(textSize.y), GUILayout.Width(textSize.x));
                    decalSize = EditorGUILayout.TextField(decalSize, MSField, GUILayout.Height(fieldSize.y), GUILayout.Width(fieldSize.x));

                    GUILayout.EndHorizontal();
                }

                GUILayout.BeginHorizontal();

                if (GUILayout.Button("Create Decal Projector", MSStrechedWidthStyle, GUILayout.Height(textSize.y), GUILayout.Width(size.x)))
                {
                    MegascansDecalTools.SetupDecalProjector();
                }

                GUILayout.EndHorizontal();
#endif
            }

            if (!MSLogo)
            {
                InitStyle();
                Repaint();
            }
        }