示例#1
0
    void OnGUI()
    {
        SetGUIStyles();

        StyledGUI.DrawWindowBanner(bannerColor, bannerText, helpURL);

        GUILayout.BeginHorizontal();
        GUILayout.Space(15);

        GUILayout.BeginVertical();

        //scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, false, GUILayout.Width(this.position.width - 28), GUILayout.Height(this.position.height - 80));

        DrawInstallMessage();

        if (packageOptions[packageIndex].Contains("Universal 7.1.8"))
        {
            EditorGUILayout.HelpBox("For Universal 7.1.8+ Pipeline, Depth Texture and one of the following features need to be enabled for the depth to work properly: Opaque Texure, HDR or Post Processing!", MessageType.Info, true);
        }

        if (packageOptions[packageIndex].Contains("Universal 7.4.1"))
        {
            EditorGUILayout.HelpBox("For Universal 7.4.1+ Pipeline, Depth Texture need to be enabled on the render pipeline asset!", MessageType.Info, true);
        }

        DrawRenderPipelineSelection();
        DrawSetupButton();

        //GUILayout.EndScrollView();

        GUILayout.EndVertical();

        GUILayout.Space(13);
        GUILayout.EndHorizontal();
    }
示例#2
0
    void OnGUI()
    {
        StyledGUI.DrawWindowBanner(bannerColor, bannerText, helpURL);

        GUILayout.BeginHorizontal();
        GUILayout.Space(20);

        EditorGUILayout.HelpBox("The included shaders are compatible by default with Standard and Universal Render Pipelines!", MessageType.Info, true);

        GUILayout.Space(13);
        GUILayout.EndHorizontal();
    }
示例#3
0
        public override void OnInspectorGUI()
        {
            SetGUIStyles();

            StyledGUI.DrawInspectorBanner(bannerColor, bannerText, helpURL);

            EditorGUILayout.HelpBox("Please note that the Link component is in experimental stage!", MessageType.Info, true);

            GUILayout.Space(10);

            DrawStatus();
            DrawInspector();

            GUILayout.Space(10);

            DrawDebugButton();

            GUILayout.Space(10);
        }
示例#4
0
    void OnGUI()
    {
        SetGUIStyles();

        StyledGUI.DrawWindowBanner(bannerColor, bannerText, helpURL);

        GUILayout.BeginHorizontal();
        GUILayout.Space(15);

        GUILayout.BeginVertical();

        //scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, false, GUILayout.Width(this.position.width - 28), GUILayout.Height(this.position.height - 80));

        DrawInstallMessage();
        DrawRenderPipelineSelection();
        DrawSetupButton();

        //GUILayout.EndScrollView();

        GUILayout.EndVertical();

        GUILayout.Space(13);
        GUILayout.EndHorizontal();
    }
