Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
Hello, I have been looking for information regarding Motion Clips on forums and the C4D SDK documentation, but I have only found this article and this article.
c4d.CallCommand(465003044, 465003044) # Add Motion Clip... c4d.CallCommand(465003050, 465003050) # Save Motion Source As...
Thank you.
Hi @blastframe, unfortunately, there is no way to call the command without open the Motion Clips Dialogs.
However, it's pretty easy to reproduce since it's only retrieving the content of NLA Root (aka where Motion Source are stored see Placing Motion Sources at Timeline Markers with Python - r19.
So here its what the Save Motion Source do:
def ExportMotionSource(path, motionSourceObject): "motionSourceObject is None to save all MotionSource or pass the returned obj from GetMotionSourceByName" doc = c4d.documents.GetActiveDocument() docNew = c4d.documents.BaseDocument() # Copy settings docNew.SetData(c4d.DOCUMENTSETTINGS_DOCUMENT, doc.GetData(c4d.DOCUMENTSETTINGS_DOCUMENT)) docNew.SetData(c4d.DOCUMENTSETTINGS_GENERAL, doc.GetData(c4d.DOCUMENTSETTINGS_GENERAL)) docNla = doc.GetNLARoot() docNewNla = docNew.GetNLARoot() if motionSourceObject is None: docNla.CopyTo(docNewNla, c4d.COPYFLAGS_NONE, None) else: copyNewObj = motionSourceObject.GetClone(c4d.COPYFLAGS_NONE, None) docNewNla.InsertLast(copyNewObj) c4d.documents.SaveDocument(docNew, savePath, c4d.SAVEDOCUMENTFLAGS_NONE, c4d.FORMAT_C4DEXPORT) def LoadExportMotionSource(path): doc = c4d.documents.GetActiveDocument() c4d.documents.MergeDocument(doc, path, c4d.SCENEFILTER_MERGESCENE, None) def GetMotionSourceByName(name): root = doc.GetNLARoot() obj = root.GetDown() while obj: if obj.GetName() == name: return obj obj = obj.GetNext()
Regarding the c4dsrc extension, as you can see internally this is just a BaseDocument saved, the extension is just used to mark this as a motion source file template.
Cheers, Maxime.
@m_adam Hi Maxime, thank you for the quick reply and insight into this. I look forward to trying this.