Skip to content

Commit

Permalink
マテリアルのMixedValue表示の対応プロパティの追加
Browse files Browse the repository at this point in the history
  • Loading branch information
CA-Tatami committed Feb 20, 2024
1 parent d06d21c commit 81130ad
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Assets/Nova/Editor/Core/Scripts/MaterialEditorUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,11 @@ public static void DrawSmallTexture(MaterialEditor editor, string label, Materia
textureRect.width = mapHeight;
using (var changeCheckScope = new EditorGUI.ChangeCheckScope())
{
EditorGUI.showMixedValue = textureProp.hasMixedValue;
var texture = (Texture)EditorGUI.ObjectField(textureRect, textureProp.textureValue,
textureType,
false);
EditorGUI.showMixedValue = false;
if (changeCheckScope.changed)
{
editor.RegisterPropertyChangeUndo(textureProp.name);
Expand Down Expand Up @@ -342,8 +344,10 @@ private static void DrawTexture(MaterialEditor editor, MaterialProperty textureP

using (var changeCheckScope = new EditorGUI.ChangeCheckScope())
{
EditorGUI.showMixedValue = textureProperty.hasMixedValue;
var texture = (Texture)EditorGUI.ObjectField(textureRect, textureProperty.textureValue, textureType,
false);
EditorGUI.showMixedValue = false;
if (changeCheckScope.changed)
{
editor.RegisterPropertyChangeUndo(textureProperty.name);
Expand Down Expand Up @@ -375,7 +379,6 @@ private static void DrawTexture(MaterialEditor editor, MaterialProperty textureP
if (drawTilingAndOffset)
using (var changeCheckScope = new EditorGUI.ChangeCheckScope())
{
;
var textureScaleAndOffset = textureProperty.textureScaleAndOffset;
var tiling = new Vector2(textureScaleAndOffset.x, textureScaleAndOffset.y);
var offset = new Vector2(textureScaleAndOffset.z, textureScaleAndOffset.w);
Expand Down Expand Up @@ -574,8 +577,9 @@ public static void DrawToggleProperty(MaterialEditor editor, string label, Mater
using (var ccs = new EditorGUI.ChangeCheckScope())
{
EditorGUI.showMixedValue = property.hasMixedValue;
isOn = EditorGUI.Toggle(rect, isOn);
EditorGUI.showMixedValue = false;
if (ccs.changed)
{
editor.RegisterPropertyChangeUndo(property.name);
Expand All @@ -599,7 +603,9 @@ public static void DrawVector2Property(MaterialEditor editor, string label, Mate
using (var ccs = new EditorGUI.ChangeCheckScope())
{
EditorGUI.showMixedValue = property.hasMixedValue;
value = EditorGUI.Vector2Field(rect, string.Empty, value);
EditorGUI.showMixedValue = false;
if (ccs.changed)
{
Expand Down

0 comments on commit 81130ad

Please sign in to comment.