Exemplo n.º 1
0
void Actor::disableAnimation(const QString& name)
{
    setAnimationEnabled(name, false);
}
Exemplo n.º 2
0
void GLWidget::keyPressEvent(QKeyEvent * event)
{
    Character *oldCharacter = _character;

    switch (event->key()) {
    // Camera controls
    case Qt::Key_W:
        _camera.moveUp();
        break;
    case Qt::Key_S:
        _camera.moveDown();
        break;
    case Qt::Key_A:
        _camera.moveLeft();
        break;
    case Qt::Key_D:
        _camera.moveRight();
        break;
    case Qt::Key_Q:
        _camera.moveFront();
        break;
    case Qt::Key_Z:
        _camera.moveBack();
        break;

    // Toggle forward/inverse kinematics
    case Qt::Key_Space:
        setAnimationEnabled(!_animationEnabled);
        break;

    // Record
    case Qt::Key_R:
        setRecording(!_isRecording);
        break;
    case Qt::Key_T:
        cycleIKMethod();
        break;

    //case Qt::Key_C: enableUserControl = !enableUserControl; break;

    // Change character views
    case Qt::Key_1:
        _character = _planarChain;
        _endEffectorsTarget.clear();
        break;
    case Qt::Key_2:
        _character = _humanHand;
        _endEffectorsTarget.clear();
        break;
    case Qt::Key_3:
        _character = _walkingBug;
        _endEffectorsTarget.clear();
        break;
    case Qt::Key_4:
        break;
    }

    // Restart animation when switching characters with animation enabled
    if(_animationEnabled && (oldCharacter != _character)) {
        _character->startAnimation();
    }

    update(); // update the screen
}
Exemplo n.º 3
0
void Actor::enableAnimation(const QString& name)
{
    setAnimationEnabled(name, true);
}