Beispiel #1
0
        /// <summary>
        /// Draws the field required to draw a VolumeInjectionParameters object
        /// </summary>
        /// <param name="injectionProperty">The related serialized property</param>
        /// <param name="displayMask">Int mask to display texture/noise mask</param>
        public static void DrawInjectionField(ref SerializedProperty injectionProperty, bool displayNoiseParameters, bool displayTexture2DMaskParameters, bool displayTexture3DMaskParameters)
        {
            SerializedProperty strengthProperty = injectionProperty.FindPropertyRelative("strength");

            DrawFloatField(ref strengthProperty, new GUIContent("Strength", "Strength of the injected data. Can be set negative to remove data."));

            if (displayNoiseParameters)
            {
                //EditorGUI.BeginDisabledGroup(!displayNoiseParameters);
                EditorGUILayout.Separator();
                EditorGUILayout.Separator();
                SerializedProperty useNoiseMask = injectionProperty.FindPropertyRelative("useNoiseMask");
                GuiHelpers.DrawToggleChecker(ref useNoiseMask, "Use Noise Mask", true);
                if (useNoiseMask.boolValue)
                {
                    EditorGUILayout.Separator();
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.BeginVertical(GUILayout.Width(4));
                    GUILayout.Label("");
                    EditorGUILayout.EndVertical();
                    EditorGUILayout.BeginVertical();
                    SerializedProperty useNoiseMaskLevels = injectionProperty.FindPropertyRelative("useNoiseMaskLevels");
                    GuiHelpers.DrawToggleChecker(ref useNoiseMaskLevels, "Levels");
                    if (useNoiseMaskLevels.boolValue)
                    {
                        EditorGUILayout.Separator();
                        //EditorGUI.BeginDisabledGroup(!useNoiseMaskLevels.boolValue);
                        SerializedProperty noiseMaskLevelsProperty = injectionProperty.FindPropertyRelative("noiseMaskLevelParameters");
                        GuiHelpers.DrawLevelsField(ref noiseMaskLevelsProperty);
                        //EditorGUI.EndDisabledGroup();
                    }
                    EditorGUILayout.EndVertical();
                    EditorGUILayout.EndHorizontal();
                }
                //EditorGUI.EndDisabledGroup();
            }

            if (displayTexture2DMaskParameters)
            {
                //EditorGUI.BeginDisabledGroup(!displayTexture2DMaskParameters);
                EditorGUILayout.Separator();
                EditorGUILayout.Separator();
                SerializedProperty useTexture2DMask = injectionProperty.FindPropertyRelative("useTexture2DMask");
                GuiHelpers.DrawToggleChecker(ref useTexture2DMask, "Use Texture2D Mask", true);
                if (useTexture2DMask.boolValue)
                {
                    EditorGUILayout.Separator();
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.BeginVertical(GUILayout.Width(4));
                    GUILayout.Label("");
                    EditorGUILayout.EndVertical();
                    EditorGUILayout.BeginVertical();
                    SerializedProperty useTexture2DMaskLevels = injectionProperty.FindPropertyRelative("useTexture2DMaskLevels");
                    GuiHelpers.DrawToggleChecker(ref useTexture2DMaskLevels, "Levels");
                    if (useTexture2DMaskLevels.boolValue)
                    {
                        EditorGUILayout.Separator();
                        //EditorGUI.BeginDisabledGroup(!useTexture2DMaskLevels.boolValue);
                        SerializedProperty texture2DMaskLevelsProperty = injectionProperty.FindPropertyRelative("texture2DMaskLevelParameters");
                        GuiHelpers.DrawLevelsField(ref texture2DMaskLevelsProperty);
                        //EditorGUI.EndDisabledGroup();
                    }
                    EditorGUILayout.EndVertical();
                    EditorGUILayout.EndHorizontal();
                }
                //EditorGUI.EndDisabledGroup();
            }

            if (displayTexture3DMaskParameters)
            {
                //EditorGUI.BeginDisabledGroup(!displayTexture3DMaskParameters);
                EditorGUILayout.Separator();
                EditorGUILayout.Separator();
                SerializedProperty useTexture3DMask = injectionProperty.FindPropertyRelative("useTexture3DMask");
                GuiHelpers.DrawToggleChecker(ref useTexture3DMask, "Texture3D Mask Levels", true);
                if (useTexture3DMask.boolValue)
                {
                    EditorGUILayout.Separator();
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.BeginVertical(GUILayout.Width(4));
                    GUILayout.Label("");
                    EditorGUILayout.EndVertical();
                    EditorGUILayout.BeginVertical();
                    SerializedProperty useTexture3DMaskLevels = injectionProperty.FindPropertyRelative("useTexture3DMaskLevels");
                    GuiHelpers.DrawToggleChecker(ref useTexture3DMaskLevels, "Levels");
                    if (useTexture3DMaskLevels.boolValue)
                    {
                        EditorGUILayout.Separator();
                        //EditorGUI.BeginDisabledGroup(!useTexture3DMaskLevels.boolValue);
                        SerializedProperty texture3DMaskLevelsProperty = injectionProperty.FindPropertyRelative("texture3DMaskLevelParameters");
                        GuiHelpers.DrawLevelsField(ref texture3DMaskLevelsProperty);
                        //EditorGUI.EndDisabledGroup();
                    }
                    EditorGUILayout.EndVertical();
                    EditorGUILayout.EndHorizontal();
                }
                //EditorGUI.EndDisabledGroup();
            }
        }
