private void UpdateErrorList(VertexSelection selection)
 {
     this.InvokeLater(() => {
         var errors = _errorChecks.SelectMany(ec => selection.SelectMany(s => ec.Value.GetErrors(s)));
         ErrorList.Items.Clear();
         ErrorList.Items.AddRange(errors.Select(e => new ErrorWrapper(_translator.Value.GetString(e.Key) ?? e.Key, e)).OfType <object>().ToArray());
     });
 }
Exemplo n.º 2
0
        public VertexTool(
            [ImportMany] IEnumerable <Lazy <VertexSubtool> > subTools
            )
        {
            _subTools = subTools;

            Usage = ToolUsage.Both;

            _selection = new VertexSelection();
        }
Exemplo n.º 3
0
        public VertexTool(
            [Import] EngineInterface engine,
            [ImportMany] IEnumerable <Lazy <VertexSubtool> > subTools
            )
        {
            _engine   = engine;
            _subTools = subTools;

            Usage         = ToolUsage.Both;
            UseValidation = true;

            _selection = new VertexSelection();
        }
    public void SetSelectedVertex(VertexSelection vertex)
    {
        if (_selectedVertex != null)
        {
            _selectedVertex.GetComponent <VertexSelectAnimation>().StopAnimation();
        }
        _selectedVertex = vertex;

        if (_selectedVertex != null)
        {
            _selectedVertex.GetComponent <VertexSelectAnimation>().StartAnimation();
            ShowVirtualLine();
        }
        else
        {
            HideVirtualLine();
        }
    }
    void CalculateLine()
    {
        /* alias */
        VertexSelection selectedVertex = EditorController.workspace.selectedVertex;

        if (selectedVertex == null)
        {
            return;
        }

        Vector3 mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        Vector3 newPosition   = new Vector3(mousePosition.x, mousePosition.y, transform.position.z);

        Vector3 centerPos = (selectedVertex.transform.position + newPosition) / 2f;
        Vector3 diff      = newPosition - selectedVertex.transform.position;

        float distance = diff.magnitude;
        float angle    = xDMath.AngleFromAToB(newPosition, selectedVertex.transform.position) * Mathf.Rad2Deg;

        transform.position   = centerPos;
        transform.localScale = new Vector3(distance, transform.localScale.y, transform.localScale.z);
        transform.rotation   = Quaternion.Euler(new Vector3(0f, 0f, angle));
    }