當前位置: 首頁>>代碼示例>>C#>>正文


C# UnityEditor.SceneView類代碼示例

本文整理匯總了C#中UnityEditor.SceneView的典型用法代碼示例。如果您正苦於以下問題:C# SceneView類的具體用法?C# SceneView怎麽用?C# SceneView使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


SceneView類屬於UnityEditor命名空間,在下文中一共展示了SceneView類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SceneViewState

			public SceneViewState(SceneView.SceneViewState other)
			{
				this.showFog = other.showFog;
				this.showMaterialUpdate = other.showMaterialUpdate;
				this.showSkybox = other.showSkybox;
				this.showFlares = other.showFlares;
			}
開發者ID:guozanhua,項目名稱:UnityDecompiled,代碼行數:7,代碼來源:SceneView.cs

示例2: Update

        public static void Update(SceneView view) {
            Event e = Event.current;

            if (Selection.activeGameObject == null || e.type == EventType.MouseUp)
                currentlyActiveGameObject = null;


            if (SceneView.currentDrawingSceneView != EditorWindow.focusedWindow) {
                if (isDragging)
                    StopDragging();
                return;
            }
            Ray ray = HandleUtility.GUIPointToWorldRay(Event.current.mousePosition);
            hit = new RaycastHit();
            var controlID = GUIUtility.GetControlID(FocusType.Passive);
            var eventType = e.GetTypeForControl(controlID);

            if (e.button == 0 && e.keyCode == DRAG_KEY && Selection.activeGameObject != null) {
                if (Physics.Raycast(ray, out hit, Mathf.Infinity, rayDetectorLayerMask)) {
                    mousePos = new Vector3(hit.point.x, hit.point.y, hit.point.z);
                    if (!isDragging)
                        StartDragging(Selection.gameObjects);
                    else
                        DragItems(Selection.activeGameObject, mousePos);
                }
            }

            if (isDragging && e.type == EventType.KeyUp && e.keyCode == DRAG_KEY) 
                StopDragging();
        }
開發者ID:JelleDekkers,項目名稱:AfstudeerProject,代碼行數:30,代碼來源:LevelEditor.cs

示例3: GetSceneViewCamera

        public static SceneViewCamera GetSceneViewCamera(SceneView sceneView)
        {
            Vector3 cameraForward = sceneView.camera.transform.forward;

            if (cameraForward == new Vector3(0, -1, 0))
            {
                return SceneViewCamera.Top;
            }
            else if (cameraForward == new Vector3(0, 1, 0))
            {
                return SceneViewCamera.Bottom;
            }
            else if (cameraForward == new Vector3(1, 0, 0))
            {
                return SceneViewCamera.Left;
            }
            else if (cameraForward == new Vector3(-1, 0, 0))
            {
                return SceneViewCamera.Right;
            }
            else if (cameraForward == new Vector3(0, 0, -1))
            {
                return SceneViewCamera.Front;
            }
            else if (cameraForward == new Vector3(0, 0, 1))
            {
                return SceneViewCamera.Back;
            }
            else
            {
                return SceneViewCamera.Other;
            }
        }
開發者ID:5thFloorGames,項目名稱:FollowTheLight,代碼行數:33,代碼來源:EditorHelper.cs

示例4: ToolGUI

 public override void ToolGUI(SceneView view, Vector3 handlePosition, bool isStatic)
 {
     Quaternion handleRotation = Tools.handleRotation;
     EditorGUI.BeginChangeCheck();
     Quaternion quaternion2 = Handles.RotationHandle(handleRotation, handlePosition);
     if (EditorGUI.EndChangeCheck() && !isStatic)
     {
         float num;
         Vector3 vector;
         (Quaternion.Inverse(handleRotation) * quaternion2).ToAngleAxis(out num, out vector);
         Undo.RecordObjects(Selection.transforms, "Rotate");
         foreach (Transform transform in Selection.transforms)
         {
             if (Tools.pivotMode == PivotMode.Center)
             {
                 transform.RotateAround(handlePosition, (Vector3) (handleRotation * vector), num);
             }
             else if (TransformManipulator.individualSpace)
             {
                 transform.Rotate((Vector3) (transform.rotation * vector), num, Space.World);
             }
             else
             {
                 transform.Rotate((Vector3) (handleRotation * vector), num, Space.World);
             }
             transform.SetLocalEulerHint(transform.GetLocalEulerAngles(transform.rotationOrder));
             if (transform.parent != null)
             {
                 transform.SendTransformChangedScale();
             }
         }
         Tools.handleRotation = quaternion2;
     }
 }
開發者ID:CarlosHBC,項目名稱:UnityDecompiled,代碼行數:34,代碼來源:RotateTool.cs

