Inheritance: AvatarSubEditor
コード例 #1
0
 private static float PreviewSlider(Rect position, float val)
 {
     val = GUI.HorizontalSlider(AvatarMuscleEditor.GetPreviewRect(position), val, -1f, 1f);
     if ((double)val > -0.100000001490116 && (double)val < 0.100000001490116)
     {
         val = 0.0f;
     }
     return(val);
 }
コード例 #2
0
 private static float PreviewSlider(Rect position, float val)
 {
     val = GUI.HorizontalSlider(AvatarMuscleEditor.GetPreviewRect(position), val, -1f, 1f);
     if (val > -0.1f && val < 0.1f)
     {
         val = 0f;
     }
     return(val);
 }
コード例 #3
0
        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();
        }
コード例 #4
0
        protected void MuscleGroupGUI()
        {
            bool flag = false;

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

            if (GUI.Button(previewRect, "Reset All", EditorStyles.miniButton))
            {
                for (int i = 0; i < this.m_MuscleMasterValue.Length; i++)
                {
                    this.m_MuscleMasterValue[i] = 0f;
                }
                for (int j = 0; j < this.m_MuscleValue.Length; j++)
                {
                    this.m_MuscleValue[j] = 0f;
                }
                flag = true;
            }
            GUI.Label(settingsRect, "Reset All Preview Values", EditorStyles.label);
            for (int k = 0; k < this.m_MasterMuscle.Length; k++)
            {
                Rect  rect2         = GUILayoutUtility.GetRect(10f, 16f);
                Rect  settingsRect2 = AvatarMuscleEditor.GetSettingsRect(rect2);
                float num           = this.m_MuscleMasterValue[k];
                this.m_MuscleMasterValue[k] = AvatarMuscleEditor.PreviewSlider(rect2, this.m_MuscleMasterValue[k]);
                if (this.m_MuscleMasterValue[k] != num)
                {
                    Undo.RegisterCompleteObjectUndo(this, "Muscle preview");
                    for (int l = 0; l < this.m_MasterMuscle[k].Length; l++)
                    {
                        if (this.m_MasterMuscle[k][l] != -1)
                        {
                            this.m_MuscleValue[this.m_MasterMuscle[k][l]] = this.m_MuscleMasterValue[k];
                        }
                    }
                }
                flag |= (this.m_MuscleMasterValue[k] != num && base.gameObject != null);
                GUI.Label(settingsRect2, AvatarMuscleEditor.styles.muscleTypeGroup[k], EditorStyles.label);
            }
            GUILayout.EndVertical();
            if (flag)
            {
                this.WritePose();
            }
        }
