Inheritance: SearchableEditorWindow, IHasCustomMenu
コード例 #1
0
    public override void OnRepaint(UnityEditor.SceneView view, bool isDragging, Vector2 dragStart, Vector2 curMousePos, int button, PP2DToolType tool)
    {
        if (_drawSettings.drawGrid)
        {
            DrawGridInView(view);
        }


        if (!isDragging)
        {
            DrawCellAtMouse(curMousePos);
        }

        else
        {
            if (tool == PP2DToolType.Rectangle)
            {
                DrawSelectionRectangle(dragStart, curMousePos);
            }

            else if (tool == PP2DToolType.Single)
            {
                DrawCellAtMouse(curMousePos);
            }
        }
    }
コード例 #2
0
 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;
     }
 }
コード例 #3
0
ファイル: VMEPaintControls.cs プロジェクト: KevinBreurken/VME
        /// <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

                    }

                }

            }

        }
コード例 #4
0
		//METHODS:
#if UNITY_EDITOR
		public override void Draw(E.SceneView sceneView)
		{
			base.Draw(sceneView);
			EditorUtil.BeginColorPocket(m_color);
			G.Label(GetPositionedRect(sceneView), m_text, guiStyle);
			EditorUtil.EndColorPocket();
		}
コード例 #5
0
ファイル: TeleportJumpWindow.cs プロジェクト: Baensi/Assets
        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);
        }
コード例 #6
0
        /// <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();
        }
コード例 #7
0
		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();
			}
		}
コード例 #8
0
ファイル: Prism.cs プロジェクト: nobnak/HairMesh
        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;
                    }
                }
            }
        }
コード例 #9
0
 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;
 }
コード例 #10
0
			public SceneViewState(SceneView.SceneViewState other)
			{
				this.showFog = other.showFog;
				this.showMaterialUpdate = other.showMaterialUpdate;
				this.showSkybox = other.showSkybox;
				this.showFlares = other.showFlares;
			}
コード例 #11
0
    void Follow()
    {
        sceneViews = UnityEditor.SceneView.sceneViews;
        if (sceneViewFollowers == null || !on || sceneViews.Count == 0)
        {
            return;
        }

        foreach (SceneViewFollower svf in sceneViewFollowers)
        {
            if (!svf.enable)
            {
                continue;
            }
            UnityEditor.SceneView sceneView = (UnityEditor.SceneView)sceneViews[svf.sceneViewIndex];
            if (sceneView != null)
            {
                if ((Application.isPlaying && onlyInPlayMode) || !onlyInPlayMode)
                {
                    sceneView.orthographic = svf.orthographic;
                    sceneView.LookAtDirect(svf.targetTransform.position + svf.positionOffset, (svf.enableFixedRotation) ? Quaternion.Euler(svf.fixedRotation) : svf.targetTransform.rotation, svf.size);
                }
            }
        }
    }
コード例 #12
0
		//METHODS:
#if UNITY_EDITOR
		public override void Draw(E.SceneView sceneView)
		{
			base.Draw(sceneView);
			EditorUtil.BeginColorPocket(m_color);
			G.DrawTexture(GetPositionedRect(sceneView), image);
			EditorUtil.EndColorPocket();
		}
コード例 #13
0
        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;
            }
        }
コード例 #14
0
 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;
 }
コード例 #15
0
 public static void OnSceneGUI(SceneView sceneView, Event e)
 {
     if (e.type == EventType.Repaint || e.type == EventType.Layout)
     {
         OnRepaint(sceneView, e);
     }
 }
コード例 #16
0
        private void OnSceneGUI(UnityEditor.SceneView sceneview)
        {
            m_mousePosition = Event.current.mousePosition;
            switch (Event.current.type)
            {
            case EventType.MouseDown:
                m_MouseClickPosition = m_mousePosition;
                break;

            case EventType.KeyDown:
                switch (Event.current.keyCode)
                {
                case KeyCode.PageUp:
                    ++m_DebugStep;
                    sceneview.Repaint();
                    break;

                case KeyCode.PageDown:
                    m_DebugStep = Mathf.Max(0, m_DebugStep - 1);
                    sceneview.Repaint();
                    break;

                case KeyCode.End:
                    // Usefull we you don't want to change the scene viewport but still update the mouse click position
                    m_MouseClickPosition = m_mousePosition;
                    sceneview.Repaint();
                    break;
                }
                break;
            }
        }
コード例 #17
0
ファイル: VMEModePanel.cs プロジェクト: KevinBreurken/VME
        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;

            }

        }
コード例 #18
0
        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();
        }
