ChangeRenderFrameRange Script

This simple script changes the first frame, last frame and frame step of the first render item in the scene. This is a bit easier than calling three separate item.channel commands and making sure that the first render item is actually selected.

  • Perl
  • Lua
  • Python
@ChangeRenderFrameRange.pl first last <step>

The first and last frame arguments are required, while the frame step is optional. This sets the first frame to 1 and the last frame to 60.

  • Perl
  • Lua
  • Python
@ChangeRenderFrameRange.pl 1 60

This script could be simplified by directly selecting the render items with select.itemType, but this extended version can be used as a framework for other scripts that operate on item types.

  • Perl
  • Lua
  • Python
# perl
#
# ChangeRenderFrameRange.pl
#  Joe Angell, Luxology LLC
#  Copyright (c) 2008 Luxology, LLC. All Rights Reserved.
#   Patents pending.
#
# Changes the render frame range for the first render item
#  in the scene.

# Make sure we have our arguments
if( ($#ARGV != 1) && ($#ARGV != 2) ) {
    lxout( "Usage: \@ChangeRenderFrameRange.pl first last <step>" );
    lxout( "Changes the render frame range for the first render item in the scene." );
    lxout( "First and last frame are required; frame step is optional." );
    die( "Missing required first and last frame arguments" );
}

# Get the item count
my $n = lxq( "query sceneservice item.N ?" );

# Loop through the items in the scene, looking for output items
for( $i=0; $i < $n; $i++ ) {
    my $type = lxq( "query sceneservice item.type ? $i" );
    if( $type eq "polyRender" ) {
        # Get the item ID
        $itemID = lxq( "query sceneservice item.id ? $i" );
        #lxout( "Item ID:  $itemID" );

        # Select the item
        lx( "select.item $itemID" );

        # Set the first frame
        lx( "item.channel polyRender\$first $ARGV[0]" );

        # Set the last frame
        lx( "item.channel polyRender\$last $ARGV[1]" );

        if($#ARGV==3){
            # Set the frame step
            lx( "item.channel polyRender\$step $ARGV[2]" );
        }

        break;
    }
}