Ejemplo n.º 1
0
 internal void SwitchToAssetMode()
 {
     using (List <AvatarEditor.SceneStateCache> .Enumerator enumerator = this.m_SceneStates.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             AvatarEditor.SceneStateCache current = enumerator.Current;
             if (!((UnityEngine.Object)current.view == (UnityEngine.Object)null))
             {
                 current.view.m_SceneViewState.showFog            = current.state.showFog;
                 current.view.m_SceneViewState.showFlares         = current.state.showFlares;
                 current.view.m_SceneViewState.showMaterialUpdate = current.state.showMaterialUpdate;
                 current.view.m_SceneViewState.showSkybox         = current.state.showSkybox;
             }
         }
     }
     this.m_EditMode = AvatarEditor.EditMode.Stopping;
     this.DestroyEditor();
     this.ChangeInspectorLock(this.m_InspectorLocked);
     if (!EditorApplication.isUpdating && !Unsupported.IsDestroyScriptableObject((ScriptableObject)this))
     {
         if (SceneManager.GetActiveScene().path.Length <= 0)
         {
             if (this.sceneSetup != null && this.sceneSetup.Length > 0)
             {
                 EditorSceneManager.RestoreSceneManagerSetup(this.sceneSetup);
                 this.sceneSetup = (SceneSetup[])null;
             }
             else
             {
                 EditorSceneManager.NewScene(NewSceneSetup.DefaultGameObjects);
             }
         }
     }
     else if (Unsupported.IsDestroyScriptableObject((ScriptableObject)this))
     {
         // ISSUE: object of a compiler-generated type is created
         // ISSUE: variable of a compiler-generated type
         AvatarEditor.\u003CSwitchToAssetMode\u003Ec__AnonStorey9C modeCAnonStorey9C = new AvatarEditor.\u003CSwitchToAssetMode\u003Ec__AnonStorey9C();
         // ISSUE: reference to a compiler-generated field
         modeCAnonStorey9C.\u003C\u003Ef__this = this;
         // ISSUE: reference to a compiler-generated field
         modeCAnonStorey9C.CleanUpSceneOnDestroy = (EditorApplication.CallbackFunction)null;
         // ISSUE: reference to a compiler-generated field
         // ISSUE: reference to a compiler-generated method
         modeCAnonStorey9C.CleanUpSceneOnDestroy = new EditorApplication.CallbackFunction(modeCAnonStorey9C.\u003C\u003Em__1C9);
         // ISSUE: reference to a compiler-generated field
         EditorApplication.update += modeCAnonStorey9C.CleanUpSceneOnDestroy;
     }
     this.m_GameObject = (GameObject)null;
     this.m_ModelBones = (Dictionary <Transform, bool>)null;
     this.SelectAsset();
     if (this.m_CameFromImportSettings)
     {
         return;
     }
     this.m_EditMode = AvatarEditor.EditMode.NotEditing;
 }
Ejemplo n.º 2
0
        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();
                }
            }
        }
Ejemplo n.º 3
0
        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();
            }
        }
Ejemplo n.º 4
0
 internal void SwitchToAssetMode()
 {
     foreach (AvatarEditor.SceneStateCache current in this.m_SceneStates)
     {
         if (!(current.view == null))
         {
             current.view.sceneViewState.showFog             = current.state.showFog;
             current.view.sceneViewState.showFlares          = current.state.showFlares;
             current.view.sceneViewState.showMaterialUpdate  = current.state.showMaterialUpdate;
             current.view.sceneViewState.showSkybox          = current.state.showSkybox;
             current.view.sceneViewState.showImageEffects    = current.state.showImageEffects;
             current.view.sceneViewState.showParticleSystems = current.state.showParticleSystems;
         }
     }
     this.m_EditMode = AvatarEditor.EditMode.Stopping;
     this.DestroyEditor();
     this.ChangeInspectorLock(this.m_InspectorLocked);
     if (!EditorApplication.isPlaying)
     {
         EditorApplication.CallbackFunction CleanUpSceneOnDestroy = null;
         CleanUpSceneOnDestroy = delegate
         {
             string path = SceneManager.GetActiveScene().path;
             if (path.Length <= 0)
             {
                 if (this.sceneSetup != null && this.sceneSetup.Length > 0)
                 {
                     EditorSceneManager.RestoreSceneManagerSetup(this.sceneSetup);
                     this.sceneSetup = null;
                 }
                 else
                 {
                     EditorSceneManager.NewScene(NewSceneSetup.DefaultGameObjects);
                 }
             }
             EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Remove(EditorApplication.update, CleanUpSceneOnDestroy);
         };
         EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Combine(EditorApplication.update, CleanUpSceneOnDestroy);
     }
     this.m_GameObject = null;
     this.m_ModelBones = null;
     this.SelectAsset();
     if (!this.m_CameFromImportSettings)
     {
         this.m_EditMode = AvatarEditor.EditMode.NotEditing;
     }
 }
