UnityEditor.AvatarMuscleEditor.PreviewSlider C# (CSharp) Method

PreviewSlider() private static method

private static PreviewSlider ( Rect position, float val ) : float
position UnityEngine.Rect
val float
return float
        private static float PreviewSlider(Rect position, float val)
        {
            val = GUI.HorizontalSlider(GetPreviewRect(position), val, -1f, 1f);
            if ((val > -0.1f) && (val < 0.1f))
            {
                val = 0f;
            }
            return val;
        }

Usage Example

        protected void MuscleGroupGUI()
        {
            bool flag = false;

            this.HeaderGUI("Preview", "Muscle Group Preview");
            GUILayout.BeginVertical(AvatarMuscleEditor.styles.box, new GUILayoutOption[0]);
            Rect rect1         = GUILayoutUtility.GetRect(10f, 16f);
            Rect settingsRect1 = AvatarMuscleEditor.GetSettingsRect(rect1);

            if (GUI.Button(AvatarMuscleEditor.GetPreviewRect(rect1), "Reset All", EditorStyles.miniButton))
            {
                for (int index = 0; index < this.m_MuscleMasterValue.Length; ++index)
                {
                    this.m_MuscleMasterValue[index] = 0.0f;
                }
                for (int index = 0; index < this.m_MuscleValue.Length; ++index)
                {
                    this.m_MuscleValue[index] = 0.0f;
                }
                flag = true;
            }
            GUI.Label(settingsRect1, "Reset All Preview Values", EditorStyles.label);
            for (int index1 = 0; index1 < this.m_MasterMuscle.Length; ++index1)
            {
                Rect  rect2         = GUILayoutUtility.GetRect(10f, 16f);
                Rect  settingsRect2 = AvatarMuscleEditor.GetSettingsRect(rect2);
                float num           = this.m_MuscleMasterValue[index1];
                this.m_MuscleMasterValue[index1] = AvatarMuscleEditor.PreviewSlider(rect2, this.m_MuscleMasterValue[index1]);
                if ((double)this.m_MuscleMasterValue[index1] != (double)num)
                {
                    Undo.RegisterCompleteObjectUndo((UnityEngine.Object) this, "Muscle preview");
                    for (int index2 = 0; index2 < this.m_MasterMuscle[index1].Length; ++index2)
                    {
                        if (this.m_MasterMuscle[index1][index2] != -1)
                        {
                            this.m_MuscleValue[this.m_MasterMuscle[index1][index2]] = this.m_MuscleMasterValue[index1];
                        }
                    }
                }
                flag = ((flag ? 1 : 0) | ((double)this.m_MuscleMasterValue[index1] == (double)num ? 0 : ((UnityEngine.Object) this.gameObject != (UnityEngine.Object)null ? 1 : 0))) != 0;
                GUI.Label(settingsRect2, AvatarMuscleEditor.styles.muscleTypeGroup[index1], EditorStyles.label);
            }
            GUILayout.EndVertical();
            if (!flag)
            {
                return;
            }
            this.WritePose();
        }
All Usage Examples Of UnityEditor.AvatarMuscleEditor::PreviewSlider