示例5: OnSceneGUI

        public void OnSceneGUI(SceneView sceneView)
        {
            if(teleportJump==null)
                return;

            teleportJump.playerNewPosition = Handles.DoPositionHandle(teleportJump.playerNewPosition, Quaternion.Euler(teleportJump.playerNewRotation));

            Vector3 point = teleportJump.playerNewPosition;
            Quaternion startRot = Quaternion.Euler(teleportJump.playerNewRotation);

            Handles.color = new Color(0f, 1f, 0f);

            Handles.color = new Color(1f, 0f, 0f);
            Handles.DrawLine(point, point + (startRot * new Vector3(-1f, 0, 0)));
            Handles.DrawLine(point, point + (startRot * new Vector3(1f, 0, 0)));
            Handles.DrawLine(point, point + (startRot * new Vector3(0, 1f, 0)));
            Handles.DrawLine(point, point + (startRot * new Vector3(0, -1f, 0)));

            if(!teleportJump.useRotation)
                return;

            Handles.color = new Color(1f, 1f, 0f);
            Vector3 seePoint = teleportJump.playerNewPosition + startRot*new Vector3(0f,0f,1f);
            Handles.DrawLine(point, seePoint);

            Handles.ConeCap(0,seePoint,startRot,0.1f);
        }
開發者ID:Baensi,項目名稱:Assets,代碼行數:27,代碼來源:TeleportJumpWindow.cs

示例6: Input

        /// <summary>
        /// Handles input for the editor.
        /// </summary>
        public void Input (SceneView view) {

            Event e = Event.current;

            if (e.isKey) {

                if (e.type == EventType.KeyDown) {

                    if (e.keyCode == settingsObject.APPLY_SINGLE) {

                        PaintAtHoverPosition();

                    }

                    if (e.keyCode == settingsObject.APPLY_ALL) {

                        //paint all of selection

                    }

                }

            }

        }
開發者ID:KevinBreurken,項目名稱:VME,代碼行數:28,代碼來源:VMEPaintControls.cs

示例7: OnSceneGUI

 public static void OnSceneGUI(SceneView sceneView, Event e)
 {
     if (e.type == EventType.Repaint || e.type == EventType.Layout)
     {
         OnRepaint(sceneView, e);
     }
 }
開發者ID:5thFloorGames,項目名稱:FollowTheLight,代碼行數:7,代碼來源:Toolbar.cs

示例8: OnSceneDrag

		public static void OnSceneDrag(SceneView sceneView)
		{
			Event current = Event.current;
			if (current.type != EventType.DragUpdated && current.type != EventType.DragPerform && current.type != EventType.DragExited)
			{
				return;
			}
			Sprite[] spriteFromDraggedPathsOrObjects = SpriteUtility.GetSpriteFromDraggedPathsOrObjects();
			if (spriteFromDraggedPathsOrObjects.Length == 0)
			{
				return;
			}
			Sprite x = spriteFromDraggedPathsOrObjects[0];
			if (x == null)
			{
				return;
			}
			DragAndDrop.visualMode = DragAndDropVisualMode.Copy;
			EventType type = current.type;
			if (type == EventType.DragPerform)
			{
				Vector3 point = HandleUtility.GUIPointToWorldRay(current.mousePosition).GetPoint(10f);
				point.z = 0f;
				GameObject objectToUndo = SpriteUtility.DropFramesToSceneToCreateGO(spriteFromDraggedPathsOrObjects, point);
				Undo.RegisterCreatedObjectUndo(objectToUndo, "Create Sprite");
				current.Use();
			}
		}
開發者ID:guozanhua,項目名稱:UnityDecompiled,代碼行數:28,代碼來源:SpriteUtility.cs

示例9: Draw

        /// <summary>
        /// Draws the in-scene GUI controls for the currently active BeholdR component
        /// </summary>
        /// <param name="sceneView">The currently drawing scene view</param>
        public static void Draw(SceneView sceneView)
        {
            if(	BeholdR.ActiveInstance == null ||
                BeholdR.ActiveInstance.IsSyncSupressed ||
                !BeholdR.ActiveInstance.ShowGuiControls)
            {
                return;
            }

            // calculate drawing area
            _controlsGuiRect = CalculateGuiRect(BeholdR.ActiveInstance.ControlsAnchor, sceneView.camera, Utilities.IsEditorVisible("UnityEditor.CameraEditor"));

            // do the actual drawing
            Handles.BeginGUI();
            {
                GUILayout.BeginArea(_controlsGuiRect, GUI.skin.box);
                {
                    DrawViewLinkControl(sceneView);
                    DrawFilterControl(sceneView);
                }
                GUILayout.EndArea();

                //EditorGUILayout.Toggle("HDR?", sceneView.camera.hdr);
                //DrawCameraPostFx(sceneView.camera);
            }
            Handles.EndGUI();
        }
開發者ID:jmschrack,項目名稱:LudumDare33,代碼行數:31,代碼來源:SceneGuiDrawer.cs

