예제 #1
0
        static State CreateLogNode(State previousState, CreateLogNodeAction action)
        {
            VSGraphModel graphModel   = (VSGraphModel)previousState.CurrentGraphModel;
            var          stackModel   = (StackBaseModel)action.StackModel;
            var          functionNode = stackModel.CreateStackedNode <LogNodeModel>(LogNodeModel.NodeTitle);

            functionNode.LogType = action.LogType;

            IConstantNodeModel constantNode = graphModel.CreateConstantNode(
                "",
                typeof(string).GenerateTypeHandle(graphModel.Stencil),
                functionNode.Position - k_StackedTestNodesTokenOffset);

            ((ConstantNodeModel <string>)constantNode).value = $"{graphModel.NodeModels.Count}";
            graphModel.CreateEdge(functionNode.InputPort, constantNode.OutputPort);

            return(previousState);
        }
예제 #2
0
        static State CreateLogNode(State previousState, CreateLogNodeAction action)
        {
            VSGraphModel graphModel   = (VSGraphModel)previousState.CurrentGraphModel;
            var          stackModel   = (StackBaseModel)action.StackModel;
            var          functionNode = stackModel.CreateStackedNode <LogNodeModel>(LogNodeModel.NodeTitle);

            functionNode.LogType = action.LogType;

            IConstantNodeModel constantNode = graphModel.CreateConstantNode(
                "",
                typeof(int).GenerateTypeHandle(graphModel.Stencil),
                stackModel.Position - k_StackedTestNodesTokenOffset);

            ((ConstantNodeModel <int>)constantNode).value = graphModel.NodeModels.Count;
            var edge = graphModel.CreateEdge(functionNode.InputPort, constantNode.OutputPort);

            graphModel.LastChanges.ModelsToAutoAlign.Add(edge);

            return(previousState);
        }