コード例 #19
0
    //Make Camera.main follor the first sceneview camera
    void Follow()
    {
        ArrayList sceneViews = UnityEditor.SceneView.sceneViews;

        if (sceneViews.Count == 0)
        {
            return;
        }

        Camera cur_game_cam = Camera.main;

        for (int i = 0; i < sceneViews.Count; ++i)
        {
            UnityEditor.SceneView sceneView = (UnityEditor.SceneView)sceneViews[i];
            if (null == sceneView)
            {
                continue;
            }

            Camera cur_scene_cam = sceneView.camera;
            if (null == cur_scene_cam)
            {
                continue;
            }

            cur_game_cam.orthographic       = sceneView.orthographic;
            cur_game_cam.transform.position = cur_scene_cam.transform.position;
            cur_game_cam.transform.rotation = cur_scene_cam.transform.rotation;
        }
    }
コード例 #20
0
		public static void OnGUI(SceneView view)
		{
			if (RotateTool.s_Instance == null)
			{
				RotateTool.s_Instance = new RotateTool();
			}
			RotateTool.s_Instance.OnToolGUI(view);
		}
コード例 #21
0
 static void OnSceneViewGUI(SceneView view)
 {
     // 检查编译中,立刻暂停游戏!
     if (EditorApplication.isCompiling)
     {
         EditorApplication.isPlaying = false;
     }
 }
コード例 #22
0
		public static void OnGUI(SceneView view)
		{
			if (ScaleTool.s_Instance == null)
			{
				ScaleTool.s_Instance = new ScaleTool();
			}
			ScaleTool.s_Instance.OnToolGUI(view);
		}
コード例 #23
0
ファイル: MoveTool.cs プロジェクト: guozanhua/UnityDecompiled
		public static void OnGUI(SceneView view)
		{
			if (MoveTool.s_Instance == null)
			{
				MoveTool.s_Instance = new MoveTool();
			}
			MoveTool.s_Instance.OnToolGUI(view);
		}
コード例 #24
0
        // This is an event handler on the scene view to handle dragging our objects from the browser
        // and creating new gameobjects
        void SceneUpdate(UnityEditor.SceneView sceneView)
        {
            Event e = Event.current;

            if (e.type == EventType.DragPerform)
            {
                if (DragAndDrop.objectReferences.Length > 0 &&
                    DragAndDrop.objectReferences[0] != null &&
                    (DragAndDrop.objectReferences[0].GetType() == typeof(EditorEventRef) ||
                     DragAndDrop.objectReferences[0].GetType() == typeof(EditorBankRef)))
                {
                    GameObject newObject = null;
                    if (DragAndDrop.objectReferences[0].GetType() == typeof(EditorEventRef))
                    {
                        string path = ((EditorEventRef)DragAndDrop.objectReferences[0]).Path;
                        string name = path.Substring(path.LastIndexOf("/") + 1);
                        newObject = new GameObject(name + " Emitter");
                        var emitter = newObject.AddComponent <StudioEventEmitter>();
                        emitter.Event = path;
                        var so = new SerializedObject(emitter);
                        so.ApplyModifiedProperties();
                        Undo.RegisterCreatedObjectUndo(newObject, "Create FMOD Studio Emitter");
                    }
                    else
                    {
                        newObject = new GameObject("FMOD Studio Loader");
                        var loader = newObject.AddComponent <StudioBankLoader>();
                        loader.Banks = new List <string>();
                        loader.Banks.Add(((EditorBankRef)DragAndDrop.objectReferences[0]).Name);
                        Undo.RegisterCreatedObjectUndo(newObject, "Create FMOD Studio Loader");
                    }
                    Ray ray = HandleUtility.GUIPointToWorldRay(e.mousePosition);
                    var hit = HandleUtility.RaySnap(ray);
                    if (hit != null)
                    {
                        newObject.transform.position = ((RaycastHit)hit).point;
                    }
                    else
                    {
                        newObject.transform.position = ray.origin + ray.direction * 10.0f;
                    }
                    Selection.activeObject = newObject;
                    e.Use();
                }
            }
            if (e.type == EventType.DragUpdated)
            {
                if (DragAndDrop.objectReferences.Length > 0 &&
                    DragAndDrop.objectReferences[0] != null &&
                    (DragAndDrop.objectReferences[0].GetType() == typeof(EditorEventRef) ||
                     DragAndDrop.objectReferences[0].GetType() == typeof(EditorBankRef)))
                {
                    DragAndDrop.visualMode = DragAndDropVisualMode.Move;
                    DragAndDrop.AcceptDrag();
                    e.Use();
                }
            }
        }
コード例 #25
0
        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);

            }
        }
