#include <maya/MPxNode.h>
#include <maya/MFnNumericAttribute.h>
#include <maya/MString.h>
#include <maya/MTypeId.h>
#include <maya/MPlug.h>
#include <maya/MDataBlock.h>
#include <maya/MDataHandle.h>
#include <maya/MEvaluationNode.h>
#include <maya/MFnPlugin.h>
#include <cassert>
#include <chrono>
#include <thread>
class simpleSkipNode : 
public MPxNode 
{
public:
    static  void*   creator();
};
MTypeId simpleSkipNode::id( 0x00081166 );
 
MObject simpleSkipNode::fastSquare;
 
MObject simpleSkipNode::slowSquare;
 
{
    assert(returnStatus);
    const float inputValue = inputData.
asFloat();
 
    const float outputValue = inputValue * inputValue;
    if ( plug == fastSquare )
    {
        outputHandle.
set( outputValue );
 
    }
    else if ( plug == slowSquare )
    {
        
        std::this_thread::sleep_for(std::chrono::milliseconds(100));
        outputHandle.
set( outputValue );
 
    }
    else
    {
        return MS::kUnknownParameter;
    }
    return MS::kSuccess;
}
{
    
    
    constexpr bool allowSingleDownstreamDependency = true;
    evaluationNode.
skipEvaluation( slowSquare, allowSingleDownstreamDependency, &returnStatus );
 
    assert(returnStatus);
    return MS::kSuccess;
}
void* simpleSkipNode::creator()
{
    return new simpleSkipNode();
}
MStatus simpleSkipNode::initialize()
 
{
    status = addAttribute( input );
        if (!status) { status.
perror(
"addAttribute"); 
return status;}
 
    status = addAttribute( fastSquare );
        if (!status) { status.
perror(
"addAttribute"); 
return status;}
 
    status = addAttribute( slowSquare );
        if (!status) { status.
perror(
"addAttribute"); 
return status;}
 
    status = attributeAffects( input, fastSquare );
        if (!status) { status.
perror(
"attributeAffects"); 
return status;}
 
    status = attributeAffects( input, slowSquare );
        if (!status) { status.
perror(
"attributeAffects"); 
return status;}
 
    return MS::kSuccess;
}
{
    MFnPlugin plugin( obj, PLUGIN_COMPANY, 
"1.0", 
"Any");
 
    status = plugin.registerNode(
        "simpleSkipNode",
        simpleSkipNode::id,
        simpleSkipNode::creator,
        simpleSkipNode::initialize
        );
    if (!status) {
        status.
perror(
"registerNode");
 
        return status;
    }
    return status;
}
{
    status = plugin.deregisterNode( simpleSkipNode::id );
    if (!status) {
        status.
perror(
"deregisterNode");
 
        return status;
    }
    return status;
}