Ejemplo n.º 1
0
 private void ClipRootMotionOffsetsGUI()
 {
     this.m_PositionProperty.set_isExpanded(EditorGUILayout.Foldout(this.m_PositionProperty.get_isExpanded(), AnimationPlayableAssetInspector.Styles.ClipOffsetTitle));
     if (this.m_PositionProperty.get_isExpanded())
     {
         float num  = 0f;
         float num2 = 0f;
         EditorGUI.set_indentLevel(EditorGUI.get_indentLevel() + 1);
         TimelineAnimationUtilities.OffsetEditMode offsetEditMode = this.m_OffsetEditMode;
         AnimationTrackInspector.ShowMotionOffsetEditModeToolbar(ref this.m_OffsetEditMode);
         if (offsetEditMode != this.m_OffsetEditMode)
         {
             this.SetTimeToClip();
             SceneView.RepaintAll();
         }
         EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
         EditorGUILayout.PropertyField(this.m_PositionProperty, new GUILayoutOption[0]);
         GUI.get_skin().get_button().CalcMinMaxWidth(AnimationPlayableAssetInspector.Styles.PositionIcon, ref num, ref num2);
         EditorGUILayout.EndHorizontal();
         EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
         AnimationPlayableAssetInspector.ShowRotationField(this.m_RotationProperty);
         EditorGUILayout.EndHorizontal();
         EditorGUILayout.Space();
         EditorGUI.set_indentLevel(EditorGUI.get_indentLevel() - 1);
     }
 }
Ejemplo n.º 2
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();
            base.get_serializedObject().Update();
            bool flag = this.m_lastPosition != this.m_TrackPositionProperty.get_vector3Value() || this.m_lastRotation != this.m_TrackRotationProperty.get_quaternionValue();

            this.m_lastPosition = this.m_TrackPositionProperty.get_vector3Value();
            this.m_lastRotation = this.m_TrackRotationProperty.get_quaternionValue();
            EditorGUI.BeginChangeCheck();
            this.DrawAvatarProperties();
            if (EditorGUI.EndChangeCheck())
            {
                this.RebuildGraph();
            }
            if (base.get_targets().Length == 1)
            {
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(this.m_ApplyOffsetsProperty, AnimationTrackInspector.Styles.TrackOffsetTitle, new GUILayoutOption[0]);
                if (EditorGUI.EndChangeCheck())
                {
                    this.RebuildGraph();
                }
                Animator animator = this.GetAnimator();
                bool     flag2    = animator == null || !TimelineAnimationUtilities.ValidateOffsetAvailabitity(base.timelineWindow.state.currentDirector, animator) || !this.m_ApplyOffsetsProperty.get_boolValue();
                using (new EditorGUI.DisabledScope(flag2))
                {
                    EditorGUI.set_indentLevel(EditorGUI.get_indentLevel() + 1);
                    float num  = 0f;
                    float num2 = 0f;
                    GUI.get_skin().get_button().CalcMinMaxWidth(AnimationTrackInspector.Styles.PositionIcon, ref num, ref num2);
                    AnimationTrackInspector.ShowMotionOffsetEditModeToolbar(ref this.m_OffsetEditMode);
                    SceneView.RepaintAll();
                    EditorGUI.BeginChangeCheck();
                    EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
                    EditorGUILayout.PropertyField(this.m_TrackPositionProperty, new GUILayoutOption[0]);
                    EditorGUILayout.EndHorizontal();
                    EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
                    AnimationPlayableAssetInspector.ShowRotationField(this.m_TrackRotationProperty);
                    EditorGUILayout.EndHorizontal();
                    EditorGUILayout.Space();
                    EditorGUILayout.Space();
                    EditorGUI.set_indentLevel(EditorGUI.get_indentLevel() - 1);
                    flag |= EditorGUI.EndChangeCheck();
                    if (flag)
                    {
                        AnimationTrack animationTrack = (AnimationTrack)base.get_target();
                        animationTrack.UpdateClipOffsets();
                        this.Evaluate();
                    }
                }
            }
            else
            {
                GUILayout.Label(AnimationTrackInspector.Styles.TrackOffsetCannotBeEditedWarning, EditorStyles.get_helpBox(), new GUILayoutOption[0]);
            }
            AnimationTrackInspector.MatchTargetsField(this.m_MatchFieldsProperty, null, null, false);
            base.get_serializedObject().ApplyModifiedProperties();
        }
        void TransformOffsetsGUI()
        {
            if (ShouldShowOffsets())
            {
                EditorGUILayout.Space();
                EditorGUILayout.LabelField(Styles.TransformOffsetTitle);
                EditorGUI.indentLevel++;

                using (new EditorGUI.DisabledScope(targets.Length > 1))
                {
                    var previousOffsetMode = m_OffsetEditMode;
                    AnimationTrackInspector.ShowMotionOffsetEditModeToolbar(ref m_OffsetEditMode);
                    if (previousOffsetMode != m_OffsetEditMode)
                    {
                        SetTimeToClip();
                        SceneView.RepaintAll();
                    }
                }

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PropertyField(m_PositionProperty);
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PropertyField(m_RotationProperty, Styles.RotationText);
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.Space();

                EditorGUI.indentLevel--;

                TransformOffsetsMatchFieldsGUI();

                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(m_RemoveStartOffsetProperty, Styles.RemoveStartOffset);
                if (EditorGUI.EndChangeCheck())
                {
                    TimelineEditor.Refresh(RefreshReason.ContentsAddedOrRemoved);
                    Repaint();
                }
            }
        }