Ejemplo n.º 5
0
 internal void SwitchToAssetMode()
 {
     foreach (AvatarEditor.SceneStateCache current in this.m_SceneStates)
     {
         if (!(current.view == null))
         {
             current.view.m_SceneViewState.showFog            = current.state.showFog;
             current.view.m_SceneViewState.showFlares         = current.state.showFlares;
             current.view.m_SceneViewState.showMaterialUpdate = current.state.showMaterialUpdate;
             current.view.m_SceneViewState.showSkybox         = current.state.showSkybox;
         }
     }
     this.m_EditMode = AvatarEditor.EditMode.Stopping;
     this.DestroyEditor();
     this.ChangeInspectorLock(this.m_InspectorLocked);
     if (!EditorApplication.isUpdating && !Unsupported.IsDestroyScriptableObject(this))
     {
         string currentScene = EditorApplication.currentScene;
         if (currentScene.Length <= 0)
         {
             if (this.m_UserFileName.Length > 0)
             {
                 EditorApplication.OpenScene(this.m_UserFileName);
             }
             else
             {
                 EditorApplication.NewScene();
             }
         }
     }
     else
     {
         if (Unsupported.IsDestroyScriptableObject(this))
         {
             EditorApplication.CallbackFunction CleanUpSceneOnDestroy = null;
             string userFileName = this.m_UserFileName;
             CleanUpSceneOnDestroy = delegate
             {
                 string currentScene2 = EditorApplication.currentScene;
                 if (currentScene2.Length <= 0)
                 {
                     if (userFileName.Length > 0)
                     {
                         EditorApplication.OpenScene(userFileName);
                     }
                     else
                     {
                         EditorApplication.NewScene();
                     }
                 }
                 EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Remove(EditorApplication.update, CleanUpSceneOnDestroy);
             };
             EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Combine(EditorApplication.update, CleanUpSceneOnDestroy);
         }
     }
     this.m_GameObject = null;
     this.m_ModelBones = null;
     this.SelectAsset();
     if (!this.m_CameFromImportSettings)
     {
         this.m_EditMode = AvatarEditor.EditMode.NotEditing;
     }
 }
Ejemplo n.º 6
0
 internal void SwitchToAssetMode()
 {
   using (List<AvatarEditor.SceneStateCache>.Enumerator enumerator = this.m_SceneStates.GetEnumerator())
   {
     while (enumerator.MoveNext())
     {
       AvatarEditor.SceneStateCache current = enumerator.Current;
       if (!((UnityEngine.Object) current.view == (UnityEngine.Object) null))
       {
         current.view.m_SceneViewState.showFog = current.state.showFog;
         current.view.m_SceneViewState.showFlares = current.state.showFlares;
         current.view.m_SceneViewState.showMaterialUpdate = current.state.showMaterialUpdate;
         current.view.m_SceneViewState.showSkybox = current.state.showSkybox;
       }
     }
   }
   this.m_EditMode = AvatarEditor.EditMode.Stopping;
   this.DestroyEditor();
   this.ChangeInspectorLock(this.m_InspectorLocked);
   if (!EditorApplication.isUpdating && !Unsupported.IsDestroyScriptableObject((ScriptableObject) this))
   {
     if (SceneManager.GetActiveScene().path.Length <= 0)
     {
       if (this.sceneSetup != null && this.sceneSetup.Length > 0)
       {
         EditorSceneManager.RestoreSceneManagerSetup(this.sceneSetup);
         this.sceneSetup = (SceneSetup[]) null;
       }
       else
         EditorSceneManager.NewScene(NewSceneSetup.DefaultGameObjects);
     }
   }
   else if (Unsupported.IsDestroyScriptableObject((ScriptableObject) this))
   {
     // ISSUE: object of a compiler-generated type is created
     // ISSUE: variable of a compiler-generated type
     AvatarEditor.\u003CSwitchToAssetMode\u003Ec__AnonStorey9C modeCAnonStorey9C = new AvatarEditor.\u003CSwitchToAssetMode\u003Ec__AnonStorey9C();
     // ISSUE: reference to a compiler-generated field
     modeCAnonStorey9C.\u003C\u003Ef__this = this;
     // ISSUE: reference to a compiler-generated field
     modeCAnonStorey9C.CleanUpSceneOnDestroy = (EditorApplication.CallbackFunction) null;
     // ISSUE: reference to a compiler-generated field
     // ISSUE: reference to a compiler-generated method
     modeCAnonStorey9C.CleanUpSceneOnDestroy = new EditorApplication.CallbackFunction(modeCAnonStorey9C.\u003C\u003Em__1C9);
     // ISSUE: reference to a compiler-generated field
     EditorApplication.update += modeCAnonStorey9C.CleanUpSceneOnDestroy;
   }
   this.m_GameObject = (GameObject) null;
   this.m_ModelBones = (Dictionary<Transform, bool>) null;
   this.SelectAsset();
   if (this.m_CameFromImportSettings)
     return;
   this.m_EditMode = AvatarEditor.EditMode.NotEditing;
 }
