Beispiel #1
0
        void AddCompressionSettings()
        {
            var formatField = new EnumField("Format", outputNode.compressionFormat);

            formatField.RegisterValueChangedCallback((e) => {
                owner.RegisterCompleteObjectUndo("Changed Compression Format");
                outputNode.compressionFormat = (MixtureCompressionFormat)e.newValue;
                graph.UpdateOutputTexture(false);
            });
            var qualityField = new EnumField("Quality", outputNode.compressionQuality);

            qualityField.RegisterValueChangedCallback((e) => {
                owner.RegisterCompleteObjectUndo("Changed Compression Quality");
                outputNode.compressionQuality = (MixtureCompressionQuality)e.newValue;
                graph.UpdateOutputTexture(false);
            });

            if (!outputNode.enableCompression)
            {
                qualityField.ToggleInClassList("Hidden");
                formatField.ToggleInClassList("Hidden");
            }

            var enabledField = new Toggle("Compression")
            {
                value = outputNode.enableCompression
            };

            enabledField.RegisterValueChangedCallback((e) => {
                owner.RegisterCompleteObjectUndo("Toggled Compression");
                qualityField.ToggleInClassList("Hidden");
                formatField.ToggleInClassList("Hidden");
                outputNode.enableCompression = e.newValue;
                graph.UpdateOutputTexture(false);
            });

            controlsContainer.Add(enabledField);
            controlsContainer.Add(formatField);
            controlsContainer.Add(qualityField);
        }