示例#1
0
        private void DrawGUIFields()
        {
            EditorGUI.indentLevel = 0;

            //SCREENSHOTTING
            EditorGUILayout.LabelField("Export image as separate color layers", EditorStyles.label);
            EditorGUILayout.PropertyField(width, new GUIContent("Width"));
            EditorGUILayout.PropertyField(height, new GUIContent("Height"));

            Stylizer stylizer = (Stylizer)target;

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PropertyField(savePath);
            if (GUILayout.Button("Browse", GUILayout.ExpandWidth(false)))
            {
                stylizer.savePath = EditorUtility.SaveFolderPanel("Path to Save Images", stylizer.savePath, Application.dataPath);
            }
            EditorGUILayout.EndHorizontal();

            if (GUILayout.Button("Export"))
            {
                stylizer.SeparateColorsToPng();
            }
            //-------------

            EditorGUILayout.PropertyField(Dither, new GUIContent("Dithering"));
            EditorGUILayout.LabelField("Adds a dithering effect to the camera", EditorStyles.miniLabel);
            if (Dither.boolValue)
            {
                EditorGUI.indentLevel = 1;

                _effect.Dither = Dither.boolValue;
                EditorGUILayout.PropertyField(_shaderProperty, ContentText.shaderProperty);
                EditorGUILayout.PropertyField(_paletteProperty, ContentText.paletteProperty);
                if (Effect.PatternTexture == null)
                {
                    EditorGUILayout.PropertyField(_patternProperty, ContentText.patternProperty);
                }
                if (Effect.Pattern == null)
                {
                    EditorGUILayout.PropertyField(_patternTextureProperty, ContentText.patternTextureProperty);
                }
            }
            else
            {
                _effect.Dither = Dither.boolValue;
            }

            EditorGUI.indentLevel = 0;
            EditorGUILayout.Space();
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("————————————————————————————————————————————————————————————————————————————————————————————————————————————————————", EditorStyles.miniLabel);
            EditorGUILayout.Space();
            EditorGUILayout.Space();

            EditorGUILayout.PropertyField(Pixelate, new GUIContent("Pixelation"));
            EditorGUILayout.LabelField("Pixelates the image", EditorStyles.miniLabel);
            if (Pixelate.boolValue)
            {
                if (_effect.enabled)
                {
                    _effect.EnablePixel();
                    _effect.Pixelate = Pixelate.boolValue;
                }
                EditorGUI.indentLevel = 1;

                EditorGUILayout.Slider(_pixelationProperty, 0.01f, 1f);
            }
            else
            {
                _effect.Pixelate = Pixelate.boolValue;
                _effect.DisablePixel();
            }

            EditorGUI.indentLevel = 0;
            EditorGUILayout.Space();
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("————————————————————————————————————————————————————————————————————————————————————————————————————————————————————", EditorStyles.miniLabel);
            EditorGUILayout.Space();
            EditorGUILayout.Space();

            EditorGUILayout.PropertyField(Grain, new GUIContent("Grain"));
            EditorGUILayout.LabelField("Overlays noise patterns", EditorStyles.miniLabel);
            if (Grain.boolValue)
            {
                EditorGUI.indentLevel = 1;
                _effect.Grain         = Grain.boolValue;

                //EditorGUILayout.PropertyField(Grain_New, new GUIContent("Grain method #1"));
                //if(Grain_New.boolValue){
                //EditorGUI.indentLevel = 2;
                _effect.Grain_New = true;

                //EditorGUILayout.PropertyField(profile);

                EditorGUILayout.PropertyField(g_Intensity);
                EditorGUILayout.PropertyField(g_LuminanceContribution);
                EditorGUILayout.PropertyField(g_Size);
                EditorGUILayout.PropertyField(g_Colored);
                EditorGUILayout.PropertyField(g_animated);

                _effect.intensity             = g_Intensity.floatValue;
                _effect.luminanceContribution = g_LuminanceContribution.floatValue;
                _effect.size     = g_Size.floatValue;
                _effect.colored  = g_Colored.boolValue;
                _effect.animated = g_animated.boolValue;

                //}else{
                //	_effect.Grain_New = Grain_New.boolValue;
                //}
                //EditorGUI.indentLevel = 1;

                /*EditorGUILayout.PropertyField(Grain_Old, new GUIContent("Grain method #2"));
                 * if(Grain_Old.boolValue){
                 *      EditorGUI.indentLevel = 2;
                 *      _effect.Grain_Old = Grain_Old.boolValue;
                 *
                 *      EditorGUILayout.PropertyField(intensityMultiplier, new GUIContent("Intensity Multiplier"));
                 *      EditorGUILayout.PropertyField(generalIntensity, new GUIContent(" General"));
                 *      EditorGUILayout.PropertyField(blackIntensity, new GUIContent(" Black Boost"));
                 *      EditorGUILayout.PropertyField(whiteIntensity, new GUIContent(" White Boost"));
                 *      midGrey.floatValue = EditorGUILayout.Slider( new GUIContent(" Mid Grey (for Boost)"), midGrey.floatValue, 0.0f, 1.0f);
                 *
                 *      EditorGUILayout.LabelField("Noise Shape");
                 *
                 *      softness.floatValue = EditorGUILayout.Slider( new GUIContent(" Softness"),softness.floatValue, 0.0001f, 0.99f);
                 *
                 * }else{
                 *      _effect.Grain_Old = Grain_Old.boolValue;
                 * }*/
                EditorGUI.indentLevel = 1;

                //EditorGUILayout.Separator();
                EditorGUILayout.Space();
                EditorGUILayout.Space();
                EditorGUILayout.Space();
            }
            else
            {
                _effect.Grain = Grain.boolValue;
            }

            serObj.ApplyModifiedProperties();
        }