void DoAnimationArea()
        {
            EditorGUILayout.BeginHorizontal();
            showHelpAnimation = GUILayout.Toggle(showHelpAnimation, "?", "Button", GUILayout.Width(25f)); GUILayout.Label("Wind animation", EditorStyles.boldLabel);
            EditorGUILayout.EndHorizontal();

#if !VEGETATION_STUDIO_PRO //VS Pro has an FAE wind controller
            if (!hasWindController)
            {
                EditorGUILayout.HelpBox("No \"WindController\" component was found in your scene. Please add this script to an empty GameObject\n\nGo to GameObject->3D Object to create one", MessageType.Warning);
                EditorGUI.BeginDisabledGroup(true);
            }
#else
            EditorGUI.BeginDisabledGroup(false);
#endif

#if UNITY_2019_3_OR_NEWER
            if (UnityEngine.Rendering.GraphicsSettings.currentRenderPipeline == null)
            {
#endif
            visualizeVectors = EditorGUILayout.Toggle("Visualize wind", visualizeVectors);
#if UNITY_2019_3_OR_NEWER
        }
#endif

            if (showHelpAnimation)
            {
                EditorGUILayout.HelpBox("Toggle a visualisation of the wind vectors on all the objects that use FAE shaders featuring wind.\n\nThis allows you to more clearly see the effects of the settings.", MessageType.None);
            }

            m_MaterialEditor.ShaderProperty(_UseSpeedTreeWind, new GUIContent("Sample SpeedTree wind"));
            if (showHelpAnimation)
            {
                EditorGUILayout.HelpBox("If this is a tree created using the Unity SpeedTree Modeler, this toggle will make the shader read the wind information as stored by SpeedTree.", MessageType.None);
            }

            m_MaterialEditor.ShaderProperty(_MaxWindStrength, new GUIContent("Max wind strength"));
            if (showHelpAnimation)
            {
                EditorGUILayout.HelpBox("Determines how much influence the wind has on the branches", MessageType.None);
            }

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(new GUIContent("Wind Amplitude Multiplier"));
            _WindAmplitudeMultiplier.floatValue = EditorGUILayout.FloatField(_WindAmplitudeMultiplier.floatValue, GUILayout.Width(65f));
            EditorGUILayout.EndHorizontal();
            //m_MaterialEditor.ShaderProperty(_WindAmplitudeMultiplier, _WindAmplitudeMultiplier.displayName);
            if (showHelpAnimation)
            {
                EditorGUILayout.HelpBox("Multiply the wind amplitude for this material. Essentally this is the size of the wind waves.", MessageType.None);
            }

            if (hasWindController && showHelpAnimation)
            {
                GUIHelper.DrawWindInfo();
            }

            EditorGUI.EndDisabledGroup();
            EditorGUILayout.Space();
        }
Exemplo n.º 2
0
        public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props)
        {
            this.FindProperties(props);

            this.m_MaterialEditor = materialEditor;

            //Style similar to Standard shader
            m_MaterialEditor.SetDefaultGUIWidths();
            m_MaterialEditor.UseDefaultMargins();
            EditorGUIUtility.labelWidth = 0f;

            EditorGUI.BeginChangeCheck();

            //Draw fields
            DoHeader();

            DoMapsArea();
            DoColorArea();

            if (EditorGUI.EndChangeCheck())
            {
                //Apply changes
            }

            GUIHelper.DrawExtraFields(m_MaterialEditor);

            if (showHelp)
            {
                GUIHelper.DrawWindInfo();
            }

            GUIHelper.DrawFooter();
        }
