Skip to content

Commit

Permalink
fix: tweener properties are not rendered correctly in the Inspector i…
Browse files Browse the repository at this point in the history
…n the editor.

close #7
  • Loading branch information
mob-sakai committed Feb 4, 2025
1 parent 8715ebe commit ba22663
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions Packages/src/Editor/InjectionPropertyDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ public void OnGUI(Rect r, GUIContent label, string name, PropertyType type, Seri
: AnimationMode.animatedPropertyColor;
}

var wideMode = EditorGUIUtility.wideMode;
EditorGUIUtility.wideMode = true;
ReadFrom(name, type, prop, material);
var mp = MaterialEditor.GetMaterialProperty(_editor.targets, name);
if (type == PropertyType.Texture || mp.name != name)
Expand Down Expand Up @@ -173,6 +175,7 @@ public void OnGUI(Rect r, GUIContent label, string name, PropertyType type, Seri
}

GUI.backgroundColor = bg;
EditorGUIUtility.wideMode = wideMode;
}

private static bool IsValid(Material material, string propertyName, PropertyType type)
Expand Down
1 change: 0 additions & 1 deletion Packages/src/Editor/InjectionPropertyListDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public InjectionPropertyListDrawer(SerializedProperty prop) : base(prop.serializ
drawHeaderCallback = DrawHeaderCallback;
drawElementCallback = DrawElementCallback;
onAddDropdownCallback = OnAddDropdownCallback;
elementHeight = EditorGUIUtility.singleLineHeight + 2;
}

private void DrawElementCallback(Rect r, int i, bool _, bool __)
Expand Down
3 changes: 2 additions & 1 deletion Packages/src/Editor/UIMaterialPropertyInjectorEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ private void OnEnable()
{
postAddCallback = PostAddElement,
resetCallback = ResetCallback,
draggable = true
draggable = true,
elementHeight = EditorGUIUtility.singleLineHeight + 2
};
}

Expand Down
3 changes: 2 additions & 1 deletion Packages/src/Editor/UIMaterialPropertyTweenerEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ private void OnEnable()
{
postAddCallback = PostAddElement,
resetCallback = ResetCallback,
draggable = false
draggable = false,
elementHeight = (EditorGUIUtility.singleLineHeight + 2) * 2 + 2
};
}

Expand Down

0 comments on commit ba22663

Please sign in to comment.