A new version of Cineversity has been launched. This legacy site and its tutorials will remain accessible for a limited transition period

Visit the New Cineversity


 ·   Wiki Home
 ·   Categories
 ·   Title List
 ·   Uncategorized Pages
 ·   Random Page
 ·   Recent Changes
 ·   RSS
 ·   Atom
 ·   What Links Here



Create or Find Page:


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__':