コード例 #26
0
ファイル: DesignerToolbar.cs プロジェクト: willstall/FPS_0
        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();
        }
コード例 #27
0
        /// <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;

                        }

                    }

                }

            }

        }
コード例 #28
0
		void OnSceneGUI( SceneView sceneView ) {
			Handles.BeginGUI();
			if( Event.current.type != EventType.used ) {
				R2DC_Main.Instance.DrawScene( sceneView );
				if( Event.current.type != EventType.Layout ) {
					R2DC_Main.Instance.HandleInteraction();
				}
			}
			Handles.EndGUI();
		}
コード例 #29
0
		public void OnSceneDrag(SceneView sceneView)
		{
			if (baseEditor == null)
				return;

			if (OnSceneDragMethod == null)
				OnSceneDragMethod = baseEditor.GetType().GetMethod("OnSceneDrag", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance);
			if (OnSceneDragMethod != null)
				OnSceneDragMethod.Invoke(baseEditor, new object[]{sceneView});
		}
コード例 #30
0
		protected U.Rect GetPositionedRect(E.SceneView sceneView)
		{
			U.Vector3 _screenPoint = sceneView.GetScreenPosition(m_position ?? U.Vector3.zero);
			U.Rect _positionedRect = ((U.Rect) m_rect);
			if (m_position != null) {
				_positionedRect.x += _screenPoint.x;
				_positionedRect.y += _screenPoint.y;
			}

			return _positionedRect;
		}
コード例 #31
0
 protected virtual void OnToolGUI(SceneView view)
 {
   if (!(bool) ((Object) Selection.activeTransform) || Tools.s_Hidden)
     return;
   bool flag = !Tools.s_Hidden && EditorApplication.isPlaying && GameObjectUtility.ContainsStatic(Selection.gameObjects);
   EditorGUI.BeginDisabledGroup(flag);
   Vector3 handlePosition = Tools.handlePosition;
   this.ToolGUI(view, handlePosition, flag);
   Handles.ShowStaticLabelIfNeeded(handlePosition);
   EditorGUI.EndDisabledGroup();
 }
コード例 #32
0
ファイル: WaterGrid.cs プロジェクト: guplem/TS20-Thoughts
 private void OnSceneGUI(UnityEditor.SceneView sceneView)
 {
     if (followSceneCamera)
     {
         actualFollowTarget = sceneView.camera.transform;
         Update();
     }
     else
     {
         actualFollowTarget = null;
     }
 }
コード例 #33
0
 protected virtual void OnToolGUI(SceneView view)
 {
     if ((Selection.activeTransform != null) && !Tools.s_Hidden)
     {
         bool disabled = (!Tools.s_Hidden && EditorApplication.isPlaying) && GameObjectUtility.ContainsStatic(Selection.gameObjects);
         EditorGUI.BeginDisabledGroup(disabled);
         Vector3 handlePosition = Tools.handlePosition;
         this.ToolGUI(view, handlePosition, disabled);
         Handles.ShowStaticLabelIfNeeded(handlePosition);
         EditorGUI.EndDisabledGroup();
     }
 }
コード例 #34
0
ファイル: MoveTool.cs プロジェクト: guozanhua/UnityDecompiled
		public override void ToolGUI(SceneView view, Vector3 handlePosition, bool isStatic)
		{
			TransformManipulator.BeginManipulationHandling(false);
			EditorGUI.BeginChangeCheck();
			Vector3 a = Handles.PositionHandle(handlePosition, Tools.handleRotation);
			if (EditorGUI.EndChangeCheck() && !isStatic)
			{
				Vector3 positionDelta = a - TransformManipulator.mouseDownHandlePosition;
				ManipulationToolUtility.SetMinDragDifferenceForPos(handlePosition);
				TransformManipulator.SetPositionDelta(positionDelta);
			}
			TransformManipulator.EndManipulationHandling();
		}
コード例 #35
0
 /// <summary>
 /// Rotate billboards to face editor camera while game not running.
 /// </summary>
 public void OnDrawGizmos()
 {
     if (!Application.isPlaying)
     {
         UnityEditor.SceneView sceneView = GetActiveSceneView();
         if (sceneView)
         {
             // Editor camera stands in for player camera in edit mode
             Vector3 viewDirection = -new Vector3(sceneView.camera.transform.forward.x, 0, sceneView.camera.transform.forward.z);
             transform.LookAt(transform.position + viewDirection);
         }
     }
 }
