Пример #1
0
        public void DrawTypecastButton(Rect r, SF_NodeConnector con, bool isInput = false)
        {
            Rect closeRect = r.ClampWidth(0, (int)r.height);

            if (isInput)
            {
                GUI.color = new Color(1f, 0.7f, 0.7f, 1f);
                if (GUI.Button(closeRect, "-"))
                {
                    RemoveConnector(con, undoRecord: true);
                    return;
                }
                GUI.color = Color.white;
                r.xMin   += closeRect.width;
                Rect dropdownRect = r;
                dropdownRect.xMax -= 50;
                r.xMin            += dropdownRect.width;
                int cvtccBef = SF_Tools.ComponentCountOf(con.CustomValueType);
                //con.CustomValueType = (CustomValueType)EditorGUI.EnumPopup(dropdownRect, con.CustomValueType);
                con.CustomValueType = (CustomValueType)UndoableEnumPopup(dropdownRect, con.CustomValueType, "set input " + con.label + " value type");
                if (cvtccBef != SF_Tools.ComponentCountOf(con.CustomValueType))
                {
                    con.Disconnect();
                }
                string before = con.label;
                con.label = EditorGUI.TextField(r, con.label);
                if (con.label != before && con.label.Length > 0)
                {
                    con.label = SF_ShaderProperty.FormatInternalName(con.label);
                    UpdateExtraInputWidth();
                    OnUpdateNode(NodeUpdateType.Soft);
                }
            }
            else
            {
                int cvtccBef = SF_Tools.ComponentCountOf(con.CustomValueType);
                //con.CustomValueType = (CustomValueType)EditorGUI.EnumPopup(r, con.CustomValueType);
                con.CustomValueType = (CustomValueType)UndoableEnumPopup(r, con.CustomValueType, "set output value type");
                if (cvtccBef != SF_Tools.ComponentCountOf(con.CustomValueType))
                {
                    con.Disconnect();
                }
            }
        }
Пример #2
0
 public void CheckPropertyInput()
 {
     if (property != null && connectors[2].IsConnected())
     {
         shelvedProperty = property;
         property        = null;
         if (editor.nodeView.treeStatus.propertyList.Contains(this))
         {
             editor.nodeView.treeStatus.propertyList.Remove(this);
         }
     }
     else if (property == null && !connectors[2].IsConnected())
     {
         property        = shelvedProperty;
         shelvedProperty = null;
         if (!editor.nodeView.treeStatus.propertyList.Contains(this))
         {
             editor.nodeView.treeStatus.propertyList.Add(this);
         }
     }
 }