public void OnSceneGUI()
    {
        // get the chosen game object
        Pix2pixTexturize texturizer = target as Pix2pixTexturize;
        var transform = texturizer.transform;

        EditorGUI.BeginChangeCheck();

        Vector3 oldForwardPos = texturizer.transform.TransformPoint(texturizer.tpData.forwardInfo.position);
        Vector3 oldRightPos   = texturizer.transform.TransformPoint(texturizer.tpData.rightInfo.position);
        Vector3 oldUpPos      = texturizer.transform.TransformPoint(texturizer.tpData.upInfo.position);

        Vector3 newForwardPos = Handles.PositionHandle(oldForwardPos, Quaternion.LookRotation(transform.position - oldForwardPos, transform.up));
        Vector3 newRightPos   = Handles.PositionHandle(oldRightPos, Quaternion.LookRotation(transform.position - oldRightPos, transform.up));
        Vector3 newUpPos      = Handles.PositionHandle(oldUpPos, Quaternion.LookRotation(transform.position - oldUpPos, transform.forward));

        if (EditorGUI.EndChangeCheck())
        {
            Undo.RecordObject(texturizer, "Move triplanr pix2pix texturizer handles");
            texturizer.tpData.forwardInfo.position = texturizer.transform.InverseTransformPoint(newForwardPos);
            texturizer.tpData.rightInfo.position   = texturizer.transform.InverseTransformPoint(newRightPos);
            texturizer.tpData.upInfo.position      = texturizer.transform.InverseTransformPoint(newUpPos);
            texturizer.isDirty = true;
            texturizer.Update();
        }
    }
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();
        Pix2pixTexturize texturizer = target as Pix2pixTexturize;

        if (EditorGUILayout.DropdownButton(new GUIContent("Bake", "Run Pix2Pix"), FocusType.Keyboard))
        {
            texturizer.Bake();
        }


        Rect rect = EditorGUILayout.GetControlRect(true, 256);

        rect.width = 256;

        EditorGUI.DrawPreviewTexture(rect, texturizer.forwardRTex);

        rect       = EditorGUILayout.GetControlRect(true, 256);
        rect.width = 256;
        EditorGUI.DrawPreviewTexture(rect, texturizer.rightRTex);

        rect       = EditorGUILayout.GetControlRect(true, 256);
        rect.width = 256;
        EditorGUI.DrawPreviewTexture(rect, texturizer.upRTex);
    }