예제 #1
0
        private void MenuItem_Click(object sender, RoutedEventArgs e)
        {
            var      prev = UI3DPreview.Instance;
            MenuItem item = sender as MenuItem;

            if (item.Header.ToString().ToLower().Contains("albedo"))
            {
                if (prev != null)
                {
                    prev.SetAlbedoNode(this);
                }
            }
            else if (item.Header.ToString().ToLower().Contains("height"))
            {
                if (prev != null)
                {
                    prev.SetHeightNode(this);
                }
            }
            else if (item.Header.ToString().ToLower().Contains("normal"))
            {
                if (prev != null)
                {
                    prev.SetNormalNode(this);
                }
            }
            else if (item.Header.ToString().ToLower().Contains("metallic"))
            {
                if (prev != null)
                {
                    prev.SetMetallicNode(this);
                }
            }
            else if (item.Header.ToString().ToLower().Contains("roughness"))
            {
                if (prev != null)
                {
                    prev.SetRoughnessNode(this);
                }
            }
            else if (item.Header.ToString().ToLower().Contains("occlusion"))
            {
                if (prev != null)
                {
                    prev.SetOcclusionNode(this);
                }
            }
            else if (item.Header.ToString().ToLower().Contains("edit"))
            {
                if (Node is PixelProcessorNode && Graph.Graph is ImageGraph)
                {
                    Graph.Push(Node);

                    if (UIPreviewPane.Instance != null)
                    {
                        UIPreviewPane.Instance.SetPreviewNode(this);
                    }
                }
            }
            else if (item.Header.ToString().ToLower().Contains("set as out"))
            {
                if (Node is MathNode && Graph.Graph is FunctionGraph)
                {
                    FunctionGraph g = Graph.Graph as FunctionGraph;
                    g.SetOutputNode(Node.Id);
                }
            }
            else if (item.Header.ToString().ToLower().Contains("export"))
            {
                ExportAsPng();
            }
        }
예제 #2
0
        private void MenuItem_Click(object sender, RoutedEventArgs e)
        {
            var      prev = UI3DPreview.Instance;
            MenuItem item = sender as MenuItem;

            if (item.Header.ToString().ToLower().Contains("base color"))
            {
                if (prev != null)
                {
                    prev.SetAlbedoNode(this);
                }
            }
            else if (item.Header.ToString().ToLower().Contains("height"))
            {
                if (prev != null)
                {
                    prev.SetHeightNode(this);
                }
            }
            else if (item.Header.ToString().ToLower().Contains("normal"))
            {
                if (prev != null)
                {
                    prev.SetNormalNode(this);
                }
            }
            else if (item.Header.ToString().ToLower().Contains("metallic"))
            {
                if (prev != null)
                {
                    prev.SetMetallicNode(this);
                }
            }
            else if (item.Header.ToString().ToLower().Contains("roughness"))
            {
                if (prev != null)
                {
                    prev.SetRoughnessNode(this);
                }
            }
            else if (item.Header.ToString().ToLower().Contains("occlusion"))
            {
                if (prev != null)
                {
                    prev.SetOcclusionNode(this);
                }
            }
            else if (item.Header.ToString().ToLower().Contains("thickness"))
            {
                if (prev != null)
                {
                    prev.SetThicknessNode(this);
                }
            }
            else if (item.Header.ToString().ToLower().Contains("emission"))
            {
                if (prev != null)
                {
                    prev.SetEmissionNode(this);
                }
            }
            else if (item.Header.ToString().ToLower().Contains("edit"))
            {
                if (Node is PixelProcessorNode && Graph.Graph is ImageGraph)
                {
                    Graph.Push(Node);

                    if (UIPreviewPane.Instance != null)
                    {
                        UIPreviewPane.Instance.SetPreviewNode(this);
                    }
                }
            }
            else if (item.Header.ToString().ToLower().Contains("set as out"))
            {
                if (Node is MathNode && Graph.Graph is FunctionGraph)
                {
                    FunctionGraph g = Graph.Graph as FunctionGraph;
                    g.SetOutputNode(Node.Id);
                }
            }
            else if (item.Header.ToString().ToLower().Contains("export"))
            {
                ExportAsPng();
            }
            else if (item.Header.ToString().ToLower().Contains("refresh"))
            {
                PreviewWrapper.Visibility = Visibility.Visible;
                //we delay to make sure the previewwrapper is fully
                //loaded and has its width and height set
                Task.Delay(25).ContinueWith(t =>
                {
                    N_OnTextureChanged(Node);
                }, TaskScheduler.FromCurrentSynchronizationContext());
            }
            else if (item.Header.ToString().ToLower().Contains("reload inst"))
            {
                if (Node is GraphInstanceNode)
                {
                    (Node as GraphInstanceNode).Reload();
                    Graph?.Graph?.TryAndProcess();
                }
            }
        }