示例#5
0
        void OnGUI()
        {
            SetGUIStyles();

            StyledGUI.DrawWindowBanner(bannerColor, bannerText, helpURL);

            GUILayout.BeginHorizontal();
            GUILayout.Space(15);

            GUILayout.BeginVertical();

            scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, false, GUILayout.Width(this.position.width - 28), GUILayout.Height(this.position.height - 80));

            if (File.Exists(assetFolder + "/Core/Editor/TVEHubAutoRun.cs"))
            {
                if (upgradeIsNeeded)
                {
                    EditorGUILayout.HelpBox("Previous version detected! The Vegetation Engine will check all project materials and upgrade them if needed. " +
                                            "Make sure you read the Upgrading Steps to upgrade to a new version. Do not close Unity during the upgrade!", MessageType.Info, true);

                    GUILayout.Space(10);

                    if (SceneManager.GetActiveScene().name != "")
                    {
                        GUILayout.BeginHorizontal();

                        GUILayout.Label("Save Current Scene", GUILayout.Width(220));
                        saveCurrentScene = EditorGUILayout.Toggle(saveCurrentScene);

                        GUILayout.EndHorizontal();

                        GUILayout.Space(10);
                    }

                    if (GUILayout.Button("Upgrade Materials And Install", GUILayout.Height(24)))
                    {
                        RestartActiveScene(true);
                        UpgradeAsset();
                        InstallAsset();
                    }
                }
                else
                {
                    EditorGUILayout.HelpBox("Welcome to the Vegetation Engine! The installer will set up the asset and prepare the shaders for the current Unity version!", MessageType.Info, true);

                    GUILayout.Space(15);

                    if (GUILayout.Button("Install", GUILayout.Height(24)))
                    {
                        InstallAsset();
                    }
                }
            }
            // TVE is installed
            else
            {
                if (packageIsImported)
                {
                    EditorGUILayout.HelpBox("The Render Pipeline is not yet installed! Choose and Install the desired Render Engine to finish the setup!", MessageType.Error, true);
                }
                else
                {
                    EditorGUILayout.HelpBox("Click the Render Pipeline Import button then click the Render Engine Update button to use The Vegetation Engine with another render pipeline. Click the Render Engine Install button to update the shader render engine only. The selected features are shared across all TVE shaders. Enable Render Engine Overrides to select per shader Render Engine.", MessageType.Info, true);
                }

                GUILayout.Space(15);

                GUILayout.BeginHorizontal();

                GUILayout.Label("Render Pipeline", GUILayout.Width(220));
                corePackageIndex = EditorGUILayout.Popup(corePackageIndex, corePackageOptions, stylePopup);

                if (GUILayout.Button("Import", GUILayout.Width(80), GUILayout.Height(GUI_HEIGHT)))
                {
                    SettingsUtils.SaveSettingsData(userFolder + "Pipeline.asset", corePackageOptions[corePackageIndex]);

                    SetDefineSymbols(corePackageOptions[corePackageIndex]);
                    ImportPackage();

                    packageIsImported = true;

                    GUIUtility.ExitGUI();
                }

                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Label("Render Engine", GUILayout.Width(220));
                coreEngineIndex = EditorGUILayout.Popup(coreEngineIndex, engineOptions, stylePopup);

                if (GUILayout.Button("Install", GUILayout.Width(80), GUILayout.Height(GUI_HEIGHT)))
                {
                    SettingsUtils.SaveSettingsData(userFolder + "Engine.asset", engineOptions[coreEngineIndex]);

                    UpdateShaders();

                    if (packageIsImported)
                    {
                        SetMaterialSettings();
                    }

                    // Refresh overrides if opened
                    showAdvancedSettingsOld = false;
                    packageIsImported       = false;

                    GUIUtility.ExitGUI();
                }

                GUILayout.EndHorizontal();

                GUILayout.Space(10);

                GUILayout.BeginHorizontal();

                GUILayout.Label("Show Advanced Settings", GUILayout.Width(220));
                showAdvancedSettings = EditorGUILayout.Toggle(showAdvancedSettings);

                GUILayout.EndHorizontal();

                if (showAdvancedSettings == true)
                {
                    if (showAdvancedSettingsOld != showAdvancedSettings)
                    {
                        for (int i = 0; i < coreShaderPaths.Count; i++)
                        {
                            GetRenderEngineFromShader(coreShaderPaths[i], i);
                        }

                        showAdvancedSettingsOld = showAdvancedSettings;
                    }

                    GUILayout.Space(10);

                    for (int i = 0; i < coreShaderPaths.Count; i++)
                    {
                        GUILayout.BeginHorizontal();

                        GUILayout.Label(Path.GetFileNameWithoutExtension(coreShaderPaths[i]), GUILayout.Width(220));
                        engineOverridesIndices[i] = EditorGUILayout.Popup(engineOverridesIndices[i], engineOptions, stylePopup);

                        if (GUILayout.Button("Install", GUILayout.Width(80), GUILayout.Height(GUI_HEIGHT)))
                        {
                            InjectShaderFeature(coreShaderPaths[i], engineOptions[engineOverridesIndices[i]]);
                            //AssetDatabase.SaveAssets();
                            //AssetDatabase.Refresh();

                            SettingsUtils.SaveSettingsData(userFolder + "Engine.asset", "Mixed Render Engines");
                            GUIUtility.ExitGUI();
                        }

                        GUILayout.EndHorizontal();
                    }
                }

                GUILayout.FlexibleSpace();
                GUI.enabled = false;

                GUILayout.Space(20);

                if (!packageIsImported)
                {
                    GUILayout.Label("<color=#7f7f7f><size=10><b>Imported Render Pipeline: " + SettingsUtils.LoadSettingsData(userFolder + "Pipeline.asset", "Standard") + "</b></size></color>", styleLabel);
                    GUILayout.Label("<color=#7f7f7f><size=10><b>Installed Render Engine: " + SettingsUtils.LoadSettingsData(userFolder + "Engine.asset", "Unity Default Renderer") + "</b></size></color>", styleLabel);
                }

                GUILayout.Space(20);
            }

            GUILayout.EndScrollView();

            GUILayout.EndVertical();

            GUILayout.Space(13);
            GUILayout.EndHorizontal();
        }
