Esempio n. 1
0
        void RemovingNodes()
        {
            int controlID = GUIUtility.GetControlID(FocusType.Passive);

            HandleUtility.AddDefaultControl(controlID);

            RaycastHit hitInfo;
            Ray        click = HandleUtility.GUIPointToWorldRay(Event.current.mousePosition);

            if (Physics.Raycast(click, out hitInfo, 1000, nodegraph.solidLayerMask))
            {
                Handles.color = Color.yellow;
                Handles.DrawWireDisc(hitInfo.point, Vector3.up, nodegraph.m_brushRadius);
                Handles.DrawWireDisc(hitInfo.point, Vector3.right, nodegraph.m_brushRadius);
                SceneView.RepaintAll();
            }

            switch (Event.current.type)
            {
            case EventType.MouseDown:
                // placing mode and mouse on Scene tab
                if (EditorWindow.mouseOverWindow.titleContent.text == "Scene")
                {
                    // grab mouse down
                    if (Event.current.button == 0)
                    {
                        nodegraph.RemoveNodes(hitInfo.point);
                        Event.current.Use();
                    }
                }
                break;
            }
        }