コード例 #36
0
        /// ///////////////////////////////////////////////////////////////////////////////////////////////////
        /// SCENE GUI ///////////////////////////////////////////////////////////////////////////////////////////////////
        /// ///////////////////////////////////////////////////////////////////////////////////////////////////
        // This will have scene events including mouse down on scenes objects
        void SceneGUI(UnityEditor.SceneView sceneView)
        {
            placeHandles();

            hideWhenRunning();

            handleMouseMove();

            handleMouseDown();

            global_influenceRadius = influenceRadius;
            global_heightAnchors   = heightAnchors;
        }
コード例 #37
0
ファイル: ExtrusionManager.cs プロジェクト: jonagill/Compute
    void Start()
    {
        AddRenderer(Camera.main);

#if UNITY_EDITOR
        // Would need to monitor if a new window is created
        foreach (var viewObj in UnityEditor.SceneView.sceneViews)
        {
            UnityEditor.SceneView sceneView = viewObj as UnityEditor.SceneView;
            AddRenderer(sceneView.camera);
        }
#endif
    }
        private static void OnGUIHandler(SceneView view)
        {
            if (System.DateTime.Now - _lastPurge > OLD_AGE)
            {
                _lastPurge = System.DateTime.Now;
                _usedHandlers.Purge();
            }

            foreach(var lst in _usedHandlers.Lists)
            {
                lst.Clear();
            }
        }
コード例 #39
0
		//METHODS:
#if UNITY_EDITOR
		public override void Draw(E.SceneView sceneView)
		{
			base.Draw(sceneView);
			EditorUtil.BeginColorPocket(m_color);
			if (G.Button(GetPositionedRect(sceneView), m_text, guiStyle))
				if (onClick != null) {
					onClick();
					onClick = null;
					EditorUtil.UnsubGUIDelegate();
				}

			EditorUtil.EndColorPocket();
		}
コード例 #40
0
ファイル: R2DC_Main.cs プロジェクト: JRSerjeant/GGJ2016
		public void DrawScene( SceneView sceneView ) {
			if ( R2DC_Utils.Instance.IsSceneViewIn2D() ) {
				if( R2DD_ContextInfo.Instance.LoadContextInfo( sceneView ) ) {
					R2DV_Grid.Instance.DrawGrid();
					R2DV_Guides.Instance.DrawGuides();
					R2DV_Measure.Instance.DrawMeasurements();
					R2DV_Rulers.Instance.DrawRulers(); 
					R2DV_Coords.Instance.DrawCoords();
				}
			}
			else {
				R2DC_Utils.Instance.RepaintEditorWindow();
			}
		}
コード例 #41
0
		private void OnScene(SceneView sceneView)
		{
			GameObjects = Selection.gameObjects;

			GUI.skin.font = ((GUIStyle)"ShurikenLabel").font;
			
			
			Handles.BeginGUI();
			GUILayout.BeginArea(new Rect(10, Screen.height-148, 216,100), "GameObject Replacer", GUI.skin.window);
			GetLayoutFields(true);
			Repaint();
			GUILayout.EndArea();
			Handles.EndGUI();
        }
コード例 #42
0
 public override void ToolGUI(SceneView view, Vector3 handlePosition, bool isStatic)
 {
   Quaternion quaternion = Selection.transforms.Length <= 1 ? Tools.handleLocalRotation : Tools.handleRotation;
   TransformManipulator.DebugAlignment(quaternion);
   if (Event.current.type == EventType.MouseDown)
     ScaleTool.s_CurrentScale = Vector3.one;
   EditorGUI.BeginChangeCheck();
   TransformManipulator.BeginManipulationHandling(true);
   ScaleTool.s_CurrentScale = Handles.ScaleHandle(ScaleTool.s_CurrentScale, handlePosition, quaternion, HandleUtility.GetHandleSize(handlePosition));
   int num = (int) TransformManipulator.EndManipulationHandling();
   if (!EditorGUI.EndChangeCheck() || isStatic)
     return;
   TransformManipulator.SetScaleDelta(ScaleTool.s_CurrentScale, quaternion);
 }