コード例 #5
0
        protected void PropertiesGUI()
        {
            bool flag = false;

            this.HeaderGUI(string.Empty, "Additional Settings");
            GUILayout.BeginVertical(AvatarMuscleEditor.styles.box, new GUILayoutOption[0]);
            this.m_ArmTwistFactor = EditorGUI.Slider(AvatarMuscleEditor.GetSettingsRect(), AvatarMuscleEditor.styles.armTwist, this.m_ArmTwistFactor, 0.0f, 1f);
            if ((double)this.m_ArmTwistProperty.floatValue != (double)this.m_ArmTwistFactor)
            {
                Undo.RegisterCompleteObjectUndo((UnityEngine.Object) this, "Upper arm twist");
                this.m_ArmTwistProperty.floatValue = this.m_ArmTwistFactor;
                this.UpdateAvatarParameter(HumanParameter.UpperArmTwist, this.m_ArmTwistFactor);
                flag = true;
            }
            this.m_ForeArmTwistFactor = EditorGUI.Slider(AvatarMuscleEditor.GetSettingsRect(), AvatarMuscleEditor.styles.foreArmTwist, this.m_ForeArmTwistFactor, 0.0f, 1f);
            if ((double)this.m_ForeArmTwistProperty.floatValue != (double)this.m_ForeArmTwistFactor)
            {
                Undo.RegisterCompleteObjectUndo((UnityEngine.Object) this, "Lower arm twist");
                this.m_ForeArmTwistProperty.floatValue = this.m_ForeArmTwistFactor;
                this.UpdateAvatarParameter(HumanParameter.LowerArmTwist, this.m_ForeArmTwistFactor);
                flag = true;
            }
            this.m_UpperLegTwistFactor = EditorGUI.Slider(AvatarMuscleEditor.GetSettingsRect(), AvatarMuscleEditor.styles.upperLegTwist, this.m_UpperLegTwistFactor, 0.0f, 1f);
            if ((double)this.m_UpperLegTwistProperty.floatValue != (double)this.m_UpperLegTwistFactor)
            {
                Undo.RegisterCompleteObjectUndo((UnityEngine.Object) this, "Upper leg twist");
                this.m_UpperLegTwistProperty.floatValue = this.m_UpperLegTwistFactor;
                this.UpdateAvatarParameter(HumanParameter.UpperLegTwist, this.m_UpperLegTwistFactor);
                flag = true;
            }
            this.m_LegTwistFactor = EditorGUI.Slider(AvatarMuscleEditor.GetSettingsRect(), AvatarMuscleEditor.styles.legTwist, this.m_LegTwistFactor, 0.0f, 1f);
            if ((double)this.m_LegTwistProperty.floatValue != (double)this.m_LegTwistFactor)
            {
                Undo.RegisterCompleteObjectUndo((UnityEngine.Object) this, "Lower leg twist");
                this.m_LegTwistProperty.floatValue = this.m_LegTwistFactor;
                this.UpdateAvatarParameter(HumanParameter.LowerLegTwist, this.m_LegTwistFactor);
                flag = true;
            }
            this.m_ArmStretchFactor = EditorGUI.Slider(AvatarMuscleEditor.GetSettingsRect(), AvatarMuscleEditor.styles.armStretch, this.m_ArmStretchFactor, 0.0f, 1f);
            if ((double)this.m_ArmStretchProperty.floatValue != (double)this.m_ArmStretchFactor)
            {
                Undo.RegisterCompleteObjectUndo((UnityEngine.Object) this, "Arm stretch");
                this.m_ArmStretchProperty.floatValue = this.m_ArmStretchFactor;
                this.UpdateAvatarParameter(HumanParameter.ArmStretch, this.m_ArmStretchFactor);
                flag = true;
            }
            this.m_LegStretchFactor = EditorGUI.Slider(AvatarMuscleEditor.GetSettingsRect(), AvatarMuscleEditor.styles.legStretch, this.m_LegStretchFactor, 0.0f, 1f);
            if ((double)this.m_LegStretchProperty.floatValue != (double)this.m_LegStretchFactor)
            {
                Undo.RegisterCompleteObjectUndo((UnityEngine.Object) this, "Leg stretch");
                this.m_LegStretchProperty.floatValue = this.m_LegStretchFactor;
                this.UpdateAvatarParameter(HumanParameter.LegStretch, this.m_LegStretchFactor);
                flag = true;
            }
            this.m_FeetSpacingFactor = EditorGUI.Slider(AvatarMuscleEditor.GetSettingsRect(), AvatarMuscleEditor.styles.feetSpacing, this.m_FeetSpacingFactor, 0.0f, 1f);
            if ((double)this.m_FeetSpacingProperty.floatValue != (double)this.m_FeetSpacingFactor)
            {
                Undo.RegisterCompleteObjectUndo((UnityEngine.Object) this, "Feet spacing");
                this.m_FeetSpacingProperty.floatValue = this.m_FeetSpacingFactor;
                this.UpdateAvatarParameter(HumanParameter.FeetSpacing, this.m_FeetSpacingFactor);
                flag = true;
            }
            this.m_HasTranslationDoF = EditorGUI.Toggle(AvatarMuscleEditor.GetSettingsRect(), AvatarMuscleEditor.styles.hasTranslationDoF, this.m_HasTranslationDoF);
            if (this.m_HasTranslationDoFProperty.boolValue != this.m_HasTranslationDoF)
            {
                Undo.RegisterCompleteObjectUndo((UnityEngine.Object) this, "Translation DoF");
                this.m_HasTranslationDoFProperty.boolValue = this.m_HasTranslationDoF;
            }
            GUILayout.EndVertical();
            if (!flag)
            {
                return;
            }
            this.WritePose();
        }
