feat: allow zero for scale

pull/197/head
mob-sakai 2021-09-21 16:24:38 +09:00
parent 8c345ddd0c
commit 4e651fac97
2 changed files with 4 additions and 26 deletions

View File

@ -238,14 +238,7 @@ namespace Coffee.UIExtensions
EditorGUILayout.BeginHorizontal(); EditorGUILayout.BeginHorizontal();
if (showXyz) if (showXyz)
{ {
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(sp); EditorGUILayout.PropertyField(sp);
if (EditorGUI.EndChangeCheck())
{
x.floatValue = Mathf.Max(0.001f, x.floatValue);
y.floatValue = Mathf.Max(0.001f, y.floatValue);
z.floatValue = Mathf.Max(0.001f, z.floatValue);
}
} }
else else
{ {
@ -253,9 +246,7 @@ namespace Coffee.UIExtensions
EditorGUILayout.PropertyField(x, s_ContentScale); EditorGUILayout.PropertyField(x, s_ContentScale);
if (EditorGUI.EndChangeCheck()) if (EditorGUI.EndChangeCheck())
{ {
x.floatValue = Mathf.Max(0.001f, x.floatValue); y.floatValue = z.floatValue = x.floatValue;
y.floatValue = Mathf.Max(0.001f, x.floatValue);
z.floatValue = Mathf.Max(0.001f, x.floatValue);
} }
} }

View File

@ -28,10 +28,7 @@ namespace Coffee.UIExtensions
[HideInInspector] [SerializeField] internal bool m_IsTrail = false; [HideInInspector] [SerializeField] internal bool m_IsTrail = false;
[Tooltip("Particle effect scale")] [SerializeField] [Tooltip("Particle effect scale")] [SerializeField]
float m_Scale = 100; private Vector3 m_Scale3D = new Vector3(10, 10, 10);
[Tooltip("Particle effect scale")] [SerializeField]
private Vector3 m_Scale3D;
[Tooltip("Animatable material properties. If you want to change the material properties of the ParticleSystem in Animation, enable it.")] [SerializeField] [Tooltip("Animatable material properties. If you want to change the material properties of the ParticleSystem in Animation, enable it.")] [SerializeField]
internal AnimatableProperty[] m_AnimatableProperties = new AnimatableProperty[0]; internal AnimatableProperty[] m_AnimatableProperties = new AnimatableProperty[0];
@ -86,11 +83,7 @@ namespace Coffee.UIExtensions
public float scale public float scale
{ {
get { return m_Scale3D.x; } get { return m_Scale3D.x; }
set set { m_Scale3D = new Vector3(value, value, value); }
{
m_Scale = Mathf.Max(0.001f, value);
m_Scale3D = new Vector3(m_Scale, m_Scale, m_Scale);
}
} }
/// <summary> /// <summary>
@ -99,13 +92,7 @@ namespace Coffee.UIExtensions
public Vector3 scale3D public Vector3 scale3D
{ {
get { return m_Scale3D; } get { return m_Scale3D; }
set set { m_Scale3D = value; }
{
if (m_Scale3D == value) return;
m_Scale3D.x = Mathf.Max(0.001f, value.x);
m_Scale3D.y = Mathf.Max(0.001f, value.y);
m_Scale3D.z = Mathf.Max(0.001f, value.z);
}
} }
internal Mesh bakedMesh internal Mesh bakedMesh