コード例 #43
0
 private void AxisSelectors(SceneView view, Camera cam, float size, float sgn, GUIStyle viewAxisLabelStyle)
 {
   for (int dir = SceneViewRotation.kDirectionRotations.Length - 1; dir >= 0; --dir)
   {
     Quaternion directionRotation = SceneViewRotation.kDirectionRotations[dir];
     string[] strArray = new string[3]{ "x", "y", "z" };
     float faded = this.dirVisible[dir % 3].faded;
     Vector3 rhs = SceneViewRotation.kDirectionRotations[dir] * Vector3.forward;
     float num = Vector3.Dot(view.camera.transform.forward, rhs);
     if (((double) num > 0.0 || (double) sgn <= 0.0) && ((double) num <= 0.0 || (double) sgn >= 0.0))
     {
       Color a;
       switch (dir)
       {
         case 0:
           a = Handles.xAxisColor;
           break;
         case 1:
           a = Handles.yAxisColor;
           break;
         case 2:
           a = Handles.zAxisColor;
           break;
         default:
           a = Handles.centerColor;
           break;
       }
       if (view.in2DMode)
         a = Color.Lerp(a, Color.gray, this.faded2Dgray);
       a.a *= faded * this.m_Visible.faded;
       Handles.color = a;
       if ((double) a.a <= 0.100000001490116)
         GUI.enabled = false;
       if ((double) sgn > 0.0 && Handles.Button(this.m_ViewDirectionControlIDs[dir], directionRotation * Vector3.forward * size * -1.2f, directionRotation, size, size * 0.7f, new Handles.DrawCapFunction(Handles.ConeCap)) && !view.in2DMode)
         this.ViewAxisDirection(view, dir);
       if (dir < 3)
       {
         GUI.color = new Color(1f, 1f, 1f, this.dirVisible[dir].faded * this.m_Visible.faded);
         Vector3 vector3 = rhs + num * view.camera.transform.forward * -0.5f;
         Handles.Label(-((vector3 * 0.7f + vector3.normalized * 1.5f) * size), new GUIContent(strArray[dir]), SceneViewRotation.styles.viewAxisLabelStyle);
       }
       if ((double) sgn < 0.0 && Handles.Button(this.m_ViewDirectionControlIDs[dir], directionRotation * Vector3.forward * size * -1.2f, directionRotation, size, size * 0.7f, new Handles.DrawCapFunction(Handles.ConeCap)) && !view.in2DMode)
         this.ViewAxisDirection(view, dir);
       Handles.color = Color.white;
       GUI.color = Color.white;
       GUI.enabled = true;
     }
   }
 }
コード例 #44
0
    private void Awake()
    {
        sceneView = UnityEditor.SceneView.lastActiveSceneView;

        savedPos.Clear();
        savedRot.Clear();

        for (int i = 0; i < cameras.Count; i++)
        {
            DestroyImmediate(cameras[i]);
        }

        cameras.Clear();
        guiContent.Clear();
    }
コード例 #45
0
ファイル: SyncCamera.cs プロジェクト: dingjian0312/MoShader
    void OnPreCull()
    {
#if UNITY_EDITOR
        if (sync)
        {
            UnityEditor.SceneView sceneView = UnityEditor.SceneView.lastActiveSceneView;
            if (sceneView)
            {
                Transform t = sceneView.camera.transform;
                lastPosition       = transform.position;
                lastRotation       = transform.rotation;
                transform.position = t.position;
                transform.rotation = t.rotation;
            }
        }
#endif
    }
コード例 #46
0
        /// <summary>
        /// [EDITOR ONLY]
        /// Draws the queued scene GUI elements and ages the queue iterator
        /// </summary>
        private static void DrawQueuedSceneGUI(E.SceneView sceneView)
        {
            if (sceneView != null)
            {
                for (int i = 0; i < guiQueue.Count; i++)
                {
                    if (guiQueue[i] != null)
                    {
                        E.Handles.BeginGUI();
                        guiQueue[i].Draw(sceneView);
                        E.Handles.EndGUI();
                    }
                }
            }

            AgeQueueIterator();
        }
コード例 #47
0
    void Start()
    {
        // Mesh with single triangle.
        _mesh          = new Mesh();
        _mesh.vertices = new Vector3 [3];
        _mesh.SetIndices(new [] { 0, 1, 2 }, MeshTopology.Triangles, 0);
        _mesh.UploadMeshData(true);

        // Allocate the indirect draw args buffer.
        _drawArgsBuffer = new ComputeBuffer(
            1, 5 * sizeof(uint), ComputeBufferType.IndirectArguments
            );

        // This property block is used only for avoiding a bug (issue #913828)
        _props = new MaterialPropertyBlock();
        _props.SetFloat("_UniqueID", Random.value);

        // Clone the given material before using.
        _material       = new Material(_material);
        _material.name += " (cloned)";

        _commandBuffer = new CommandBuffer();
        Camera.main.AddCommandBuffer(CameraEvent.AfterForwardOpaque, _commandBuffer);

#if UNITY_EDITOR
        // Would need to monitor if a new window is created
        foreach (var viewObj in UnityEditor.SceneView.sceneViews)
        {
            UnityEditor.SceneView sceneView = viewObj as UnityEditor.SceneView;
            sceneView.camera.AddCommandBuffer(CameraEvent.AfterForwardOpaque, _commandBuffer);
        }
#endif

        //var kernel = _compute.FindKernel("Update");
        //_commandBuffer.DispatchCompute(_compute, kernel, ThreadGroupCount, 1, 1);
        //_commandBuffer.DrawMeshInstancedIndirect(
        //    _mesh,
        //    0,
        //    _material,
        //    0,
        //    // new Bounds(transform.position, transform.lossyScale * 5),
        //    _drawArgsBuffer,
        //    0,
        //    _props);
    }
