Пример #1
0
        public static ISystemConstantNodeModel CreateSystemConstantNode(this VSGraphModel graphModel, Type type,
                                                                        PropertyInfo propertyInfo, Vector2 position, SpawnFlags spawnFlags = SpawnFlags.Default)
        {
            void Setup(SystemConstantNodeModel n)
            {
                n.ReturnType    = propertyInfo.PropertyType.GenerateTypeHandle(graphModel.Stencil);
                n.DeclaringType = propertyInfo.DeclaringType.GenerateTypeHandle(graphModel.Stencil);
                n.Identifier    = propertyInfo.Name;
            }

            var name = $"{type.FriendlyName(false)} > {propertyInfo.Name}";

            return(graphModel.CreateModel <SystemConstantNodeModel>(name, position, spawnFlags, Setup));
        }
Пример #2
0
        public void VisitGraph(VSGraphModel vsGraphModel)
        {
            HashSet <IStackModel> visitedStacks = new HashSet <IStackModel>();
            HashSet <INodeModel>  visitedNodes  = new HashSet <INodeModel>();

            foreach (var entryPoint in vsGraphModel.Stencil.GetEntryPoints(vsGraphModel))
            {
                if (entryPoint is IStackModel entryStack)
                {
                    VisitStack(entryStack, visitedStacks, visitedNodes);
                }
                else
                {
                    VisitNode(entryPoint, visitedNodes);
                }
            }

            // floating stacks
            foreach (var stack in vsGraphModel.StackModels)
            {
                if (visitedStacks.Contains(stack))
                {
                    continue;
                }

                VisitStack(stack, visitedStacks, visitedNodes);
            }

            // floating nodes
            foreach (var node in vsGraphModel.NodeModels)
            {
                if (node == null || node is IStackModel || visitedNodes.Contains(node))
                {
                    continue;
                }

                VisitNode(node, visitedNodes);
            }

            foreach (var variableDeclaration in vsGraphModel.GraphVariableModels)
            {
                VisitVariableDeclaration(variableDeclaration);
            }

            foreach (var edgeModel in vsGraphModel.EdgeModels)
            {
                VisitEdge(edgeModel);
            }
        }
Пример #3
0
 public static FunctionCallNodeModel CreateFunctionCallNode(this VSGraphModel graphModel, MethodBase methodInfo,
                                                            Vector2 position, SpawnFlags spawnFlags = SpawnFlags.Default)
 {
     return(graphModel.CreateModel <FunctionCallNodeModel>(methodInfo.Name, position, spawnFlags, n => n.MethodInfo = methodInfo));
 }
Пример #4
0
 public static FunctionRefCallNodeModel CreateFunctionRefCallNode(this VSGraphModel graphModel,
                                                                  FunctionModel methodInfo, Vector2 position, SpawnFlags spawnFlags = SpawnFlags.Default)
 {
     return(graphModel.CreateModel <FunctionRefCallNodeModel>(methodInfo.Title, position, spawnFlags, n => n.Function = methodInfo));
 }
Пример #5
0
 public static LoopStackModel CreateLoopStack(this VSGraphModel graphModel, Type loopStackType, Vector2 position,
                                              SpawnFlags spawnFlags = SpawnFlags.Default)
 {
     return(graphModel.CreateModel <LoopStackModel>(loopStackType, "loopStack", position, spawnFlags, node => ((LoopStackModel)node).CreateLoopVariables(null)));
 }
Пример #6
0
 public static T CreateLoopStack <T>(this VSGraphModel graphModel, Vector2 position,
                                     SpawnFlags spawnFlags = SpawnFlags.Default) where T : LoopStackModel
 {
     return(graphModel.CreateNode <T>("loopStack", position, spawnFlags, node => node.CreateLoopVariables(null)));
 }
Пример #7
0
 public static GroupNodeModel CreateGroup(this VSGraphModel graphModel, string name, Vector2 position,
                                          SpawnFlags spawnFlags = SpawnFlags.Default)
 {
     return(graphModel.CreateModel <GroupNodeModel>(name, position, spawnFlags));
 }
Пример #8
0
 public static MacroRefNodeModel CreateMacroRefNode(this VSGraphModel graphModel, VSGraphModel macroGraphModel,
                                                    Vector2 position, SpawnFlags spawnFlags = SpawnFlags.Default)
 {
     return(graphModel.CreateModel <MacroRefNodeModel>(graphModel.AssetModel.Name, position, spawnFlags, n => n.Macro = macroGraphModel));
 }
Пример #9
0
 public static GroupNodeModel CreateGroupNode(this VSGraphModel graphModel, string name, Vector2 position)
 {
     return(graphModel.CreateNode <GroupNodeModel>(name, position));
 }
Пример #10
0
 public static GetPropertyGroupNodeModel CreateGetPropertyGroupNode(this VSGraphModel graphModel,
                                                                    Vector2 position, SpawnFlags spawnFlags = SpawnFlags.Default)
 {
     return(graphModel.CreateModel <GetPropertyGroupNodeModel>("Get Property", position, spawnFlags));
 }
Пример #11
0
 public static BinaryOperatorNodeModel CreateBinaryOperatorNode(this VSGraphModel graphModel,
                                                                BinaryOperatorKind kind, Vector2 position, SpawnFlags spawnFlags = SpawnFlags.Default)
 {
     return(graphModel.CreateModel <BinaryOperatorNodeModel>(kind.ToString(), position, spawnFlags, n => n.kind = kind));
 }