コード例 #1
0
		private void SetupCamera()
		{
			if (this.m_RenderMode == DrawCameraMode.Overdraw)
			{
				this.m_Camera.backgroundColor = Color.black;
			}
			else
			{
				this.m_Camera.backgroundColor = SceneView.kSceneViewBackground;
			}
			EditorUtility.SetCameraAnimateMaterials(this.m_Camera, this.m_SceneViewState.showMaterialUpdate);
			this.ResetIfNaN();
			this.m_Camera.transform.rotation = this.m_Rotation.value;
			float num = this.m_Ortho.Fade(90f, 0f);
			if (num > 3f)
			{
				this.m_Camera.orthographic = false;
				this.m_Camera.fieldOfView = this.GetVerticalFOV(num);
			}
			else
			{
				this.m_Camera.orthographic = true;
				this.m_Camera.orthographicSize = this.GetVerticalOrthoSize();
			}
			this.m_Camera.transform.position = this.m_Position.value + this.m_Camera.transform.rotation * new Vector3(0f, 0f, -this.cameraDistance);
			float num2 = Mathf.Max(1000f, 2000f * this.size);
			this.m_Camera.nearClipPlane = num2 * 5E-06f;
			this.m_Camera.farClipPlane = num2;
			this.m_Camera.renderingPath = SceneView.GetSceneViewRenderingPath();
			if (!this.CheckDrawModeForRenderingPath(this.m_RenderMode))
			{
				this.m_RenderMode = DrawCameraMode.Textured;
			}
			this.SetSceneCameraHDRAndDepthModes();
			Handles.EnableCameraFlares(this.m_Camera, this.m_SceneViewState.showFlares);
			Handles.EnableCameraSkybox(this.m_Camera, this.m_SceneViewState.showSkybox);
			this.m_Light[0].transform.position = this.m_Camera.transform.position;
			this.m_Light[0].transform.rotation = this.m_Camera.transform.rotation;
			if (this.m_AudioPlay)
			{
				AudioUtil.SetListenerTransform(this.m_Camera.transform);
				AudioUtil.UpdateAudio();
			}
			if (this.m_ViewIsLockedToObject && Selection.gameObjects.Length > 0)
			{
				switch (this.m_DraggingLockedState)
				{
				case SceneView.DraggingLockedState.NotDragging:
					this.m_Position.value = Selection.activeGameObject.transform.position;
					break;
				case SceneView.DraggingLockedState.LookAt:
					if (!this.m_Position.value.Equals(Selection.activeGameObject.transform.position))
					{
						if (!EditorApplication.isPlaying)
						{
							this.m_Position.target = Selection.activeGameObject.transform.position;
						}
						else
						{
							this.m_Position.value = Selection.activeGameObject.transform.position;
						}
					}
					else
					{
						this.m_DraggingLockedState = SceneView.DraggingLockedState.NotDragging;
					}
					break;
				}
			}
		}
コード例 #2
0
		public override void OnEnable()
		{
			this.m_RectSelection = new RectSelection(this);
			if (this.grid == null)
			{
				this.grid = new SceneViewGrid();
			}
			this.grid.Register(this);
			if (this.svRot == null)
			{
				this.svRot = new SceneViewRotation();
			}
			this.svRot.Register(this);
			base.autoRepaintOnSceneChange = true;
			this.m_Rotation.valueChanged.AddListener(new UnityAction(base.Repaint));
			this.m_Position.valueChanged.AddListener(new UnityAction(base.Repaint));
			this.m_Size.valueChanged.AddListener(new UnityAction(base.Repaint));
			this.m_Ortho.valueChanged.AddListener(new UnityAction(base.Repaint));
			base.wantsMouseMove = true;
			base.dontClearBackground = true;
			SceneView.s_SceneViews.Add(this);
			this.m_Lighting = EditorGUIUtility.IconContent("SceneviewLighting");
			this.m_Fx = EditorGUIUtility.IconContent("SceneviewFx");
			this.m_AudioPlayContent = EditorGUIUtility.IconContent("SceneviewAudio");
			this.m_GizmosContent = new GUIContent("Gizmos");
			this.m_2DModeContent = new GUIContent("2D");
			this.m_SceneViewOverlay = new SceneViewOverlay(this);
			EditorApplication.modifierKeysChanged = (EditorApplication.CallbackFunction)Delegate.Combine(EditorApplication.modifierKeysChanged, new EditorApplication.CallbackFunction(SceneView.RepaintAll));
			this.m_DraggingLockedState = SceneView.DraggingLockedState.NotDragging;
			this.CreateSceneCameraAndLights();
			base.OnEnable();
		}
コード例 #3
0
 public override void OnEnable()
 {
   this.titleContent = this.GetLocalizedTitleContent();
   this.m_RectSelection = new RectSelection((EditorWindow) this);
   if (this.grid == null)
     this.grid = new SceneViewGrid();
   this.grid.Register(this);
   if (this.svRot == null)
     this.svRot = new SceneViewRotation();
   this.svRot.Register(this);
   this.autoRepaintOnSceneChange = true;
   this.m_Rotation.valueChanged.AddListener(new UnityAction(((EditorWindow) this).Repaint));
   this.m_Position.valueChanged.AddListener(new UnityAction(((EditorWindow) this).Repaint));
   this.m_Size.valueChanged.AddListener(new UnityAction(((EditorWindow) this).Repaint));
   this.m_Ortho.valueChanged.AddListener(new UnityAction(((EditorWindow) this).Repaint));
   this.wantsMouseMove = true;
   this.dontClearBackground = true;
   SceneView.s_SceneViews.Add((object) this);
   this.m_Lighting = EditorGUIUtility.IconContent("SceneviewLighting", "Lighting|The scene lighting is used when toggled on. When toggled off a light attached to the scene view camera is used.");
   this.m_Fx = EditorGUIUtility.IconContent("SceneviewFx", "Fx|Toggles skybox, fog and lens flare effects.");
   this.m_AudioPlayContent = EditorGUIUtility.IconContent("SceneviewAudio", "AudioPlay|Toggles audio on or off.");
   this.m_GizmosContent = new GUIContent("Gizmos");
   this.m_2DModeContent = new GUIContent("2D");
   this.m_RenderDocContent = EditorGUIUtility.IconContent("renderdoc", "Capture|Capture the current view and open in RenderDoc");
   this.m_SceneViewOverlay = new SceneViewOverlay(this);
   EditorApplication.modifierKeysChanged += new EditorApplication.CallbackFunction(SceneView.RepaintAll);
   this.m_DraggingLockedState = SceneView.DraggingLockedState.NotDragging;
   this.CreateSceneCameraAndLights();
   if (this.m_2DMode)
     this.LookAt(this.pivot, Quaternion.identity, this.size, true, true);
   base.OnEnable();
 }