コード例 #48
0
    void CreateNewScreen()
    {
        Undo.RegisterCreatedObjectUndo(uiManager, uiManager.name);
        GameObject newUIScreenManager = uiManager.CreateNewUIScreenManager();

        if (newUIScreenManager != null)
        {
            newUIScreenManager.transform.SetSiblingIndex(uiManager.GetLastScreenSiblingIndex());
            ArrayList sceneViews = UnityEditor.SceneView.sceneViews;
            if (sceneViews != null)
            {
                if (sceneViews.Count > 0)
                {
                    UnityEditor.SceneView sceneView = (UnityEditor.SceneView)sceneViews[0];
                    sceneView.AlignViewToObject(newUIScreenManager.transform);
                }
            }
        }
    }
コード例 #49
0
    private void OnDrawGizmosSelected()
    {
        var terrain = GetComponent <Terrain>();

        var terrainData = terrain.terrainData; //terrain = Terrain.activeTerrain;
        var terrainPos  = terrain.transform.position;

        //float mapX = (((WorldPos.x - terrainPos.x) / terrainData.size.x) * terrainData.alphamapWidth);
        //float mapZ = (((WorldPos.z - terrainPos.z) / terrainData.size.z) * terrainData.alphamapHeight);


        float   down = -10000;
        Vector3 up   = Vector3.up * 20000;

        Gizmos.DrawRay(new Vector3(terrainPos.x, down, terrainPos.z), up);
        Gizmos.DrawRay(new Vector3(terrainPos.x, down, terrainPos.z + terrainData.size.z), up);
        Gizmos.DrawRay(new Vector3(terrainPos.x + terrainData.size.x, down, terrainPos.z + terrainData.size.z), up);
        Gizmos.DrawRay(new Vector3(terrainPos.x + terrainData.size.x, down, terrainPos.z), up);


        UnityEditor.SceneView sv = UnityEditor.SceneView.lastActiveSceneView;

        Vector3 WorldPos = sv != null ? sv.camera.transform.position : Vector3.zero;

        float mapX = (((WorldPos.x - terrainPos.x) / terrainData.size.x) * (terrainData.alphamapWidth - 1));
        float mapZ = (((WorldPos.z - terrainPos.z) / terrainData.size.z) * (terrainData.alphamapHeight - 1));

        int xx = (int)mapX;
        int zz = (int)mapZ;

        int ww = 3;

        for (int x = -ww; x <= ww; x++)
        {
            for (int z = -ww; z <= ww; z++)
            {
                var xoff = terrainData.size.x * ((xx + x) / ((float)terrainData.alphamapWidth - 1));
                var zoff = terrainData.size.z * ((zz + z) / ((float)terrainData.alphamapHeight - 1));
                Gizmos.DrawRay(new Vector3(terrainPos.x + xoff, down, terrainPos.z + zoff), up);
            }
        }
    }
コード例 #50
0
    // Start is called before the first frame update
    void Start()
    {
        if (mDrawer == null)
        {
            return;
        }

        InitRaymarchingData();
        UpdateRaymarchingData();

        mCmd      = new CommandBuffer();
        mCmd.name = "Raymarching";
        mCmd.Blit(null, BuiltinRenderTextureType.CurrentActive, mDrawer);

        mView = UnityEditor.SceneView.lastActiveSceneView;
        mCam  = mView.camera;
        mCam.AddCommandBuffer(CameraEvent.AfterImageEffects, mCmd);

        UnityEditor.SceneView.onSceneGUIDelegate += SceneUpdate;
    }
