internal GraphicsCompositorNodeVertex([NotNull] GraphicsCompositorGraph graph, [NotNull] IGraphicsCompositorBlockViewModel block)
        {
            if (graph == null)
            {
                throw new ArgumentNullException(nameof(graph));
            }
            this.graph = graph;
            Block      = block;

            InputSlots  = new ObservableCollection <object>();
            OutputSlots = new ObservableCollection <object>();
            block.InputSlots.ForEach(AddInputSlot);
            block.OutputSlots.ForEach(AddOutputSlot);

            // Track slot changes
            block.InputSlots.CollectionChanged  += InputSlotsCollectionChanged;
            block.OutputSlots.CollectionChanged += OutputSlotsCollectionChanged;
        }
Beispiel #2
0
        /// <inheritdoc/>
        public async Task <IAssetEditorViewModel> InitializeEditor(AssetViewModel asset)
        {
            var graphicsCompositor = (GraphicsCompositorViewModel)asset;

            var editor = new GraphicsCompositorEditorViewModel(graphicsCompositor);

            Graph = new GraphicsCompositorGraph(editor.Blocks, editor.SelectedSharedRenderers, editor.SelectedRendererLinks);
            // Don't set the actual Editor property until the editor object is fully initialized - we don't want data bindings to access uninitialized properties
            var result = await editor.Initialize();

            editorInitializationNotifier.SetResult(result);
            if (result)
            {
                return(editor);
            }

            editor.Destroy();
            return(null);
        }