示例#6
0
        void OnGUI()
        {
            SetGUIStyles();

            GUI_HALF_WIDTH = this.position.width / 2.0f - 24;

            StyledGUI.DrawWindowBanner(bannerColor, bannerText, helpURL);

            GUILayout.BeginHorizontal();
            GUILayout.Space(15);

            GUILayout.BeginVertical();

            GUILayout.Space(-2);

            if (isValid && prefabObjects.Count > 0)
            {
                EditorGUILayout.HelpBox("Move the slider to owerride the Mixed values for prefabs with different material settings. Please note that Undo is not supported for the Prefab Settings window!", MessageType.Info, true);

                if (useProceduralVariation)
                {
                    EditorGUILayout.HelpBox("Procedural variation detected! Use the Scale settings if the Variation is breaking the bending and rolling animation!", MessageType.Warning, true);
                }
            }
            else
            {
                if (isValid == false)
                {
                    EditorGUILayout.HelpBox("The Vegetation Engine manager is missing from your scene. Make sure setup it up first and the reopen the Prefab Converter!", MessageType.Warning, true);
                }
                else if (prefabObjects.Count == 0)
                {
                    EditorGUILayout.HelpBox("Select a prefab or multiple prefabs to get started!", MessageType.Info, true);
                }
            }

            scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, false, GUILayout.Width(this.position.width - 28), GUILayout.Height(this.position.height - 200));

            if (isValid == false || prefabObjects.Count == 0)
            {
                GUI.enabled = false;
            }

            DrawWindPower();

            SetGlobalShaderProperties();

            if (TVEManager.Instance == null)
            {
                globalMotion = TVEManager.Instance.globalMotion;
            }

            if (prefabObjects.Count > 0)
            {
                GUILayout.Space(5);
            }

            DrawPrefabObjects();

            GUILayout.Space(15);

            presetIndex = StyledPopup("Material Preset", presetIndex, presetOptions);

            if (presetIndex > 0)
            {
                GetPresetLines();

                for (int i = 0; i < prefabMaterials.Count; i++)
                {
                    var material = prefabMaterials[i];

                    GetMaterialConversionFromPreset(material);
                    TVEShaderUtils.SetMaterialSettings(material);
                }

                materialData = new List <TVEMaterialData>();
                materialData.AddRange(motionData);
                materialData.AddRange(globalData);
                materialData.AddRange(subsurfaceData);
                materialData.AddRange(mainData);
                materialData.AddRange(secondData);
                materialData.AddRange(gradientAndNoiseData);
                materialData.AddRange(billboardAndGrassData);

                GetInitMaterialProperties();
                GetMaterialProperties();

                presetIndex      = 0;
                settingsIndexOld = -1;
            }

            settingsIndex = StyledPopup("Material Settings", settingsIndex, materialOptions);

            if (settingsIndexOld != settingsIndex)
            {
                materialData = new List <TVEMaterialData>();

                if (settingsIndex == 0)
                {
                    materialData.AddRange(motionData);
                    materialData.AddRange(globalData);
                    materialData.AddRange(subsurfaceData);
                    materialData.AddRange(mainData);
                    materialData.AddRange(secondData);
                    materialData.AddRange(gradientAndNoiseData);
                    materialData.AddRange(billboardAndGrassData);
                }
                else if (settingsIndex == 1)
                {
                    materialData = motionData;
                }
                else if (settingsIndex == 2)
                {
                    materialData.AddRange(globalData);
                    materialData.AddRange(subsurfaceData);
                    materialData.AddRange(mainData);
                    materialData.AddRange(secondData);
                    materialData.AddRange(gradientAndNoiseData);
                    materialData.AddRange(billboardAndGrassData);
                }
                else if (settingsIndex == 3)
                {
                    materialData = globalData;
                }
                else if (settingsIndex == 4)
                {
                    materialData = subsurfaceData;
                }
                else if (settingsIndex == 5)
                {
                    materialData = mainData;
                }
                else if (settingsIndex == 6)
                {
                    materialData = secondData;
                }
                else if (settingsIndex == 7)
                {
                    materialData = gradientAndNoiseData;
                }
                else if (settingsIndex == 8)
                {
                    materialData = billboardAndGrassData;
                }

                settingsIndexOld = settingsIndex;
            }

            for (int i = 0; i < materialData.Count; i++)
            {
                if (materialData[i].type == TVEMaterialData.PropertyType.Range)
                {
                    materialData[i].value = StyledSlider(materialData[i].name, materialData[i].value, materialData[i].min, materialData[i].max, materialData[i].snap, materialData[i].space);
                }
                else if (materialData[i].type == TVEMaterialData.PropertyType.Color)
                {
                    materialData[i].color = StyledColor(materialData[i].name, materialData[i].color, materialData[i].hdr, materialData[i].space);
                }
            }

            GUILayout.Space(10);

            SavePreset();

            SetMaterialProperties();

            GUILayout.EndScrollView();

            GUILayout.EndVertical();

            GUILayout.Space(13);
            GUILayout.EndHorizontal();
        }