ParticleSystemCurveEditor.OnGUI C# (CSharp) Method

OnGUI() public method

public OnGUI ( Rect rect ) : void
rect Rect
return void
    public void OnGUI(Rect rect)
    {
        this.Init();
        if (s_Styles == null)
        {
            s_Styles = new Styles();
        }
        Rect position = new Rect(rect.x, rect.y, rect.width, rect.height - 30f);
        Rect rect3 = new Rect(rect.x, rect.y + position.height, rect.width, 30f);
        GUI.Label(position, GUIContent.none, s_Styles.curveEditorBackground);
        if (Event.current.type == EventType.Repaint)
        {
            this.m_CurveEditor.rect = position;
        }
        foreach (CurveWrapper wrapper in this.m_CurveEditor.animationCurves)
        {
            if ((wrapper.getAxisUiScalarsCallback != null) && (wrapper.setAxisUiScalarsCallback != null))
            {
                Vector2 newAxisScalars = wrapper.getAxisUiScalarsCallback();
                if (newAxisScalars.y > 1000000f)
                {
                    newAxisScalars.y = 1000000f;
                    wrapper.setAxisUiScalarsCallback(newAxisScalars);
                }
            }
        }
        this.m_CurveEditor.OnGUI();
        this.DoLabelForTopMostCurve(new Rect(rect.x + 4f, rect.y, rect.width, 20f));
        this.DoRemoveSelectedButton(new Rect(position.x, position.y, position.width, 24f));
        this.DoOptimizeCurveButton(rect3);
        rect3.x += 30f;
        rect3.width -= 60f;
        this.PresetCurveButtons(rect3, rect);
        this.SaveChangedCurves();
    }

Usage Example

示例#1
0
        private void WindowCurveEditorGUI(bool verticalLayout)
        {
            Rect rect;

            if (verticalLayout)
            {
                rect = GUILayoutUtility.GetRect(13, m_CurveEditorAreaHeight, GUILayout.MinHeight(m_CurveEditorAreaHeight));
            }
            else
            {
                EditorWindow win = (EditorWindow)m_Owner;
                System.Diagnostics.Debug.Assert(win != null);
                rect = GUILayoutUtility.GetRect(win.position.width - m_EmitterAreaWidth, win.position.height - 17);
            }

            // Get mouse down event before curve editor
            ResizeHandling(verticalLayout);

            m_ParticleSystemCurveEditor.OnGUI(rect);
        }