public override void OnBodyGUI()
    {
        NodeEditorGUILayout.PortField(target.GetPort("input"));

        OutNode noiseNode  = target as OutNode;
        Rect    lastRect   = GUILayoutUtility.GetLastRect();
        Rect    toggleRect = new Rect(lastRect)
        {
            width  = 18,
            height = 18,
            y      = lastRect.y + EditorGUIUtility.singleLineHeight,
            x      = (GetWidth() - 18f) / 2
        };

        noiseNode.ShowTextureInEditor = EditorGUI.Toggle(toggleRect, noiseNode.ShowTextureInEditor, NodeEditorResources.styles.preview);
        GUILayoutUtility.GetRect(toggleRect.width, toggleRect.height);

        if (noiseNode.ShowTextureInEditor)
        {
            if (noiseNode.HasTexture)
            {
                Rect textureRect = new Rect(toggleRect)
                {
                    width  = GetWidth() * 0.95f,
                    height = GetWidth() * 0.8f / noiseNode.GetGraph.Ratio,
                    y      = toggleRect.y + EditorGUIUtility.singleLineHeight * 2
                };
                textureRect.x = (GetWidth() - textureRect.width) / 2;
                GUILayoutUtility.GetRect(textureRect.width, textureRect.height + EditorGUIUtility.singleLineHeight);
                EditorGUI.DrawPreviewTexture(textureRect, noiseNode.GetInputTexture);
            }
        }
    }
        public override void UpdateWeight(double newValue)
        {
            var momentum = OutNode.GetNodeValue(MomentumIndex);

            // and percent of last change
            Values[WeightIndex] += (newValue + (momentum * Values[DeltaIndex]));   // Update weight with current change

            // Store current change for next time
            Values[DeltaIndex] = newValue;
        }
    public override int GetWidth()
    {
        OutNode noiseNode = target as OutNode;

        if (noiseNode != null && noiseNode.HasTexture)
        {
            return((int)(150 * noiseNode.GetGraph.Ratio));
        }
        return(base.GetWidth());
    }
    public Texture2D GetTexture()
    {
        OutNode outNode = nodes.Find(n => n is OutNode) as OutNode;

        if (outNode == null)
        {
            Debug.Log($"{nameof(outNode)} is null");
            return(null);
        }

        return(outNode.GetTexture());
    }
        public virtual double GetWeightedError(int index, LinkDirection direction)
        {
            var val = 0.0;

            switch (direction)
            {
            case LinkDirection.Input:
                val = Values[WeightIndex] * InNode.GetNodeError(index);
                break;

            case LinkDirection.Output:
                val = Values[WeightIndex] * OutNode.GetNodeError(index);
                break;
            }
            return(val);
        }
    public void ApplyMapSize()
    {
        OutNode outNode = nodes.Find(n => n is OutNode) as OutNode;

        if (outNode == null)
        {
            Debug.Log($"{nameof(outNode)} is null");
            return;
        }

        foreach (var node in nodes)
        {
            var noiseNode = node as NoiseNode;

            if (noiseNode != null)
            {
                noiseNode.RefreshTexture();
                noiseNode.SetTextureDirty();
            }
        }

        outNode.GenerateTexture();
    }
 public virtual double GetOutValue(int index)
 {
     return(OutNode.GetNodeValue(index));
 }