Exemple #1
0
 private void DrawParameters(ConstellationEditorStyles editorStyles)
 {
     GUI.color = Color.white;
     if (NodeData.GetParameters() != null)
     {
         var i = 0;
         foreach (var parameter in NodeData.ParametersData)
         {
             var parameterControleName = NodeData.Guid + "-" + i;
             var isFocusable           = false;
             EditorGUIUtility.labelWidth = 25;
             EditorGUIUtility.fieldWidth = 10;
             var parameterRect     = GetParameterRect(i, editorStyles);
             var nodeAttributeRect = new Rect(NodeData.XPosition + 10, NodeData.YPosition + editorStyles.nodeTitleHeight, NodeData.SizeX - 20, NodeData.SizeY - editorStyles.nodeTitleHeight - 10);
             if (parameter.Value != null)
             {
                 GUI.SetNextControlName(parameterControleName);
                 var currentParameterValue = parameter.Value.GetString();
                 parameter.Value = ParametersStyleFactory.Draw(parameter.Type, parameterRect, nodeAttributeRect, parameter.Value, editorStyles, out isFocusable);
                 if (parameter.Value != null)
                 {
                     if (currentParameterValue != parameter.Value.GetString())
                     {
                         ParameterValueChanged(i);
                     }
                 }
             }
             if (GUI.GetNameOfFocusedControl() == parameterControleName && isFocusable)
             {
                 LastFocusedAttribute = parameterControleName;
             }
             i++;
         }
     }
 }
Exemple #2
0
        public NodeView(NodeData node)
        {
            changedParameters = new List <int>();
            NodeData          = node;
            if (node.OverrideDisplayedName == "")
            {
                nodeName = node.Name;
            }
            else
            {
                nodeName = node.OverrideDisplayedName;
            }
            LockNodeSize();
            LockNodePosition();

            foreach (var attribute in node.ParametersData)
            {
                attribute.Value = ParametersStyleFactory.Reset(attribute.Type, attribute.Value);
            }
        }