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)); }
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); } }
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)); }
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)); }
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))); }
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))); }
public static GroupNodeModel CreateGroup(this VSGraphModel graphModel, string name, Vector2 position, SpawnFlags spawnFlags = SpawnFlags.Default) { return(graphModel.CreateModel <GroupNodeModel>(name, position, spawnFlags)); }
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)); }
public static GroupNodeModel CreateGroupNode(this VSGraphModel graphModel, string name, Vector2 position) { return(graphModel.CreateNode <GroupNodeModel>(name, position)); }
public static GetPropertyGroupNodeModel CreateGetPropertyGroupNode(this VSGraphModel graphModel, Vector2 position, SpawnFlags spawnFlags = SpawnFlags.Default) { return(graphModel.CreateModel <GetPropertyGroupNodeModel>("Get Property", position, spawnFlags)); }
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)); }