示例10: Input

        public override void Input (SceneView sceneView) {

            base.Input(sceneView);

            Event e = Event.current;

            if (e.isKey) {

                if (e.type == EventType.KeyDown) {

                    if (e.keyCode == settingsObject.SET_MODE_TO_SELECT) { currentModeIndex = 0; VMEGlobal.Hidden = false; }
                    if (e.keyCode == settingsObject.SET_MODE_TO_MOVE) { currentModeIndex = 1; VMEGlobal.Hidden = true; }
                    if (e.keyCode == settingsObject.SET_MODE_TO_EDIT) { currentModeIndex = 2; VMEGlobal.Hidden = true; }
                    if (e.keyCode == settingsObject.SET_MODE_TO_PAINT) { currentModeIndex = 3; VMEGlobal.Hidden = true; }
                    if (e.keyCode == settingsObject.SET_MODE_TO_REMOVE) { currentModeIndex = 4; VMEGlobal.Hidden = true; }

                }

            }

            switch (currentModeIndex) {

                case 1: selectionControls.Input(sceneView); break;
                case 0: break;
                case 2: editControls.Input(sceneView); break;
                case 3: paintControls.Input(sceneView); break;
                case 4: break;

            }

        }
開發者ID:KevinBreurken,項目名稱:VME,代碼行數:31,代碼來源:VMEModePanel.cs

示例11: OnSceneGUI

        void OnSceneGUI(SceneView sceneView)
        {
            if (layerMesh == null)
                return;
            if (resolution <= 0)
                resolution = 1;

            if (hairLayers.Length >= 2) {
                if (drawCorners) {
                    Handles.color = Color.black;
                    var vertices = layerMesh.vertices;
                    for (var i = 0; i < vertices.Length; i++) {
                        var p = vertices[i];
                        var spl = GetSplineInWorld(p);
                        DrawSplineInScene (spl);
                    }
                }
            }
            if (Selection.activeGameObject == this.gameObject) {
                for (var i = 0; i < hairLayers.Length; i++) {
                    var tr = hairLayers[i].transform;
                    switch (Tools.current) {
                    case Tool.Move:
                        tr.position = Handles.PositionHandle(tr.position, tr.rotation);
                        break;
                    case Tool.Rotate:
                        tr.rotation = Handles.RotationHandle(tr.rotation, tr.position);
                        break;
                    case Tool.Scale:
                        tr.localScale = Handles.ScaleHandle(tr.localScale, tr.position, tr.rotation, 5f);
                        break;
                    }
                }
            }
        }
開發者ID:nobnak,項目名稱:HairMesh,代碼行數:35,代碼來源:Prism.cs

示例12: DisplayControls

 public void DisplayControls(SceneView sceneView)
 {
   LightmapVisualization.showLightProbeLocations = EditorGUILayout.Toggle(EditorGUIUtility.TextContent("Show Light Probes"), LightmapVisualization.showLightProbeLocations, new GUILayoutOption[0]);
   ++EditorGUI.indentLevel;
   LightmapVisualization.showLightProbeCells = EditorGUILayout.Toggle(EditorGUIUtility.TextContent("Show Cells"), LightmapVisualization.showLightProbeCells, new GUILayoutOption[0]);
   --EditorGUI.indentLevel;
 }
開發者ID:BlakeTriana,項目名稱:unity-decompiled,代碼行數:7,代碼來源:LightProbeGUI.cs

示例13: ToolGUI

 public override void ToolGUI(SceneView view, Vector3 handlePosition, bool isStatic)
 {
   Quaternion handleRotation = Tools.handleRotation;
   EditorGUI.BeginChangeCheck();
   Quaternion quaternion = Handles.RotationHandle(handleRotation, handlePosition);
   if (!EditorGUI.EndChangeCheck() || isStatic)
     return;
   float angle;
   Vector3 axis1;
   (Quaternion.Inverse(handleRotation) * quaternion).ToAngleAxis(out angle, out axis1);
   Vector3 vector3 = handleRotation * axis1;
   if (TransformManipulator.individualSpace)
     vector3 = Quaternion.Inverse(Tools.handleRotation) * vector3;
   Undo.RecordObjects((Object[]) Selection.transforms, "Rotate");
   foreach (Transform transform in Selection.transforms)
   {
     Vector3 axis2 = vector3;
     if (TransformManipulator.individualSpace)
       axis2 = transform.rotation * vector3;
     if (Tools.pivotMode == PivotMode.Center)
       transform.RotateAround(handlePosition, axis2, angle);
     else
       transform.RotateAround(transform.position, axis2, angle);
     if ((Object) transform.parent != (Object) null)
       transform.SendTransformChangedScale();
   }
   Tools.handleRotation = quaternion;
 }
開發者ID:BlakeTriana,項目名稱:unity-decompiled,代碼行數:28,代碼來源:RotateTool.cs

示例14: OnGUI

		public static void OnGUI(SceneView view)
		{
			if (MoveTool.s_Instance == null)
			{
				MoveTool.s_Instance = new MoveTool();
			}
			MoveTool.s_Instance.OnToolGUI(view);
		}
開發者ID:guozanhua,項目名稱:UnityDecompiled,代碼行數:8,代碼來源:MoveTool.cs

示例15: OnGUI

		public static void OnGUI(SceneView view)
		{
			if (RotateTool.s_Instance == null)
			{
				RotateTool.s_Instance = new RotateTool();
			}
			RotateTool.s_Instance.OnToolGUI(view);
		}
開發者ID:guozanhua,項目名稱:UnityDecompiled,代碼行數:8,代碼來源:RotateTool.cs


注:本文中的UnityEditor.SceneView類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。