Added GetEnumValue;
Added EnumFlagsDrawer; Added custom keywordName option to KeywordTexturePropertySingleLine;
This commit is contained in:
@@ -81,9 +81,9 @@ namespace Misaki.ShaderGUI
|
||||
/// <param name="label">The label of the texture property.</param>
|
||||
/// <param name="textureProperty">The texture property to draw.</param>
|
||||
/// <returns>True if the texture property is not null. Otherwise, false.</returns>
|
||||
public static bool KeywordTexturePropertySingleLine(this MaterialEditor editor, GUIContent label, MaterialProperty textureProperty)
|
||||
public static bool KeywordTexturePropertySingleLine(this MaterialEditor editor, GUIContent label, MaterialProperty textureProperty, string keywordName = null)
|
||||
{
|
||||
return KeywordTexturePropertySingleLine(editor, label, textureProperty, null, null);
|
||||
return KeywordTexturePropertySingleLine(editor, label, textureProperty, null, null, keywordName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -94,9 +94,9 @@ namespace Misaki.ShaderGUI
|
||||
/// <param name="textureProperty">The texture property to draw.</param>
|
||||
/// <param name="extraProperty">The first extra property to draw.</param>
|
||||
/// <returns>True if the texture property is not null. Otherwise, false.</returns>
|
||||
public static bool KeywordTexturePropertySingleLine(this MaterialEditor editor, GUIContent label, MaterialProperty textureProperty, MaterialProperty extraProperty)
|
||||
public static bool KeywordTexturePropertySingleLine(this MaterialEditor editor, GUIContent label, MaterialProperty textureProperty, MaterialProperty extraProperty, string keywordName = null)
|
||||
{
|
||||
return KeywordTexturePropertySingleLine(editor, label, textureProperty, extraProperty, null);
|
||||
return KeywordTexturePropertySingleLine(editor, label, textureProperty, extraProperty, null, keywordName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -108,13 +108,13 @@ namespace Misaki.ShaderGUI
|
||||
/// <param name="extraProperty1">The first extra property to draw.</param>
|
||||
/// <param name="extraProperty2">The second extra property to draw.</param>
|
||||
/// <returns>True if the texture property is not null. Otherwise, false.</returns>
|
||||
public static bool KeywordTexturePropertySingleLine(this MaterialEditor editor, GUIContent label, MaterialProperty textureProperty, MaterialProperty extraProperty1, MaterialProperty extraProperty2)
|
||||
public static bool KeywordTexturePropertySingleLine(this MaterialEditor editor, GUIContent label, MaterialProperty textureProperty, MaterialProperty extraProperty1, MaterialProperty extraProperty2, string keywordName = null)
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
editor.TexturePropertySingleLine(label, textureProperty, extraProperty1, extraProperty2);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
editor.SetKeyword(textureProperty.name.ToUpper(), textureProperty.textureValue != null);
|
||||
editor.SetKeyword(string.IsNullOrEmpty(keywordName) ? textureProperty.name.ToUpper() : keywordName, textureProperty.textureValue != null);
|
||||
}
|
||||
|
||||
return textureProperty.textureValue != null;
|
||||
|
||||
Reference in New Issue
Block a user