Exemplo n.º 1
0
 public CreateNodeOnEdgeAction(IEdgeModel edgeModel, Vector2 position,
                               GraphNodeModelSearcherItem selectedItem)
 {
     EdgeModel    = edgeModel;
     Position     = position;
     SelectedItem = selectedItem;
 }
Exemplo n.º 2
0
 public CreateNodeFromSearcherAction(IGraphModel graphModel, Vector2 position,
                                     GraphNodeModelSearcherItem selectedItem)
 {
     GraphModel   = graphModel;
     Position     = position;
     SelectedItem = selectedItem;
 }
 public CreateNodeFromSearcherAction(IGraphModel graphModel, Vector2 position,
                                     GraphNodeModelSearcherItem selectedItem, IReadOnlyList <GUID> guids = null)
 {
     GraphModel   = graphModel;
     Position     = position;
     SelectedItem = selectedItem;
     Guids        = guids;
 }
 public CreateNodeOnEdgeAction(IEdgeModel edgeModel, Vector2 position,
                               GraphNodeModelSearcherItem selectedItem, GUID?guid = null)
 {
     EdgeModel    = edgeModel;
     Position     = position;
     SelectedItem = selectedItem;
     Guid         = guid;
 }
 public CreateNodeFromOutputPortAction(IPortModel portModel, Vector2 position,
                                       GraphNodeModelSearcherItem selectedItem, IEnumerable <IGTFEdgeModel> edgesToDelete = null)
 {
     PortModel     = portModel;
     Position      = position;
     SelectedItem  = selectedItem;
     EdgesToDelete = edgesToDelete ?? Enumerable.Empty <IGTFEdgeModel>();
 }
Exemplo n.º 6
0
#pragma warning restore CS0649
#pragma warning restore CS0414

        void CreateNodesAndValidateGraphModel(GraphNodeModelSearcherItem item, SpawnFlags mode,
                                              Action <List <INodeModel> > assertNodesCreation)
        {
            var initialNodes = GraphModel.NodeModels.ToList();
            var initialEdges = GraphModel.EdgeModels.ToList();

            item.CreateElements.Invoke(new GraphNodeCreationData(GraphModel, Vector2.zero, mode));

            // If nodes are created as Orphan, graphModel should not be modified
            if (mode.IsOrphan())
            {
                CollectionAssert.AreEqual(initialNodes, GraphModel.NodeModels);
                CollectionAssert.AreEqual(initialEdges, GraphModel.EdgeModels);
                return;
            }

            assertNodesCreation.Invoke(initialNodes);
        }
Exemplo n.º 7
0
        public override List <SearcherDatabase> GetDynamicSearcherDatabases(IPortModel portModel)
        {
            var dbs = base.GetDynamicSearcherDatabases(portModel);

            if (portModel == null) // graph searcher
            {
                var    rngDb = new GraphElementSearcherDatabase(m_Stencil);
                string title = RandomNodeModel.k_DefaultRngTitle;
                var    node  = new GraphNodeModelSearcherItem(
                    new NodeSearcherItemData(typeof(RandomNodeModel)),
                    data => data.CreateNode <RandomNodeModel>(title),
                    title
                    );
                rngDb.Items.Add(node);
                dbs.Add(rngDb.Build());
                return(dbs);
            }

            // input to graph
            if (RandomNodeModel.RngByType.TryGetValue(portModel.DataType.Resolve(portModel.NodeModel.GraphModel.Stencil), out var methods))
            {
                var rngDb = new GraphElementSearcherDatabase(m_Stencil);
                foreach (var method in methods)
                {
                    if (method == RandomNodeModel.DefaultMethod)
                    {
                        continue;
                    }
                    string title = RandomNodeModel.MakeTitle(method);
                    var    node  = new GraphNodeModelSearcherItem(
                        new NodeSearcherItemData(typeof(RandomNodeModel)),
                        data => data.CreateNode <RandomNodeModel>(title),
                        title
                        );
                    rngDb.Items.Add(node);
                }
                dbs.Add(rngDb.Build());
            }
            return(dbs);
        }