InstantiateForAnimatorPreview() static private method

static private InstantiateForAnimatorPreview ( Object original ) : GameObject
original Object
return UnityEngine.GameObject
示例#1
0
        void SetupBounds(GameObject go)
        {
            m_IsValid = go != null && go != GetGenericAnimationFallback();

            if (go != null)
            {
                m_PreviewInstance = EditorUtility.InstantiateForAnimatorPreview(go);
                previewUtility.AddSingleGO(m_PreviewInstance);

                m_Previewables = m_PreviewInstance.GetComponentsInChildren <IAnimationPreviewable>();
                var bounds = GameObjectInspector.GetRenderableBounds(m_PreviewInstance);

                m_BoundingVolumeScale = Mathf.Max(bounds.size.x, Mathf.Max(bounds.size.y, bounds.size.z));


                if (Animator && Animator.isHuman)
                {
                    m_AvatarScale = m_ZoomFactor = Animator.humanScale;
                }
                else
                {
                    m_AvatarScale = m_ZoomFactor = m_BoundingVolumeScale / 2;
                }
            }
        }
        void SetupBounds(GameObject go)
        {
            m_IsValid = go != null && go != GetGenericAnimationFallback();

            if (go != null)
            {
                m_PreviewInstance = EditorUtility.InstantiateForAnimatorPreview(go);
                previewUtility.AddSingleGO(m_PreviewInstance);

                Bounds bounds = new Bounds(m_PreviewInstance.transform.position, Vector3.zero);
                GameObjectInspector.GetRenderableBoundsRecurse(ref bounds, m_PreviewInstance);

                m_BoundingVolumeScale = Mathf.Max(bounds.size.x, Mathf.Max(bounds.size.y, bounds.size.z));


                if (Animator && Animator.isHuman)
                {
                    m_AvatarScale = m_ZoomFactor = Animator.humanScale;
                }
                else
                {
                    m_AvatarScale = m_ZoomFactor = m_BoundingVolumeScale / 2;
                }
            }
        }
 private void CreatePreviewInstances()
 {
     if (this.m_PreviewInstances == null)
     {
         this.m_PreviewInstances = new List <GameObject>(base.targets.Length);
     }
     for (int i = 0; i < base.targets.Length; i++)
     {
         GameObject gameObject = EditorUtility.InstantiateForAnimatorPreview(base.targets[i]);
         this.m_PreviewInstances.Add(gameObject);
         this.m_PreviewUtility.AddSingleGO(gameObject);
     }
 }
 private void CreatePreviewInstances()
 {
     this.DestroyPreviewInstances();
     if (this.m_PreviewInstances == null)
     {
         this.m_PreviewInstances = new List <GameObject>(base.targets.Length);
     }
     for (int i = 0; i < base.targets.Length; i++)
     {
         GameObject go = EditorUtility.InstantiateForAnimatorPreview(base.targets[i]);
         SetEnabledRecursive(go, false);
         this.m_PreviewInstances.Add(go);
     }
 }
 private void CreatePreviewInstances()
 {
     this.DestroyPreviewInstances();
     if (this.m_PreviewInstances == null)
     {
         this.m_PreviewInstances = new List <GameObject>(this.targets.Length);
     }
     for (int index = 0; index < this.targets.Length; ++index)
     {
         GameObject go = EditorUtility.InstantiateForAnimatorPreview(this.targets[index]);
         GameObjectInspector.SetEnabledRecursive(go, false);
         this.m_PreviewInstances.Add(go);
     }
 }
 private void SetupBounds(GameObject go)
 {
     this.m_IsValid = (go != null) && (go != GetGenericAnimationFallback());
     if (go != null)
     {
         this.m_PreviewInstance = EditorUtility.InstantiateForAnimatorPreview(go);
         Bounds bounds = new Bounds(this.m_PreviewInstance.transform.position, Vector3.zero);
         GameObjectInspector.GetRenderableBoundsRecurse(ref bounds, this.m_PreviewInstance);
         this.m_BoundingVolumeScale = Mathf.Max(bounds.size.x, Mathf.Max(bounds.size.y, bounds.size.z));
         if ((this.Animator != null) && this.Animator.isHuman)
         {
             this.m_AvatarScale = this.m_ZoomFactor = this.Animator.humanScale;
         }
         else
         {
             this.m_AvatarScale = this.m_ZoomFactor = this.m_BoundingVolumeScale / 2f;
         }
     }
 }
 public void UpdateGameObject(UnityObject targetObject)
 {
     UnityObject.DestroyImmediate(gameObject);
     gameObject = EditorUtility.InstantiateForAnimatorPreview(targetObject);
     renderUtility.AddManagedGO(gameObject);
 }
 public void UpdateGameObject(UnityEngine.Object targetObject)
 {
     UnityEngine.Object.DestroyImmediate(this.gameObject);
     this.m_GameObject = EditorUtility.InstantiateForAnimatorPreview(targetObject);
     this.renderUtility.AddManagedGO(this.gameObject);
 }