Beispiel #1
0
 private void AddExistingPort(NodeWeightedLink nwLink, Port port, BaseNode inNode)
 {
     if (!String.IsNullOrEmpty(nwLink.otherNodeID))
     {
         BaseNode node    = NodeByGuid(nwLink.otherNodeID);
         Port     outPort = null;
         if (node is ScorerNode)
         {
             outPort = ((ScorerNode)node).outPort;
         }
         else if (node is QualiScorerNode)
         {
             outPort = ((QualiScorerNode)node).outPort;
         }
         if (outPort != null)
         {
             Edge edge = new Edge()
             {
                 output = outPort,
                 input  = port
             };
             port.Connect(edge);
             outPort.Connect(edge);
             Add(edge);
         }
     }
     inNode.Refresh();
 }
Beispiel #2
0
        public Port AddInputPort(NodeWeightedLink existingLink, SerializedProperty nodeLink)
        {
            Port port = AddPort("", Orientation.Horizontal, Direction.Input, Port.Capacity.Single);
            LimitedFloatField weightField = new LimitedFloatField(0, 1);

            weightField.BindProperty(nodeLink);
            port.contentContainer.Add(weightField);
            Refresh();
            return(port);
        }
Beispiel #3
0
        private void AddExistingQualifierPort(QualifierNode qNode, int qIndex, int nwIndex)
        {
            NodeWeightedLink nwLink = graphData.qualifiers[qIndex].inLinks[nwIndex];

            SaveGraphData();
            SerializedProperty serNWL = graphDataSerialized
                                        .FindProperty("qualifiers")
                                        .GetArrayElementAtIndex(qIndex)
                                        .FindPropertyRelative("inLinks")
                                        .GetArrayElementAtIndex(nwIndex)
                                        .FindPropertyRelative("weight");
            Port port = qNode.AddInputPort(nwLink, serNWL);

            AddExistingPort(nwLink, port, qNode);
        }
Beispiel #4
0
        private void AddNewQualifierPort(QualifierNode qNode, int qIndex)
        {
            NodeWeightedLink nwLink = new NodeWeightedLink();

            nwLink.otherNodeID = "";
            nwLink.weight      = 0.5f;
            graphData.qualifiers[qIndex].inLinks.Add(nwLink);
            int linkIndex = graphData.qualifiers[qIndex].inLinks.Count - 1;

            SaveGraphData();
            SerializedProperty serNWL = graphDataSerialized
                                        .FindProperty("qualifiers")
                                        .GetArrayElementAtIndex(qIndex)
                                        .FindPropertyRelative("inLinks")
                                        .GetArrayElementAtIndex(linkIndex)
                                        .FindPropertyRelative("weight");

            qNode.AddInputPort(nwLink, serNWL);
        }