Maya: Repeating Image Sequence Texture

From wikinotes

Repeating Image Sequences are not a built-in option in Maya. You need to modify the image sequence expression in order to make it repeat.

Repeating Texture

// Texture fileNode >> Use Image Sequence
// Window > Animation Editors > Expression Editor
// File   > By Expression Name

// The default expression looks like this:
ripples_tex.frameExtension=frame

// Change it to this:
ripples_tex.frameExtension=(( (frame-1)%numOfFrames) +1 )		/* The -1 allows you to extend to the total number      *
                                                                * of frames instead of stopping at one before the last *
                                                                * ex: (40fr) 38,39,0,1,2                               */

Repeating Texture with Offset

// The math for an offset is very similar
ripples_tex.frameExtension=( (( ((frame + offset -1)%numOfFrames) + offset)% numOfFrames) +1  )  /* First we get the frame with the offset,         *
                                                                                                  * then add the offset back onto it and calculate  *
                                                                                                  * the remainder again.                            */
// ex: int $var = ((((60-1)%40)+20 )% 40) +1