public CNodeEntryViewModel(CKlaxScriptNodeFactory nodeFactory, CAddNodeViewModel parentViewModel, CCategoryViewModel parentCategory)
        {
            NodeFactory       = nodeFactory;
            Name              = nodeFactory.Name;
            m_parentCategory  = parentCategory;
            m_parentViewModel = parentViewModel;

            LeftDoubleClickCommand = new CRelayCommand(OnLeftDoubleClick);

            if (nodeFactory.TargetType != null)
            {
                Tooltip = "Target is " + nodeFactory.TargetType.Name;
            }

            if (!string.IsNullOrWhiteSpace(nodeFactory.Tooltip))
            {
                if (Tooltip != null)
                {
                    Tooltip = Tooltip + System.Environment.NewLine + nodeFactory.Tooltip;
                }
                else
                {
                    Tooltip = nodeFactory.Tooltip;
                }
            }
        }
Esempio n. 2
0
        public CNodeGraphViewModel() : base("NodeGraph")
        {
            SetIconSourcePath("Resources/Images/Tabs/assetbrowser.png");

            Content                 = new NodeGraphView();
            MouseDownCommand        = new CRelayCommand(OnMouseDown);
            PreviewMouseDownCommand = new CRelayCommand(OnPreviewMouseDown);
            PreviewMouseUpCommand   = new CRelayCommand(OnPreviewMouseUp);
            StartDragContentCommand = new CRelayCommand(OnStartDragContent);
            DeleteNodesCommand      = new CRelayCommand(OnDeleteCommand);
            CopyNodesCommand        = new CRelayCommand(OnCopyNodes);
            PasteNodesCommand       = new CRelayCommand(OnPasteNodes);
            CutNodesCommand         = new CRelayCommand(OnCutNodes);
            DuplicateNodesCommand   = new CRelayCommand(OnDuplicateNodes);
            DragEnterCommand        = new CRelayCommand(OnDragEnter);
            DragOverCommand         = new CRelayCommand(OnDragOver);
            DropCommand             = new CRelayCommand(OnDrop);

            CreateNewGraph();

            m_lodLevels.Add(1.0);
            m_lodLevels.Add(0.7);
            m_lodLevels.Add(0.5);
            m_lodLevels.Add(0.3);
            m_lodLevels.Add(0.1);

            AddNodeViewModel = new CAddNodeViewModel(CKlaxScriptNodeQueryContext.Empty);
            AddNodeViewModel.NodeSelected += OnNodeAddNodePopupSelected;

            VariablePopup = new CVariableDragPopupViewModel(this);
        }
        public CCategoryViewModel(string name, CAddNodeViewModel parentViewModel, CCategoryViewModel parentCategory)
        {
            Name = name;
            m_combinedCollection = new CompositeCollection();
            CollectionContainer categoriesContainer = new CollectionContainer();

            categoriesContainer.Collection = SubCategories;
            CollectionContainer nodesContainer = new CollectionContainer();

            nodesContainer.Collection = Nodes;
            CombinedCollection.Add(categoriesContainer);
            CombinedCollection.Add(nodesContainer);

            MouseDownCommand = new CRelayCommand(OnMouseDown);

            m_parentCategory  = parentCategory;
            m_parentViewModel = parentViewModel;
        }