Пример #1
0
        public DiagramDocument(NodeEditorCore.IDiagramDocument underlyingDoc, Uri uri) : base(underlyingDoc.ViewModel) 
        {
            UnderlyingDocument = underlyingDoc;
            _uri = uri;

                // tracking for dirty flag --
            Model.NodeAdded += Model_NodeAdded;
            Model.NodeRemoved += Model_NodeRemoved;
            Model.ConnectionAdded += Model_ConnectionAdded;
            Model.ConnectionRemoved += Model_ConnectionRemoved;
            Model.MiscChange += Model_MiscChange;
        }
Пример #2
0
        public DiagramDocument(NodeEditorCore.IDiagramDocument underlyingDoc, Uri uri) : base(underlyingDoc.ViewModel)
        {
            UnderlyingDocument = underlyingDoc;
            _uri = uri;

            // tracking for dirty flag --
            Model.NodeAdded         += Model_NodeAdded;
            Model.NodeRemoved       += Model_NodeRemoved;
            Model.ConnectionAdded   += Model_ConnectionAdded;
            Model.ConnectionRemoved += Model_ConnectionRemoved;
            Model.MiscChange        += Model_MiscChange;
        }
Пример #3
0
        public DiagramSettings(NodeEditorCore.IDiagramDocument context)
        {
            InitializeComponent();
            _context = context;

            // We need to calculate the interface for the node graph and
            // find the variables from there...
            var interf = ShaderPatcherLayer.NodeGraph.GetInterface(context.NodeGraph);
            var sugg   = interf.Variables.Select(x => x.Name);

            {
                _variables.AutoGenerateColumns = false;

                _variables.Columns.Add(
                    new DataGridViewTextBoxColumn()
                {
                    CellTemplate = new ControlsLibrary.VariableNameCell {
                        Suggestions = sugg
                    },
                    Name             = "Variable",
                    HeaderText       = "Variable",
                    ToolTipText      = "Name of the variable",
                    DataPropertyName = "Key",
                    FillWeight       = 30,
                    AutoSizeMode     = DataGridViewAutoSizeColumnMode.Fill
                });

                _variables.Columns.Add(
                    new DataGridViewTextBoxColumn()
                {
                    CellTemplate     = new ControlsLibrary.VariableRestrictionCell(),
                    Name             = "Value",
                    HeaderText       = "Restrictions",
                    ToolTipText      = "Restrictions applied to the variable",
                    DataPropertyName = "Value",
                    FillWeight       = 70,
                    AutoSizeMode     = DataGridViewAutoSizeColumnMode.Fill
                });
            }

            _variablesList = new BindingList <ControlsLibrary.StringPair>();
            foreach (var i in _context.GraphContext.Variables)
            {
                _variablesList.Add(new ControlsLibrary.StringPair {
                    Key = i.Key, Value = i.Value
                });
            }
            _variables.DataSource = _variablesList;

            var diagContext = _context.GraphContext;

            _type.SelectedIndex            = diagContext.HasTechniqueConfig ? 1 : 0;
            _needsWorldPosition.CheckState = CheckState.Unchecked;
            foreach (var i in diagContext.ShaderParameters)
            {
                if (i.Key.Equals("OUTPUT_WORLD_POSITION"))
                {
                    _needsWorldPosition.CheckState = CheckState.Checked;
                }
            }
            _previewModel.Text = diagContext.PreviewModelFile;

            _okButton.Click += _okButton_Click;
        }