Exemplo n.º 1
0
        void AddRealtimeFields(MixtureNode node, MixtureGraphView owner)
        {
            doubleBuffered = new Toggle("Double Buffered")
            {
                value = node.rtSettings.doubleBuffered,
            };
            doubleBuffered.RegisterValueChangedCallback(e => {
                owner.RegisterCompleteObjectUndo("Set Double Buffered " + e.newValue);
                node.rtSettings.doubleBuffered = e.newValue;
                onChanged?.Invoke();
            });

            Add(doubleBuffered);

            refreshMode = new EnumField("Refresh Mode", node.rtSettings.refreshMode);
            refreshMode.RegisterValueChangedCallback(e => {
                owner.RegisterCompleteObjectUndo("Set Refresh Mode " + e.newValue);
                node.rtSettings.refreshMode = (RefreshMode)e.newValue;
                onChanged?.Invoke();
            });

            Add(refreshMode);

            period = new FloatField("Period")
            {
                value = node.rtSettings.period
            };
            period.RegisterValueChangedCallback(e => {
                owner.RegisterCompleteObjectUndo("Set Period " + e.newValue);
                node.rtSettings.period = e.newValue;
                onChanged?.Invoke();
            });

            Add(period);
        }
Exemplo n.º 2
0
        public MixtureRTSettingsView(MixtureNode node, MixtureGraphView owner)
        {
            this.graph = owner.graph as MixtureGraph;
            this.node  = node;
            this.owner = owner;

            ReloadSettingsView();

            onChanged += ReloadSettingsView;
        }
Exemplo n.º 3
0
        protected override void InitializeWindow(BaseGraph graph)
        {
            var  mixture  = (graph as MixtureGraph);
            bool realtime = mixture.isRealtime;

            titleContent = new GUIContent($"Mixture {(realtime ? "(RT) " : "")}- {mixture.name}", MixtureUtils.windowIcon);

            view = new MixtureGraphView(this);

            rootView.Add(view);

            view.Add(new MixtureToolbar(view));
        }
Exemplo n.º 4
0
        public MixtureSettingsView(MixtureSettings settings, MixtureGraphView owner, string title = "Node Output Settings", bool showSettingsForNode = true)
        {
            this.graph               = owner.graph as MixtureGraph;
            this.settings            = settings;
            this.owner               = owner;
            this.title               = title;
            this.showSettingsForNode = showSettingsForNode;

            var stylesheet = Resources.Load <StyleSheet>("MixtureCommon");

            styleSheets.Add(stylesheet);
            ReloadSettingsView();
        }
Exemplo n.º 5
0
        public OutputTextureView(MixtureGraphView graphView, OutputNodeView nodeView, OutputTextureSettings targetSettings)
        {
            this.nodeView       = nodeView;
            node                = nodeView.nodeTarget as OutputNode;
            this.targetSettings = targetSettings;
            this.graphView      = graphView;

            root = Resources.Load <VisualTreeAsset>("UI Blocks/OutputTexture").CloneTree();
            Add(root);

            LoadOutputElements();
            InitializeView();
            RefreshSettings();
        }
Exemplo n.º 6
0
        protected override void InitializeWindow(BaseGraph graph)
        {
            var  mixture  = (graph as MixtureGraph);
            bool realtime = mixture.isRealtime;
            var  fileName = Path.GetFileNameWithoutExtension(mixture.mainAssetPath);

            titleContent = new GUIContent($"Mixture {(realtime ? "(RT) " : "")}- {fileName}", MixtureUtils.windowIcon);

            view = new MixtureGraphView(this);

            rootView.Add(view);

            view.Add(new MixtureToolbar(view));
        }
Exemplo n.º 7
0
        void AddRealtimeFields(MixtureNode node, MixtureGraphView owner)
        {
            doubleBuffered = new Toggle("Double Buffered")
            {
                value = node.rtSettings.doubleBuffered,
            };
            doubleBuffered.RegisterValueChangedCallback(e => {
                owner.RegisterCompleteObjectUndo("Set Double Buffered " + e.newValue);
                node.rtSettings.doubleBuffered = e.newValue;
                onChanged?.Invoke();
            });

            Add(doubleBuffered);
        }
Exemplo n.º 8
0
        public MixtureExposedParameterPropertyView(BaseGraphView graphView, ExposedParameter param)
        {
            mixtureGraphView = graphView as MixtureGraphView;
            parameter        = param;

            var valueField = graphView.exposedParameterFactory.GetParameterValueField(param, (newValue) => {
                graphView.RegisterCompleteObjectUndo("Updated Parameter Value");
                param.value = newValue;
                graphView.graph.NotifyExposedParameterValueChanged(param);
                mixtureGraphView.ProcessGraph();
            });

            var field = graphView.exposedParameterFactory.GetParameterSettingsField(param, (newValue) => {
                param.settings = newValue as ExposedParameter.Settings;
            });

            Add(valueField);

            Add(field);
        }
