Exemplo n.º 1
0
        public void OnSceneGUI(Event evt)
        {
            // necessary because there is no callback on toolbar changes
            SyncPivotPoint();
            SyncPivotRotation();

            currentEvent = evt;

            if (evt.type == EventType.MouseUp || evt.type == EventType.Ignore)
            {
                FinishEdit();
            }

            if (!m_IsEditing)
            {
                m_HandlePosition = MeshSelection.GetHandlePosition();
                m_HandleRotation = MeshSelection.GetHandleRotation();

                m_HandlePositionOrigin      = m_HandlePosition;
                m_HandleRotationOrigin      = m_HandleRotation;
                handleRotationOriginInverse = Quaternion.Inverse(m_HandleRotation);
            }

            DoTool(m_HandlePosition, m_HandleRotation);
        }
Exemplo n.º 2
0
        public override void OnToolGUI(EditorWindow window)
        {
            if (MeshSelection.selectedVertexCount == 0)
            {
                return;
            }

            // necessary because there is no callback on toolbar changes
            SyncPivotPoint();
            SyncPivotRotation();

            currentEvent = Event.current;

            if (currentEvent.type == EventType.MouseUp || currentEvent.type == EventType.Ignore)
            {
                FinishEdit();
            }

            switch (ProBuilderEditor.selectMode)
            {
            case SelectMode.Face:
            case SelectMode.TextureFace:
                if (MeshSelection.selectedFaceCount < 1)
                {
                    return;
                }
                break;

            case SelectMode.Edge:
            case SelectMode.TextureEdge:
                if (MeshSelection.selectedEdgeCount < 1)
                {
                    return;
                }
                break;

            case SelectMode.Vertex:
            case SelectMode.TextureVertex:
                if (MeshSelection.selectedVertexCount < 1)
                {
                    return;
                }
                break;
            }

            if (!m_IsEditing)
            {
                m_HandlePosition = MeshSelection.GetHandlePosition();
                m_HandleRotation = MeshSelection.GetHandleRotation();

                m_HandlePositionOrigin      = m_HandlePosition;
                m_HandleRotationOrigin      = m_HandleRotation;
                handleRotationOriginInverse = Quaternion.Inverse(m_HandleRotation);
            }

            DoToolGUI();
        }