On 07/07/2016 at 15:12, xxxxxxxx wrote:
Here I have a somewhat basic script that takes all materials and creates c4d materials based on their names. What I really want to do is actaully create and replace all the scene with c4d ones. Useful for situations where I find myself needing to convert other render engine materials to basic ones for export. I of course get the creating part, how can I do the conversion? As it stands I run this script and then have to do alt dragging to manually replace my original materials.
import c4d
from c4d import gui
def main() :
mats = doc.GetMaterials();
for mat in mats:
new_mat = c4d.BaseMaterial(c4d.Mmaterial); # create standard material
new_mat[c4d.ID_BASELIST_NAME] = mat.GetName() +"_c4d";
doc.InsertMaterial(new_mat,pred=None,checknames=True)
c4d.EventAdd();
if __name__=='__main__':
main()