Getting and setting frame range from RenderData
-
Hi,
I read that I can get the RenderData object via
rdata = doc.GetActiveRenderData()
I see that frame range values are documented here
RDATA_FRAMEFROM
RDATA_FRAMETO
RDATA_FRAMESTEPCheers
-
Hi @nicholas_yue thanks for reaching out us.
Although I'm not sure if your post was meant as a question or as a statement I'm going, nevertheless, to share some thoughts.
The data you're looking for are stored in theRenderData
BaseContainer
and you can set/get them using the usual method.A full exmaple is available on PluginCafe Github Repo.
Put down in words the code might looks like something as:
def printRDataInfo(in_rdata): # BaseTime values are printed as frame print in_rdata[c4d.RDATA_FRAMEFROM].GetFrame(doc.GetFps()) print in_rdata[c4d.RDATA_FRAMETO].GetFrame(doc.GetFps()) print in_rdata[c4d.RDATA_FRAMESTEP] # Main function def main(): # retrieve the RenderData instance rdata = doc.GetActiveRenderData() #just print the default values print "default rdata from/to/step values" printRDataInfo(rdata) # start is at sec 1 rdata[c4d.RDATA_FRAMEFROM] = c4d.BaseTime(1) # end is at sec 2 rdata[c4d.RDATA_FRAMETO] = c4d.BaseTime(2) rdata[c4d.RDATA_FRAMESTEP] = 1 #just print again the values print "first change with values to secs" printRDataInfo(rdata) # start is at frame 5 rdata[c4d.RDATA_FRAMEFROM] = c4d.BaseTime( 5.0, doc.GetFps()) # end is at frame 15 rdata[c4d.RDATA_FRAMETO] = c4d.BaseTime( 15.0, doc.GetFps()) rdata[c4d.RDATA_FRAMESTEP] = 1 #just print again the values print "second change with values to frames" printRDataInfo(rdata)
Cheers, R