예제 #1
0
        public static IGraphElement CreateNode(this ElementBuilder elementBuilder, IStore store, NodeModel model)
        {
            var ui = new Node();

            ui.Setup(model, store, elementBuilder.GraphView);
            return(ui);
        }
        public static IGraphElement CreateInlineExpressionNode(this ElementBuilder elementBuilder, IStore store, ExpressionNodeModel model)
        {
            var ui = new Node();

            ui.AddToClassList(Unity.Modifier.GraphElements.Node.k_UssClassName + "--expression-node");
            ui.Setup(model, store, elementBuilder.GraphView);
            return(ui);
        }
예제 #3
0
        public static IGraphElement CreateUnaryOperator(this ElementBuilder elementBuilder, IStore store, UnaryOperatorNodeModel model)
        {
            var ui = new Node();

            ui.Setup(model, store, elementBuilder.GraphView);
            ui.CustomSearcherHandler = (node, nStore, pos, _) =>
            {
                SearcherService.ShowEnumValues("Pick a new operator type", typeof(UnaryOperatorKind), pos, (pickedEnum, __) =>
                {
                    if (pickedEnum != null)
                    {
                        ((UnaryOperatorNodeModel)node.NodeModel).Kind = (UnaryOperatorKind)pickedEnum;
                        nStore.Dispatch(new RefreshUIAction(UpdateFlags.GraphTopology));
                    }
                });
                return(true);
            };
            return(ui);
        }