Exemplo n.º 3
0
        void DoAnimationArea()
        {
            EditorGUILayout.BeginHorizontal();
            showHelpAnimation = GUILayout.Toggle(showHelpAnimation, "?", "Button", GUILayout.Width(25f)); GUILayout.Label("Wind animation", EditorStyles.boldLabel);
            EditorGUILayout.EndHorizontal();

            visualizeVectors = EditorGUILayout.Toggle("Visualize wind", visualizeVectors);

            if (!hasWindController)
            {
                EditorGUILayout.HelpBox("No \"WindController\" component was found in your scene. Please add this script to an empty GameObject\n\nA prefab can be found in the Prefabs/Effects folder.", MessageType.Warning);
                EditorGUI.BeginDisabledGroup(true);
            }

            if (showHelpAnimation)
            {
                EditorGUILayout.HelpBox("Toggle a visualisation of the wind vectors on all the objects that use FAE shaders featuring wind.\n\nThis allows you to more clearly see the effects of the settings.", MessageType.None);
            }

            m_MaterialEditor.ShaderProperty(_MaxWindStrength, _MaxWindStrength.displayName);
            if (showHelpAnimation)
            {
                EditorGUILayout.HelpBox("Determines how much influence the wind has on the object", MessageType.None);
            }
            m_MaterialEditor.ShaderProperty(_WindSwinging, _WindSwinging.displayName);
            if (showHelpAnimation)
            {
                EditorGUILayout.HelpBox("Higher values mean the object always sways back against the wind direction", MessageType.None);
            }

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(_WindAmplitudeMultiplier.displayName);
            _WindAmplitudeMultiplier.floatValue = EditorGUILayout.FloatField(_WindAmplitudeMultiplier.floatValue, GUILayout.Width(65f));
            EditorGUILayout.EndHorizontal();

            if (showHelpAnimation)
            {
                EditorGUILayout.HelpBox("Multiply the wind amplitude for this material. Essentally this is the size of the wind waves.", MessageType.None);
            }
            if (!hasWindController)
            {
                EditorGUI.EndDisabledGroup();
            }
            m_MaterialEditor.ShaderProperty(_BendingInfluence, _BendingInfluence.displayName);
            if (showHelpAnimation)
            {
                EditorGUILayout.HelpBox("Determines how much influence the FoliageBender script has on the object", MessageType.None);
            }

            if (hasWindController && showHelpAnimation)
            {
                GUIHelper.DrawWindInfo();
            }

            EditorGUILayout.Space();
        }
Exemplo n.º 4
0
        public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props)
        {
            this.m_MaterialEditor = materialEditor;
            targetMat             = materialEditor.target as Material;

            this.FindProperties(props);

            //Style similar to Standard shader
            m_MaterialEditor.SetDefaultGUIWidths();
            m_MaterialEditor.UseDefaultMargins();
            EditorGUIUtility.labelWidth = 0f;

#if UNITY_2019_3_OR_NEWER
            if (UnityEngine.Rendering.GraphicsSettings.currentRenderPipeline != null &&
                !targetMat.shader.name.Contains("Universal Render Pipeline"))
            {
                EditorGUILayout.HelpBox("A render pipeline is in use, but this material is using a shader for the Built-in render pipeline.\n\nShaders and materials can be converted through the Help window", MessageType.Error);
                EditorGUILayout.Space();
            }
#endif

            EditorGUI.BeginChangeCheck();

            //Draw fields
            DoHeader();

            DoMapsArea();
            DoColorArea();

            if (EditorGUI.EndChangeCheck())
            {
                //Apply changes
            }

            GUILayout.Label("Advanced Options", EditorStyles.boldLabel);

            GUIHelper.DrawExtraFields(m_MaterialEditor);

            m_MaterialEditor.ShaderProperty(_UseSpeedTreeWind, new GUIContent("Sample SpeedTree wind"));
            if (showHelp)
            {
                EditorGUILayout.HelpBox("If this is a tree created using the SpeedTree Unity Modeler, this toggle will make the shader read the wind information as stored by SpeedTree.", MessageType.None);
            }

            if (showHelp)
            {
                GUIHelper.DrawWindInfo();
            }

            GUIHelper.DrawFooter();
        }
        public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props)
        {
            this.FindProperties(props);

            this.m_MaterialEditor = materialEditor;

            //Style similar to Standard shader
            m_MaterialEditor.SetDefaultGUIWidths();
            m_MaterialEditor.UseDefaultMargins();
            EditorGUIUtility.labelWidth = 0f;

            EditorGUI.BeginChangeCheck();

            //Draw fields
            DoHeader();

            DoMapsArea();
            DoColorArea();

            if (EditorGUI.EndChangeCheck())
            {
                //Apply changes
            }

            GUILayout.Label("Advanced Options", EditorStyles.boldLabel);

            GUIHelper.DrawExtraFields(m_MaterialEditor);

            m_MaterialEditor.ShaderProperty(_UseSpeedTreeWind, new GUIContent("Sample SpeedTree wind"));
            if (showHelp)
            {
                EditorGUILayout.HelpBox("If this is a tree created using the SpeedTree Unity Modeler, this toggle will make the shader read the wind information as stored by SpeedTree.", MessageType.None);
            }

            EditorGUI.BeginDisabledGroup(_UseSpeedTreeWind.floatValue == 1);
            m_MaterialEditor.ShaderProperty(_UseLegacyVertexColors, new GUIContent("Legacy vertex color layout"));
            if (_UseSpeedTreeWind.floatValue == 0)
            {
                EditorGUILayout.HelpBox("Since version 1.2.1 the Blue and Alpha channel have been swapped. If your custom tree uses the old layout, check this.", MessageType.None);
            }
            EditorGUI.EndDisabledGroup();

            if (showHelp)
            {
                GUIHelper.DrawWindInfo();
            }

            GUIHelper.DrawFooter();
        }
        public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props)
        {
            this.FindProperties(props);

            this.m_MaterialEditor = materialEditor;

            //Style similar to Standard shader
            m_MaterialEditor.SetDefaultGUIWidths();
            m_MaterialEditor.UseDefaultMargins();
            EditorGUIUtility.labelWidth = 0f;

            EditorGUI.BeginChangeCheck();

            //Draw fields
            DoHeader();

            DoMapsArea();
            DoColorArea();

            if (EditorGUI.EndChangeCheck())
            {
                //Apply changes
            }

            GUILayout.Label("Advanced Options", EditorStyles.boldLabel);

            GUIHelper.DrawExtraFields(m_MaterialEditor);

            m_MaterialEditor.ShaderProperty(_UseSpeedTreeWind, new GUIContent("Sample SpeedTree wind"));
            if (showHelp)
            {
                EditorGUILayout.HelpBox("If this is a tree created using the SpeedTree Unity Modeler, this toggle will make the shader read the wind information as stored by SpeedTree.", MessageType.None);
            }

            if (showHelp)
            {
                GUIHelper.DrawWindInfo();
            }

            GUIHelper.DrawFooter();
        }
