• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# UnityEditor.SceneView类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中UnityEditor.SceneView的典型用法代码示例。如果您正苦于以下问题:C# SceneView类的具体用法?C# SceneView怎么用?C# SceneView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SceneView类属于UnityEditor命名空间,在下文中一共展示了SceneView类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: OnGUI

		public static void OnGUI(SceneView view)
		{
			if (ScaleTool.s_Instance == null)
			{
				ScaleTool.s_Instance = new ScaleTool();
			}
			ScaleTool.s_Instance.OnToolGUI(view);
		}
开发者ID:guozanhua,项目名称:UnityDecompiled,代码行数:8,代码来源:ScaleTool.cs


示例17: OnSceneViewGUI

 static void OnSceneViewGUI(SceneView view)
 {
     // 检查编译中,立刻暂停游戏!
     if (EditorApplication.isCompiling)
     {
         EditorApplication.isPlaying = false;
     }
 }
开发者ID:dannisliang,项目名称:CosmosEngine,代码行数:8,代码来源:CCosmosEngineConfWindow.cs


示例18: OnScene

        static void OnScene(SceneView sceneView)
        {
            Handles.BeginGUI();

            GUILayout.BeginArea( new Rect(5, 5, Screen.width-10, 45) );

            EditorGUILayout.BeginHorizontal();

            int numShapesSelected = 0;
            foreach( UnityEngine.Object obj in Selection.objects )
            {
                GameObject go = obj as GameObject;
                if( go != null && go.GetComponent<Shape>() != null )
                {
                    numShapesSelected++;
                }
            }

            bool first = true;
            for( int i = 0; i < items.Count; i++ )
            {
                ToolbarItem item = items[i];
                bool last = (i + 1 == items.Count) || ( item.group != items[i+1].group );

                GUIStyle style = "ButtonMid";

                if( first && last ) style = "Button";
                else if ( first ) style = "ButtonLeft";
                else if ( last ) style = "ButtonRight";

                GUI.enabled = numShapesSelected >= item.attribute.minimumSelected;
                lastRect = GUILayoutUtility.GetRect(30, 25);
                if( GUI.Button( lastRect, new GUIContent( item.icon, item.attribute.tooltip ), style ) )
                {
                    item.Invoke();
                }

                if( last )
                {
                    GUILayoutUtility.GetRect(5, 25);
                }

                first = last;
            }

            GUI.enabled = true;

            GUILayout.FlexibleSpace();
            EditorGUILayout.EndHorizontal();

            //int numDelegates = SceneView.onSceneGUIDelegate.GetInvocationList().Length;
            //EditorGUILayout.LabelField( numDelegates + " delegates" );

            GUILayout.EndArea();
            Handles.EndGUI();
        }
开发者ID:willstall,项目名称:FPS_0,代码行数:56,代码来源:DesignerToolbar.cs


示例19: Input

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

            Event e = Event.current;

            if (e.isKey) {

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

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

                        if (state == SelectState.Two) {

                            state = SelectState.None;
                            GetSelectionOfObjects();

                        }

                    }

                }

            }

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

                Vector3 tar = VMEGlobal.GetPositionNextToHoveredTile();
    
                if (e.button == 0) {

                    if (tar == new Vector3(0, 9000, 0)) {

                        firstTarget.transform.position = new Vector3(0, 9000, 0);
                        secondTarget.transform.position = new Vector3(0, 9000, 0);
                        state = SelectState.None;

                    } else {

                        if (state == SelectState.None) {

                            firstTarget.transform.position = tar;
                            state = SelectState.One;

                        } else if (state == SelectState.One) {

                            secondTarget.transform.position = tar;
                            state = SelectState.Two;

                        }

                    }

                }

            }

        }
开发者ID:KevinBreurken,项目名称:VME,代码行数:59,代码来源:VMESelectionControls.cs


示例20: OnSceneGUI

        public void OnSceneGUI(SceneView sceneView)
        {
            if(Event.current != null && Event.current.type == EventType.keyDown)
            {
                OnKeyDown(Event.current.keyCode);
            }

            if(mSceneMenuVisible)
            {

                Handles.BeginGUI();

                GUI.skin = EditorGUIUtility.GetBuiltinSkin(EditorSkin.Inspector);
                GUI.color = new Color(0,0,0,0.8f);
                GUI.DrawTexture(new Rect((Screen.width - kWidth) / 2,120,kWidth,kHeight),EditorGUIUtility.whiteTexture);

                GUI.color = Color.white;

                GUILayout.BeginArea( new Rect((Screen.width - kWidth) / 2,120,kWidth,kHeight));

                GUILayout.Space(2);

                GUI.color = Color.white;
                GUILayout.BeginVertical(GUILayout.Width(kWidth));

                GUI.SetNextControlName(kMenuTextField);

                string filter = GUILayout.TextField(mTextFieldContent);

                if(filter != mTextFieldContent)
                {
                    FilterCommands(filter);
                    mTextFieldContent = filter;
                }

                if(mFilteredMenuCommands != null)
                {
                    mScrollPos = GUILayout.BeginScrollView(mScrollPos);

                    foreach(SceneMenuCommand c in mFilteredMenuCommands)
                    {
                        RenderMenuEntry(c);
                    }

                    GUILayout.EndScrollView();
                }

                GUILayout.EndVertical();
                GUILayout.EndArea();

                Handles.EndGUI();

                GUI.FocusControl(kMenuTextField);

            }
        }
开发者ID:robertvoigt030,项目名称:ugb-source,代码行数:56,代码来源:SceneMenu.cs



注:本文中的UnityEditor.SceneView类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# UnityEditor.SerializedObject类代码示例发布时间:2022-05-26
下一篇:
C# UnityEditor.MonoScript类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap