PropertiesDefaultGUI() public method

public PropertiesDefaultGUI ( MaterialProperty props ) : void
props MaterialProperty
return void
        public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props)
        {
            if (!m_Initialized)
            {
                m_ShowLatLongLayout.valueChanged.AddListener(materialEditor.Repaint);
                m_ShowMirrorOnBack.valueChanged.AddListener(materialEditor.Repaint);
                m_Show3DControl.valueChanged.AddListener(materialEditor.Repaint);

                m_Initialized = true;
            }

            // Allow the default implementation to set widths for consistency for common properties.
            float lw = EditorGUIUtility.labelWidth;

            materialEditor.SetDefaultGUIWidths();

            ShowProp(materialEditor, FindProperty("_Tint", props));
            ShowProp(materialEditor, FindProperty("_Exposure", props));
            ShowProp(materialEditor, FindProperty("_Rotation", props));
            ShowProp(materialEditor, FindProperty("_Tex", props));

            EditorGUIUtility.labelWidth = lw;

            m_ShowLatLongLayout.target = ShowProp(materialEditor, FindProperty("_Mapping", props)) == 1;

            if (EditorGUILayout.BeginFadeGroup(m_ShowLatLongLayout.faded))
            {
                m_ShowMirrorOnBack.target = ShowProp(materialEditor, FindProperty("_ImageType", props)) == 1;

                if (EditorGUILayout.BeginFadeGroup(m_ShowMirrorOnBack.faded))
                {
                    EditorGUI.indentLevel++;

                    ShowProp(materialEditor, FindProperty("_MirrorOnBack", props));

                    EditorGUI.indentLevel--;
                }

                EditorGUILayout.EndFadeGroup();

                // No 3D settings unless PlayerSettings have VR support.
                m_Show3DControl.value = PlayerSettings.virtualRealitySupported;

                if (EditorGUILayout.BeginFadeGroup(m_Show3DControl.faded))
                {
                    ShowProp(materialEditor, FindProperty("_Layout", props));
                }

                EditorGUILayout.EndFadeGroup();
            }

            EditorGUILayout.EndFadeGroup();

            // Let the default implementation add the extra shader properties at the bottom.
            materialEditor.PropertiesDefaultGUI(new MaterialProperty[0]);
        }
示例#2
0
        public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props)
        {
            if (!m_Initialized)
            {
                m_ShowLatLongLayout.valueChanged.AddListener(materialEditor.Repaint);
                m_ShowMirrorOnBack.valueChanged.AddListener(materialEditor.Repaint);
                m_Show3DControl.valueChanged.AddListener(materialEditor.Repaint);
                m_Initialized = true;
            }

            // Allow the default implementation to set widths for consistency for common properties.
            float lw = EditorGUIUtility.labelWidth;

            materialEditor.SetDefaultGUIWidths();
            ShowProp(materialEditor, FindProperty("_Tint", props));
            ShowProp(materialEditor, FindProperty("_Exposure", props));
            ShowProp(materialEditor, FindProperty("_Rotation", props));
            ShowProp(materialEditor, FindProperty("_MainTex", props));
            EditorGUIUtility.labelWidth = lw;

            m_ShowLatLongLayout.target = ShowProp(materialEditor, FindProperty("_Mapping", props)) == 1;
            if (EditorGUILayout.BeginFadeGroup(m_ShowLatLongLayout.faded))
            {
                m_ShowMirrorOnBack.target = ShowProp(materialEditor, FindProperty("_ImageType", props)) == 1;
                if (EditorGUILayout.BeginFadeGroup(m_ShowMirrorOnBack.faded))
                {
                    EditorGUI.indentLevel++;
                    ShowProp(materialEditor, FindProperty("_MirrorOnBack", props));
                    EditorGUI.indentLevel--;
                }
                EditorGUILayout.EndFadeGroup();

                // Show 3D settings if VR support is enabled on ANY platform.
                m_Show3DControl.value = false;
                foreach (BuildPlatform cur in BuildPlatforms.instance.buildPlatforms)
                {
                    if (UnityEditorInternal.VR.VREditor.GetVREnabledOnTargetGroup(cur.targetGroup))
                    {
                        m_Show3DControl.value = true;
                        break;
                    }
                }
                if (EditorGUILayout.BeginFadeGroup(m_Show3DControl.faded))
                {
                    ShowProp(materialEditor, FindProperty("_Layout", props));
                }
                EditorGUILayout.EndFadeGroup();
            }
            EditorGUILayout.EndFadeGroup();

            // Let the default implementation add the extra shader properties at the bottom.
            materialEditor.PropertiesDefaultGUI(new MaterialProperty[0]);
        }
