public static GetPropertyColor ( string name ) : Color | ||
name | string | |
리턴 | Color |
public static Color GetPropertyColor(string name)
{
Color white = Color.white;
int num = 0;
if (name.StartsWith("m_LocalPosition"))
{
num = 1;
}
if (name.StartsWith("localEulerAngles"))
{
num = 2;
}
if (name.StartsWith("m_LocalScale"))
{
num = 3;
}
if (num == 1)
{
if (name.EndsWith(".x"))
{
white = Handles.xAxisColor;
}
else if (name.EndsWith(".y"))
{
white = Handles.yAxisColor;
}
else if (name.EndsWith(".z"))
{
white = Handles.zAxisColor;
}
}
else if (num == 2)
{
if (name.EndsWith(".x"))
{
white = (Color) AnimEditor.kEulerXColor;
}
else if (name.EndsWith(".y"))
{
white = (Color) AnimEditor.kEulerYColor;
}
else if (name.EndsWith(".z"))
{
white = (Color) AnimEditor.kEulerZColor;
}
}
else if (num == 3)
{
if (name.EndsWith(".x"))
{
white = GetBalancedColor(new Color(0.7f, 0.4f, 0.4f));
}
else if (name.EndsWith(".y"))
{
white = GetBalancedColor(new Color(0.4f, 0.7f, 0.4f));
}
else if (name.EndsWith(".z"))
{
white = GetBalancedColor(new Color(0.4f, 0.4f, 0.7f));
}
}
else if (name.EndsWith(".x"))
{
white = Handles.xAxisColor;
}
else if (name.EndsWith(".y"))
{
white = Handles.yAxisColor;
}
else if (name.EndsWith(".z"))
{
white = Handles.zAxisColor;
}
else if (name.EndsWith(".w"))
{
white = new Color(1f, 0.5f, 0f);
}
else if (name.EndsWith(".r"))
{
white = GetBalancedColor(Color.red);
}
else if (name.EndsWith(".g"))
{
white = GetBalancedColor(Color.green);
}
else if (name.EndsWith(".b"))
{
white = GetBalancedColor(Color.blue);
}
else if (name.EndsWith(".a"))
{
white = GetBalancedColor(Color.yellow);
}
else if (name.EndsWith(".width"))
{
white = GetBalancedColor(Color.blue);
}
else if (name.EndsWith(".height"))
{
white = GetBalancedColor(Color.yellow);
}
else
{
float f = 6.283185f * (name.GetHashCode() % 0x3e8);
f -= Mathf.Floor(f);
white = GetBalancedColor(Color.HSVToRGB(f, 1f, 1f));
}
white.a = 1f;
return white;
}
public void RefreshCurves() { if (m_ClipDataSource == null || m_Selection == null) { return; } var bindings = new List <EditorCurveBinding>(); foreach (int s in m_Selection) { var item = (CurveTreeViewNode)m_TreeView.FindItem(s); if (item != null && item.bindings != null) { bindings.AddRange(item.bindings); } } AnimationClip clip = m_ClipDataSource.animationClip; var wrappers = new List <CurveWrapper>(); int curveWrapperId = 0; foreach (EditorCurveBinding b in bindings) { var wrapper = new CurveWrapper { id = curveWrapperId++, binding = b, groupId = -1, color = CurveUtility.GetPropertyColor(b.propertyName), hidden = false, readOnly = false, renderer = new NormalCurveRenderer(AnimationUtility.GetEditorCurve(clip, b)), getAxisUiScalarsCallback = GetAxisScalars }; wrapper.renderer.SetCustomRange(0.0f, clip.length); wrappers.Add(wrapper); } m_CurveEditor.animationCurves = wrappers.ToArray(); }