Exemple #1
0
        internal override void AddCustomNodeProperties(VisualElement parentElement, AbstractMaterialNode nodeBase, Action setNodesAsDirtyCallback, Action updateNodeViewsCallback)
        {
            node = nodeBase as TransformNode;

            var normalizeControl = new Toggle();

            normalizeControl.value = node.normalize;

            normalizePropRow = new PropertyRow(new Label("Normalize Output"));
            normalizePropRow.Add(normalizeControl, (field) =>
            {
                field.RegisterValueChangedCallback(evt =>
                {
                    if (evt.newValue.Equals(node.normalize))
                    {
                        return;
                    }

                    setNodesAsDirtyCallback?.Invoke();
                    node.owner.owner.RegisterCompleteObjectUndo("Change normalize");
                    node.normalize = evt.newValue;
                    updateNodeViewsCallback?.Invoke();
                    node.Dirty(ModificationScope.Graph);
                });
            });
            parentElement.Add(normalizePropRow);

            UpdateVisibility();

            node.RegisterCallback(OnNodeModified);
        }