示例#3
0
        public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props)
        {
            if (!this.m_Initialized)
            {
                this.m_ShowLatLongLayout.valueChanged.AddListener(new UnityAction(materialEditor.Repaint));
                this.m_ShowMirrorOnBack.valueChanged.AddListener(new UnityAction(materialEditor.Repaint));
                this.m_Show3DControl.valueChanged.AddListener(new UnityAction(materialEditor.Repaint));
                this.m_Initialized = true;
            }
            float labelWidth = EditorGUIUtility.labelWidth;

            materialEditor.SetDefaultGUIWidths();
            this.ShowProp(materialEditor, ShaderGUI.FindProperty("_Tint", props));
            this.ShowProp(materialEditor, ShaderGUI.FindProperty("_Exposure", props));
            this.ShowProp(materialEditor, ShaderGUI.FindProperty("_Rotation", props));
            this.ShowProp(materialEditor, ShaderGUI.FindProperty("_MainTex", props));
            EditorGUIUtility.labelWidth     = labelWidth;
            this.m_ShowLatLongLayout.target = (this.ShowProp(materialEditor, ShaderGUI.FindProperty("_Mapping", props)) == 1f);
            if (EditorGUILayout.BeginFadeGroup(this.m_ShowLatLongLayout.faded))
            {
                this.m_ShowMirrorOnBack.target = (this.ShowProp(materialEditor, ShaderGUI.FindProperty("_ImageType", props)) == 1f);
                if (EditorGUILayout.BeginFadeGroup(this.m_ShowMirrorOnBack.faded))
                {
                    EditorGUI.indentLevel++;
                    this.ShowProp(materialEditor, ShaderGUI.FindProperty("_MirrorOnBack", props));
                    EditorGUI.indentLevel--;
                }
                EditorGUILayout.EndFadeGroup();
                this.m_Show3DControl.value = false;
                BuildPlatform[] buildPlatforms = BuildPlatforms.instance.buildPlatforms;
                for (int i = 0; i < buildPlatforms.Length; i++)
                {
                    BuildPlatform buildPlatform = buildPlatforms[i];
                    if (VREditor.GetVREnabledOnTargetGroup(buildPlatform.targetGroup))
                    {
                        this.m_Show3DControl.value = true;
                        break;
                    }
                }
                if (EditorGUILayout.BeginFadeGroup(this.m_Show3DControl.faded))
                {
                    this.ShowProp(materialEditor, ShaderGUI.FindProperty("_Layout", props));
                }
                EditorGUILayout.EndFadeGroup();
            }
            EditorGUILayout.EndFadeGroup();
            materialEditor.PropertiesDefaultGUI(new MaterialProperty[0]);
        }
示例#4
0
 /// <summary>
 /// <para>To define a custom shader GUI use the methods of materialEditor to render controls for the properties array.</para>
 /// </summary>
 /// <param name="materialEditor">The MaterialEditor that are calling this OnGUI (the 'owner').</param>
 /// <param name="properties">Material properties of the current selected shader.</param>
 public virtual void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties)
 {
     materialEditor.PropertiesDefaultGUI(properties);
 }
示例#5
0
 /// <summary>
 /// <para>To define a custom shader GUI use the methods of materialEditor to render controls for the properties array.</para>
 /// </summary>
 /// <param name="materialEditor">The MaterialEditor that are calling this OnGUI (the 'owner').</param>
 /// <param name="properties">Material properties of the current selected shader.</param>
 public virtual void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties)
 {
     materialEditor.PropertiesDefaultGUI(properties);
 }