Exemplo n.º 9
0
        public HistogramView(HistogramData data, MixtureGraphView graphView, int height = 200)
        {
            var modeField = new EnumField("Histogram Mode", data.mode);

            modeField.RegisterValueChangedCallback(e => {
                graphView.RegisterCompleteObjectUndo("Changed histogram Mode");
                data.mode = (HistogramMode)e.newValue;
            });
            Add(modeField);
            var drawHistogram = new DrawHistogram(data, height);

            Add(drawHistogram);

            var minMaxLabel = new Label();

            Add(minMaxLabel);
            schedule.Execute(() => {
                minMaxLabel.text = $"Luminance min: {data.minLuminance:F3}, max: {data.maxLuminance:F3}";
            }).Every(20);
        }
Exemplo n.º 10
0
        protected override void InitializeWindow(BaseGraph graph)
        {
            if (view != null)
            {
                view.Dispose();
                MixtureUpdater.RemoveGraphToProcess(view);
            }

            var  mixture  = (graph as MixtureGraph);
            bool realtime = mixture.type == MixtureGraphType.Realtime;
            var  fileName = Path.GetFileNameWithoutExtension(mixture.mainAssetPath);

            titleContent = new GUIContent($"Mixture {(realtime ? "(RT) " : "")}- {fileName}", MixtureUtils.windowIcon);

            view = new MixtureGraphView(this);

            rootView.Add(view);

            view.Add(new MixtureToolbar(view));
        }
Exemplo n.º 11
0
        public NodeTexturePreview(MixtureNodeView view)
        {
            nodeView    = view;
            graphView   = nodeView.owner as MixtureGraphView;
            previewRoot = Resources.Load <VisualTreeAsset>("UI Blocks/Preview").CloneTree();
            Add(previewRoot);

            // Load additional resources:
            arrowUp   = Resources.Load <Texture2D>("Collapse-Down");
            arrowDown = Resources.Load <Texture2D>("Collapse-Up");

            // Init all preview components:
            previewContainer = previewRoot.Q("PreviewContainer");
            rgb = previewRoot.Q("ToggleRGB") as Toggle;
            r   = previewRoot.Q("ToggleR") as Toggle;
            g   = previewRoot.Q("ToggleG") as Toggle;
            b   = previewRoot.Q("ToggleB") as Toggle;
            a   = previewRoot.Q("ToggleA") as Toggle;

            mipmapSlider      = previewRoot.Q("MipMapSlider") as SliderInt;
            mipmapInputs      = previewRoot.Q("MipMapInput") as VisualElement;
            currentMipIndex   = previewRoot.Q("MipMapNumberText") as Label;
            sliceInputs       = previewRoot.Q("SliceInputs");
            sliceSlider       = previewRoot.Q("SliceSlider") as SliderInt;
            currentSliceIndex = previewRoot.Q("SliceNumber") as IntegerField;
            imageInfo         = previewRoot.Q("ImageInfo");
            textureInfo       = previewRoot.Q("ImageInfoText") as Label;
            collapseButton    = previewRoot.Q("PreviewFoldout") as Button;
            previewImage      = previewRoot.Q("PreviewImage");

            previewImage.style.width  = 200;
            previewImage.style.height = 200;

            previewImage.Add(new IMGUIContainer(DrawPreviewImage));

            // TODO: determine image size rect to fit the node

            collapseButton.clicked += PreviewColapse;

            // TODO: all events, preview shader ect...
        }
Exemplo n.º 12
0
        void AddRealtimeFields(MixtureGraphView owner)
        {
            refreshMode = new EnumField("Refresh Mode", settings.refreshMode);
            refreshMode.RegisterValueChangedCallback(e => {
                owner.RegisterCompleteObjectUndo("Set Refresh Mode " + e.newValue);
                settings.refreshMode = (RefreshMode)e.newValue;
                onChanged?.Invoke();
            });

            Add(refreshMode);

            period = new FloatField("Period")
            {
                value = settings.period
            };
            period.RegisterValueChangedCallback(e => {
                owner.RegisterCompleteObjectUndo("Set Period " + e.newValue);
                settings.period = e.newValue;
                onChanged?.Invoke();
            });

            Add(period);
        }
Exemplo n.º 13
0
 public static void RemoveGraphToProcess(MixtureGraphView view) => views.Remove(view);
Exemplo n.º 14
0
 public static void AddGraphToProcess(MixtureGraphView view)
 {
     views.Add(view);
 }
Exemplo n.º 15
0
 public SettingsMixturePopupWindow(MixtureGraphView graphView)
 {
     this.graphView = graphView;
     height         = graphView.graph.type == MixtureGraphType.Realtime ? 310 : 240;
 }