Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #C4D Merge mat
- #Coded by graphos more information
- #graphos.xyz
- #https://vimeo.com/207692957
- import c4d
- def main():
- mats = doc.GetActiveMaterials()
- list_tags = list()
- for mat in mats:
- obj_link = mat[c4d.ID_MATERIALASSIGNMENTS]
- for i in xrange(obj_link.GetObjectCount()):
- list_tags.append(obj_link.ObjectFromIndex(doc, i))
- doc.StartUndo()
- for tag in list_tags:
- doc.AddUndo(c4d.UNDOTYPE_CHANGE, tag)
- tag[c4d.TEXTURETAG_MATERIAL] = mats[0]
- for mat in mats[1:]:
- doc.AddUndo(c4d.UNDOTYPE_DELETE, mat)
- mat.Remove()
- doc.EndUndo()
- c4d.EventAdd()
- if __name__=='__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement