Exemplo n.º 1
0
void
NodePrivate::runOnNodeDeleteCB()
{

    if (_publicInterface->getScriptName_mt_safe().empty()) {
        return;
    }
    std::string cb = _publicInterface->getApp()->getProject()->getOnNodeDeleteCB();
    NodeCollectionPtr group = _publicInterface->getGroup();

    if (!group) {
        return;
    }

    std::string callbackFunction;
    if (figureOutCallbackName(cb, &callbackFunction)) {
        runOnNodeDeleteCBInternal(callbackFunction);
    }




    // If this is a group, run the node deleted callback on itself
    {
        cb = effect->getBeforeNodeRemovalCallback();
        if (!cb.empty()) {
            if (figureOutCallbackName(cb, &callbackFunction)) {
                runOnNodeDeleteCBInternal(callbackFunction);
            }

        }
    }

    // if there's a parent group, run the node deletec callback on the parent
    NodeGroupPtr isParentGroup = toNodeGroup(group);
    if (isParentGroup) {
        NodePtr grpNode = isParentGroup->getNode();
        if (grpNode) {
            cb = isParentGroup->getBeforeNodeRemovalCallback();
            if (figureOutCallbackName(cb, &callbackFunction)) {
                runOnNodeDeleteCBInternal(callbackFunction);
            }
        }
    }
}