コード例 #51
0
    void CustomUpdate(UnityEditor.SceneView sv)
    {
        Event e = Event.current;

        if (CreateCP && !Application.isPlaying && Application.isEditor)
        {
            RaycastHit hit;
            Vector3    screenPosition = Event.current.mousePosition;
            screenPosition.y = Camera.current.pixelHeight - screenPosition.y;

            if (Physics.Raycast(Camera.current.ScreenPointToRay(screenPosition), out hit))
            {
                Clicked = false;

                CreateControlPoint(hit.point);
                UltiDraw.Begin();
                UltiDraw.DrawSphere(hit.point, Quaternion.identity, 0.1f, Color.red);
                for (float i = GetTotalTime() - 2 * TimeInterval; i < GetTotalTime(); i += TimeDelta)
                {
                    //UltiDraw.DrawLine(GetPointPositon(i), GetPointPositon(i + TimeDelta), 0.05f, UltiDraw.DarkGreen);
                    UltiDraw.DrawSphere(GetPointPositon(i), Quaternion.identity, 0.03f, UltiDraw.DarkGreen);
                }

                //UltiDraw.DrawLine(GetPointPositon(GetTotalTime()-TimeInterval), hit.point, 0.05f, UltiDraw.DarkGreen);
                UltiDraw.End();

                if (((Event.current.type == EventType.KeyUp) || (Event.current.type == EventType.MouseDown)) && Event.current.keyCode == CreateCPKey)
                {
                    Clicked = true;
                    //Event.current.Use();
                }

                if (!Clicked)
                {
                    Utility.Destroy(ControlPoints[ControlPoints.Count - 1].GameObject);
                    ControlPoints.RemoveAt(ControlPoints.Count - 1);
                    //Event.current.Use();
                }
            }
        }
    }
コード例 #52
0
ファイル: SkySetting.cs プロジェクト: e184223sk/OnlineGame_v2
    private static void OnGui(UnityEditor.SceneView s)
    {
        UnityEditor.Handles.BeginGUI();
        bool c = Lightmapping.giWorkflowMode == Lightmapping.GIWorkflowMode.Iterative;

        if (!c)
        {
            if (GUI.Button(new Rect(s.position.size.x - 120, s.position.size.y - 52, 120, 16), "手動ベイク"))
            {
                   Lightmapping.BakeAsync();
            }
        }

        if (GUI.Button(new Rect(s.position.size.x - 120, s.position.size.y - 36, 120, 16), "AutoBakeを" + !c + "に"))
        {
            Lightmapping.giWorkflowMode = c ? Lightmapping.GIWorkflowMode.OnDemand : Lightmapping.GIWorkflowMode.Iterative;
        }
        // ここに UIを描画する処理を記述

        UnityEditor.Handles.EndGUI();
    }
コード例 #53
0
    public void OnSceneGUI()
    {
        sceneView = UnityEditor.SceneView.lastActiveSceneView;

        cur = Event.current;

        switch (cur.keyCode)
        {
        case KeyCode.H:
            if (Selection.activeGameObject != hb.gameObject)
            {
                Selection.activeObject = hb.gameObject;
            }
            //sceneView.LookAtDirect(player.position, player.rotation);
            break;

        case KeyCode.KeypadMinus:
            SceneView.RepaintAll();
            sceneView.size *= 1.1f;
            break;
        }
    }
コード例 #54
0
    public static Vector3 GetViewScenePosition()
    {
        UnityEditor.SceneView sceneView = UnityEditor.SceneView.lastActiveSceneView;
        if (sceneView == null)
        {
            sceneView = (UnityEditor.SceneView)(UnityEditor.SceneView.sceneViews.Count == 0 ? null : UnityEditor.SceneView.sceneViews[0]);
        }

        if (sceneView == null || sceneView.camera == null)
        {
            return(Vector3.zero);
        }

        Ray        ray = sceneView.camera.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0f));
        RaycastHit hitInfo;

        if (Physics.Raycast(ray, out hitInfo, 10000f))
        {
            return(hitInfo.point);
        }

        return(ray.GetPoint(50f));
    }
コード例 #55
0
    static void CreateNewUIScreen()
    {
        UIManager uiManager = FindObjectOfType <UIManager>();

        if (uiManager != null)
        {
            Undo.RegisterCreatedObjectUndo(uiManager, uiManager.name);
            GameObject newUIScreenManager = uiManager.CreateNewUIScreenManager();
            Selection.activeObject = newUIScreenManager;
            ArrayList sceneViews = UnityEditor.SceneView.sceneViews;
            if (sceneViews != null)
            {
                if (sceneViews.Count > 0)
                {
                    UnityEditor.SceneView sceneView = (UnityEditor.SceneView)sceneViews[0];
                    sceneView.AlignViewToObject(newUIScreenManager.transform);
                }
            }
        }
        else
        {
            EditorUtility.DisplayDialog("Cant find UIManager", "A UIManager gameobject in the scene is necessary for this feature to work correctly", "Ok");
        }
    }
