void SetupBounds(GameObject go) { m_IsValid = go != null && go != GetGenericAnimationFallback(); if (go != null) { m_PreviewInstance = ReflectionHelper.Instance.EditorUtility.InstantiateForAnimatorPreview(go); m_PreviewInstance.tag = Constants.PREVIRE_TAG; 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; } } }
static public bool IsValidPreviewGameObject(GameObject target, ModelImporterAnimationType requiredClipType) { if (target != null && !target.activeSelf) { Debug.LogWarning("Can't preview inactive object, using fallback object"); } return(target != null && target.activeSelf && GameObjectInspector.HasRenderableParts(target) && !(requiredClipType != ModelImporterAnimationType.None && GetAnimationType(target) != requiredClipType)); }
void SetPreviewCharacterEnabled(bool enabled, bool showReference) { if (m_PreviewInstance != null) { GameObjectInspector.SetEnabledRecursive(m_PreviewInstance, enabled); } GameObjectInspector.SetEnabledRecursive(m_ReferenceInstance, showReference && enabled); GameObjectInspector.SetEnabledRecursive(m_DirectionInstance, showReference && enabled); GameObjectInspector.SetEnabledRecursive(m_PivotInstance, showReference && enabled); GameObjectInspector.SetEnabledRecursive(m_RootInstance, showReference && enabled); }