Exemplo n.º 1
0
void
NodePrivate::runOnNodeCreatedCB(bool userEdited)
{

    std::string cb = _publicInterface->getApp()->getProject()->getOnNodeCreatedCB();
    NodeCollectionPtr group = _publicInterface->getGroup();

    if (!group) {
        return;
    }
    std::string callbackFunction;
    if (figureOutCallbackName(cb, &callbackFunction)) {
        runOnNodeCreatedCBInternal(callbackFunction, userEdited);
    }

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

    }

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

}