Beispiel #2
0
        /// <summary>
        /// Draws the field required to draw a VolumeInjectionParameters object
        /// </summary>
        /// <param name="injectionProperty">The related serialized property</param>
        public static void DrawInjectionField(ref SerializedProperty injectionProperty, bool displayNoiseParameters, bool displayTexture2DMaskParameters, bool displayTexture3DMaskParameters, bool clampStrength = false, float clampStrengthMin = 0.0f, float clampStrengthMax = 1.0f, bool saturateLevelOuput = false, string strengthLabel = "Strength", string strengthTooltip = "Strength of the injected data. Can be set negative to remove data.")
        {
            SerializedProperty strengthProperty = injectionProperty.FindPropertyRelative("strength");
            GUIContent         strengthContent  = new GUIContent(strengthLabel, strengthTooltip);

            if (clampStrength)
            {
                DrawSlider(ref strengthProperty, clampStrengthMin, clampStrengthMax, strengthContent.text);
            }
            else
            {
                DrawFloatField(ref strengthProperty, strengthContent);
            }

            if (displayNoiseParameters)
            {
                //EditorGUI.BeginDisabledGroup(!displayNoiseParameters);
                EditorGUILayout.Separator();
                EditorGUILayout.Separator();
                SerializedProperty useNoiseMask = injectionProperty.FindPropertyRelative("useNoiseMask");
                GuiHelpers.DrawToggleChecker(ref useNoiseMask, "Use Noise Mask", true);
                if (useNoiseMask.boolValue)
                {
                    EditorGUILayout.Separator();
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.BeginVertical(GUILayout.Width(4));
                    GUILayout.Label("");
                    EditorGUILayout.EndVertical();
                    EditorGUILayout.BeginVertical();
                    SerializedProperty useNoiseMaskLevels = injectionProperty.FindPropertyRelative("useNoiseMaskLevels");
                    GuiHelpers.DrawToggleChecker(ref useNoiseMaskLevels, "Levels");
                    if (useNoiseMaskLevels.boolValue)
                    {
                        EditorGUILayout.Separator();
                        //EditorGUI.BeginDisabledGroup(!useNoiseMaskLevels.boolValue);
                        SerializedProperty noiseMaskLevelsProperty = injectionProperty.FindPropertyRelative("noiseMaskLevelParameters");
                        GuiHelpers.DrawLevelsField(ref noiseMaskLevelsProperty, saturateLevelOuput);
                        //EditorGUI.EndDisabledGroup();
                    }
                    EditorGUILayout.EndVertical();
                    EditorGUILayout.EndHorizontal();
                }
                //EditorGUI.EndDisabledGroup();
            }

            if (displayTexture2DMaskParameters)
            {
                //EditorGUI.BeginDisabledGroup(!displayTexture2DMaskParameters);
                EditorGUILayout.Separator();
                EditorGUILayout.Separator();
                SerializedProperty useTexture2DMask = injectionProperty.FindPropertyRelative("useTexture2DMask");
                GuiHelpers.DrawToggleChecker(ref useTexture2DMask, "Use Texture2D Mask", true);
                if (useTexture2DMask.boolValue)
                {
                    EditorGUILayout.Separator();
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.BeginVertical(GUILayout.Width(4));
                    GUILayout.Label("");
                    EditorGUILayout.EndVertical();
                    EditorGUILayout.BeginVertical();
                    SerializedProperty useTexture2DMaskLevels = injectionProperty.FindPropertyRelative("useTexture2DMaskLevels");
                    GuiHelpers.DrawToggleChecker(ref useTexture2DMaskLevels, "Levels");
                    if (useTexture2DMaskLevels.boolValue)
                    {
                        EditorGUILayout.Separator();
                        //EditorGUI.BeginDisabledGroup(!useTexture2DMaskLevels.boolValue);
                        SerializedProperty texture2DMaskLevelsProperty = injectionProperty.FindPropertyRelative("texture2DMaskLevelParameters");
                        GuiHelpers.DrawLevelsField(ref texture2DMaskLevelsProperty, saturateLevelOuput);
                        //EditorGUI.EndDisabledGroup();
                    }
                    EditorGUILayout.EndVertical();
                    EditorGUILayout.EndHorizontal();
                }
                //EditorGUI.EndDisabledGroup();
            }

            if (displayTexture3DMaskParameters)
            {
                //EditorGUI.BeginDisabledGroup(!displayTexture3DMaskParameters);
                EditorGUILayout.Separator();
                EditorGUILayout.Separator();
                SerializedProperty useTexture3DMask = injectionProperty.FindPropertyRelative("useTexture3DMask");
                GuiHelpers.DrawToggleChecker(ref useTexture3DMask, "Texture3D Mask Levels", true);
                if (useTexture3DMask.boolValue)
                {
                    EditorGUILayout.Separator();
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.BeginVertical(GUILayout.Width(4));
                    GUILayout.Label("");
                    EditorGUILayout.EndVertical();
                    EditorGUILayout.BeginVertical();
                    SerializedProperty useTexture3DMaskLevels = injectionProperty.FindPropertyRelative("useTexture3DMaskLevels");
                    GuiHelpers.DrawToggleChecker(ref useTexture3DMaskLevels, "Levels");
                    if (useTexture3DMaskLevels.boolValue)
                    {
                        EditorGUILayout.Separator();
                        //EditorGUI.BeginDisabledGroup(!useTexture3DMaskLevels.boolValue);
                        SerializedProperty texture3DMaskLevelsProperty = injectionProperty.FindPropertyRelative("texture3DMaskLevelParameters");
                        GuiHelpers.DrawLevelsField(ref texture3DMaskLevelsProperty, saturateLevelOuput);
                        //EditorGUI.EndDisabledGroup();
                    }
                    EditorGUILayout.EndVertical();
                    EditorGUILayout.EndHorizontal();
                }
                //EditorGUI.EndDisabledGroup();
            }
        }