Пример #1
0
    protected virtual void OnDestroy()
    {
        Unlock();

        P3D_BrushPreview.Mark();
        P3D_BrushPreview.Sweep();
        P3D_TexturePreview.Mark();
        P3D_TexturePreview.Sweep();
    }
Пример #2
0
    // Draws the brush and texture previews in the main scene view
    protected override void OnScene(SceneView sceneView, Camera camera, Vector2 mousePosition)
    {
        if (sceneView == (SceneView)SceneView.sceneViews[0])
        {
            P3D_BrushPreview.Sweep();
            P3D_BrushPreview.Mark();

            P3D_TexturePreview.Sweep();
            P3D_TexturePreview.Mark();

            if (lastMousePosition != mousePosition)
            {
                sceneView.Repaint();
            }

            lastMousePosition = mousePosition;
        }

        UpdateLock();

        if (locked == true)
        {
            if (mousePosition.x >= 0.0f && mousePosition.x < sceneView.position.width && mousePosition.y >= 0.0f && mousePosition.y < sceneView.position.height)
            {
                if (Event.current.button == 0)
                {
                    if (Event.current.type == EventType.MouseDown || Event.current.type == EventType.MouseDrag)
                    {
                        if (colorPickerWindowIsOpened)
                        {
                            PickColor(camera, mousePosition);
                        }
                        else
                        {
                            Paint(camera, mousePosition);
                        }
                    }
                }
                if (!colorPickerWindowIsOpened)
                {
                    ShowBrushPreview(camera, mousePosition);
                }
            }

            if (Event.current.type == EventType.MouseUp)
            {
                FinishPaint();
            }
            //ShowTexturePreview();
        }
    }