Пример #1
0
void findOtherLayers(KisNodeDummy *root,
                     TimelineNodeListKeeper::OtherLayersList *list,
                     const QString &prefix)
{
    KisNodeSP node = root->node();

    if (root->parent() && !node->useInTimeline()) {
        *list <<
              TimelineNodeListKeeper::OtherLayer(
                  QString(prefix + node->name()),
                  root);
    }

    KisNodeDummy *dummy = root->lastChild();
    while(dummy) {
        findOtherLayers(dummy, list, prefix + " ");
        dummy = dummy->prevSibling();
    }
}
KisNodeDummy* TimelineFramesIndexConverter::findNodeFromRow(KisNodeDummy *root, int &startCount)
{
    if (isDummyVisible(root)) {
        if (!startCount) {
            return root;
        }

        startCount--;
    }

    KisNodeDummy *dummy = root->lastChild();
    while (dummy) {
        KisNodeDummy *found = findNodeFromRow(dummy, startCount);
        if (found) return found;

        dummy = dummy->prevSibling();
    }

    return 0;
}
bool TimelineFramesIndexConverter::calcNodesInPath(KisNodeDummy *root, int &startCount, KisNodeDummy *endDummy)
{
    if (isDummyVisible(root)) {
        if (endDummy && root == endDummy) {
            return true;
        }

        startCount++;
    }

    KisNodeDummy *dummy = root->lastChild();
    while (dummy) {
        if (calcNodesInPath(dummy, startCount, endDummy)) {
            return true;
        }

        dummy = dummy->prevSibling();
    }

    return false;
}