当前位置: 首页>>代码示例>>C++>>正文


C++ KisNodeSP::getKeyframeChannel方法代码示例

本文整理汇总了C++中KisNodeSP::getKeyframeChannel方法的典型用法代码示例。如果您正苦于以下问题:C++ KisNodeSP::getKeyframeChannel方法的具体用法?C++ KisNodeSP::getKeyframeChannel怎么用?C++ KisNodeSP::getKeyframeChannel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KisNodeSP的用法示例。


在下文中一共展示了KisNodeSP::getKeyframeChannel方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: removeKeyframes

    bool removeKeyframes(KisImageSP image, const FrameItemList &frames) {
        bool result = false;

        QScopedPointer<KUndo2Command> cmd(
            new KUndo2Command(kundo2_i18np("Remove Keyframe",
                                           "Remove Keyframes",
                                           frames.size()))); // lisp-lovers present ;)

        foreach (const FrameItem &item, frames) {
            const int time = item.time;
            KisNodeSP node = item.node;

            KisKeyframeChannel *content =
                node->getKeyframeChannel(KisKeyframeChannel::Content.id());

            if (!content) continue;

            KisKeyframeSP keyframe = content->keyframeAt(time);
            if (!keyframe) continue;

            content->deleteKeyframe(keyframe, cmd.data());

            result = true;
        }

        if (result) {
            image->postExecutionUndoAdapter()->addCommand(toQShared(cmd.take()));
        }

        return result;
    }
开发者ID:Developer626,项目名称:krita,代码行数:31,代码来源:kis_animation_utils.cpp

示例2: moveKeyframes

    bool moveKeyframes(KisImageSP image,
                       const FrameItemList &srcFrames,
                       const FrameItemList &dstFrames,
                       bool copy) {

        if (srcFrames.size() != dstFrames.size()) return false;

        bool result = false;

        QScopedPointer<KUndo2Command> cmd(
            new KUndo2Command(!copy ?
                              kundo2_i18np("Move Keyframe",
                                           "Move Keyframes",
                                           srcFrames.size()) :
                              kundo2_i18np("Copy Keyframe",
                                           "Copy Keyframes",
                                           srcFrames.size()))); // lisp-lovers present ;)

        for (int i = 0; i < srcFrames.size(); i++) {
            const int srcTime = srcFrames[i].time;
            KisNodeSP srcNode = srcFrames[i].node;

            const int dstTime = dstFrames[i].time;
            KisNodeSP dstNode = dstFrames[i].node;

            if (srcNode != dstNode) continue;

            KisKeyframeChannel *content =
                srcNode->getKeyframeChannel(KisKeyframeChannel::Content.id());

            if (!content) continue;

            KisKeyframeSP dstKeyframe = content->keyframeAt(dstTime);
            if (dstKeyframe) {
                content->deleteKeyframe(dstKeyframe, cmd.data());
            }

            KisKeyframeSP srcKeyframe = content->keyframeAt(srcTime);
            if (srcKeyframe) {
                if (copy) {
                    content->copyKeyframe(srcKeyframe, dstTime, cmd.data());
                } else {
                    content->moveKeyframe(srcKeyframe, dstTime, cmd.data());
                }
            }

            result = true;
        }

        if (result) {
            image->postExecutionUndoAdapter()->addCommand(toQShared(cmd.take()));
        }

        return result;
    }
开发者ID:Developer626,项目名称:krita,代码行数:55,代码来源:kis_animation_utils.cpp

示例3: loadNodeKeyframes

void KisKraLoader::loadNodeKeyframes(KoStore *store, const QString &location, KisNodeSP node)
{
    if (!store->open(location)) {
        m_d->errorMessages << i18n("Could not load keyframes from %1.", location);
        return;
    }

    QString errorMsg;
    int errorLine;
    int errorColumn;
    KoXmlDocument doc = KoXmlDocument(true);

    bool ok = doc.setContent(store->device(), &errorMsg, &errorLine, &errorColumn);
    store->close();

    if (!ok) {
        m_d->errorMessages << i18n("parsing error in the keyframe file %1 at line %2, column %3\nError message: %4", location, errorLine, errorColumn, i18n(errorMsg.toUtf8()));
        return;
    }

    QDomDocument dom;
    KoXml::asQDomElement(dom, doc.documentElement());
    QDomElement root = dom.firstChildElement();

    for (QDomElement child = root.firstChildElement(); !child.isNull(); child = child.nextSiblingElement()) {
        if (child.nodeName().toUpper() == "CHANNEL") {
            QString id = child.attribute("name");
            KisKeyframeChannel *channel = node->getKeyframeChannel(id);

            if (!channel) {
                m_d->errorMessages << i18n("unknown keyframe channel type: %1 in %2", id, location);
                continue;
            }

            channel->loadXML(child);
        }
    }
}
开发者ID:IGLOU-EU,项目名称:krita,代码行数:38,代码来源:kis_kra_loader.cpp

示例4: moveKeyframes

    bool moveKeyframes(KisImageSP image,
                       const FrameItemList &srcFrames,
                       const FrameItemList &dstFrames,
                       bool copy,
                       KUndo2Command *parentCommand) {

        if (srcFrames.size() != dstFrames.size()) return false;

        bool result = false;

        QScopedPointer<KUndo2Command> cmd(
            new KUndo2Command(!copy ?
                              kundo2_i18np("Move Keyframe",
                                           "Move %1 Keyframes",
                                           srcFrames.size()) :
                              kundo2_i18np("Copy Keyframe",
                                           "Copy %1 Keyframes",
                                           srcFrames.size()),
                              parentCommand));

        for (int i = 0; i < srcFrames.size(); i++) {
            const int srcTime = srcFrames[i].time;
            KisNodeSP srcNode = srcFrames[i].node;
            KisKeyframeChannel *srcChannel = srcNode->getKeyframeChannel(srcFrames[i].channel);

            const int dstTime = dstFrames[i].time;
            KisNodeSP dstNode = dstFrames[i].node;
            KisKeyframeChannel *dstChannel = dstNode->getKeyframeChannel(dstFrames[i].channel, true);

            if (srcNode == dstNode) {
                if (!srcChannel) continue;

                KisKeyframeSP srcKeyframe = srcChannel->keyframeAt(srcTime);
                if (srcKeyframe) {
                    if (copy) {
                        srcChannel->copyKeyframe(srcKeyframe, dstTime, cmd.data());
                    } else {
                        srcChannel->moveKeyframe(srcKeyframe, dstTime, cmd.data());
                    }
                }
            } else {
                if (!srcChannel|| !dstChannel) continue;

                KisKeyframeSP srcKeyframe = srcChannel->keyframeAt(srcTime);
                if (!srcKeyframe) continue;

                dstChannel->copyExternalKeyframe(srcChannel, srcTime, dstTime, cmd.data());

                if (!copy) {
                    srcChannel->deleteKeyframe(srcKeyframe, cmd.data());
                }
            }

            result = true;
        }

        if (parentCommand) {
            cmd.take();
        } else if (result) {
            image->postExecutionUndoAdapter()->addCommand(toQShared(cmd.take()));
        }

        return result;
    }
开发者ID:KDE,项目名称:krita,代码行数:64,代码来源:kis_animation_utils.cpp


注:本文中的KisNodeSP::getKeyframeChannel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。