Ejemplo n.º 7
0
 internal void SwitchToEditMode()
 {
   this.m_EditMode = AvatarEditor.EditMode.Starting;
   this.ChangeInspectorLock(true);
   this.sceneSetup = EditorSceneManager.GetSceneManagerSetup();
   EditorSceneManager.NewScene(NewSceneSetup.DefaultGameObjects);
   this.m_GameObject = UnityEngine.Object.Instantiate<GameObject>(this.prefab);
   if (this.serializedObject.FindProperty("m_OptimizeGameObjects").boolValue)
     AnimatorUtility.DeoptimizeTransformHierarchy(this.m_GameObject);
   Animator component = this.m_GameObject.GetComponent<Animator>();
   if ((UnityEngine.Object) component != (UnityEngine.Object) null && (UnityEngine.Object) component.runtimeAnimatorController == (UnityEngine.Object) null)
   {
     AnimatorController animatorController = new AnimatorController();
     animatorController.hideFlags = HideFlags.DontSave;
     animatorController.AddLayer("preview");
     animatorController.layers[0].stateMachine.hideFlags = HideFlags.DontSave;
     component.runtimeAnimatorController = (RuntimeAnimatorController) animatorController;
   }
   this.m_ModelBones = AvatarSetupTool.GetModelBones(this.m_GameObject.transform, false, AvatarSetupTool.GetHumanBones(this.serializedObject, AvatarSetupTool.GetModelBones(this.m_GameObject.transform, true, (AvatarSetupTool.BoneWrapper[]) null)));
   Selection.activeObject = (UnityEngine.Object) this.m_GameObject;
   foreach (SceneHierarchyWindow sceneHierarchyWindow in Resources.FindObjectsOfTypeAll(typeof (SceneHierarchyWindow)))
     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.FrameSelected();
   }
 }
Ejemplo n.º 8
0
		internal void SwitchToAssetMode()
		{
			foreach (AvatarEditor.SceneStateCache current in this.m_SceneStates)
			{
				if (!(current.view == null))
				{
					current.view.m_SceneViewState.showFog = current.state.showFog;
					current.view.m_SceneViewState.showFlares = current.state.showFlares;
					current.view.m_SceneViewState.showMaterialUpdate = current.state.showMaterialUpdate;
					current.view.m_SceneViewState.showSkybox = current.state.showSkybox;
				}
			}
			this.m_EditMode = AvatarEditor.EditMode.Stopping;
			this.DestroyEditor();
			this.ChangeInspectorLock(this.m_InspectorLocked);
			if (!EditorApplication.isUpdating && !Unsupported.IsDestroyScriptableObject(this))
			{
				string currentScene = EditorApplication.currentScene;
				if (currentScene.Length <= 0)
				{
					if (this.m_UserFileName.Length > 0)
					{
						EditorApplication.OpenScene(this.m_UserFileName);
					}
					else
					{
						EditorApplication.NewScene();
					}
				}
			}
			else
			{
				if (Unsupported.IsDestroyScriptableObject(this))
				{
					EditorApplication.CallbackFunction CleanUpSceneOnDestroy = null;
					string userFileName = this.m_UserFileName;
					CleanUpSceneOnDestroy = delegate
					{
						string currentScene2 = EditorApplication.currentScene;
						if (currentScene2.Length <= 0)
						{
							if (userFileName.Length > 0)
							{
								EditorApplication.OpenScene(userFileName);
							}
							else
							{
								EditorApplication.NewScene();
							}
						}
						EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Remove(EditorApplication.update, CleanUpSceneOnDestroy);
					};
					EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Combine(EditorApplication.update, CleanUpSceneOnDestroy);
				}
			}
			this.m_GameObject = null;
			this.m_ModelBones = null;
			this.SelectAsset();
			if (!this.m_CameFromImportSettings)
			{
				this.m_EditMode = AvatarEditor.EditMode.NotEditing;
			}
		}
Ejemplo n.º 9
0
		internal void SwitchToEditMode()
		{
			this.m_EditMode = AvatarEditor.EditMode.Starting;
			this.ChangeInspectorLock(true);
			this.m_UserFileName = EditorApplication.currentScene;
			EditorApplication.NewScene();
			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");
				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.FrameSelected();
			}
		}