Exemple #1
0
        void AddDefaultSettings()
        {
            PropertySheet ps = new PropertySheet();
            bool          hasDefaultSettings = false;

            if (node.canSetPrecision)
            {
                hasDefaultSettings = true;
                ps.Add(new PropertyRow(new Label("Precision")), (row) =>
                {
                    row.Add(new EnumField(node.precision), (field) =>
                    {
                        field.RegisterValueChangedCallback(evt =>
                        {
                            if (evt.newValue.Equals(node.precision))
                            {
                                return;
                            }

                            var editorView = GetFirstAncestorOfType <GraphEditorView>();
                            var nodeList   = m_GraphView.Query <MaterialNodeView>().ToList();

                            editorView.colorManager.SetNodesDirty(nodeList);
                            node.owner.owner.RegisterCompleteObjectUndo("Change precision");
                            node.precision = (Precision)evt.newValue;
                            node.owner.ValidateGraph();
                            editorView.colorManager.UpdateNodeViews(nodeList);
                            node.Dirty(ModificationScope.Graph);
                        });
                    });
                });
            }

            if (hasDefaultSettings)
            {
                m_Settings.Add(ps);
            }
        }