Ejemplo n.º 1
0
        void InitInstance(Animator scenePreviewObject, Motion motion)
        {
            m_SourcePreviewMotion        = motion;
            m_SourceScenePreviewAnimator = scenePreviewObject;

            if (m_PreviewInstance == null)
            {
                GameObject go = CalculatePreviewGameObject(scenePreviewObject, motion, animationClipType);
                SetupBounds(go);
            }

            if (timeControl == null)
            {
                timeControl = new TimeControl();
            }

            if (m_ReferenceInstance == null)
            {
                GameObject referenceGO = (GameObject)EditorGUIUtility.Load("Avatar/dial_flat.prefab");
                m_ReferenceInstance = (GameObject)Object.Instantiate(referenceGO, Vector3.zero, Quaternion.identity);
                EditorUtility.InitInstantiatedPreviewRecursive(m_ReferenceInstance);
                previewUtility.AddSingleGO(m_ReferenceInstance);
            }

            if (m_DirectionInstance == null)
            {
                GameObject directionGO = (GameObject)EditorGUIUtility.Load("Avatar/arrow.fbx");
                m_DirectionInstance = (GameObject)Object.Instantiate(directionGO, Vector3.zero, Quaternion.identity);
                EditorUtility.InitInstantiatedPreviewRecursive(m_DirectionInstance);
                previewUtility.AddSingleGO(m_DirectionInstance);
            }

            if (m_PivotInstance == null)
            {
                GameObject pivotGO = (GameObject)EditorGUIUtility.Load("Avatar/root.fbx");
                m_PivotInstance = (GameObject)Object.Instantiate(pivotGO, Vector3.zero, Quaternion.identity);
                EditorUtility.InitInstantiatedPreviewRecursive(m_PivotInstance);
                previewUtility.AddSingleGO(m_PivotInstance);
            }

            if (m_RootInstance == null)
            {
                GameObject rootGO = (GameObject)EditorGUIUtility.Load("Avatar/root.fbx");
                m_RootInstance = (GameObject)Object.Instantiate(rootGO, Vector3.zero, Quaternion.identity);
                EditorUtility.InitInstantiatedPreviewRecursive(m_RootInstance);
                previewUtility.AddSingleGO(m_RootInstance);
            }

            // Load preview settings from prefs
            m_IKOnFeet                = EditorPrefs.GetBool(kIkPref, false);
            m_ShowReference           = EditorPrefs.GetBool(kReferencePref, true);
            is2D                      = EditorPrefs.GetBool(k2DPref, EditorSettings.defaultBehaviorMode == EditorBehaviorMode.Mode2D);
            timeControl.playbackSpeed = EditorPrefs.GetFloat(kSpeedPref, 1f);

            SetPreviewCharacterEnabled(false, false);

            m_PivotPositionOffset = Vector3.zero;
        }
Ejemplo n.º 2
0
 private void InitInstance(Animator scenePreviewObject, Motion motion)
 {
     this.m_SourcePreviewMotion        = motion;
     this.m_SourceScenePreviewAnimator = scenePreviewObject;
     if (this.m_PreviewInstance == null)
     {
         GameObject go = AvatarPreview.CalculatePreviewGameObject(scenePreviewObject, motion, this.animationClipType);
         this.SetupBounds(go);
     }
     if (this.timeControl == null)
     {
         this.timeControl = new TimeControl();
     }
     if (this.m_ReferenceInstance == null)
     {
         GameObject original = (GameObject)EditorGUIUtility.Load("Avatar/dial_flat.prefab");
         this.m_ReferenceInstance = UnityEngine.Object.Instantiate <GameObject>(original, Vector3.zero, Quaternion.identity);
         EditorUtility.InitInstantiatedPreviewRecursive(this.m_ReferenceInstance);
         this.previewUtility.AddSingleGO(this.m_ReferenceInstance);
     }
     if (this.m_DirectionInstance == null)
     {
         GameObject original2 = (GameObject)EditorGUIUtility.Load("Avatar/arrow.fbx");
         this.m_DirectionInstance = UnityEngine.Object.Instantiate <GameObject>(original2, Vector3.zero, Quaternion.identity);
         EditorUtility.InitInstantiatedPreviewRecursive(this.m_DirectionInstance);
         this.previewUtility.AddSingleGO(this.m_DirectionInstance);
     }
     if (this.m_PivotInstance == null)
     {
         GameObject original3 = (GameObject)EditorGUIUtility.Load("Avatar/root.fbx");
         this.m_PivotInstance = UnityEngine.Object.Instantiate <GameObject>(original3, Vector3.zero, Quaternion.identity);
         EditorUtility.InitInstantiatedPreviewRecursive(this.m_PivotInstance);
         this.previewUtility.AddSingleGO(this.m_PivotInstance);
     }
     if (this.m_RootInstance == null)
     {
         GameObject original4 = (GameObject)EditorGUIUtility.Load("Avatar/root.fbx");
         this.m_RootInstance = UnityEngine.Object.Instantiate <GameObject>(original4, Vector3.zero, Quaternion.identity);
         EditorUtility.InitInstantiatedPreviewRecursive(this.m_RootInstance);
         this.previewUtility.AddSingleGO(this.m_RootInstance);
     }
     this.m_IKOnFeet                = EditorPrefs.GetBool("AvatarpreviewShowIK", false);
     this.m_ShowReference           = EditorPrefs.GetBool("AvatarpreviewShowReference", true);
     this.is2D                      = EditorPrefs.GetBool("Avatarpreview2D", EditorSettings.defaultBehaviorMode == EditorBehaviorMode.Mode2D);
     this.timeControl.playbackSpeed = EditorPrefs.GetFloat("AvatarpreviewSpeed", 1f);
     this.SetPreviewCharacterEnabled(false, false);
     this.m_PivotPositionOffset = Vector3.zero;
 }
