Exemple #1
0
        internal static void ShowEdgeNodes(State state, IEdgeModel edgeModel, Vector2 position,
                                           Action <GraphNodeModelSearcherItem> callback)
        {
            var stencil    = state.CurrentGraphModel.Stencil;
            var filter     = stencil.GetSearcherFilterProvider()?.GetEdgeSearcherFilter(edgeModel);
            var adapter    = new GraphNodeSearcherAdapter(state.CurrentGraphModel, "Insert Node");
            var dbProvider = stencil.GetSearcherDatabaseProvider();
            var dbs        = dbProvider.GetGraphElementsSearcherDatabases()
                             .Concat(dbProvider.GetTypeMembersSearcherDatabases(edgeModel.OutputPortModel.DataType))
                             .ToList();

            PromptSearcher(dbs, filter, adapter, position, callback);
        }
        internal static void ShowInputToGraphNodes(State state, IPortModel portModel, Vector2 position,
                                                   Action <GraphNodeModelSearcherItem> callback)
        {
            var stencil    = state.CurrentGraphModel.Stencil;
            var stackModel = portModel.NodeModel.ParentStackModel;
            var filter     = stencil.GetSearcherFilterProvider()?.GetInputToGraphSearcherFilter(portModel);
            var adapter    = new GraphNodeSearcherAdapter(state.CurrentGraphModel, "Pick a data member for this input port");
            var dbProvider = stencil.GetSearcherDatabaseProvider();
            var dbs        = dbProvider.GetGraphElementsSearcherDatabases()
                             .Concat(dbProvider.GetGraphVariablesSearcherDatabases(
                                         state.CurrentGraphModel, stackModel?.OwningFunctionModel))
                             .ToList();

            PromptSearcher(dbs, filter, adapter, position, callback);
        }
        internal static void ShowOutputToGraphNodes(State state, IPortModel portModel, Vector2 position,
                                                    Action <GraphNodeModelSearcherItem> callback)
        {
            var stencil = state.CurrentGraphModel.Stencil;
            var filter  = stencil.GetSearcherFilterProvider()?.GetOutputToGraphSearcherFilter(portModel);
            var adapter = new GraphNodeSearcherAdapter(
                state.CurrentGraphModel,
                $"Choose an action for {portModel.DataType.GetMetadata(stencil).FriendlyName}"
                );
            var dbProvider = stencil.GetSearcherDatabaseProvider();
            var dbs        = dbProvider.GetGraphElementsSearcherDatabases()
                             .Concat(dbProvider.GetTypeMembersSearcherDatabases(portModel.DataType))
                             .ToList();

            PromptSearcher(dbs, filter, adapter, position, callback);
        }