コード例 #6
0
        protected void MuscleGUI()
        {
            bool flag1 = false;

            this.HeaderGUI("Preview", "Per-Muscle Settings");
            GUILayout.BeginVertical(AvatarMuscleEditor.styles.box, new GUILayoutOption[0]);
            for (int index1 = 0; index1 < this.m_MuscleBodyGroupToggle.Length; ++index1)
            {
                Rect settingsRect = AvatarMuscleEditor.GetSettingsRect(GUILayoutUtility.GetRect(10f, 16f));
                this.m_MuscleBodyGroupToggle[index1] = GUI.Toggle(settingsRect, this.m_MuscleBodyGroupToggle[index1], AvatarMuscleEditor.styles.muscleBodyGroup[index1], EditorStyles.foldout);
                if (this.m_MuscleBodyGroupToggle[index1])
                {
                    for (int index2 = 0; index2 < this.m_Muscles[index1].Length; ++index2)
                    {
                        int muscleId = this.m_Muscles[index1][index2];
                        if (muscleId != -1 && this.m_MuscleMin[muscleId] != null && this.m_MuscleMax[muscleId] != null)
                        {
                            bool flag2 = this.m_MuscleToggle[muscleId];
                            Rect rect  = GUILayoutUtility.GetRect(10f, !flag2 ? 16f : 32f);
                            settingsRect                  = AvatarMuscleEditor.GetSettingsRect(rect);
                            settingsRect.xMin            += 15f;
                            settingsRect.height           = 16f;
                            this.m_MuscleToggle[muscleId] = GUI.Toggle(settingsRect, this.m_MuscleToggle[muscleId], this.m_MuscleName[muscleId], EditorStyles.foldout);
                            float num = AvatarMuscleEditor.PreviewSlider(rect, this.m_MuscleValue[muscleId]);
                            if ((double)this.m_MuscleValue[muscleId] != (double)num)
                            {
                                Undo.RegisterCompleteObjectUndo((UnityEngine.Object) this, "Muscle preview");
                                this.m_FocusedMuscle         = muscleId;
                                this.m_MuscleValue[muscleId] = num;
                                flag1 |= (UnityEngine.Object) this.gameObject != (UnityEngine.Object)null;
                            }
                            if (flag2)
                            {
                                bool flag3 = false;
                                settingsRect.xMin += 15f;
                                settingsRect.y    += 16f;
                                Rect position1 = settingsRect;
                                if ((double)settingsRect.width > 160.0)
                                {
                                    Rect position2 = settingsRect;
                                    position2.width = 38f;
                                    EditorGUI.BeginChangeCheck();
                                    this.m_MuscleMinEdit[muscleId] = EditorGUI.FloatField(position2, this.m_MuscleMinEdit[muscleId]);
                                    bool flag4 = flag3 | EditorGUI.EndChangeCheck();
                                    position2.x = settingsRect.xMax - 38f;
                                    EditorGUI.BeginChangeCheck();
                                    this.m_MuscleMaxEdit[muscleId] = EditorGUI.FloatField(position2, this.m_MuscleMaxEdit[muscleId]);
                                    flag3           = flag4 | EditorGUI.EndChangeCheck();
                                    position1.xMin += 43f;
                                    position1.xMax -= 43f;
                                }
                                EditorGUI.BeginChangeCheck();
                                EditorGUI.MinMaxSlider(position1, ref this.m_MuscleMinEdit[muscleId], ref this.m_MuscleMaxEdit[muscleId], -180f, 180f);
                                if (flag3 | EditorGUI.EndChangeCheck())
                                {
                                    this.m_MuscleMinEdit[muscleId] = Mathf.Clamp(this.m_MuscleMinEdit[muscleId], -180f, 0.0f);
                                    this.m_MuscleMaxEdit[muscleId] = Mathf.Clamp(this.m_MuscleMaxEdit[muscleId], 0.0f, 180f);
                                    flag1 |= this.UpdateMuscle(muscleId, this.m_MuscleMinEdit[muscleId], this.m_MuscleMaxEdit[muscleId]);
                                }
                            }
                        }
                    }
                }
            }
            GUILayout.EndVertical();
            if (!flag1)
            {
                return;
            }
            this.WritePose();
        }
