void SkeletonAnimationFbo::updateSkeletonAnimation()
{
    if (!isSkeletonValid()) {
        update();
        return;
    }

    if (!mEventCache.isEmpty()){
        Q_FOREACH(SpineEvent* event, mEventCache)
            SAFE_DELETE(event);
        mEventCache.clear();
    }

    qint64 mSecs = 0;
    if (!mTimer.isValid())
        mTimer.start();
    else
        mSecs = mTimer.restart();

    const float deltaTime = mSecs/1000.0 * mTimeScale;
    spSkeleton_update(mspSkeleton, deltaTime);
    spAnimationState_update(mspAnimationState, deltaTime);
    spAnimationState_apply(mspAnimationState, mspSkeleton);
    spSkeleton_updateWorldTransform(mspSkeleton);

    const QRectF rect = calculateSkeletonRect();
    setSourceSize(QSize(rect.width(), rect.height()));
    setImplicitSize(rect.width(), rect.height());
    setPosition(QPointF(rect.left(), -1.0f*(rect.top() + rect.height())));
    update();
}
Beispiel #2
0
int QDeclarativeImageBase::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QDeclarativeImplicitSizeItem::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 9)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 9;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< Status*>(_v) = status(); break;
        case 1: *reinterpret_cast< QUrl*>(_v) = source(); break;
        case 2: *reinterpret_cast< qreal*>(_v) = progress(); break;
        case 3: *reinterpret_cast< bool*>(_v) = asynchronous(); break;
        case 4: *reinterpret_cast< bool*>(_v) = cache(); break;
        case 5: *reinterpret_cast< QSize*>(_v) = sourceSize(); break;
        case 6: *reinterpret_cast< bool*>(_v) = mirror(); break;
        }
        _id -= 7;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 1: setSource(*reinterpret_cast< QUrl*>(_v)); break;
        case 3: setAsynchronous(*reinterpret_cast< bool*>(_v)); break;
        case 4: setCache(*reinterpret_cast< bool*>(_v)); break;
        case 5: setSourceSize(*reinterpret_cast< QSize*>(_v)); break;
        case 6: setMirror(*reinterpret_cast< bool*>(_v)); break;
        }
        _id -= 7;
    } else if (_c == QMetaObject::ResetProperty) {
        switch (_id) {
        case 5: resetSourceSize(); break;
        }
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 7;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
void QQuickImageBase::resetSourceSize()
{
    setSourceSize(QSize());
}