Exemple #1
0
bool TupSvgItem::layerIsVisible()
{
    TupLayer *layer = k->frame->layer();
    if (layer->isVisible())
        return true;

    return false;
}
Exemple #2
0
bool TupGraphicObject::layerIsVisible()
{
    TupLayer *layer = k->frame->layer();
    if (layer->isVisible())
        return true;

    return false;
}
Exemple #3
0
void TupGraphicsScene::drawPhotogram(int photogram)
{
    /*
    #ifdef K_DEBUG
           T_FUNCINFO;
    #endif
    */

    // Q_CHECK_PTR(k->scene);

    if (photogram < 0 || !k->scene) 
        return;

    cleanWorkSpace();

    bool valid = false;

    // Drawing frames from another layers

    for (int i=0; i < k->scene->layersTotal(); i++) {

         TupLayer *layer = k->scene->layer(i);

         if (layer->framesTotal() > 0 && photogram < layer->framesTotal()) {

             TupFrame *mainFrame = layer->frame(photogram);

             QString currentFrame = "";

             if (mainFrame) {
                 currentFrame = mainFrame->frameName();

                 if (layer) {
                     if (layer->isVisible()) {

                         // Painting the background
                         drawBackground();

                         // Painting previews frames
                         if (k->onionSkin.previous > 0 && photogram > 0) {

                             double opacity = k->opacity;
                             double opacityFactor = opacity / (double)qMin(layer->frames().count(), k->onionSkin.previous);

                             int limit = photogram - k->onionSkin.previous;
                             if (limit < 0) 
                                 limit = 0;

                             QString frameBehind = ""; 
                             for (int frameIndex = photogram-1; frameIndex >= limit; frameIndex--) {
                                  TupFrame *frame = layer->frame(frameIndex);
                                  QString previousFrame = frame->frameName();
                                  if (frame && previousFrame.compare(currentFrame) != 0 
                                            && frameBehind.compare(previousFrame) != 0) {
                                      addFrame(frame, opacity, Preview);
                                  } 

                                  frameBehind = previousFrame;
                                  opacity -= opacityFactor;
                             }

                         }

                         // valid = true;
                         // k->layerCounter = i;
                         addFrame(mainFrame, TupGraphicsScene::Current);

                         // Painting next frames
                         if (k->onionSkin.next > 0 && layer->framesTotal() > photogram + 1) {

                             double opacity = k->opacity;
                             double opacityFactor = opacity / (double)qMin(layer->frames().count(), k->onionSkin.next);

                             int limit = photogram + k->onionSkin.next;
                             if (limit >= layer->frames().count()) 
                                 limit = layer->frames().count() - 1;

                             QString frameLater = "";
                             for (int frameIndex = photogram+1; frameIndex <= limit; frameIndex++) {
                                  TupFrame * frame = layer->frame(frameIndex);
                                  QString nextFrame = frame->frameName();
                                  if (frame && nextFrame.compare(currentFrame) != 0 
                                            && frameLater.compare(nextFrame) != 0) {
                                      addFrame(frame, opacity, Next);
                                  }
                      
                                  frameLater = nextFrame;
                                  opacity -= opacityFactor;
                             }
                         }

                         // SQA: Crashpoint when layers are deleted 

                         valid = true;
                         k->layerCounter = i;
                         // addFrame(mainFrame, TupGraphicsScene::Current);
                     }
                  }
              }
         }
    }

    // Drawing tweening objects

    if (valid) {
        addTweeningObjects(photogram);
        addSvgTweeningObjects(photogram);

        update();
    }

    if (k->tool)
        k->tool->updateScene(this);
}