コード例 #56
0
    void SceneUpdate(UnityEditor.SceneView _view)
    {
        if (mView != _view)
        {
            return;
        }

        UpdateRaymarchingData();

        // https://gamedev.stackexchange.com/questions/131978/shader-reconstructing-position-from-depth-in-vr-through-projection-matrix
        Matrix4x4 proj = GL.GetGPUProjectionMatrix(mCam.projectionMatrix, true);

        //Matrix4x4 proj = GL.GetGPUProjectionMatrix(mCam.projectionMatrix, false);

        proj[2, 3] = proj[3, 2] = 0.0f;
        proj[3, 3] = 1.0f;

        Matrix4x4 view = mCam.worldToCameraMatrix;

        Matrix4x4 clip = Matrix4x4.Inverse(proj * view)
                         * Matrix4x4.TRS(new Vector3(0, 0, -proj[2, 2]), Quaternion.identity, Vector3.one);

        mDrawer.SetMatrix("_ClipToWorld", clip);
    }
コード例 #57
0
        public override void OnSceneGUI(UnityEditor.SceneView sceneView, Event e)
        {
            base.OnSceneGUI(sceneView, e);             // Allow the base logic to calculate first

            if (primaryTargetBrush != null && AnySelected)
            {
                if (startPositions.Count == 0)
                {
                    foreach (KeyValuePair <Vertex, Brush> selectedVertex in selectedVertices)
                    {
                        startPositions.Add(selectedVertex.Key, selectedVertex.Key.Position);
                    }
                }

                // Make the handle respect the Unity Editor's Local/World orientation mode
                Quaternion handleDirection = Quaternion.identity;
                if (Tools.pivotRotation == PivotRotation.Local)
                {
                    handleDirection = primaryTargetBrush.transform.rotation;
                }

                // Grab a source point and convert from local space to world
                Vector3 sourceWorldPosition = GetSelectedCenter();


                if (e.type == EventType.MouseUp)
                {
                    Undo.RecordObjects(targetBrushTransforms, "Moved Vertices");
                    Undo.RecordObjects(targetBrushes, "Moved Vertices");

                    AutoWeld();

                    foreach (PrimitiveBrush brush in targetBrushes)
                    {
                        brush.Invalidate(true);

                        brush.BreakTypeRelation();
                    }
                }

                EditorGUI.BeginChangeCheck();
                // Display a handle and allow the user to determine a new position in world space
                Vector3 newWorldPosition = Handles.PositionHandle(sourceWorldPosition, handleDirection);


                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObjects(targetBrushTransforms, "Moved Vertices");
                    Undo.RecordObjects(targetBrushes, "Moved Vertices");

                    Vector3 deltaWorld = newWorldPosition - sourceWorldPosition;

                    //				if(deltaLocal.sqrMagnitude > 0)
                    //				{
                    TranslateSelectedVertices(deltaWorld);
                    isMarqueeSelection = false;
                    moveInProgress     = true;
                    foreach (PrimitiveBrush brush in targetBrushes)
                    {
                        EditorUtility.SetDirty(brush);
                    }
                    e.Use();
                    // Shouldn't reset the pivot while the vertices are being manipulated, so make sure the pivot
                    // is set to get reset at next opportunity
                    pivotNeedsReset = true;
                }
                else
                {
                    // The user is no longer moving a handle
                    if (pivotNeedsReset)
                    {
                        // Pivot needs to be reset, so reset it!
                        foreach (PrimitiveBrush brush in targetBrushes)
                        {
                            brush.ResetPivot();
                        }

                        pivotNeedsReset = false;
                    }

                    startPositions.Clear();
                }
            }

            if (primaryTargetBrush != null)
            {
                if (!EditorHelper.IsMousePositionNearSceneGizmo(e.mousePosition))
                {
                    if (e.type == EventType.MouseDown)
                    {
                        OnMouseDown(sceneView, e);
                    }
                    else if (e.type == EventType.MouseDrag)
                    {
                        OnMouseDrag(sceneView, e);
                    }
                    // If you mouse up on a different scene view to the one you started on it's surpressed as Ignore, when
                    // doing marquee selection make sure to check the real type
                    else if (e.type == EventType.MouseUp || (isMarqueeSelection && e.rawType == EventType.MouseUp))
                    {
                        OnMouseUp(sceneView, e);
                    }
                }
            }

//			if(e.type == EventType.Repaint)
            {
                OnRepaint(sceneView, e);
            }
        }
コード例 #58
0
 private void OnSceneGUI(UnityEditor.SceneView sceneview)
 {
     DrawGUI(true);
 }
コード例 #59
0
 public abstract void OnRepaint(UnityEditor.SceneView view, bool isDragging, Vector2 dragStart, Vector2 curMousePos, int button, PP2DToolType tool);
コード例 #60
0
    // Start is called before the first frame update
    void Start()
    {
        sceneView = UnityEditor.SceneView.lastActiveSceneView;

        mainCamTrans = Camera.main.transform;
    }