Announcement

Collapse
No announcement yet.

Start and end frames of render

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Start and end frames of render

    Hi,
    From the Maya compute method, is there a way to get the start and end frame defined for the current render ?
    Thanks.

  • #2
    Ok, found it. In case it can help someone:
    Code:
    void myNode::readSceneStartEnd()
    {
        MTime startFrame;
        MTime endFrame;
        // Get the render globals node
        //
        int rangeIsSet = 0;
        MObject renderGlobNode;
    
        animType=-1;
        fStartFrame=-1;
        fEndFrame=-1;
        fByFrame=-1;
        if (nodeFromName("vraySettings", renderGlobNode) == MS::kSuccess)
        {
            log("in animtype");
            MFnDependencyNode fnRenderGlobals( renderGlobNode );
            fnRenderGlobals.findPlug("animType").getValue(animType);
        }
    
        if (nodeFromName("defaultRenderGlobals", renderGlobNode) == MS::kSuccess)
        {
            MFnDependencyNode fnRenderGlobals( renderGlobNode );
            
            // Check if the time-slider or renderGlobals is used for
            // the frame range
            //
            MPlug animPlug = fnRenderGlobals.findPlug( "animation" );
            short anim;
            animPlug.getValue( anim );
            
            if ( anim )
            {
                float byFrame;
                fnRenderGlobals.findPlug( "startFrame"  ).getValue(startFrame);
                fnRenderGlobals.findPlug( "endFrame"    ).getValue(endFrame);
                fnRenderGlobals.findPlug( "byFrameStep" ).getValue(byFrame);
                fByFrame = (double) byFrame;
                rangeIsSet = 1;
            }
        }
        if (!rangeIsSet)        {
            // USE_TIMESLIDER
            startFrame = MAnimControl::minTime();
            endFrame   = MAnimControl::maxTime();
            fByFrame = 1;
        }
        fStartFrame = (int) startFrame.as( MTime::uiUnit() );
        fEndFrame   = (int)   endFrame.as( MTime::uiUnit() );
    }

    Comment

    Working...
    X