コード例 #1
0
        internal static void WrapModePopup(SerializedProperty wrapU, SerializedProperty wrapV, SerializedProperty wrapW, bool isVolumeTexture, ref bool showPerAxisWrapModes)
        {
            if (TextureInspector.s_Styles == null)
            {
                TextureInspector.s_Styles = new TextureInspector.Styles();
            }
            TextureWrapMode textureWrapMode  = (TextureWrapMode)Mathf.Max(wrapU.intValue, 0);
            TextureWrapMode textureWrapMode2 = (TextureWrapMode)Mathf.Max(wrapV.intValue, 0);
            TextureWrapMode textureWrapMode3 = (TextureWrapMode)Mathf.Max(wrapW.intValue, 0);

            if (textureWrapMode != textureWrapMode2)
            {
                showPerAxisWrapModes = true;
            }
            if (isVolumeTexture)
            {
                if (textureWrapMode != textureWrapMode3 || textureWrapMode2 != textureWrapMode3)
                {
                    showPerAxisWrapModes = true;
                }
            }
            if (!showPerAxisWrapModes)
            {
                if (wrapU.hasMultipleDifferentValues || wrapV.hasMultipleDifferentValues || (isVolumeTexture && wrapW.hasMultipleDifferentValues))
                {
                    if (TextureInspector.IsAnyTextureObjectUsingPerAxisWrapMode(wrapU.serializedObject.targetObjects, isVolumeTexture))
                    {
                        showPerAxisWrapModes = true;
                    }
                }
            }
            int num = (int)((!showPerAxisWrapModes) ? textureWrapMode : ((TextureWrapMode)(-1)));

            EditorGUI.BeginChangeCheck();
            EditorGUI.showMixedValue = (!showPerAxisWrapModes && (wrapU.hasMultipleDifferentValues || wrapV.hasMultipleDifferentValues || (isVolumeTexture && wrapW.hasMultipleDifferentValues)));
            num = EditorGUILayout.IntPopup(TextureInspector.s_Styles.wrapModeLabel, num, TextureInspector.s_Styles.wrapModeContents, TextureInspector.s_Styles.wrapModeValues, new GUILayoutOption[0]);
            if (EditorGUI.EndChangeCheck() && num != -1)
            {
                wrapU.intValue       = num;
                wrapV.intValue       = num;
                wrapW.intValue       = num;
                showPerAxisWrapModes = false;
            }
            if (num == -1)
            {
                showPerAxisWrapModes = true;
                EditorGUI.indentLevel++;
                TextureInspector.WrapModeAxisPopup(TextureInspector.s_Styles.wrapU, wrapU);
                TextureInspector.WrapModeAxisPopup(TextureInspector.s_Styles.wrapV, wrapV);
                if (isVolumeTexture)
                {
                    TextureInspector.WrapModeAxisPopup(TextureInspector.s_Styles.wrapW, wrapW);
                }
                EditorGUI.indentLevel--;
            }
            EditorGUI.showMixedValue = false;
        }
コード例 #2
0
 public override void OnPreviewSettings()
 {
     if (this.IsCubemap())
     {
         this.m_CubemapPreview.OnPreviewSettings(base.targets);
     }
     else
     {
         if (TextureInspector.s_Styles == null)
         {
             TextureInspector.s_Styles = new TextureInspector.Styles();
         }
         Texture texture = base.target as Texture;
         bool    flag    = true;
         bool    flag2   = false;
         bool    flag3   = true;
         int     num     = 1;
         if (base.target is Texture2D || base.target is ProceduralTexture)
         {
             flag2 = true;
             flag3 = false;
         }
         UnityEngine.Object[] targets = base.targets;
         for (int i = 0; i < targets.Length; i++)
         {
             Texture texture2 = (Texture)targets[i];
             if (!(texture2 == null))
             {
                 TextureFormat format = (TextureFormat)0;
                 bool          flag4  = false;
                 if (texture2 is Texture2D)
                 {
                     format = (texture2 as Texture2D).format;
                     flag4  = true;
                 }
                 else if (texture2 is ProceduralTexture)
                 {
                     format = (texture2 as ProceduralTexture).format;
                     flag4  = true;
                 }
                 if (flag4)
                 {
                     if (!TextureUtil.IsAlphaOnlyTextureFormat(format))
                     {
                         flag2 = false;
                     }
                     if (TextureUtil.HasAlphaTextureFormat(format))
                     {
                         if (TextureUtil.GetUsageMode(texture2) == TextureUsageMode.Default)
                         {
                             flag3 = true;
                         }
                     }
                 }
                 num = Mathf.Max(num, TextureUtil.GetMipmapCount(texture2));
             }
         }
         if (flag2)
         {
             this.m_ShowAlpha = true;
             flag             = false;
         }
         else if (!flag3)
         {
             this.m_ShowAlpha = false;
             flag             = false;
         }
         if (flag && texture != null && !TextureInspector.IsNormalMap(texture))
         {
             this.m_ShowAlpha = GUILayout.Toggle(this.m_ShowAlpha, (!this.m_ShowAlpha) ? TextureInspector.s_Styles.RGBIcon : TextureInspector.s_Styles.alphaIcon, TextureInspector.s_Styles.previewButton, new GUILayoutOption[0]);
         }
         GUI.enabled = (num != 1);
         GUILayout.Box(TextureInspector.s_Styles.smallZoom, TextureInspector.s_Styles.previewLabel, new GUILayoutOption[0]);
         GUI.changed     = false;
         this.m_MipLevel = Mathf.Round(GUILayout.HorizontalSlider(this.m_MipLevel, (float)(num - 1), 0f, TextureInspector.s_Styles.previewSlider, TextureInspector.s_Styles.previewSliderThumb, new GUILayoutOption[]
         {
             GUILayout.MaxWidth(64f)
         }));
         GUILayout.Box(TextureInspector.s_Styles.largeZoom, TextureInspector.s_Styles.previewLabel, new GUILayoutOption[0]);
         GUI.enabled = true;
     }
 }