コード例 #7
0
 private static Rect GetSettingsRect()
 {
     return(AvatarMuscleEditor.GetSettingsRect(GUILayoutUtility.GetRect(10f, 16f)));
 }
コード例 #8
0
        protected void MuscleGUI()
        {
            bool flag = false;

            this.HeaderGUI("Preview", "Per-Muscle Settings");
            GUILayout.BeginVertical(AvatarMuscleEditor.styles.box, new GUILayoutOption[0]);
            for (int i = 0; i < this.m_MuscleBodyGroupToggle.Length; i++)
            {
                Rect rect         = GUILayoutUtility.GetRect(10f, 16f);
                Rect settingsRect = AvatarMuscleEditor.GetSettingsRect(rect);
                this.m_MuscleBodyGroupToggle[i] = GUI.Toggle(settingsRect, this.m_MuscleBodyGroupToggle[i], AvatarMuscleEditor.styles.muscleBodyGroup[i], EditorStyles.foldout);
                if (this.m_MuscleBodyGroupToggle[i])
                {
                    for (int j = 0; j < this.m_Muscles[i].Length; j++)
                    {
                        int num = this.m_Muscles[i][j];
                        if (num != -1 && this.m_MuscleMin[num] != null && this.m_MuscleMax[num] != null)
                        {
                            bool flag2 = this.m_MuscleToggle[num];
                            rect                     = GUILayoutUtility.GetRect(10f, (!flag2) ? 16f : 32f);
                            settingsRect             = AvatarMuscleEditor.GetSettingsRect(rect);
                            settingsRect.xMin       += 15f;
                            settingsRect.height      = 16f;
                            this.m_MuscleToggle[num] = GUI.Toggle(settingsRect, this.m_MuscleToggle[num], this.m_MuscleName[num], EditorStyles.foldout);
                            float num2 = AvatarMuscleEditor.PreviewSlider(rect, this.m_MuscleValue[num]);
                            if (this.m_MuscleValue[num] != num2)
                            {
                                Undo.RegisterCompleteObjectUndo(this, "Muscle preview");
                                this.m_FocusedMuscle    = num;
                                this.m_MuscleValue[num] = num2;
                                flag |= (base.gameObject != null);
                            }
                            if (flag2)
                            {
                                bool flag3 = false;
                                settingsRect.xMin += 15f;
                                settingsRect.y    += 16f;
                                Rect position = settingsRect;
                                if (settingsRect.width > 160f)
                                {
                                    Rect position2 = settingsRect;
                                    position2.width = 38f;
                                    EditorGUI.BeginChangeCheck();
                                    this.m_MuscleMinEdit[num] = EditorGUI.FloatField(position2, this.m_MuscleMinEdit[num]);
                                    flag3      |= EditorGUI.EndChangeCheck();
                                    position2.x = settingsRect.xMax - 38f;
                                    EditorGUI.BeginChangeCheck();
                                    this.m_MuscleMaxEdit[num] = EditorGUI.FloatField(position2, this.m_MuscleMaxEdit[num]);
                                    flag3         |= EditorGUI.EndChangeCheck();
                                    position.xMin += 43f;
                                    position.xMax -= 43f;
                                }
                                EditorGUI.BeginChangeCheck();
                                EditorGUI.MinMaxSlider(position, ref this.m_MuscleMinEdit[num], ref this.m_MuscleMaxEdit[num], -180f, 180f);
                                flag3 |= EditorGUI.EndChangeCheck();
                                if (flag3)
                                {
                                    this.m_MuscleMinEdit[num] = Mathf.Clamp(this.m_MuscleMinEdit[num], -180f, 0f);
                                    this.m_MuscleMaxEdit[num] = Mathf.Clamp(this.m_MuscleMaxEdit[num], 0f, 180f);
                                    flag |= this.UpdateMuscle(num, this.m_MuscleMinEdit[num], this.m_MuscleMaxEdit[num]);
                                }
                            }
                        }
                    }
                }
            }
            GUILayout.EndVertical();
            if (flag)
            {
                this.WritePose();
            }
        }