This commit is contained in:
SoulliesOfficial
2025-12-17 04:19:38 -05:00
parent 7c1cb7e8e1
commit d15957c719
4315 changed files with 8260710 additions and 2940 deletions

View File

@@ -0,0 +1,38 @@
#if UNITY_EDITOR
using UnityEditor;
using UnityEngine;
namespace GraphicsCat.MarkupShaderGUIInternal
{
public static class PropertyUtils
{
public static int GetAsInt(MaterialProperty prop)
{
return prop.propertyType switch
{
UnityEngine.Rendering.ShaderPropertyType.Int => prop.intValue,
UnityEngine.Rendering.ShaderPropertyType.Float => Mathf.RoundToInt(prop.floatValue),
_ => 0
};
}
public static void SetAsInt(MaterialProperty prop, int value)
{
switch (prop.propertyType)
{
case UnityEngine.Rendering.ShaderPropertyType.Int:
prop.intValue = value;
break;
case UnityEngine.Rendering.ShaderPropertyType.Float:
prop.floatValue = value;
break;
default:
// Unsupported type, do nothing
break;
}
}
}
}
#endif