I am a part-time pipeline engineer at my company, and trying to write a python script to help out the c4d users.
We run our renderfarm on Qube, which uses the command-line to control Cinema.
Unfortunately with Cinema, when you package a job up to send off to the farm, the paths to realflow mesh files to not get translated into relative paths. Thus, we are trying to write a script to do this. We'd like to have the script change any paths to meshes to a new, specified one. It would be even better if we could get it to happen without opening cinema (as in, modify the c4d file) but lets start with this:
Code: Select all
import c4d from c4d import documents doc = documents.GetActiveDocument() charAmount = 10 #number of characters to replace at the beginning. replaceWith = 'Hello' first = doc.GetFirstObject() def Browse(obj): if not obj: return if obj.GetTypeName() == 'RF_MESH_IMPORTER': temp = obj[c4d.M_IMP_FILE_PATH] result = replaceWith + temp[charAmount:] obj[c4d.M_IMP_FILE_PATH] = result c4d.DrawViews() #refreshes screen Browse(obj.GetDown()) Browse(obj.GetNext()) Browse(first)
We are using R12.