View Python: Cycle Legacy Xref Path
Here’s a script to cycle the filename of a Legacy Xref object between files in the directory of the first path.
import c4d,os # Main function def main(): if op.GetType() == 200000118: # Legacy Xref # Get the path fn = op[c4d.SCENEINSTANCE_FILENAME] path, fname = os.path.split(fn) # Loop through the directory fileList = os.listdir(path) for i,f in enumerate(fileList): # When we find the current file, get the next one if f == fname: op[c4d.SCENEINSTANCE_FILENAME] = os.path.join(path,fileList[i+1]) # Execute main() if __name__=='__main__': main()