On 23/08/2018 at 07:16, xxxxxxxx wrote:
Hi,
the goal is a C4D scene file containing only the materials of a scene, right?
The idea is to clone the needed materials into a new document, which then saved in the end.
The simplest approach could look like so (although it reverses the material order) :
doc = c4d.documents.GetActiveDocument()
newDoc = c4d.documents.BaseDocument()
mat = doc.GetFirstMaterial()
while mat is not None:
newDoc.InsertMaterial(mat.GetClone(c4d.COPYFLAGS_0))
mat = mat.GetNext()
c4d.documents.SaveDocument(newDoc, 'C:/Users/Andreas/Desktop/test_all_materials.c4d', c4d.SAVEDOCUMENTFLAGS_0, c4d.FORMAT_C4DEXPORT)