internal void SwitchToEditMode() { this.m_EditMode = AvatarEditor.EditMode.Starting; this.ChangeInspectorLock(true); this.sceneSetup = EditorSceneManager.GetSceneManagerSetup(); EditorSceneManager.NewScene(NewSceneSetup.DefaultGameObjects).name = "Avatar Configuration"; this.m_GameObject = UnityEngine.Object.Instantiate <GameObject>(this.prefab); if (base.serializedObject.FindProperty("m_OptimizeGameObjects").boolValue) { AnimatorUtility.DeoptimizeTransformHierarchy(this.m_GameObject); } Dictionary <Transform, bool> modelBones = AvatarSetupTool.GetModelBones(this.m_GameObject.transform, true, null); AvatarSetupTool.BoneWrapper[] humanBones = AvatarSetupTool.GetHumanBones(base.serializedObject, modelBones); this.m_ModelBones = AvatarSetupTool.GetModelBones(this.m_GameObject.transform, false, humanBones); Selection.activeObject = this.m_GameObject; UnityEngine.Object[] array = Resources.FindObjectsOfTypeAll(typeof(SceneHierarchyWindow)); for (int i = 0; i < array.Length; i++) { SceneHierarchyWindow sceneHierarchyWindow = (SceneHierarchyWindow)array[i]; sceneHierarchyWindow.SetExpandedRecursive(this.m_GameObject.GetInstanceID(), true); } this.CreateEditor(); this.m_EditMode = AvatarEditor.EditMode.Editing; this.m_SceneStates = new List <AvatarEditor.SceneStateCache>(); IEnumerator enumerator = SceneView.sceneViews.GetEnumerator(); try { while (enumerator.MoveNext()) { SceneView sceneView = (SceneView)enumerator.Current; this.m_SceneStates.Add(new AvatarEditor.SceneStateCache { state = new SceneView.SceneViewState(sceneView.sceneViewState), view = sceneView }); sceneView.sceneViewState.showFlares = false; sceneView.sceneViewState.showMaterialUpdate = false; sceneView.sceneViewState.showFog = false; sceneView.sceneViewState.showSkybox = false; sceneView.sceneViewState.showImageEffects = false; sceneView.sceneViewState.showParticleSystems = false; sceneView.FrameSelected(); } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } }
internal void SwitchToEditMode() { this.m_EditMode = AvatarEditor.EditMode.Starting; this.ChangeInspectorLock(true); this.sceneSetup = EditorSceneManager.GetSceneManagerSetup(); EditorSceneManager.NewScene(NewSceneSetup.DefaultGameObjects).name = "Avatar Configuration"; this.m_GameObject = UnityEngine.Object.Instantiate <GameObject>(this.prefab); if (base.serializedObject.FindProperty("m_OptimizeGameObjects").boolValue) { AnimatorUtility.DeoptimizeTransformHierarchy(this.m_GameObject); } Animator component = this.m_GameObject.GetComponent <Animator>(); if (component != null && component.runtimeAnimatorController == null) { AnimatorController animatorController = new AnimatorController(); animatorController.hideFlags = HideFlags.DontSave; animatorController.AddLayer("preview"); animatorController.layers[0].stateMachine.hideFlags = HideFlags.DontSave; component.runtimeAnimatorController = animatorController; } Dictionary <Transform, bool> modelBones = AvatarSetupTool.GetModelBones(this.m_GameObject.transform, true, null); AvatarSetupTool.BoneWrapper[] humanBones = AvatarSetupTool.GetHumanBones(base.serializedObject, modelBones); this.m_ModelBones = AvatarSetupTool.GetModelBones(this.m_GameObject.transform, false, humanBones); Selection.activeObject = this.m_GameObject; UnityEngine.Object[] array = Resources.FindObjectsOfTypeAll(typeof(SceneHierarchyWindow)); for (int i = 0; i < array.Length; i++) { SceneHierarchyWindow sceneHierarchyWindow = (SceneHierarchyWindow)array[i]; sceneHierarchyWindow.SetExpandedRecursive(this.m_GameObject.GetInstanceID(), true); } this.CreateEditor(); this.m_EditMode = AvatarEditor.EditMode.Editing; this.m_SceneStates = new List <AvatarEditor.SceneStateCache>(); foreach (SceneView sceneView in SceneView.sceneViews) { this.m_SceneStates.Add(new AvatarEditor.SceneStateCache { state = new SceneView.SceneViewState(sceneView.m_SceneViewState), view = sceneView }); sceneView.m_SceneViewState.showFlares = false; sceneView.m_SceneViewState.showMaterialUpdate = false; sceneView.m_SceneViewState.showFog = false; sceneView.m_SceneViewState.showSkybox = false; sceneView.m_SceneViewState.showImageEffects = false; sceneView.FrameSelected(); } }