Ejemplo n.º 3
0
 private void InitInstance(UnityEngine.Animator scenePreviewObject, Motion motion)
 {
     this.m_SourcePreviewMotion        = motion;
     this.m_SourceScenePreviewAnimator = scenePreviewObject;
     if (this.m_PreviewInstance == null)
     {
         GameObject go = CalculatePreviewGameObject(scenePreviewObject, motion, this.animationClipType);
         this.SetupBounds(go);
     }
     if (this.timeControl == null)
     {
         this.timeControl = new TimeControl();
     }
     if (this.m_ReferenceInstance == null)
     {
         GameObject original = (GameObject)EditorGUIUtility.Load("Avatar/dial_flat.prefab");
         this.m_ReferenceInstance = UnityEngine.Object.Instantiate <GameObject>(original, Vector3.zero, Quaternion.identity);
         EditorUtility.InitInstantiatedPreviewRecursive(this.m_ReferenceInstance);
     }
     if (this.m_DirectionInstance == null)
     {
         GameObject obj4 = (GameObject)EditorGUIUtility.Load("Avatar/arrow.fbx");
         this.m_DirectionInstance = UnityEngine.Object.Instantiate <GameObject>(obj4, Vector3.zero, Quaternion.identity);
         EditorUtility.InitInstantiatedPreviewRecursive(this.m_DirectionInstance);
     }
     if (this.m_PivotInstance == null)
     {
         GameObject obj5 = (GameObject)EditorGUIUtility.Load("Avatar/root.fbx");
         this.m_PivotInstance = UnityEngine.Object.Instantiate <GameObject>(obj5, Vector3.zero, Quaternion.identity);
         EditorUtility.InitInstantiatedPreviewRecursive(this.m_PivotInstance);
     }
     if (this.m_RootInstance == null)
     {
         GameObject obj6 = (GameObject)EditorGUIUtility.Load("Avatar/root.fbx");
         this.m_RootInstance = UnityEngine.Object.Instantiate <GameObject>(obj6, Vector3.zero, Quaternion.identity);
         EditorUtility.InitInstantiatedPreviewRecursive(this.m_RootInstance);
     }
     this.m_IKOnFeet                = EditorPrefs.GetBool("AvatarpreviewShowIK", false);
     this.m_ShowReference           = EditorPrefs.GetBool("AvatarpreviewShowReference", true);
     this.timeControl.playbackSpeed = EditorPrefs.GetFloat("AvatarpreviewSpeed", 1f);
     this.SetPreviewCharacterEnabled(false, false);
 }
Ejemplo n.º 4
0
 private void InitInstance(UnityEngine.Animator scenePreviewObject, Motion motion)
 {
     this.m_SourcePreviewMotion = motion;
     this.m_SourceScenePreviewAnimator = scenePreviewObject;
     if (this.m_PreviewInstance == null)
     {
         GameObject go = CalculatePreviewGameObject(scenePreviewObject, motion, this.animationClipType);
         this.SetupBounds(go);
     }
     if (this.timeControl == null)
     {
         this.timeControl = new TimeControl();
     }
     if (this.m_ReferenceInstance == null)
     {
         GameObject original = (GameObject) EditorGUIUtility.Load("Avatar/dial_flat.prefab");
         this.m_ReferenceInstance = (GameObject) UnityEngine.Object.Instantiate(original, Vector3.zero, Quaternion.identity);
         EditorUtility.InitInstantiatedPreviewRecursive(this.m_ReferenceInstance);
     }
     if (this.m_DirectionInstance == null)
     {
         GameObject obj4 = (GameObject) EditorGUIUtility.Load("Avatar/arrow.fbx");
         this.m_DirectionInstance = (GameObject) UnityEngine.Object.Instantiate(obj4, Vector3.zero, Quaternion.identity);
         EditorUtility.InitInstantiatedPreviewRecursive(this.m_DirectionInstance);
     }
     if (this.m_PivotInstance == null)
     {
         GameObject obj5 = (GameObject) EditorGUIUtility.Load("Avatar/root.fbx");
         this.m_PivotInstance = (GameObject) UnityEngine.Object.Instantiate(obj5, Vector3.zero, Quaternion.identity);
         EditorUtility.InitInstantiatedPreviewRecursive(this.m_PivotInstance);
     }
     if (this.m_RootInstance == null)
     {
         GameObject obj6 = (GameObject) EditorGUIUtility.Load("Avatar/root.fbx");
         this.m_RootInstance = (GameObject) UnityEngine.Object.Instantiate(obj6, Vector3.zero, Quaternion.identity);
         EditorUtility.InitInstantiatedPreviewRecursive(this.m_RootInstance);
     }
     this.m_IKOnFeet = EditorPrefs.GetBool("AvatarpreviewShowIK", false);
     this.m_ShowReference = EditorPrefs.GetBool("AvatarpreviewShowReference", true);
     this.timeControl.playbackSpeed = EditorPrefs.GetFloat("AvatarpreviewSpeed", 1f);
     this.SetPreviewCharacterEnabled(false, false);
 }