Example #1
0
bool TupCommandExecutor::renameLayer(TupLayerResponse *response)
{
    int scenePos = response->sceneIndex();
    int position = response->layerIndex();
    QString newName = response->arg().toString();

    #ifdef K_DEBUG
           tWarning() << "Renamed layer: " << newName;
    #endif

    QString oldName;

    TupScene *scene = m_project->scene(scenePos);

    if (!scene)
        return false;

    TupLayer *layer = scene->layer(position);

    if (layer) {
        QString current = layer->layerName();
        layer->setLayerName(newName);

        emit responsed(response);
        response->setArg(current);

        return true;
    }

    return false;
}
Example #2
0
bool TupCommandExecutor::removeLayer(TupLayerResponse *response)
{
    #ifdef K_DEBUG
           T_FUNCINFO;
    #endif

    int scenePos = response->sceneIndex();
    int position = response->layerIndex();

    TupScene *scene = m_project->scene(scenePos);

    if (scene) {
        TupLayer *layer = scene->layer(position);
        if (layer) {
            QDomDocument document;
            document.appendChild(layer->toXml(document));
            response->setState(document.toString());
            response->setArg(layer->layerName());

            if (scene->removeLayer(position)) {
                emit responsed(response);
                return true;
            } 
        } 
    }

    return false;
}
Example #3
0
bool TupCommandExecutor::exchangeFrame(TupFrameResponse *response)
{
    int scenePos = response->sceneIndex();
    int layerPos = response->layerIndex();
    int position = response->frameIndex();
    int newPosition = response->arg().toInt();
    TupScene *scene = m_project->scene(scenePos);
   
    if (!scene)
        return false;
  
    scene->moveStoryBoardScene(position, newPosition);
    TupLayer *layer = scene->layer(layerPos);
   
    if (layer) {
        if (layer->exchangeFrame(position, newPosition)) {
            emit responsed(response);
            return true;
        } else {
            #ifdef K_DEBUG
                QString msg = "TupCommandExecutor::exchangeFrame() - Error while exchanging frames";
                #ifdef Q_OS_WIN32
                    qDebug() << msg;
                #else
                    tError() << msg;
                #endif
            #endif  
            return false;
        }
    }
   
    return false;
}
Example #4
0
bool TupCommandExecutor::addLipSync(TupLayerResponse *response)
{
    #ifdef K_DEBUG
        QString msg = "TupCommandExecutor::addLipSync() - Adding lipsync...";
        #ifdef Q_OS_WIN32
            qWarning() << msg;
        #else
            tWarning() << msg;
        #endif
    #endif

    int scenePos = response->sceneIndex();
    int position = response->layerIndex();
    QString xml = response->arg().toString();

    TupScene *scene = m_project->scene(scenePos);

    if (!scene)
        return false;

    TupLayer *layer = scene->layer(position);

    if (layer) {
        TupLipSync *lipsync = new TupLipSync();
        lipsync->fromXml(xml);
        layer->addLipSync(lipsync);

        emit responsed(response);
        return true;
    }

    return false;
}
bool TupCommandExecutor::insertSymbolIntoFrame(TupLibraryResponse *response)
{
#ifdef K_DEBUG
    tFatal() << "TupCommandExecutor::insertSymbolIntoFrame() - Adding symbol to project: " << response->arg().toString();
#endif


    if (m_project->scenesTotal() > 0) {
        if (m_project->insertSymbolIntoFrame(response->spaceMode(), response->arg().toString(),
                                             response->sceneIndex(), response->layerIndex(), response->frameIndex())) {
            TupScene *scene = m_project->scene(response->sceneIndex());
            if (scene) {
                TupLayer *layer = scene->layer(response->layerIndex());
                if (layer) {
                    TupFrame *frame = layer->frame(response->frameIndex());
                    if (frame)
                        response->setFrameState(frame->isEmpty());
                }
            }
            emit responsed(response);
            return true;
        }
    } else {
#ifdef K_DEBUG
        tError() << "TupCommandExecutor::insertSymbolIntoFrame() - No scenes available!";
#endif
    }

    return false;
}
bool TupCommandExecutor::removeSymbolFromFrame(TupLibraryResponse *response)
{
#ifdef K_DEBUG
    T_FUNCINFO;
#endif

    if (m_project->scenesTotal() > 0) {
        if (m_project->removeSymbolFromFrame(response->arg().toString(), response->symbolType())) {
            TupScene *scene = m_project->scene(response->sceneIndex());
            if (scene) {
                TupLayer *layer = scene->layer(response->layerIndex());
                if (layer) {
                    TupFrame *frame = layer->frame(response->frameIndex());
                    if (frame)
                        response->setFrameState(frame->isEmpty());
                }
            }
            emit responsed(response);
            return true;
        } else {
#ifdef K_DEBUG
            tError() << "TupCommandExecutor::removeSymbolFromFrame() - Error: Symbol can't be removed from project!";
#endif
        }
    } else {
#ifdef K_DEBUG
        tError() << "TupCommandExecutor::removeSymbolFromFrame() - No scenes available!";
#endif
    }

    return false;
}
Example #7
0
void TupGraphicsScene::addGraphicObject(TupGraphicObject *object, double opacity)
{
    /*
    #ifdef K_DEBUG
       T_FUNCINFO;
    #endif
    */

        QGraphicsItem *item = object->item();
        k->onionSkin.opacityMap.insert(item, opacity);

        if (TupItemGroup *group = qgraphicsitem_cast<TupItemGroup *>(item))
            group->recoverChilds();

        if (! qgraphicsitem_cast<TupItemGroup *>(item->parentItem())) {

            item->setSelected(false);
            TupLayer *layer = k->scene->layer(k->framePosition.layer);

            if (layer) {

                TupFrame *frame = layer->frame(k->framePosition.frame);

                if (frame) {
                    item->setOpacity(opacity);
                    // k->objectCounter++;
                    addItem(item);
                }
            }
        } 
}
Example #8
0
bool TupCommandExecutor::createFrame(TupFrameResponse *response)
{
    #ifdef K_DEBUG
        #ifdef Q_OS_WIN32
            qDebug() << "[TupCommandExecutor::createFrame()]";
        #else
            T_FUNCINFO;
        #endif
    #endif

    int scenePosition = response->sceneIndex();
    int layerPosition = response->layerIndex();
    int position = response->frameIndex();
    QString name = response->arg().toString();

    // QString state = response->state();
    
    TupScene *scene = m_project->scene(scenePosition);
    
    if (!scene) 
        return false;

    scene->insertStoryBoardScene(position);
    
    TupLayer *layer = scene->layer(layerPosition);
    
    if (layer) {
        TupFrame *frame = layer->createFrame(name, position);
        
        if (!frame)
            return false;
       
        /* 
        if (!name.isEmpty()) {
            #ifdef K_DEBUG
                tDebug("items") << name;
            #endif
            frame->setFrameName(name);
        } else {
            response->setArg(frame->frameName());
        }
        */

        response->setArg(frame->frameName());
        response->setFrameIndex(layer->visualIndexOf(frame));

        emit responsed(response);

        /* SQA: Check if this code is really necessary
        if (!state.isEmpty()) {
            frame->fromXml(state);
            response->setArg(frame->frameName());
        }
        */

        return true;
    }
    
    return false;
}
Example #9
0
bool TupCommandExecutor::setFrameVisibility(TupFrameResponse *response)
{
    int scenePos = response->sceneIndex();
    int layerPos = response->layerIndex();
    int position = response->frameIndex();
    bool view = response->arg().toBool();
    
    TupScene *scene = m_project->scene(scenePos);
    
    if (!scene)
        return false;
    
    TupLayer *layer = scene->layer(layerPos);
    
    if (layer) {
        TupFrame *frame = layer->frame(position);
        
        if (! frame) 
            return false;
        
        frame->setVisible(view);
        emit responsed(response);

        return true;
    }
    
    return false;
}
Example #10
0
bool TupCommandExecutor::resetFrame(TupFrameResponse *response)
{
    int scenePos = response->sceneIndex();
    int layerPos = response->layerIndex();
    int position = response->frameIndex();
   
    TupScene *scene = m_project->scene(scenePos);
   
    if (scene) {
        scene->resetStoryBoardScene(position);
        TupLayer *layer = scene->layer(layerPos);
        if (layer) {
            TupFrame *frame = layer->frame(position);
            if (frame) {
                /*
                QDomDocument doc;
                doc.appendChild(frame->toXml(doc));
                response->setArg(frame->frameName());
                */
                if (layer->resetFrame(position)) {
                    //response->setState(doc.toString(0));
                    emit responsed(response);

                    return true;
                }
            }
        }
    }
   
    return false;
}
Example #11
0
bool TupSvgItem::layerIsVisible()
{
    TupLayer *layer = k->frame->layer();
    if (layer->isVisible())
        return true;

    return false;
}
Example #12
0
int TupGraphicsScene::framesTotal() 
{
    TupLayer *layer = k->scene->layer(k->framePosition.layer);
    if (layer)
        return layer->framesTotal();
    else
        return -1;
}
Example #13
0
bool TupGraphicObject::layerIsVisible()
{
    TupLayer *layer = k->frame->layer();
    if (layer->isVisible())
        return true;

    return false;
}
Example #14
0
bool TupProject::removeSymbolFromFrame(const QString &name, TupLibraryObject::Type type)
{
    #ifdef K_DEBUG
        QString msg = "TupProject::removeSymbolFromFrame() - Removing symbol " + name + " from project...";
        #ifdef Q_OS_WIN
            qDebug() << msg;
        #else
            T_FUNCINFO << msg;
        #endif
    #endif
    
    if (type == TupLibraryObject::Folder)
        return true;

    int totalScenes = k->scenes.size(); 
    for (int i = 0; i < totalScenes; i++) {
         TupScene *scene =  k->scenes.at(i);
         int totalLayers = scene->layers().size();
         for (int j = 0; j < totalLayers; j++) {
              TupLayer *layer = scene->layers().at(j);
              int totalFrames = layer->frames().size(); 
              for (int t = 0; t < totalFrames; t++) {
                   TupFrame *frame = layer->frames().at(t);
                   if (type != TupLibraryObject::Svg)
                       frame->removeImageItemFromFrame(name);
                   else
                       frame->removeSvgItemFromFrame(name);
              }
         }

         TupBackground *bg = scene->background();
         if (bg) {
             TupFrame *frame = bg->staticFrame();
             if (frame) {
                 if (type == TupLibraryObject::Svg)
                     frame->removeSvgItemFromFrame(name);
                 else
                     frame->removeImageItemFromFrame(name);
             }

             frame = bg->dynamicFrame();
             if (frame) {
                 if (type == TupLibraryObject::Svg)
                     frame->removeSvgItemFromFrame(name);
                 else
                     frame->removeImageItemFromFrame(name);
             }
         }
    }

    // k->library->removeObject(name, true);

    return true;
}
Example #15
0
bool TupProject::removeSymbol(const QString &name, TupLibraryObject::Type type)
{
    #ifdef K_DEBUG
        #ifdef Q_OS_WIN
            qDebug() << "[TupProject::removeSymbol()]";
        #else
            T_FUNCINFO;
        #endif
    #endif    
    
    int totalScenes = k->scenes.size();
    for (int i = 0; i < totalScenes; i++) {
         TupScene *scene = k->scenes.at(i);

         TupBackground *bg = scene->background();
         if (bg) {
             TupFrame *frame = bg->staticFrame();
             if (frame) {
                 if (type != TupLibraryObject::Svg)
                     frame->removeImageItemFromFrame(name);
                 else
                     frame->removeSvgItemFromFrame(name);
             } 

             frame = bg->dynamicFrame();
             if (frame) {
                 if (type != TupLibraryObject::Svg)
                     frame->removeImageItemFromFrame(name);
                 else
                     frame->removeSvgItemFromFrame(name);
             }
         }

         int totalLayers = scene->layers().size();
         for (int j = 0; j < totalLayers; j++) {
              TupLayer *layer = scene->layers().at(j);
              int totalFrames = layer->frames().size();
              for (int t = 0; t < totalFrames; t++) {
                   TupFrame *frame = layer->frames().at(t);
                   if (type != TupLibraryObject::Svg)
                       frame->removeImageItemFromFrame(name);
                   else
                       frame->removeSvgItemFromFrame(name);
              }
         }
    }

    return k->library->removeObject(name, true);
}
Example #16
0
int TupAnimationRenderer::Private::calculateTotalPhotograms(TupScene *scene)
{
    Layers layers = scene->layers();

    int total = 0;

    int totalLayers = layers.size();
    for (int i = 0; i < totalLayers; i++) {
         TupLayer *layer = layers.at(i);
         if (layer)
             total = qMax(total, layer->frames().count());
    }

    return total;
}
Example #17
0
bool TupCommandExecutor::selectFrame(TupFrameResponse *response)
{
    #ifdef K_DEBUG
        #ifdef Q_OS_WIN32
            qDebug() << "[TupCommandExecutor::selectFrame()]";
        #else
            T_FUNCINFO;
        #endif
    #endif	
	
    int scenePos = response->sceneIndex();
    int layerPos = response->layerIndex();
    int position = response->frameIndex();
    // bool prioritary = response->arg().toBool();

    TupScene *scene = m_project->scene(scenePos);

    if (!scene || scenePos < 0 || position < 0)
        return false;
    
    TupLayer *layer = scene->layer(layerPos);
    
    if (layer) {
        if (position < layer->framesTotal()) {
            TupFrame *frame = layer->frame(position);
            if (! frame) 
                return false;
        
            emit responsed(response);
            return true;
        } else {
            #ifdef K_DEBUG
                QString msg = "TupCommandExecutor::selectFrame() - Invalid frame index -> " + QString::number(position);
                #ifdef Q_OS_WIN32
                    qDebug() << msg;
                #else
                    tError() << msg;
                #endif
            #endif
            return false;
        }
    } 
    
    return false;
}
Example #18
0
bool TupCommandExecutor::createLayer(TupLayerResponse *response)
{	
    #ifdef K_DEBUG
        #ifdef Q_OS_WIN32
            qDebug() << "[TupCommandExecutor::createLayer()]";
        #else
            T_FUNCINFO;
        #endif
    #endif

    int scenePosition = response->sceneIndex();
    int position = response->layerIndex();

    QString name = response->arg().toString();
    QString state = response->state();

    TupScene *scene = m_project->scene(scenePosition);

    if (scene) {
        TupLayer *layer = scene->createLayer(name, position);

        if (! layer) 
            return false;

        /*
        if (!name.isEmpty())
            layer->setLayerName(name);
        else
            response->setArg(layer->layerName());
        */

        layer->setLayerName(name);

        // response->setArg(layer->layerName());
        // layer->fromXml(state);
        // m_project->updateScene(scenePosition, scene);

        emit responsed(response);

        return true;
    }

    return false;
}
Example #19
0
void TupGraphicsScene::drawCurrentPhotogram()
{
    #ifdef K_DEBUG
           T_FUNCINFO;
    #endif

    TupLayer *layer = k->scene->layer(k->framePosition.layer);
    int frames = layer->framesTotal();

    if (k->framePosition.frame >= frames)
        k->framePosition.frame = frames - 1;

    if (k->spaceMode == TupProject::FRAMES_EDITION) {
        drawPhotogram(k->framePosition.frame);
    } else if (k->spaceMode == TupProject::BACKGROUND_EDITION) {
               cleanWorkSpace();
               drawBackground();
    }
}
Example #20
0
bool TupCommandExecutor::renameFrame(TupFrameResponse *response)
{
    #ifdef K_DEBUG
        #ifdef Q_OS_WIN32
            qDebug() << "[TupCommandExecutor::renameFrame()]";
        #else
            T_FUNCINFO;
        #endif
    #endif	

    int scenePos = response->sceneIndex();
    int layerPos = response->layerIndex();
    int position = response->frameIndex();
    QString newName= response->arg().toString();

    QString oldName;
    
    TupScene *scene = m_project->scene(scenePos);
    
    if (!scene)
        return false;
    
    TupLayer *layer = scene->layer(layerPos);
    
    if (layer) {
        TupFrame *frame = layer->frame(position);
        
        if (! frame) 
            return false;
        
        oldName = frame->frameName();

        if (oldName.compare(newName) != 0)
            frame->setFrameName(newName);
        
        emit responsed(response);

        return true;
    }
    
    return false;
}
Example #21
0
void TupGraphicsScene::addSvgObject(TupSvgItem *svgItem, double opacity)
{
    #ifdef K_DEBUG
           T_FUNCINFO;
    #endif

    if (svgItem) {

        k->onionSkin.opacityMap.insert(svgItem, opacity);
        svgItem->setSelected(false);

        TupLayer *layer = k->scene->layer(k->framePosition.layer);

        if (layer) {

            TupFrame *frame = layer->frame(k->framePosition.frame);

            if (frame) {
                svgItem->setOpacity(opacity);

                if (svgItem->symbolName().compare("dollar.svg")==0)
                    connect(svgItem, SIGNAL(enabledChanged()), this, SIGNAL(showInfoWidget()));

                addItem(svgItem);
            } else {
                #ifdef K_DEBUG
                       tFatal() << "TupGraphicsScene::addSvgObject() - Error: Frame #" << k->framePosition.frame << " NO available!";
                #endif
            }
        } else {
                #ifdef K_DEBUG
                       tFatal() << "TupGraphicsScene::addSvgObject() - Error: Layer #" << k->framePosition.layer << " NO available!";
                #endif
        }

    } else {
        #ifdef K_DEBUG
               tFatal() << "TupGraphicsScene::addSvgObject() - Error: No SVG item!";
        #endif
    } 
} 
Example #22
0
bool TupCommandExecutor::lockLayer(TupLayerResponse *response)
{
    int scenePos = response->sceneIndex();
    int position = response->layerIndex();
    bool lock = response->arg().toBool();

    TupScene *scene = m_project->scene(scenePos);

    if (!scene)
        return false;

    TupLayer *layer = scene->layer(position);

    if (layer) {
        layer->setLocked(lock);
        emit responsed(response);
        return true;
    }

    return false;
}
Example #23
0
bool TupProject::updateSymbolId(TupLibraryObject::Type type, const QString &oldId, const QString &newId)
{
    int scenesCount = k->scenes.size();
    for (int i = 0; i < scenesCount; i++) {
         TupScene *scene = k->scenes.at(i);
         int layersCount = scene->layers().size();
         for (int j = 0; j < layersCount; j++) {
              TupLayer *layer = scene->layers().at(j);
              int framesCount = layer->frames().size();  
              for (int t = 0; t < framesCount; t++) {
                   TupFrame *frame = layer->frames().at(t); 
                   if (type != TupLibraryObject::Svg)
                       frame->updateIdFromFrame(oldId, newId);
                   else 
                       frame->updateSvgIdFromFrame(oldId, newId);
              }
         }

         TupBackground *bg = scene->background();
         if (bg) {
             TupFrame *frame = bg->staticFrame();
             if (frame) {
                 if (type != TupLibraryObject::Svg)
                     frame->updateIdFromFrame(oldId, newId);
                 else
                     frame->updateSvgIdFromFrame(oldId, newId);
             }

             frame = bg->dynamicFrame();
             if (frame) {
                 if (type != TupLibraryObject::Svg)
                     frame->updateIdFromFrame(oldId, newId);
                 else
                     frame->updateSvgIdFromFrame(oldId, newId);
             }
         }
    }

    return true;
}
Example #24
0
bool TupCommandExecutor::pasteFrame(TupFrameResponse *response)
{
    #ifdef K_DEBUG
        #ifdef Q_OS_WIN32
            qDebug() << "[TupCommandExecutor::pasteFrame()]";
        #else
            T_FUNCINFO;
        #endif
    #endif	
	
    int scenePos = response->sceneIndex();
    int layerPos = response->layerIndex();
    int position = response->frameIndex();
    QString copyFrame = response->arg().toString();

    TupScene *scene = m_project->scene(scenePos);
    if (scene) {
        TupLayer *layer = scene->layer(layerPos);
        if (layer) {
            TupFrame *frame = layer->frame(position);
            if (frame) {
                QString name = frame->frameName();
                
                QDomDocument doc;
                doc.appendChild(frame->toXml(doc));
                response->setArg(doc.toString(0));
                frame->clear();
                frame->fromXml(copyFrame);
                frame->setFrameName(name);

                response->setFrameState(frame->isEmpty());
                emit responsed(response);

                return true;
            }
        }
    }

    return false;
}
Example #25
0
TupLayer *TupScene::createLayer(QString name, int position, bool loaded)
{
    // Q_CHECK_PTR(k->layers);

    if (position < 0 || position > k->layers.count()) {
        #ifdef K_DEBUG
               tError() << "TupScene::createLayer() - Invalid index -> " << position;
        #endif
        return 0;
    }

    k->layerCount++;

    TupLayer *layer = new TupLayer(this, k->layerCount);
    layer->setLayerName(name);
    k->layers.insert(position, layer);

    if (loaded)
        TupProjectLoader::createLayer(project()->visualIndexOf(this), position, layer->layerName(), project());

    return layer;
}
Example #26
0
void TupGraphicsScene::includeObject(QGraphicsItem *object)
{
    if (k->spaceMode == TupProject::FRAMES_EDITION) {
        TupLayer *layer = k->scene->layer(k->framePosition.layer);
        if (layer) {
            TupFrame *frame = layer->frame(k->framePosition.frame);
            if (frame) {
                int zLevel = frame->getTopZLevel();
                object->setZValue(zLevel);
                addItem(object);
            }
        }
    } else {
        TupBackground *bg = k->scene->background();
        TupFrame *frame = bg->frame();
        if (frame) {
            int zLevel = frame->getTopZLevel();
            object->setZValue(zLevel);
            addItem(object);
        }
    }
}
Example #27
0
bool TupCommandExecutor::setLayerVisibility(TupLayerResponse *response)
{
    int scenePos = response->sceneIndex();
    int position = response->layerIndex();
    bool view = response->arg().toBool();

    TupScene *scene = m_project->scene(scenePos);

    if (!scene)
        return false;

    TupLayer *layer = scene->layer(position);

    if (layer) {
        layer->setVisible(view);
        responsed(response);

        return true;
    }

    return false;
}
Example #28
0
void TupProject::reloadLibraryItem(TupLibraryObject::Type type, const QString &id, TupLibraryObject *object)
{
    int scenesCount = k->scenes.size();
    for (int i = 0; i < scenesCount; i++) {
         TupScene *scene = k->scenes.at(i);
         int layersCount = scene->layers().size();
         for (int j = 0; j < layersCount; j++) {
              TupLayer *layer = scene->layers().at(j);
              int framesCount = layer->frames().size();
              for (int t = 0; t < framesCount; t++) {
                   TupFrame *frame = layer->frames().at(t);
                   if (type == TupLibraryObject::Svg)
                       frame->reloadSVGItem(id, object);
                   else
                       frame->reloadGraphicItem(id, object->dataPath());
              }
         }

         TupBackground *bg = scene->background();
         if (bg) {
             TupFrame *frame = bg->staticFrame();
             if (frame) {
                 if (type == TupLibraryObject::Svg)
                     frame->reloadSVGItem(id, object);
                 else
                     frame->reloadGraphicItem(id, object->dataPath());
             }

             frame = bg->dynamicFrame();
             if (frame) {
                 if (type == TupLibraryObject::Svg)
                     frame->reloadSVGItem(id, object);
                 else
                     frame->reloadGraphicItem(id, object->dataPath());
             }
         }
    }
}
Example #29
0
bool TupCommandExecutor::expandFrame(TupFrameResponse *response)
{
    int scenePos = response->sceneIndex();
    int layerPos = response->layerIndex();
    int position = response->frameIndex();
    int times = response->arg().toInt();
    
    TupScene *scene = m_project->scene(scenePos);
    
    if (!scene)
        return false;
    
    TupLayer *layer = scene->layer(layerPos);
    
    if (layer) {
        if (layer->expandFrame(position, times)) {
            emit responsed(response);

            return true;
        }
    }

    return false;
}
Example #30
0
TupFrame *TupGraphicsScene::currentFrame()
{
    if (k->scene) {

        if (k->scene->layersTotal() > 0) {

            if (k->framePosition.layer < k->scene->layersTotal()) {
  
                if (k->scene->layers().contains(k->framePosition.layer)) {
                    TupLayer *layer = k->scene->layer(k->framePosition.layer);
                    Q_CHECK_PTR(layer);
                    if (layer) {
                        if (!layer->frames().isEmpty())
                            return layer->frame(k->framePosition.frame);
                    } else {
                        #ifdef K_DEBUG
                               tFatal() << "TupGraphicsScene::currentFrame - No layer available: " << k->framePosition.frame;
                        #endif
                    }
                } else {
                    #ifdef K_DEBUG
                           tFatal() << "TupGraphicsScene::currentFrame - Layer index incorrect!"; 
                    #endif
                }
            } else {
                TupLayer *layer = k->scene->layer(k->scene->layersTotal() - 1);
                if (layer) {
                    if (!layer->frames().isEmpty())
                        return layer->frame(k->framePosition.frame);
                }
            }

        }

    }

    return 0;
}