Esempio n. 1
0
/**
 * Select vertices in bone range
 * if there are no attached vertices use circle selection
 * otherwise select attached vertices
 * \param mesh pointer to mesh
 **/
void Skeleton::selectVerticesInRange(Mesh *mesh)
{
    mesh->clearSelection();
    for (unsigned i = 0; i < bones->size(); i++) {
        Bone *b = (*bones)[i];

        /* select vertices in selection circle only if there are no vertices
         * attached */
        if (b->selected) {
            if (b->getAttachedVerticesCount() == 0) {
                /* selection happens in screen coordinate system, just like the
                 * drawSelectionBox in animata.cpp */
                // so get the view radius as in Bone.draw()
                Vector2D v = b->getViewCenter();
                // float r = b->getRadius();
                float r = b->getViewRadius();
                selector->doCircleSelect(mesh, Selection::SELECT_VERTEX, v,
                                         (int)r);
            }
            else {
                b->selectAttachedVertices();
            }
        }
    }
}