コード例 #3
0
 public override void OnPreviewSettings()
 {
     if (this.IsCubemap())
     {
         this.m_CubemapPreview.OnPreviewSettings(this.targets);
     }
     else
     {
         if (TextureInspector.s_Styles == null)
         {
             TextureInspector.s_Styles = new TextureInspector.Styles();
         }
         Texture target1 = this.target as Texture;
         bool    flag1   = true;
         bool    flag2   = false;
         bool    flag3   = true;
         int     a       = 1;
         if (this.target is Texture2D || this.target is ProceduralTexture)
         {
             flag2 = true;
             flag3 = false;
         }
         foreach (Texture target2 in this.targets)
         {
             TextureFormat format = (TextureFormat)0;
             bool          flag4  = false;
             if (target2 is Texture2D)
             {
                 format = (target2 as Texture2D).format;
                 flag4  = true;
             }
             else if (target2 is ProceduralTexture)
             {
                 format = (target2 as ProceduralTexture).format;
                 flag4  = true;
             }
             if (flag4)
             {
                 if (!TextureUtil.IsAlphaOnlyTextureFormat(format))
                 {
                     flag2 = false;
                 }
                 if (TextureUtil.HasAlphaTextureFormat(format) && TextureUtil.GetUsageMode(target2) == TextureUsageMode.Default)
                 {
                     flag3 = true;
                 }
             }
             a = Mathf.Max(a, TextureUtil.CountMipmaps(target2));
         }
         if (flag2)
         {
             this.m_ShowAlpha = true;
             flag1            = false;
         }
         else if (!flag3)
         {
             this.m_ShowAlpha = false;
             flag1            = false;
         }
         if (flag1 && !TextureInspector.IsNormalMap(target1))
         {
             this.m_ShowAlpha = GUILayout.Toggle(this.m_ShowAlpha, !this.m_ShowAlpha ? TextureInspector.s_Styles.RGBIcon : TextureInspector.s_Styles.alphaIcon, TextureInspector.s_Styles.previewButton, new GUILayoutOption[0]);
         }
         GUI.enabled = a != 1;
         GUILayout.Box(TextureInspector.s_Styles.smallZoom, TextureInspector.s_Styles.previewLabel, new GUILayoutOption[0]);
         GUI.changed     = false;
         this.m_MipLevel = Mathf.Round(GUILayout.HorizontalSlider(this.m_MipLevel, (float)(a - 1), 0.0f, TextureInspector.s_Styles.previewSlider, TextureInspector.s_Styles.previewSliderThumb, GUILayout.MaxWidth(64f)));
         GUILayout.Box(TextureInspector.s_Styles.largeZoom, TextureInspector.s_Styles.previewLabel, new GUILayoutOption[0]);
         GUI.enabled = true;
     }
 }