Exemplo n.º 7
0
        void DoAnimationArea()
        {
            EditorGUILayout.BeginHorizontal();
            showHelpAnimation = GUILayout.Toggle(showHelpAnimation, "?", "Button", GUILayout.Width(25f)); GUILayout.Label("Wind animation", EditorStyles.boldLabel);
            EditorGUILayout.EndHorizontal();

#if UNITY_2019_3_OR_NEWER
            if (UnityEngine.Rendering.GraphicsSettings.currentRenderPipeline == null)
            {
#endif
            visualizeVectors = EditorGUILayout.Toggle("Visualize wind", visualizeVectors);
#if UNITY_2019_3_OR_NEWER
        }
#endif

#if !VEGETATION_STUDIO_PRO //VS Pro has an FAE wind controller
            if (!hasWindController)
            {
                EditorGUILayout.HelpBox("No \"WindController\" component was found in your scene. Please add this script to an empty GameObject\n\nA prefab can be found in the Prefabs/Effects folder.", MessageType.Warning);
                EditorGUI.BeginDisabledGroup(true);
            }
#else
            EditorGUI.BeginDisabledGroup(false);
#endif
            if (showHelpAnimation)
            {
                EditorGUILayout.HelpBox("Toggle a visualisation of the wind vectors on all the objects that use FAE shaders featuring wind.\n\nThis allows you to more clearly see the effects of the settings.", MessageType.None);
            }

            m_MaterialEditor.ShaderProperty(_MaxWindStrength, _MaxWindStrength.displayName);
            if (showHelpAnimation)
            {
                EditorGUILayout.HelpBox("Determines how much influence the wind has on the object", MessageType.None);
            }
            m_MaterialEditor.ShaderProperty(_GlobalWindMotion, _GlobalWindMotion.displayName);
            if (showHelpAnimation)
            {
                EditorGUILayout.HelpBox("Back and forth motion", MessageType.None);
            }
            m_MaterialEditor.ShaderProperty(_LeafFlutter, _LeafFlutter.displayName);
            if (showHelpAnimation)
            {
                EditorGUILayout.HelpBox("Local wind turbulence", MessageType.None);
            }
            m_MaterialEditor.ShaderProperty(_WindAmplitudeMultiplier, _WindAmplitudeMultiplier.displayName);
            if (showHelpAnimation)
            {
                EditorGUILayout.HelpBox("Multiply the wind amplitude for this material.Essentally this is the size of the wind waves.", MessageType.None);
            }
            m_MaterialEditor.ShaderProperty(_WindSwinging, _WindSwinging.displayName);
            if (showHelpAnimation)
            {
                EditorGUILayout.HelpBox("Higher values mean the object always sways back against the wind direction", MessageType.None);
            }

            if (targetMat.HasProperty("_WindTint"))
            {
                m_MaterialEditor.ShaderProperty(_WindTint, _WindTint.displayName);
                if (showHelpAnimation)
                {
                    EditorGUILayout.HelpBox("Vizualises the wind by adding a slight tint, either dark (<0) or light (>0)", MessageType.None);
                }
            }

            if (showHelpAnimation)
            {
                EditorGUILayout.HelpBox("Multiply the wind amplitude for this material. Essentally this is the size of the wind waves.", MessageType.None);
            }
            if (!hasWindController)
            {
                EditorGUI.EndDisabledGroup();
            }
            m_MaterialEditor.ShaderProperty(_BendingInfluence, _BendingInfluence.displayName);
            if (showHelpAnimation)
            {
                EditorGUILayout.HelpBox("Determines how much influence the FoliageBender script has on the object", MessageType.None);
            }

            if (hasWindController && showHelpAnimation)
            {
                GUIHelper.DrawWindInfo();
            }

            EditorGUILayout.Space();
        }