void PaintWires() { Color color; float wireWidth; for (int i = 0; i < mGraph.Layers; i++) { uint layer = 1u << i; if ((mPaintLayers & layer) == 0) { continue; } for (int j = 0; j < mGraph.PathLength(i); j++) { int from, to; mGraph.PathAt(i, j, out from, out to); GraphNode fromNode = graph[from]; GraphNode toNode = graph[to]; for (int n = 0; n < fromNode.SocketCount; n++) { tmpSockA = fromNode.GetSocket(n); if (tmpSockA.layer != i) { continue; } if (!toNode.GetSocket(tmpSockA.toPort, ref tmpSockB)) { continue; } GetWireColorAndWidth(fromNode, tmpSockA, toNode, tmpSockB, out color, out wireWidth); DrawBezierWire(tmpSockA, tmpSockB, tmpSockA.GetSockPos(fromNode.ClipRect), tmpSockB.GetSockPos(toNode.ClipRect), color, wireWidth); } } } }
public NodeConnection(NodeSocket startSocket, NodeSocket endSocket, Color connectionColor, bool isEntryConnection) { StartSocket = startSocket; EndSocket = endSocket; ConnectionColor = connectionColor; IsEntryConnection = isEntryConnection; }
public override object GetValue(NodeSocket socket) { float px = GetInputValue <float>("x"); float py = GetInputValue <float>("y"); float pz = GetInputValue <float>("z"); FastNoise noiseGenerator = new FastNoise(); noiseGenerator.SetGradientPerturbAmp(GetInputValue <float>("amp")); noiseGenerator.GradientPerturb(ref px, ref py, ref pz); if (socket.FieldName == "newX") { return(px); } if (socket.FieldName == "newY") { return(py); } if (socket.FieldName == "newZ") { return(pz); } return(default(float)); }
protected override void OnNodeSocketDisconnect(NodeSocket sink, NodeSocket source) { base.OnNodeSocketDisconnect(sink, source); _value.Text = "0"; source.SocketDataOutgoingEvent -= OnSourceSocketDataOutgoingEvent; }
public NodeActions(AmUser myAmUser) { MySocket = new NodeSocket(myAmUser.WAS.KkoID); MyUser = myAmUser; Ag.LogIntenseWord("NodeActions :: Creating >>>>>>> " + MySocket.mName + " <<<<<<< "); MySocket.dlgtConnect += () => { MySocket.ActionUser(); }; MySocket.dlgtJoinAsVisitor += () => { if (AmHost.HasValue) { Ag.LogString(MySocket.mName + "_____ AmHost.HasValue _____ " + AmHost.Value + " will be set as false "); } AmHost = false; }; MySocket.dlgtReverseHostVstr += () => { Ag.LogIntenseWord(MySocket.mName + " MySocket.dlgtReverseHostVstr += () => From " + AmHost); AmHost = !AmHost; }; MakeConnect(); }
public override object GetValue(NodeSocket socket) { FastNoise noiseGenerator = new FastNoise(); noiseGenerator.SetFractalGain(GetInputValue <float>("gain")); noiseGenerator.SetFractalLacunarity(GetInputValue <float>("lacunarity")); noiseGenerator.SetFractalOctaves(GetInputValue <int>("octaves")); noiseGenerator.SetFractalType(GetInputValue <FastNoise.FractalType>("type")); return(noiseGenerator.GetSimplexFractal(GetInputValue <float>("x"), GetInputValue <float>("y"), GetInputValue <float>("z"))); }
public override object GetValue(NodeSocket socket) { FastNoise noiseGenerator = new FastNoise(); noiseGenerator.SetInterp(GetInputValue <FastNoise.Interp>("interp")); noiseGenerator.SetCellularJitter(GetInputValue <float>("jitter")); noiseGenerator.SetCellularDistanceFunction(GetSocket("distance").IsConnected ? GetInputValue <FastNoise.CellularDistanceFunction>("distance") : FastNoise.CellularDistanceFunction.Euclidean); noiseGenerator.SetCellularReturnType(GetSocket("returnType").IsConnected ? GetInputValue <FastNoise.CellularReturnType>("returnType") : FastNoise.CellularReturnType.CellValue); return(noiseGenerator.GetCellular(GetInputValue <float>("x"), GetInputValue <float>("y"), GetInputValue <float>("z"))); }
public ResultNode() { Label = "Result"; _value = new Label("0") { Xalign = -1.0f }; _nodeSocket = ItemAdd(_value, NodeSocketIO.Sink, 1); }
public bool GetSocket(int port, ref NodeSocket sock) { for (int i = 0; i < mSockets.Length; i++) { if (mSockets[i].sockPort == port) { sock = mSockets[i]; return(true); } } return(false); }
public virtual void OnSocketsGUI(GraphViewEditorWindow window) { for (int i = 0; i < mSockets.Length; i++) { NodeSocket sock = mSockets[i]; if ((sock.layerMask & window.PaintLayers) == 0) { continue; } OnSocketGUI(window, mSockets[i]); } }
public override object GetValue(NodeSocket socket) { if (socket.FieldName == "x") { return(GetInputValue <Vector2>("vector").x); } if (socket.FieldName == "y") { return(GetInputValue <Vector2>("vector").y); } return(default(float)); }
protected virtual void OnSocketGUI(GraphViewEditorWindow window, NodeSocket sock) { Rect rect = new Rect(); rect.size = new Vector2(PixelSize.x - 40, 15); rect.center = sock.GetSockPos(ClipRect) + Vector2.up * 8 * (sock.uvCoord.y == 0 ? 1 : -1); if (window.mShowContextMenu) { GUI.Label(rect, "", "Icon.ClipSelected"); } else if (GUI.Button(rect, "", "Icon.ClipSelected")) { window.CreateConnection(this, sock.layer, sock.sockPort, sock.toPort); } }
protected virtual bool TryConnectNode(int layer, NodeSocket sockA, NodeSocket sockB, GraphNode startNode, GraphNode endNode) { if (sockA.toPort != sockB.sockPort) { return(false); } if (sockA.layer != -1) { mGraph.AddPath(layer, startNode, endNode); return(true); } if (!endNode.GetSocket(sockB.sockPort, ref tmpSockA) || tmpSockA.toPort != sockA.sockPort) { return(false); } mGraph.AddPath(tmpSockA.layer, endNode, startNode); return(true); }
protected override void OnNodeSocketDisconnect(NodeSocket sink, NodeSocket source) { base.OnNodeSocketDisconnect(sink, source); if (sink == _a) { _s1.Visible = true; } if (sink == _b) { _s2.Visible = true; } sink.SocketDataIncomingEvent -= OnSourceSocketDataIncoming; _o.Write(DoOperation(_s1.Value, _s2.Value)); }
protected override void OnInitChildren() { HBox aBox = new HBox(false, 4); HBox bBox = new HBox(false, 4); _s1.Hexpand = true; _s2.Hexpand = true; aBox.Add(new Label("A") { Visible = true, Halign = Align.Start, Valign = Align.Center, Hexpand = false, Vexpand = false }); aBox.Add(_s1); bBox.Add(new Label("B") { Visible = true, Halign = Align.Start, Valign = Align.Center, Hexpand = false, Vexpand = false }); bBox.Add(_s2); _a = ItemAdd(aBox, NodeSocketIO.Sink, 1); Add(_op); _b = ItemAdd(bBox, NodeSocketIO.Sink, 1); _o = ItemAdd(new Label("Result") { Xalign = 1.0f }, NodeSocketIO.Source, 1); _s1.ValueChanged += OnOperandValueChanged; _s2.ValueChanged += OnOperandValueChanged; _op.Changed += OnOperandValueChanged; }
protected override void OnNodeSocketConnect(NodeSocket sink, NodeSocket source) { base.OnNodeSocketConnect(sink, source); source.SocketDataOutgoingEvent += OnSourceSocketDataOutgoingEvent; }
public override object GetValue(NodeSocket socket) { return(GetInputValue <Vector2>("a") + GetInputValue <Vector2>("b")); }
public override object GetValue(NodeSocket socket) { return(Mathf.Clamp01(GetInputValue <float>("f"))); }
public override object GetValue(NodeSocket socket) { FastNoise noiseGenerator = new FastNoise(); return(noiseGenerator.GetWhiteNoise(GetInputValue <float>("x"), GetInputValue <float>("y"), GetInputValue <float>("z"))); }
public override object GetValue(NodeSocket socket) { return(new Vector2(GetInputValue <float>("x"), GetInputValue <float>("y"))); }
public override object GetValue(NodeSocket socket) { return(FastNoise.FractalType.FBM); }
public override object GetValue(NodeSocket socket) { return(FastNoise.Interp.Quintic); }
public override object GetValue(NodeSocket socket) { return(FastNoise.Interp.Hermite); }
public override object GetValue(NodeSocket socket) { return(FastNoise.CellularDistanceFunction.Euclidean); }
public override object GetValue(NodeSocket socket) { return(GetInputValue <float>("a") / GetInputValue <float>("b")); }
protected virtual void DrawBezierWire(NodeSocket sockA, NodeSocket sockB, Vector2 p0, Vector2 p1, Color color, float width) { Handles.DrawBezier(p0, p1, p0, p1, color, null, width); }
public override object GetValue(NodeSocket socket) { return(socket.FloatFieldValue); }
protected virtual void GetWireColorAndWidth(GraphNode nodeA, NodeSocket sockA, GraphNode nodeB, NodeSocket sockB, out Color color, out float width) { width = 3; color = nodeB == null ? Color.yellow : Color.white; }
public override object GetValue(NodeSocket socket) { return(Graph.ActiveTerrain == null ? default(Vector2) : Graph.CurrentUV); }
public override object GetValue(NodeSocket socket) { return(FastNoise.CellularReturnType.Distance); }