private void DrawNodeContents()
{
var style = new GUIStyle(EditorStyles.label);
style.alignment = TextAnchor.MiddleCenter;
var connectionNodeStyleOutput = new GUIStyle(EditorStyles.label);
connectionNodeStyleOutput.alignment = TextAnchor.MiddleRight;
var connectionNodeStyleInput = new GUIStyle(EditorStyles.label);
connectionNodeStyleInput.alignment = TextAnchor.MiddleLeft;
var nodeTitleRect = new Rect(0, 0, m_baseRect.width * scaleFactor, m_baseRect.height * scaleFactor);
GUI.Label(nodeTitleRect, Name, style);
if (m_running) {
EditorGUI.ProgressBar(new Rect(10f, m_baseRect.height - 20f, m_baseRect.width - 20f, 10f), m_progress, string.Empty);
}
if (m_hasErrors) {
GUIStyle errorStyle = new GUIStyle("CN EntryError");
errorStyle.alignment = TextAnchor.MiddleCenter;
var labelSize = GUI.skin.label.CalcSize(new GUIContent(Name));
EditorGUI.LabelField(new Rect((nodeTitleRect.width - labelSize.x )/2.0f - 28f, (nodeTitleRect.height-labelSize.y)/2.0f - 7f, 20f, 20f), string.Empty, errorStyle);
}
// draw & update connectionPoint button interface.
if (scaleFactor == SCALE_MAX) {
Action<ConnectionPointData> drawConnectionPoint = (ConnectionPointData point) =>
{
var label = point.Label;
if( label != AssetBundleGraphSettings.DEFAULT_INPUTPOINT_LABEL &&
label != AssetBundleGraphSettings.DEFAULT_OUTPUTPOINT_LABEL)
{
var region = point.Region;
// if point is output node, then label position offset is minus. otherwise plus.
var xOffset = (point.IsOutput) ? - m_baseRect.width : AssetBundleGraphGUISettings.INPUT_POINT_WIDTH;
var labelStyle = (point.IsOutput) ? connectionNodeStyleOutput : connectionNodeStyleInput;
var labelRect = new Rect(region.x + xOffset, region.y - (region.height/2), m_baseRect.width, region.height*2);
GUI.Label(labelRect, label, labelStyle);
}
GUI.backgroundColor = Color.clear;
Texture2D tex = (point.IsInput)? NodeGUIUtility.inputPointTex : NodeGUIUtility.outputPointTex;
GUI.Button(point.Region, tex, "AnimationKeyframeBackground");
};
m_data.InputPoints.ForEach(drawConnectionPoint);
m_data.OutputPoints.ForEach(drawConnectionPoint);
}
}