示例#1
0
        private void StopDraggingPin()
        {
            if (IsDraggingPin)
            {
                if (PreviewConnection.IsValidDrop && PreviewConnection.DropTarget != null)
                {
                    ConnectPins(DraggedPin, PreviewConnection.DropTarget);
                }
                else
                {
                    CKlaxScriptNodeQueryContext queryContext = new CKlaxScriptNodeQueryContext
                    {
                        InputPinType = DraggedPin.GetPinType(),
                        IsExecPin    = DraggedPin.IsExecutionPin(),
                        QueryObject  = ScriptGraph.ScriptableObject,
                    };
                    m_addNodePoint = ((NodeGraphView)Content).GetPasteReferenceLocation();
                    AddNodeViewModel.SetContext(queryContext);
                    AddNodeViewModel.IsOpen = true;
                    m_addNodeContextPin     = DraggedPin;
                }
            }

            PreviewConnection.IsVisible   = false;
            PreviewConnection.IsValidDrop = false;
            PreviewConnection.DropTarget  = null;
            IsDraggingPin        = false;
            Mouse.OverrideCursor = null;
        }
        public void SetContext(CKlaxScriptNodeQueryContext context)
        {
            if (CKlaxScriptNodeQueryContext.AreEqual(context, m_queryContext))
            {
                return;
            }

            m_queryContext = context;
            CKlaxScriptRegistry.Instance.GetNodeSuggestions(m_queryContext, m_nodeFactories);
            PopulatePossibleNodes();
        }
        public CAddNodeViewModel(CKlaxScriptNodeQueryContext context)
        {
            m_queryContext = context;
            CKlaxScriptRegistry.Instance.GetNodeSuggestions(m_queryContext, m_nodeFactories);

            EnterCommand          = new CRelayCommand(OnEnterPressed);
            PreviewKeyDownCommand = new CRelayCommand(OnPreviewKeyDown);
            TreeGotFocusCommand   = new CRelayCommand(OnTreeGotFocus);
            TreeLostFocusCommand  = new CRelayCommand(OnTreeLostFocus);
            PopulatePossibleNodes();
        }