Beispiel #1
0
            public override void OnOpen()
            {
                var settingsView = new MixtureSettingsView(graphView.graph.settings, graphView, "Graph Settings", false);

                settingsView.AddToClassList("RTSettingsView");
                settingsView.style.height = new StyleLength(new Length(100, LengthUnit.Percent));
                settingsView.RegisterChangedCallback(() => graphView.ProcessGraph());

                var otherHeader = new Label("Advanced Settings");

                otherHeader.AddToClassList(MixtureSettingsView.headerStyleClass);
                settingsView.Add(otherHeader);

                var defaultInheritanceMode = new EnumField(graphView.graph.defaultNodeInheritanceMode)
                {
                    label = "Node Inheritance Mode"
                };

                defaultInheritanceMode.RegisterValueChangedCallback(e => {
                    graphView.RegisterCompleteObjectUndo("Changed node inheritance mode");
                    graphView.graph.defaultNodeInheritanceMode = (NodeInheritanceMode)e.newValue;

                    graphView.graph.UpdateNodeInheritanceMode();
                    graphView.RefreshNodeSettings();

                    graphView.ProcessGraph();
                });
                settingsView.Add(defaultInheritanceMode);

                editorWindow.rootVisualElement.Add(settingsView);
            }
Beispiel #2
0
        protected override VisualElement CreateSettingsView()
        {
            settingsView = new MixtureSettingsView(nodeTarget.settings, owner);
            settingsView.AddToClassList("RTSettingsView");

            var currentDim = nodeTarget.settings.dimension;

            settingsView.RegisterChangedCallback(() => {
                nodeTarget.OnSettingsChanged();

                // When the dimension is updated, we need to update all the node ports in the graph
                var newDim = nodeTarget.settings.dimension;
                if (currentDim != newDim)
                {
                    // We delay the port refresh to let the settings finish it's update
                    schedule.Execute(() => {
                        {
                            // Refresh ports on all the nodes in the graph
                            nodeTarget.UpdateAllPortsLocal();
                            RefreshPorts();
                        }
                    }).ExecuteLater(1);
                    currentDim = newDim;
                }
            });

            return(settingsView);
        }