FloatField() public static method

Mimics UnityEditor.EditorGUILayout.FloatField by taking a label and a float and returning the edited float.
public static FloatField ( GUIContent label, float value, object callingObj ) : float
label GUIContent
value float
callingObj object
return float
Exemplo n.º 1
0
    public override void NodeGUI()
    {
        value = GUIExt.FloatField(new GUIContent("Value", "The input value of type float"), value);
        OutputKnob(0);

        if (GUI.changed)
        {
            NodeEditor.RecalculateFrom(this);
        }
    }
Exemplo n.º 2
0
    public override void NodeGUI()
    {
        GUILayout.BeginHorizontal();
        GUILayout.BeginVertical();

        if (Inputs [0].connection != null)
        {
            GUILayout.Label(Inputs [0].name);
        }
        else
        {
            Input1Val = GUIExt.FloatField(GUIContent.none, Input1Val);
        }
        InputKnob(0);
        // --
        if (Inputs [1].connection != null)
        {
            GUILayout.Label(Inputs [1].name);
        }
        else
        {
            Input2Val = GUIExt.FloatField(GUIContent.none, Input2Val);
        }
        InputKnob(1);

        GUILayout.EndVertical();
        GUILayout.BeginVertical();

        Outputs [0].DisplayLayout();

        GUILayout.EndVertical();
        GUILayout.EndHorizontal();

#if UNITY_EDITOR
        type = (CalcType)UnityEditor.EditorGUILayout.EnumPopup(new GUIContent("Calculation Type", "The type of calculation performed on Input 1 and Input 2"), type);
#else
        GUILayout.Label(new GUIContent("Calculation Type: " + type.ToString(), "The type of calculation performed on Input 1 and Input 2"));
#endif

        if (GUI.changed)
        {
            NodeEditor.RecalculateFrom(this);
        }
    }