コード例 #4
0
		public override void OnPreviewSettings()
		{
			if (this.IsCubemap())
			{
				this.m_CubemapPreview.OnPreviewSettings(base.targets);
				return;
			}
			if (TextureInspector.s_Styles == null)
			{
				TextureInspector.s_Styles = new TextureInspector.Styles();
			}
			Texture t = this.target as Texture;
			bool flag = true;
			bool flag2 = false;
			bool flag3 = true;
			int num = 1;
			if (this.target is Texture2D || this.target is ProceduralTexture)
			{
				flag2 = true;
				flag3 = false;
			}
			UnityEngine.Object[] targets = base.targets;
			for (int i = 0; i < targets.Length; i++)
			{
				Texture texture = (Texture)targets[i];
				TextureFormat format = (TextureFormat)0;
				bool flag4 = false;
				if (texture is Texture2D)
				{
					format = (texture as Texture2D).format;
					flag4 = true;
				}
				else
				{
					if (texture is ProceduralTexture)
					{
						format = (texture as ProceduralTexture).format;
						flag4 = true;
					}
				}
				if (flag4)
				{
					num = Mathf.Max(num, TextureUtil.CountMipmaps(texture));
					if (!TextureUtil.IsAlphaOnlyTextureFormat(format))
					{
						flag2 = false;
					}
					if (TextureUtil.HasAlphaTextureFormat(format) && TextureUtil.GetUsageMode(texture) == TextureUsageMode.Default)
					{
						flag3 = true;
					}
				}
			}
			if (flag2)
			{
				this.m_ShowAlpha = true;
				flag = false;
			}
			else
			{
				if (!flag3)
				{
					this.m_ShowAlpha = false;
					flag = false;
				}
			}
			if (flag && !TextureInspector.IsNormalMap(t))
			{
				this.m_ShowAlpha = GUILayout.Toggle(this.m_ShowAlpha, (!this.m_ShowAlpha) ? TextureInspector.s_Styles.RGBIcon : TextureInspector.s_Styles.alphaIcon, TextureInspector.s_Styles.previewButton, new GUILayoutOption[0]);
			}
			GUI.enabled = (num != 1);
			GUILayout.Box(TextureInspector.s_Styles.smallZoom, TextureInspector.s_Styles.previewLabel, new GUILayoutOption[0]);
			GUI.changed = false;
			this.m_MipLevel = Mathf.Round(GUILayout.HorizontalSlider(this.m_MipLevel, (float)(num - 1), 0f, TextureInspector.s_Styles.previewSlider, TextureInspector.s_Styles.previewSliderThumb, new GUILayoutOption[]
			{
				GUILayout.MaxWidth(64f)
			}));
			GUILayout.Box(TextureInspector.s_Styles.largeZoom, TextureInspector.s_Styles.previewLabel, new GUILayoutOption[0]);
			GUI.enabled = true;
		}
コード例 #5
0
 public override void OnPreviewSettings()
 {
   if (this.IsCubemap())
   {
     this.m_CubemapPreview.OnPreviewSettings(this.targets);
   }
   else
   {
     if (TextureInspector.s_Styles == null)
       TextureInspector.s_Styles = new TextureInspector.Styles();
     Texture target1 = this.target as Texture;
     bool flag1 = true;
     bool flag2 = false;
     bool flag3 = true;
     int a = 1;
     if (this.target is Texture2D || this.target is ProceduralTexture)
     {
       flag2 = true;
       flag3 = false;
     }
     foreach (Texture target2 in this.targets)
     {
       TextureFormat format = (TextureFormat) 0;
       bool flag4 = false;
       if (target2 is Texture2D)
       {
         format = (target2 as Texture2D).format;
         flag4 = true;
       }
       else if (target2 is ProceduralTexture)
       {
         format = (target2 as ProceduralTexture).format;
         flag4 = true;
       }
       if (flag4)
       {
         if (!TextureUtil.IsAlphaOnlyTextureFormat(format))
           flag2 = false;
         if (TextureUtil.HasAlphaTextureFormat(format) && TextureUtil.GetUsageMode(target2) == TextureUsageMode.Default)
           flag3 = true;
       }
       a = Mathf.Max(a, TextureUtil.CountMipmaps(target2));
     }
     if (flag2)
     {
       this.m_ShowAlpha = true;
       flag1 = false;
     }
     else if (!flag3)
     {
       this.m_ShowAlpha = false;
       flag1 = false;
     }
     if (flag1 && !TextureInspector.IsNormalMap(target1))
       this.m_ShowAlpha = GUILayout.Toggle(this.m_ShowAlpha, !this.m_ShowAlpha ? TextureInspector.s_Styles.RGBIcon : TextureInspector.s_Styles.alphaIcon, TextureInspector.s_Styles.previewButton, new GUILayoutOption[0]);
     GUI.enabled = a != 1;
     GUILayout.Box(TextureInspector.s_Styles.smallZoom, TextureInspector.s_Styles.previewLabel, new GUILayoutOption[0]);
     GUI.changed = false;
     this.m_MipLevel = Mathf.Round(GUILayout.HorizontalSlider(this.m_MipLevel, (float) (a - 1), 0.0f, TextureInspector.s_Styles.previewSlider, TextureInspector.s_Styles.previewSliderThumb, GUILayout.MaxWidth(64f)));
     GUILayout.Box(TextureInspector.s_Styles.largeZoom, TextureInspector.s_Styles.previewLabel, new GUILayoutOption[0]);
     GUI.enabled = true;
   }
 }