private void OnEnable()
    {
        targetScript  = (QuadraticBezierPathComponent)target;
        qdrBezierPath = targetScript.Path;
        settings      = targetScript.EditorOnlyToolSettings;

        if (!Safety())
        {
            SceneView.currentDrawingSceneView.ShowNotification(new GUIContent(PathEditorUtility.EditorUnavailable));
            return;
        }
    }
Exemplo n.º 2
0
    public void Reset()
    {
        EditorOnlyToolSettings = new ToolSettings();

        var localBezier = new QuadraticBezier(
            new Vector3(0.5f, 0f, 0f),
            new Vector3(0f, 0.5f, 0.5f),
            new Vector3(0.5f, 1.0f, 0.5f)
            );

        Path = new QuadraticBezierPath(transform, localBezier);
    }
    private bool Safety()
    {
        bool safe = true;

        //~ Fixes first run issues
        if (settings == null)
        {
            targetScript.Reset();
        }
        qdrBezierPath = targetScript.Path;
        settings      = targetScript.EditorOnlyToolSettings;

        //~ Fixes deleted transform issues
        if (qdrBezierPath.LocalSpaceTransform == null)
        {
            qdrBezierPath.LocalSpaceTransform = null;
            safe = false;
        }

        return(safe);
    }