For anyone trying to do this, too, it gets fun...
First thing's first: you'll have to bake out a ptex map to a different folder per frame. I had a Frame Begin mel script to the tune of:
python("execfile('G:/pathToScript/ptexBake.py')");
All that did was bake out the maps, automatically making our awesome new folder structure (ptexBake will create the directory if it doesn't already exist) and a map in each one:
import maya.cmds as cmds
frame = int(cmds.currentTime(query = True)) #I int it in case it wants to return decimals, which I'd rather not have
cmds.ptexBake( inMesh='pSphere1', o='G:/pathToProject/collections/collectionName/descriptionName/colormap1/' + str(frame), bt='file1', tpu=29) #'file1' will depend, of course, on the material
For some reason that messes up the baking--I really don't know, but it doesn't work via a Frame Begin script (this is half question). Maybe some little thing would fix it, but getting those baked out isn't the hard thing. I just put the bake command in a loop and iterated through the timeline, baking, before sending it to render:
import maya.cmds as cmds
import xgenm as xg #I think I just forgot to delete this, you don't need xgenm for ptexBake
for i in range(150): #Number of frames, of course
cmds.currentTime(i+1)
cmds.ptexBake( inMesh='pSphere1', o='G:/pathToProject/xgen/collections/c2/d2/colormap1/' + str(i+1), bt='file1', tpu=29) #Don't forget to replace c2 and d2 with your collection and description name
Anyway, for the color tip and color root options you need to have it exactly like Li's post, except instead of $select = frame; you need to have $select = 1;, or any number, so that xgen realizes (thinks) you want some kind of slider that switches between maps. Lord knows everyone wants a slider before a different ptex map per frame (just kidding, xgen, you're doin a great job ^^).
Now hit Accept, and write "frame" (without the quotes) instead of the "1" that'll be displayed. It actually raises a warning, claiming it wants an integer, but it'll work. All you have to do from here on out is, well, add a line like the first one for every frame you need to render 🙂 Your scene's a few hundred frames? Mine was, too. You either need an intern to type it all out, or you can use this:
count = 150 #Number of frames
for i in range(count):
print "$a" + str(i) + "=map('${DESC}/colormap1/" + str(i) + "');"
chooseLine = "choose($fit,"
for i in range(count):
chooseLine = chooseLine + "$a" + str(i) + "," #Replace last comma with closing parenthesis
print chooseLine
That'll print out such that you can just copy the result from the script editor and paste it accordingly (should be obvious). Don't forget to replace the $fit line so the 2 equals the number of frames (150 in my case) and don't forget to make sure your path after ${DESC} is right. The way I'm doing it, here, is every folder is just named after the frame it was created on.
Okee dokee, good luck! I think that's everything.
Thanks again, Li.